Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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 {
trustchainId,
userId,
userSecret,
delegationToken,
};
} catch (e) {
throw new InvalidArgument(`Invalid identity provided: ${identityB64}`);
}
}