Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async signJWT (payload) {
const settings = {
signer: this.keyring.getJWTSigner(),
issuer: this.did
// TODO - should we have an expiry?
}
return didJWT.createJWT(payload, settings)
}
return _regenerator2.default.wrap(function _callee5$(_context5) {
while (1) {
switch (_context5.prev = _context5.next) {
case 0:
settings = {
signer: this.keyring.getJWTSigner(),
issuer: this.did
// TODO - should we have an expiry?
};
return _context5.abrupt('return', didJWT.createJWT(payload, settings));
case 2:
case 'end':
return _context5.stop();
}
}
}, _callee5, this);
}));
async signClaim (payload, { DID, space, expiresIn } = {}) {
if (!this._keyring) throw new Error('This method can only be called after authenticate has been called')
const issuer = DID || await this._get3id(space)
const settings = {
signer: this._keyring.getJWTSigner(space),
issuer,
expiresIn
}
return didJWT.createJWT(payload, settings)
}
return new Promise((resolve, reject) => {
if (!address) { return reject(new Error('No application identity address has been configured')) }
if (!signer) { return reject(new Error('No Signer functionality has been configured')) }
return createJwt(
payload, { issuer: address,
signer: signer}).then(jwt => {
resolve(jwt)
})
})
}
async signJWT (payload, { space, expiresIn } = {}) {
let issuer = this.DID
if (space) {
issuer = this._subDIDs[space]
}
if (this._has3idProv) {
return utils.callRpc(this._provider, '3id_signClaim', { payload, did: issuer, space, expiresIn })
} else {
const keyring = this._keyringBySpace(space)
const settings = {
signer: keyring.getJWTSigner(),
issuer,
expiresIn
}
return didJWT.createJWT(payload, settings)
}
}
this.signJWT = (payload, expiresIn) =>
createJWT(payload, {
issuer: this.did,
signer: this.signer,
alg: this.did.match('^did:uport:') || isMNID(this.did) ? 'ES256K' : 'ES256K-R',
expiresIn,
})
const signAnonymousClaim = (claim: any): VerifiableClaim => {
return createJWT(claim, {
issuer: Config.uport.app.address,
signer: SimpleSigner(Config.uport.app.privateKey),
})
}