Socket
Socket
Sign inDemoInstall

@0xpass/passport

Package Overview
Dependencies
Maintainers
3
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@0xpass/passport - npm Package Compare versions

Comparing version 0.1.10 to 0.1.11

6

CHANGELOG.md
# @0xpass/passport
## 0.1.11
### Patch Changes
- 2cac52c: Split registration into initiate and complete
## 0.1.10

@@ -4,0 +10,0 @@

2

dist/index.d.ts

@@ -62,2 +62,4 @@ import { AuthenticationParams, AuthenticationResponse, DelegatedRegisterAccountParams, DelegatedRegisterAccountResponse, LambaCallParams, LambdaListParams, LambdaNewParams, Method, NewScopeParams, NewScopeResponse, RegistrationParams, RegistrationResponse, RpcHeaders, RpcMethodParams, SignMessageParams, SignMessageResponse, SignTransactionParams, SignTransactionResponse, UpdateScopeParams, UpdateScopeResponse } from "./types";

register: (params: RegistrationParams) => Promise<RegistrationResponse>;
initiateRegistration(params: RegistrationParams): Promise<any>;
completeRegistration(encrypted_user: any, challenge_id: any, cco_json: any): Promise<RegistrationResponse>;
authenticate: (params: AuthenticationParams, regenerate_seed?: boolean) => Promise<AuthenticationResponse>;

@@ -64,0 +66,0 @@ uncompressPublicKey: (compressedPubKeyHex: any) => string;

@@ -380,2 +380,37 @@ import axios from 'axios';

}
async initiateRegistration(params) {
if (!this.isCredentialCreator(this.signer)) {
throw new Error("Signer does not support registration.");
}
const encrypted_user = await aesEncrypt(JSON.stringify(params), this.aesKey);
const initRegResponse = await this.call("initiateRegistration", {
encrypted_user,
});
if (initRegResponse.error) {
throw new Error(`error message: ${initRegResponse.error.message}, error data: ${initRegResponse.error.data}`);
}
const challenge_id = initRegResponse.result.challenge_id;
const cco_str = await aesDecrypt(initRegResponse.result.encrypted_creation_challenge, this.aesKey);
const cco_json = JSON.parse(cco_str);
return {
challenge_id,
cco_json,
};
}
async completeRegistration(encrypted_user, challenge_id, cco_json) {
if (!this.isCredentialCreator(this.signer)) {
throw new Error("Signer does not support registration.");
}
const attestation = await this.signer.create(cco_json);
const encrypted_attestation = await aesEncrypt(JSON.stringify(attestation), this.aesKey);
const finishRegResult = await this.call("completeRegistration", {
challenge_id,
encrypted_attestation,
encrypted_user,
});
if (finishRegResult.error) {
throw new Error(`error message: ${finishRegResult.error.message}, error data: ${finishRegResult.error.data}`);
}
return finishRegResult;
}
}

@@ -382,0 +417,0 @@

2

package.json
{
"name": "@0xpass/passport",
"version": "0.1.10",
"version": "0.1.11",
"description": "",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -231,2 +231,57 @@ import axios from "axios";

public async initiateRegistration(params: RegistrationParams): Promise<any> {
if (!this.isCredentialCreator(this.signer)) {
throw new Error("Signer does not support registration.");
}
const encrypted_user = await aesEncrypt(JSON.stringify(params), this.aesKey);
const initRegResponse = await this.call("initiateRegistration", {
encrypted_user,
});
if (initRegResponse.error) {
throw new Error(
`error message: ${initRegResponse.error.message}, error data: ${initRegResponse.error.data}`
);
}
const challenge_id = initRegResponse.result.challenge_id;
const cco_str = await aesDecrypt(
initRegResponse.result.encrypted_creation_challenge,
this.aesKey
);
const cco_json = JSON.parse(cco_str) as CredentialCreationOptions;
return {
challenge_id,
cco_json,
};
}
public async completeRegistration(
encrypted_user: any,
challenge_id: any,
cco_json: any
): Promise<RegistrationResponse> {
if (!this.isCredentialCreator(this.signer)) {
throw new Error("Signer does not support registration.");
}
const attestation = await this.signer.create(cco_json);
const encrypted_attestation = await aesEncrypt(JSON.stringify(attestation), this.aesKey);
const finishRegResult = await this.call("completeRegistration", {
challenge_id,
encrypted_attestation,
encrypted_user,
});
if (finishRegResult.error) {
throw new Error(
`error message: ${finishRegResult.error.message}, error data: ${finishRegResult.error.data}`
);
}
return finishRegResult;
}
public authenticate = async (

@@ -233,0 +288,0 @@ params: AuthenticationParams,

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc