How to use the @tanker/identity._deserializePermanentIdentity function in @tanker/identity

To help you get started, we’ve selected a few @tanker/identity 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 TankerHQ / sdk-js / packages / core / src / Session / LocalUser / UserData.js View on Github external
export function extractUserData(identityB64: b64string): UserData {
  try {
    const identity = _deserializePermanentIdentity(identityB64);

    const userId = utils.fromBase64(identity.value);
    const userSecret = utils.fromBase64(identity.user_secret);
    const trustchainId = utils.fromBase64(identity.trustchain_id);

    const delegationToken: DelegationToken = {
      ephemeral_public_signature_key: utils.fromBase64(identity.ephemeral_public_signature_key),
      ephemeral_private_signature_key: utils.fromBase64(identity.ephemeral_private_signature_key),
      user_id: userId,
      delegation_signature: utils.fromBase64(identity.delegation_signature),
      last_reset: new Uint8Array(32),
    };

    assertUserSecret(userId, userSecret);

    return {