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.12 to 0.1.13

dist/utils.d.ts

6

CHANGELOG.md
# @0xpass/passport
## 0.1.13
### Patch Changes
- 106f13c: Fixes issue with safari webauthn registration
## 0.1.12

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

1

dist/crypto.d.ts
export declare const LOCAL_RSA_PUBLIC_KEY = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsl8sLC46QMKa400EnVfz+bEU2JJHXsXcwIGMItRJ3ZM3XZSzAmELJPh3lAlXyhktq2Cl0w0PuaH//fCQm5/3Rm48ytcdBmvwh3zpCnUylS3eJKF15L2xMb8eQf6nnNMnucnrhvDfdCL5ZZlkn2FDB4/UJpgPfrHivK69gaeT725g89gWvKmEG7+RGoXLPEXU4UyHxYyMMCDwxH2fE+jN53FG8JlwuLu1cbTYxgYIxf4Um+CvYp7irlGfvxP+Ws9lkBJ+MtCishod/7ytJD9jpbYf6BUAHSAeWeNBbkgSdmPSia4Mi2wPXeqmzmovjfJfWSiaCW+wFuMyCGVx/g/znQIDAQAB";
export declare const TESTNET_RSA_PUBLIC_KEY = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvQOa1gkatuN6KjaS4KEWsVZAN9i4Cf0j9jlmBW5RwCJ3Bxo32McP7axt4Ev6sMWM24lpCgXgu68S9KBYRcrcEB6dRcaupFGd+ER7M518fiJ0VtCZ+XRnmwn9fqEvotp9DPZOysJkUQ60kugCRKwNvfZzAFcDiubwiqsUY2sCm943a/u9Hym51SEetG+ZFPJZFOBqwRSGkOgGZ+9Ac7ITE+bWLCZk9DlzRu+BIoDOFzXZIn+/0a0X8BnLtRY4g50aew4J+4OllQagBbhYnPMvYExYIEUx6bdjQicw0Js6s2pHr+SFAX23kQtbVOVxb5+KEGp1d+6Q4Gx7FBoyWI5qPQIDAQAB";
export declare const generateKeyPair: () => Promise<{

@@ -3,0 +4,0 @@ publicKey: string;

import { AuthenticationParams, AuthenticationResponse, DelegatedRegisterAccountParams, DelegatedRegisterAccountResponse, LambaCallParams, LambdaListParams, LambdaNewParams, Method, NewScopeParams, NewScopeResponse, RegistrationParams, RegistrationResponse, RpcHeaders, RpcMethodParams, SignMessageParams, SignMessageResponse, SignTransactionParams, SignTransactionResponse, UpdateScopeParams, UpdateScopeResponse } from "./types";
import { LambdaExecutable, NewLambda } from "./types/lambda";
import { SignerWithOptionalCreator } from "./types/credential";
import { TESTNET_RSA_PUBLIC_KEY } from "./crypto";
type PassportConstructorParams = {

@@ -73,2 +74,3 @@ scope_id?: string;

export type { NewLambda, LambdaExecutable };
export { TESTNET_RSA_PUBLIC_KEY };
//# sourceMappingURL=index.d.ts.map

@@ -6,2 +6,3 @@ import axios from 'axios';

const LOCAL_RSA_PUBLIC_KEY = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsl8sLC46QMKa400EnVfz+bEU2JJHXsXcwIGMItRJ3ZM3XZSzAmELJPh3lAlXyhktq2Cl0w0PuaH//fCQm5/3Rm48ytcdBmvwh3zpCnUylS3eJKF15L2xMb8eQf6nnNMnucnrhvDfdCL5ZZlkn2FDB4/UJpgPfrHivK69gaeT725g89gWvKmEG7+RGoXLPEXU4UyHxYyMMCDwxH2fE+jN53FG8JlwuLu1cbTYxgYIxf4Um+CvYp7irlGfvxP+Ws9lkBJ+MtCishod/7ytJD9jpbYf6BUAHSAeWeNBbkgSdmPSia4Mi2wPXeqmzmovjfJfWSiaCW+wFuMyCGVx/g/znQIDAQAB";
const TESTNET_RSA_PUBLIC_KEY = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvQOa1gkatuN6KjaS4KEWsVZAN9i4Cf0j9jlmBW5RwCJ3Bxo32McP7axt4Ev6sMWM24lpCgXgu68S9KBYRcrcEB6dRcaupFGd+ER7M518fiJ0VtCZ+XRnmwn9fqEvotp9DPZOysJkUQ60kugCRKwNvfZzAFcDiubwiqsUY2sCm943a/u9Hym51SEetG+ZFPJZFOBqwRSGkOgGZ+9Ac7ITE+bWLCZk9DlzRu+BIoDOFzXZIn+/0a0X8BnLtRY4g50aew4J+4OllQagBbhYnPMvYExYIEUx6bdjQicw0Js6s2pHr+SFAX23kQtbVOVxb5+KEGp1d+6Q4Gx7FBoyWI5qPQIDAQAB";
const generateAesKey = async () => {

@@ -114,2 +115,30 @@ const cryptoKey = await window.crypto.subtle.generateKey({

const sendXMLRequest = (url, method, data, headers) => {
return new Promise((resolve, reject) => {
const xhr = new XMLHttpRequest();
xhr.open(method, url, true);
xhr.setRequestHeader("Content-Type", "application/json");
Object.keys(headers).forEach((key) => {
xhr.setRequestHeader(key, headers[key]);
});
xhr.onreadystatechange = () => {
if (xhr.readyState === XMLHttpRequest.DONE) {
try {
const response = JSON.parse(xhr.responseText);
if (xhr.status === 200) {
resolve(response);
}
else {
reject(new Error(`Server error: ${xhr.status}`));
}
}
catch (e) {
reject(new Error(`Invalid JSON response: ${xhr.responseText}`));
}
}
};
xhr.send(JSON.stringify(data));
});
};
const { keccak256 } = pkg;

@@ -170,4 +199,13 @@ const ec = new elliptic.ec("secp256k1");

const encrypted_user = await aesEncrypt(JSON.stringify(params), this.aesKey);
const initRegResponse = await this.call("initiateRegistration", {
encrypted_user,
// use an ajax instead of fetch because of safari browser loses interaction context
// when using fetch and therefore also when using axios.
// https://github.com/passwordless-lib/fido2-net-lib/issues/303
const initRegResponse = await sendXMLRequest(this.endpoint, "POST", {
jsonrpc: "2.0",
id: 1,
method: "initiateRegistration",
params: { encrypted_user },
}, {
"x-encrypted-key": this.encryptedAesKey,
"x-scope-id": this.scopeId,
});

@@ -182,6 +220,14 @@ if (initRegResponse.error) {

const encrypted_attestation = await aesEncrypt(JSON.stringify(attestation), this.aesKey);
const finishRegResult = await this.call("completeRegistration", {
challenge_id,
encrypted_attestation,
encrypted_user,
const finishRegResult = await sendXMLRequest(this.endpoint, "POST", {
jsonrpc: "2.0",
id: 1,
method: "completeRegistration",
params: {
challenge_id,
encrypted_attestation,
encrypted_user,
},
}, {
"x-encrypted-key": this.encryptedAesKey,
"x-scope-id": this.scopeId,
});

@@ -198,5 +244,13 @@ if (finishRegResult.error) {

const encrypted_user = await aesEncrypt(JSON.stringify(params), this.aesKey);
const initAuthResponse = await this.call("initiateAuthentication", {
encrypted_user,
regenerate_seed,
const initAuthResponse = await sendXMLRequest(this.endpoint, "POST", {
jsonrpc: "2.0",
id: 1,
method: "initiateAuthentication",
params: {
encrypted_user,
regenerate_seed,
},
}, {
"x-encrypted-key": this.encryptedAesKey,
"x-scope-id": this.scopeId,
});

@@ -208,6 +262,14 @@ const request_challenge_str = await aesDecrypt(initAuthResponse.result.encrypted_request_challenge, this.aesKey);

const encrypted_assertion = await aesEncrypt(JSON.stringify(assertion), this.aesKey);
const authResult = await this.call("completeAuthentication", {
challenge_id,
encrypted_assertion,
encrypted_user,
const authResult = await sendXMLRequest(this.endpoint, "POST", {
jsonrpc: "2.0",
id: 1,
method: "completeAuthentication",
params: {
challenge_id,
encrypted_assertion,
encrypted_user,
},
}, {
"x-encrypted-key": this.encryptedAesKey,
"x-scope-id": this.scopeId,
});

@@ -424,3 +486,3 @@ this.authenticatedHeaders = {

export { Passport };
export { Passport, TESTNET_RSA_PUBLIC_KEY };
//# sourceMappingURL=index.js.map

@@ -68,2 +68,3 @@ import { LambdaExecutable, NewLambda } from "./lambda";

id: string;
account_id: string;
creation_challenge: any;

@@ -70,0 +71,0 @@ };

6

package.json
{
"name": "@0xpass/passport",
"version": "0.1.12",
"version": "0.1.13",
"description": "",

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

"typescript": "^5.0.4",
"@0xpass/eslint-config": "0.0.1",
"@0xpass/jest-config": "0.0.1",
"@0xpass/typescript-config": "0.0.1"
"@0xpass/typescript-config": "0.0.1",
"@0xpass/eslint-config": "0.0.1"
},

@@ -40,0 +40,0 @@ "scripts": {

export const LOCAL_RSA_PUBLIC_KEY =
"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsl8sLC46QMKa400EnVfz+bEU2JJHXsXcwIGMItRJ3ZM3XZSzAmELJPh3lAlXyhktq2Cl0w0PuaH//fCQm5/3Rm48ytcdBmvwh3zpCnUylS3eJKF15L2xMb8eQf6nnNMnucnrhvDfdCL5ZZlkn2FDB4/UJpgPfrHivK69gaeT725g89gWvKmEG7+RGoXLPEXU4UyHxYyMMCDwxH2fE+jN53FG8JlwuLu1cbTYxgYIxf4Um+CvYp7irlGfvxP+Ws9lkBJ+MtCishod/7ytJD9jpbYf6BUAHSAeWeNBbkgSdmPSia4Mi2wPXeqmzmovjfJfWSiaCW+wFuMyCGVx/g/znQIDAQAB";
export const TESTNET_RSA_PUBLIC_KEY = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvQOa1gkatuN6KjaS4KEWsVZAN9i4Cf0j9jlmBW5RwCJ3Bxo32McP7axt4Ev6sMWM24lpCgXgu68S9KBYRcrcEB6dRcaupFGd+ER7M518fiJ0VtCZ+XRnmwn9fqEvotp9DPZOysJkUQ60kugCRKwNvfZzAFcDiubwiqsUY2sCm943a/u9Hym51SEetG+ZFPJZFOBqwRSGkOgGZ+9Ac7ITE+bWLCZk9DlzRu+BIoDOFzXZIn+/0a0X8BnLtRY4g50aew4J+4OllQagBbhYnPMvYExYIEUx6bdjQicw0Js6s2pHr+SFAX23kQtbVOVxb5+KEGp1d+6Q4Gx7FBoyWI5qPQIDAQAB";
export const generateKeyPair = async () => {

@@ -5,0 +7,0 @@ const keyPair = await window.crypto.subtle.generateKey(

@@ -35,5 +35,7 @@ import axios from "axios";

rsaEncrypt,
TESTNET_RSA_PUBLIC_KEY,
} from "./crypto";
import pkg from "js-sha3";
import elliptic from "elliptic";
import { sendXMLRequest } from "./utils";

@@ -199,6 +201,21 @@ const { keccak256 } = pkg;

const encrypted_user = await aesEncrypt(JSON.stringify(params), this.aesKey);
const initRegResponse = await this.call("initiateRegistration", {
encrypted_user,
});
// use an ajax instead of fetch because of safari browser loses interaction context
// when using fetch and therefore also when using axios.
// https://github.com/passwordless-lib/fido2-net-lib/issues/303
const initRegResponse = await sendXMLRequest(
this.endpoint,
"POST",
{
jsonrpc: "2.0",
id: 1,
method: "initiateRegistration",
params: { encrypted_user },
},
{
"x-encrypted-key": this.encryptedAesKey,
"x-scope-id": this.scopeId,
}
);
if (initRegResponse.error) {

@@ -218,8 +235,22 @@ throw new Error(

const encrypted_attestation = await aesEncrypt(JSON.stringify(attestation), this.aesKey);
const finishRegResult = await this.call("completeRegistration", {
challenge_id,
encrypted_attestation,
encrypted_user,
});
const finishRegResult = await sendXMLRequest(
this.endpoint,
"POST",
{
jsonrpc: "2.0",
id: 1,
method: "completeRegistration",
params: {
challenge_id,
encrypted_attestation,
encrypted_user,
},
},
{
"x-encrypted-key": this.encryptedAesKey,
"x-scope-id": this.scopeId,
}
);
if (finishRegResult.error) {

@@ -298,7 +329,21 @@ throw new Error(

const encrypted_user = await aesEncrypt(JSON.stringify(params), this.aesKey);
const initAuthResponse = await this.call("initiateAuthentication", {
encrypted_user,
regenerate_seed,
});
const initAuthResponse = await sendXMLRequest(
this.endpoint,
"POST",
{
jsonrpc: "2.0",
id: 1,
method: "initiateAuthentication",
params: {
encrypted_user,
regenerate_seed,
},
},
{
"x-encrypted-key": this.encryptedAesKey,
"x-scope-id": this.scopeId,
}
);
const request_challenge_str = await aesDecrypt(

@@ -314,7 +359,20 @@ initAuthResponse.result.encrypted_request_challenge,

const authResult = await this.call("completeAuthentication", {
challenge_id,
encrypted_assertion,
encrypted_user,
});
const authResult = await sendXMLRequest(
this.endpoint,
"POST",
{
jsonrpc: "2.0",
id: 1,
method: "completeAuthentication",
params: {
challenge_id,
encrypted_assertion,
encrypted_user,
},
},
{
"x-encrypted-key": this.encryptedAesKey,
"x-scope-id": this.scopeId,
}
);

@@ -451,1 +509,2 @@ this.authenticatedHeaders = {

export type { NewLambda, LambdaExecutable };
export { TESTNET_RSA_PUBLIC_KEY };

@@ -101,2 +101,3 @@ import { LambdaExecutable, NewLambda } from "./lambda";

id: string;
account_id: string;
creation_challenge: any;

@@ -103,0 +104,0 @@ };

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

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