How to use the @arcblock/did.toAddress function in @arcblock/did

To help you get started, we’ve selected a few @arcblock/did 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 ArcBlock / forge-js / did / did-auth / lib / authenticator / wallet.js View on Github external
async getClaimInfo({ claim, context, extraParams }) {
    const { userDid, userPk, walletOS, sessionDid, walletVersion } = context;
    const result =
      typeof claim === 'function'
        ? await claim({
            userDid: userDid ? toAddress(userDid) : '',
            userPk: userPk || '',
            sessionDid: sessionDid || '',
            walletOS,
            walletVersion,
            extraParams,
          })
        : claim;

    const chainInfoParams = Object.assign({}, context, extraParams);
    const chainInfo = this.getChainInfo(chainInfoParams, result.chainInfo || undefined);
    ForgeSDK.connect(chainInfo.host, { chainId: chainInfo.id, name: chainInfo.id });

    result.chainInfo = chainInfo;

    return result;
  }
github ArcBlock / forge-js / did / did-auth / lib / authenticator / wallet.js View on Github external
return new Promise(async (resolve, reject) => {
      try {
        const { iss, action = 'responseAuth', requestedClaims } = await this._verify(
          data,
          'userPk',
          'userInfo',
          locale,
          enforceTimestamp
        );

        resolve({
          token: data.token,
          userDid: toAddress(iss),
          userPk: data.userPk,
          claims: requestedClaims,
          action,
        });

        debug('verify.context', { userPk: data.userPk, userDid: toAddress(iss), action });
        debug('verify.claims', requestedClaims);
      } catch (err) {
        reject(err);
      }
    });
  }