@0xpass/passport
Advanced tools
Comparing version 0.1.13 to 0.1.14
# @0xpass/passport | ||
## 0.1.14 | ||
### Patch Changes | ||
- a90ba11: Use axios so request can be intercepted for performance measurement | ||
## 0.1.13 | ||
@@ -4,0 +10,0 @@ |
@@ -114,30 +114,2 @@ import axios from 'axios'; | ||
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; | ||
@@ -198,13 +170,4 @@ const ec = new elliptic.ec("secp256k1"); | ||
const encrypted_user = await aesEncrypt(JSON.stringify(params), this.aesKey); | ||
// 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, | ||
const initRegResponse = await this.call("initiateRegistration", { | ||
encrypted_user, | ||
}); | ||
@@ -219,14 +182,6 @@ if (initRegResponse.error) { | ||
const encrypted_attestation = await aesEncrypt(JSON.stringify(attestation), this.aesKey); | ||
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, | ||
const finishRegResult = await this.call("completeRegistration", { | ||
challenge_id, | ||
encrypted_attestation, | ||
encrypted_user, | ||
}); | ||
@@ -243,13 +198,5 @@ if (finishRegResult.error) { | ||
const encrypted_user = await aesEncrypt(JSON.stringify(params), this.aesKey); | ||
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 initAuthResponse = await this.call("initiateAuthentication", { | ||
encrypted_user, | ||
regenerate_seed, | ||
}); | ||
@@ -261,14 +208,6 @@ 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 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, | ||
const authResult = await this.call("completeAuthentication", { | ||
challenge_id, | ||
encrypted_assertion, | ||
encrypted_user, | ||
}); | ||
@@ -275,0 +214,0 @@ this.authenticatedHeaders = { |
{ | ||
"name": "@0xpass/passport", | ||
"version": "0.1.13", | ||
"version": "0.1.14", | ||
"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/eslint-config": "0.0.1" | ||
"@0xpass/typescript-config": "0.0.1" | ||
}, | ||
@@ -40,0 +40,0 @@ "scripts": { |
@@ -39,3 +39,2 @@ import axios from "axios"; | ||
import elliptic from "elliptic"; | ||
import { sendXMLRequest } from "./utils"; | ||
@@ -202,19 +201,5 @@ const { keccak256 } = pkg; | ||
// 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, | ||
} | ||
); | ||
const initRegResponse = await this.call("initiateRegistration", { | ||
encrypted_user, | ||
}); | ||
@@ -236,20 +221,7 @@ if (initRegResponse.error) { | ||
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, | ||
} | ||
); | ||
const finishRegResult = await this.call("completeRegistration", { | ||
challenge_id, | ||
encrypted_attestation, | ||
encrypted_user, | ||
}); | ||
@@ -330,19 +302,6 @@ if (finishRegResult.error) { | ||
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 initAuthResponse = await this.call("initiateAuthentication", { | ||
encrypted_user, | ||
regenerate_seed, | ||
}); | ||
@@ -359,20 +318,7 @@ const request_challenge_str = await aesDecrypt( | ||
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, | ||
} | ||
); | ||
const authResult = await this.call("completeAuthentication", { | ||
challenge_id, | ||
encrypted_assertion, | ||
encrypted_user, | ||
}); | ||
@@ -379,0 +325,0 @@ this.authenticatedHeaders = { |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
66659
1496