I am using nodejs with this library node-jose, to get allow me to do get my private key and using it to sign and/or decript.
So the problem now is this. I am trying to return a signature from result after generating it by is unable to do so.
At Point A, when I do a console.log, i am to actually see my result. Beyond that, i.e. at Point B, i am unable to see my result. All i get is this.
2018-10-23T15:04:23.553 signature1: null //Point B
Am i doing things the right way?
main.js:
let jose = require('node-jose');
function sendRequest(id, keystore, kid1, kid2) {
    let result;
    ... 
    let baseString1 = generateBaseString(baseUrl1);
    let signature1 = null;
    jose.JWS.createSign(keystore.get(kid1)).update(baseString1).final().then(function(result) {
        signature1 = result;
        //Point A
        console.log(result);
    });
    //Point B
    console.log("signature1: " + signature1);
    ...
    return result;
}
 
    