@simplewebauthn/server 14.0.0 → 14.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/authentication/verifyAuthenticationResponse.d.ts.map +1 -1
- package/esm/authentication/verifyAuthenticationResponse.js +12 -0
- package/esm/errors/index.d.ts +17 -0
- package/esm/errors/index.d.ts.map +1 -0
- package/esm/errors/index.js +24 -0
- package/esm/helpers/convertX509PublicKeyToCOSE.d.ts +1 -1
- package/esm/helpers/convertX509PublicKeyToCOSE.d.ts.map +1 -1
- package/esm/helpers/convertX509PublicKeyToCOSE.js +22 -6
- package/esm/helpers/cose.d.ts +1 -0
- package/esm/helpers/cose.d.ts.map +1 -1
- package/esm/helpers/cose.js +3 -0
- package/esm/helpers/isCertRevoked.d.ts +2 -1
- package/esm/helpers/isCertRevoked.d.ts.map +1 -1
- package/esm/helpers/isCertRevoked.js +91 -70
- package/esm/helpers/iso/isoCrypto/verifyAKP.d.ts.map +1 -1
- package/esm/helpers/iso/isoCrypto/verifyAKP.js +2 -1
- package/esm/helpers/mapX509SignatureAlgToCOSEAlg.d.ts +0 -3
- package/esm/helpers/mapX509SignatureAlgToCOSEAlg.d.ts.map +1 -1
- package/esm/helpers/mapX509SignatureAlgToCOSEAlg.js +19 -10
- package/esm/helpers/validateCertificatePath.d.ts +1 -0
- package/esm/helpers/validateCertificatePath.d.ts.map +1 -1
- package/esm/helpers/validateCertificatePath.js +94 -52
- package/esm/index.d.ts +1 -0
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +1 -0
- package/esm/metadata/verifyAttestationWithMetadata.d.ts.map +1 -1
- package/esm/metadata/verifyAttestationWithMetadata.js +1 -7
- package/esm/registration/verifications/verifyAttestationPacked.js +1 -1
- package/esm/registration/verifyRegistrationResponse.d.ts.map +1 -1
- package/esm/registration/verifyRegistrationResponse.js +19 -8
- package/package.json +4 -2
- package/script/authentication/verifyAuthenticationResponse.d.ts.map +1 -1
- package/script/authentication/verifyAuthenticationResponse.js +12 -0
- package/script/errors/index.d.ts +17 -0
- package/script/errors/index.d.ts.map +1 -0
- package/script/errors/index.js +29 -0
- package/script/helpers/convertX509PublicKeyToCOSE.d.ts +1 -1
- package/script/helpers/convertX509PublicKeyToCOSE.d.ts.map +1 -1
- package/script/helpers/convertX509PublicKeyToCOSE.js +21 -5
- package/script/helpers/cose.d.ts +1 -0
- package/script/helpers/cose.d.ts.map +1 -1
- package/script/helpers/cose.js +4 -0
- package/script/helpers/isCertRevoked.d.ts +2 -1
- package/script/helpers/isCertRevoked.d.ts.map +1 -1
- package/script/helpers/isCertRevoked.js +91 -70
- package/script/helpers/iso/isoCrypto/verifyAKP.d.ts.map +1 -1
- package/script/helpers/iso/isoCrypto/verifyAKP.js +2 -1
- package/script/helpers/mapX509SignatureAlgToCOSEAlg.d.ts +0 -3
- package/script/helpers/mapX509SignatureAlgToCOSEAlg.d.ts.map +1 -1
- package/script/helpers/mapX509SignatureAlgToCOSEAlg.js +19 -10
- package/script/helpers/validateCertificatePath.d.ts +1 -0
- package/script/helpers/validateCertificatePath.d.ts.map +1 -1
- package/script/helpers/validateCertificatePath.js +94 -52
- package/script/index.d.ts +1 -0
- package/script/index.d.ts.map +1 -1
- package/script/index.js +1 -0
- package/script/metadata/verifyAttestationWithMetadata.d.ts.map +1 -1
- package/script/metadata/verifyAttestationWithMetadata.js +1 -7
- package/script/registration/verifications/verifyAttestationPacked.js +1 -1
- package/script/registration/verifyRegistrationResponse.d.ts.map +1 -1
- package/script/registration/verifyRegistrationResponse.js +22 -11
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.verifyRegistrationResponse = verifyRegistrationResponse;
|
|
4
|
+
const index_js_1 = require("../errors/index.js");
|
|
4
5
|
const decodeAttestationObject_js_1 = require("../helpers/decodeAttestationObject.js");
|
|
5
6
|
const decodeClientDataJSON_js_1 = require("../helpers/decodeClientDataJSON.js");
|
|
6
7
|
const parseAuthenticatorData_js_1 = require("../helpers/parseAuthenticatorData.js");
|
|
@@ -10,7 +11,7 @@ const cose_js_1 = require("../helpers/cose.js");
|
|
|
10
11
|
const convertAAGUIDToString_js_1 = require("../helpers/convertAAGUIDToString.js");
|
|
11
12
|
const parseBackupFlags_js_1 = require("../helpers/parseBackupFlags.js");
|
|
12
13
|
const matchExpectedRPID_js_1 = require("../helpers/matchExpectedRPID.js");
|
|
13
|
-
const
|
|
14
|
+
const index_js_2 = require("../helpers/iso/index.js");
|
|
14
15
|
const settingsService_js_1 = require("../services/settingsService.js");
|
|
15
16
|
const generateRegistrationOptions_js_1 = require("./generateRegistrationOptions.js");
|
|
16
17
|
const verifyAttestationFIDOU2F_js_1 = require("./verifications/verifyAttestationFIDOU2F.js");
|
|
@@ -94,7 +95,7 @@ async function verifyRegistrationResponse(options) {
|
|
|
94
95
|
throw new Error(`Unexpected tokenBinding.status value of "${tokenBinding.status}"`);
|
|
95
96
|
}
|
|
96
97
|
}
|
|
97
|
-
const attestationObject =
|
|
98
|
+
const attestationObject = index_js_2.isoBase64URL.toBuffer(attestationResponse.attestationObject);
|
|
98
99
|
const decodedAttestationObject = (0, decodeAttestationObject_js_1.decodeAttestationObject)(attestationObject);
|
|
99
100
|
const fmt = decodedAttestationObject.get('fmt');
|
|
100
101
|
const authData = decodedAttestationObject.get('authData');
|
|
@@ -131,19 +132,29 @@ async function verifyRegistrationResponse(options) {
|
|
|
131
132
|
throw new Error('No AAGUID was present during registration');
|
|
132
133
|
}
|
|
133
134
|
const decodedPublicKey = (0, decodeCredentialPublicKey_js_1.decodeCredentialPublicKey)(credentialPublicKey);
|
|
134
|
-
const
|
|
135
|
-
if (typeof
|
|
135
|
+
const pubKeyAlg = decodedPublicKey.get(cose_js_1.COSEKEYS.alg);
|
|
136
|
+
if (typeof pubKeyAlg !== 'number') {
|
|
136
137
|
throw new Error('Credential public key was missing numeric alg');
|
|
137
138
|
}
|
|
138
139
|
// Make sure the key algorithm is one we specified within the registration options
|
|
139
|
-
if (!supportedAlgorithmIDs.includes(
|
|
140
|
+
if (!supportedAlgorithmIDs.includes(pubKeyAlg)) {
|
|
140
141
|
const supported = supportedAlgorithmIDs.join(', ');
|
|
141
|
-
throw new Error(`Unexpected public key alg "${
|
|
142
|
+
throw new Error(`Unexpected public key alg "${pubKeyAlg}", expected one of "${supported}"`);
|
|
142
143
|
}
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
144
|
+
/**
|
|
145
|
+
* If the runtime doesn't support PQC passkeys then terminate here at the first sign of a PQC
|
|
146
|
+
* algorithm so that downstream issues that arise due to lack of PQC support won't get masked as
|
|
147
|
+
* unexpected behavior.
|
|
148
|
+
*
|
|
149
|
+
* I'm choosing to raise here even if attestation is "none" because it feels weird to allow an RP
|
|
150
|
+
* to parse a registration response w/o attestation only to encounter failure when trying to auth
|
|
151
|
+
* with the PQC passkey and the runtime doesn't support PQC.
|
|
152
|
+
*/
|
|
153
|
+
if ((0, cose_js_1.isPQCCOSEAlg)(pubKeyAlg) && !settingsService_js_1.SettingsService.runtimeSupportsPQC()) {
|
|
154
|
+
throw new index_js_1.PQCNotSupportedError(pubKeyAlg);
|
|
155
|
+
}
|
|
156
|
+
const clientDataHash = await (0, toHash_js_1.toHash)(index_js_2.isoBase64URL.toBuffer(attestationResponse.clientDataJSON));
|
|
157
|
+
const rootCertificates = settingsService_js_1.SettingsService.getRootCertificates({ identifier: fmt });
|
|
147
158
|
// Prepare arguments to pass to the relevant verification method
|
|
148
159
|
const verifierOpts = {
|
|
149
160
|
aaguid,
|
|
@@ -199,7 +210,7 @@ async function verifyRegistrationResponse(options) {
|
|
|
199
210
|
aaguid: (0, convertAAGUIDToString_js_1.convertAAGUIDToString)(aaguid),
|
|
200
211
|
credentialType,
|
|
201
212
|
credential: {
|
|
202
|
-
id:
|
|
213
|
+
id: index_js_2.isoBase64URL.fromBuffer(credentialID),
|
|
203
214
|
publicKey: credentialPublicKey,
|
|
204
215
|
counter,
|
|
205
216
|
transports: response.response.transports,
|