index.js
function generateSignature(email, password) {
    let googleDefaultPublicKey  = 'AAAAgMom/1a/v0lblO2Ubrt60J2gcuXSljGFQXgcyZWveWLEwo6prwgi3iJIZdodyhKZQrNWp5nKJ3srRXcUW+F1BD3baEVGcmEgqaLZUNBjm057pKRI16kB0YppeGx5qIQ5QjKzsR8ETQbKLNWgRY0QRNVz34kMJR3P/LgHax/6rmf5AAAAAwEAAQ==';
    let keyBuffer = Buffer.from(googleDefaultPublicKey, 'base64');

    let pem = `-----BEGIN PUBLIC KEY-----
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDKJv9Wv79JW5TtlG67etCdoHLl
0pYxhUF4HMmVr3lixMKOqa8IIt4iSGXaHcoSmUKzVqeZyid7K0V3FFvhdQQ922hF
RnJhIKmi2VDQY5tOe6SkSNepAdGKaXhseaiEOUIys7EfBE0GyizVoEWNEETVc9+J
DCUdz/y4B2sf+q5n+QIDAQAB
-----END PUBLIC KEY-----`;

    let sha = crypto.createHash('sha1');
    sha.update(keyBuffer);

    let hash = sha.digest().slice(0, 4);

    let rsa = new nodeRSA(pem);
    let encrypted = rsa.encrypt(email + '\x00' + password);
    
    let base64Output = Buffer.concat([
        Buffer.from([0]),
        hash,
        encrypted
    ]).toString('base64');

    base64Output = base64Output.replace(/\+/g, '-');
    base64Output = base64Output.replace(/\//g, '_');

    return base64Output;
}
function generateSignature(email, password) {
    let googleDefaultPublicKey  = 'AAAAgMom/1a/v0lblO2Ubrt60J2gcuXSljGFQXgcyZWveWLEwo6prwgi3iJIZdodyhKZQrNWp5nKJ3srRXcUW+F1BD3baEVGcmEgqaLZUNBjm057pKRI16kB0YppeGx5qIQ5QjKzsR8ETQbKLNWgRY0QRNVz34kMJR3P/LgHax/6rmf5AAAAAwEAAQ==';
    let keyBuffer = Buffer.from(googleDefaultPublicKey, 'base64');

    let pem = `-----BEGIN PUBLIC KEY-----
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDKJv9Wv79JW5TtlG67etCdoHLl
0pYxhUF4HMmVr3lixMKOqa8IIt4iSGXaHcoSmUKzVqeZyid7K0V3FFvhdQQ922hF
RnJhIKmi2VDQY5tOe6SkSNepAdGKaXhseaiEOUIys7EfBE0GyizVoEWNEETVc9+J
DCUdz/y4B2sf+q5n+QIDAQAB
-----END PUBLIC KEY-----`;

    let sha = crypto.createHash('sha1');
    sha.update(keyBuffer);

    let hash = sha.digest().slice(0, 4);

    let rsa = new nodeRSA(pem);
    let encrypted = rsa.encrypt(email + '\x00' + password);
    
    let base64Output = Buffer.concat([
        Buffer.from([0]),
        hash,
        encrypted
    ]).toString('base64');

    base64Output = base64Output.replace(/\+/g, '-');
    base64Output = base64Output.replace(/\//g, '_');

    return base64Output;
}
function generateSignature ( email , password ) { let googleDefaultPublicKey = 'AAAAgMom/1a/v0lblO2Ubrt60J2gcuXSljGFQXgcyZWveWLEwo6prwgi3iJIZdodyhKZQrNWp5nKJ3srRXcUW+F1BD3baEVGcmEgqaLZUNBjm057pKRI16kB0YppeGx5qIQ5QjKzsR8ETQbKLNWgRY0QRNVz34kMJR3P/LgHax/6rmf5AAAAAwEAAQ==' ; let keyBuffer = Buffer . from ( googleDefaultPublicKey , 'base64' ) ; let pem = ` ` ; let sha = crypto . createHash ( 'sha1' ) ; sha . update ( keyBuffer ) ; let hash = sha . digest ( ) . slice ( 0 , 4 ) ; let rsa = new nodeRSA ( pem ) ; let encrypted = rsa . encrypt ( email + '\x00' + password ) ; let base64Output = Buffer . concat ( [ Buffer . from ( [ 0 ] ) , hash , encrypted ] ) . toString ( 'base64' ) ; base64Output = base64Output . replace ( / \+ / g , '-' ) ; base64Output = base64Output . replace ( / \/ / g , '_' ) ; return base64Output ; }
Generates a signature to be passed into GPS
Generates a signature to be passed into GPS