How to use the did-jwt.createJWT function in did-jwt

To help you get started, we’ve selected a few did-jwt examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github 3box / muport-core-js / src / muport.js View on Github external
async signJWT (payload) {
    const settings = {
      signer: this.keyring.getJWTSigner(),
      issuer: this.did
      // TODO - should we have an expiry?
    }
    return didJWT.createJWT(payload, settings)
  }
github 3box / muport-core-js / lib / muport.js View on Github external
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);
      }));
github 3box / identity-wallet-js / src / identity-wallet.js View on Github external
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)
  }
github uport-project / uport-credentials / src / JWT.js View on Github external
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)
        })
  })
}
github 3box / 3box-js / src / 3id / index.js View on Github external
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)
    }
  }
github uport-project / uport-credentials / src / Credentials.js View on Github external
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,
      })
github gluon-project / gluon-rxp / src / Services / uPort / index.ts View on Github external
const signAnonymousClaim = (claim: any): VerifiableClaim => {
  return createJWT(claim, {
    issuer: Config.uport.app.address,
    signer: SimpleSigner(Config.uport.app.privateKey),
  })
}

did-jwt

Library for Signing and Verifying JWTs that use DIDs as issuers and JWEs that use DIDs as recipients

Apache-2.0
Latest version published 1 month ago

Package Health Score

85 / 100
Full package analysis

Similar packages