@simplewebauthn/server 13.3.3 → 14.0.1
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/README.md +8 -4
- package/esm/authentication/generateAuthenticationOptions.d.ts +2 -2
- package/esm/authentication/generateAuthenticationOptions.d.ts.map +1 -1
- package/esm/authentication/verifyAuthenticationResponse.d.ts +1 -0
- package/esm/authentication/verifyAuthenticationResponse.d.ts.map +1 -1
- package/esm/authentication/verifyAuthenticationResponse.js +52 -2
- 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 +19 -2
- package/esm/helpers/cose.d.ts.map +1 -1
- package/esm/helpers/cose.js +15 -0
- package/esm/helpers/decodeClientDataJSON.d.ts +1 -0
- package/esm/helpers/decodeClientDataJSON.d.ts.map +1 -1
- package/esm/helpers/index.d.ts +2 -0
- package/esm/helpers/index.d.ts.map +1 -1
- package/esm/helpers/index.js +2 -0
- package/esm/helpers/isCertRevoked.d.ts +1 -0
- package/esm/helpers/isCertRevoked.d.ts.map +1 -1
- package/esm/helpers/isCertRevoked.js +1 -0
- package/esm/helpers/iso/isoCrypto/digest.js +2 -2
- package/esm/helpers/iso/isoCrypto/getWebCrypto.d.ts.map +1 -1
- package/esm/helpers/iso/isoCrypto/getWebCrypto.js +12 -0
- package/esm/helpers/iso/isoCrypto/importJWKKey.d.ts +9 -0
- package/esm/helpers/iso/isoCrypto/importJWKKey.d.ts.map +1 -0
- package/esm/helpers/iso/isoCrypto/{importKey.js → importJWKKey.js} +6 -4
- package/esm/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoHashAlgName.d.ts +10 -0
- package/esm/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoHashAlgName.d.ts.map +1 -0
- package/esm/helpers/iso/isoCrypto/{mapCoseAlgToWebCryptoAlg.js → mapCoseAlgToWebCryptoHashAlgName.js} +6 -3
- package/esm/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoKeyAlgName.d.ts +4 -1
- package/esm/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoKeyAlgName.d.ts.map +1 -1
- package/esm/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoKeyAlgName.js +15 -0
- package/esm/helpers/iso/isoCrypto/runtimeSupportsWebCryptoKeyAlg.d.ts +7 -0
- package/esm/helpers/iso/isoCrypto/runtimeSupportsWebCryptoKeyAlg.d.ts.map +1 -0
- package/esm/helpers/iso/isoCrypto/runtimeSupportsWebCryptoKeyAlg.js +16 -0
- package/esm/helpers/iso/isoCrypto/structs.d.ts +1 -1
- package/esm/helpers/iso/isoCrypto/structs.d.ts.map +1 -1
- package/esm/helpers/iso/isoCrypto/verify.d.ts.map +1 -1
- package/esm/helpers/iso/isoCrypto/verify.js +5 -1
- package/esm/helpers/iso/isoCrypto/verifyAKP.d.ts +9 -0
- package/esm/helpers/iso/isoCrypto/verifyAKP.d.ts.map +1 -0
- package/esm/helpers/iso/isoCrypto/verifyAKP.js +48 -0
- package/esm/helpers/iso/isoCrypto/verifyEC2.d.ts.map +1 -1
- package/esm/helpers/iso/isoCrypto/verifyEC2.js +5 -8
- package/esm/helpers/iso/isoCrypto/verifyOKP.d.ts.map +1 -1
- package/esm/helpers/iso/isoCrypto/verifyOKP.js +2 -5
- package/esm/helpers/iso/isoCrypto/verifyRSA.d.ts.map +1 -1
- package/esm/helpers/iso/isoCrypto/verifyRSA.js +5 -8
- package/esm/helpers/logging.d.ts +28 -10
- package/esm/helpers/logging.d.ts.map +1 -1
- package/esm/helpers/logging.js +27 -16
- 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 +26 -7
- package/esm/index.d.ts +1 -0
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +1 -0
- package/esm/registration/generateRegistrationOptions.d.ts +10 -8
- package/esm/registration/generateRegistrationOptions.d.ts.map +1 -1
- package/esm/registration/generateRegistrationOptions.js +11 -29
- package/esm/registration/verifications/tpm/constants.d.ts +1 -2
- package/esm/registration/verifications/tpm/constants.d.ts.map +1 -1
- package/esm/registration/verifications/tpm/constants.js +1 -2
- package/esm/registration/verifications/tpm/isValidTPMManufacturerID.d.ts +3 -0
- package/esm/registration/verifications/tpm/isValidTPMManufacturerID.d.ts.map +1 -0
- package/esm/registration/verifications/tpm/isValidTPMManufacturerID.js +6 -0
- package/esm/registration/verifications/tpm/verifyAttestationTPM.d.ts.map +1 -1
- package/esm/registration/verifications/tpm/verifyAttestationTPM.js +3 -2
- package/esm/registration/verifications/verifyAttestationPacked.js +1 -1
- package/esm/registration/verifyRegistrationResponse.d.ts +3 -3
- package/esm/registration/verifyRegistrationResponse.d.ts.map +1 -1
- package/esm/registration/verifyRegistrationResponse.js +22 -11
- package/esm/services/metadataService.d.ts +4 -0
- package/esm/services/metadataService.d.ts.map +1 -1
- package/esm/services/metadataService.js +16 -10
- package/esm/services/settingsService.d.ts +4 -0
- package/esm/services/settingsService.d.ts.map +1 -1
- package/esm/services/settingsService.js +12 -0
- package/esm/types/dom.d.ts +236 -3
- package/esm/types/dom.d.ts.map +1 -1
- package/esm/types/index.d.ts +158 -44
- package/esm/types/index.d.ts.map +1 -1
- package/package.json +4 -2
- package/script/authentication/generateAuthenticationOptions.d.ts +2 -2
- package/script/authentication/generateAuthenticationOptions.d.ts.map +1 -1
- package/script/authentication/verifyAuthenticationResponse.d.ts +1 -0
- package/script/authentication/verifyAuthenticationResponse.d.ts.map +1 -1
- package/script/authentication/verifyAuthenticationResponse.js +52 -2
- 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 +19 -2
- package/script/helpers/cose.d.ts.map +1 -1
- package/script/helpers/cose.js +17 -0
- package/script/helpers/decodeClientDataJSON.d.ts +1 -0
- package/script/helpers/decodeClientDataJSON.d.ts.map +1 -1
- package/script/helpers/index.d.ts +2 -0
- package/script/helpers/index.d.ts.map +1 -1
- package/script/helpers/index.js +4 -1
- package/script/helpers/isCertRevoked.d.ts +1 -0
- package/script/helpers/isCertRevoked.d.ts.map +1 -1
- package/script/helpers/isCertRevoked.js +1 -0
- package/script/helpers/iso/isoCrypto/digest.js +2 -2
- package/script/helpers/iso/isoCrypto/getWebCrypto.d.ts.map +1 -1
- package/script/helpers/iso/isoCrypto/getWebCrypto.js +12 -0
- package/script/helpers/iso/isoCrypto/importJWKKey.d.ts +9 -0
- package/script/helpers/iso/isoCrypto/importJWKKey.d.ts.map +1 -0
- package/script/helpers/iso/isoCrypto/{importKey.js → importJWKKey.js} +7 -5
- package/script/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoHashAlgName.d.ts +10 -0
- package/script/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoHashAlgName.d.ts.map +1 -0
- package/script/helpers/iso/isoCrypto/{mapCoseAlgToWebCryptoAlg.js → mapCoseAlgToWebCryptoHashAlgName.js} +7 -4
- package/script/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoKeyAlgName.d.ts +4 -1
- package/script/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoKeyAlgName.d.ts.map +1 -1
- package/script/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoKeyAlgName.js +15 -0
- package/script/helpers/iso/isoCrypto/runtimeSupportsWebCryptoKeyAlg.d.ts +7 -0
- package/script/helpers/iso/isoCrypto/runtimeSupportsWebCryptoKeyAlg.d.ts.map +1 -0
- package/script/helpers/iso/isoCrypto/runtimeSupportsWebCryptoKeyAlg.js +19 -0
- package/script/helpers/iso/isoCrypto/structs.d.ts +1 -1
- package/script/helpers/iso/isoCrypto/structs.d.ts.map +1 -1
- package/script/helpers/iso/isoCrypto/verify.d.ts.map +1 -1
- package/script/helpers/iso/isoCrypto/verify.js +4 -0
- package/script/helpers/iso/isoCrypto/verifyAKP.d.ts +9 -0
- package/script/helpers/iso/isoCrypto/verifyAKP.d.ts.map +1 -0
- package/script/helpers/iso/isoCrypto/verifyAKP.js +51 -0
- package/script/helpers/iso/isoCrypto/verifyEC2.d.ts.map +1 -1
- package/script/helpers/iso/isoCrypto/verifyEC2.js +5 -8
- package/script/helpers/iso/isoCrypto/verifyOKP.d.ts.map +1 -1
- package/script/helpers/iso/isoCrypto/verifyOKP.js +2 -5
- package/script/helpers/iso/isoCrypto/verifyRSA.d.ts.map +1 -1
- package/script/helpers/iso/isoCrypto/verifyRSA.js +5 -8
- package/script/helpers/logging.d.ts +28 -10
- package/script/helpers/logging.d.ts.map +1 -1
- package/script/helpers/logging.js +29 -17
- 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 +26 -7
- package/script/index.d.ts +1 -0
- package/script/index.d.ts.map +1 -1
- package/script/index.js +1 -0
- package/script/registration/generateRegistrationOptions.d.ts +10 -8
- package/script/registration/generateRegistrationOptions.d.ts.map +1 -1
- package/script/registration/generateRegistrationOptions.js +13 -31
- package/script/registration/verifications/tpm/constants.d.ts +1 -2
- package/script/registration/verifications/tpm/constants.d.ts.map +1 -1
- package/script/registration/verifications/tpm/constants.js +1 -2
- package/script/registration/verifications/tpm/isValidTPMManufacturerID.d.ts +3 -0
- package/script/registration/verifications/tpm/isValidTPMManufacturerID.d.ts.map +1 -0
- package/script/registration/verifications/tpm/isValidTPMManufacturerID.js +9 -0
- package/script/registration/verifications/tpm/verifyAttestationTPM.d.ts.map +1 -1
- package/script/registration/verifications/tpm/verifyAttestationTPM.js +2 -1
- package/script/registration/verifications/verifyAttestationPacked.js +1 -1
- package/script/registration/verifyRegistrationResponse.d.ts +3 -3
- package/script/registration/verifyRegistrationResponse.d.ts.map +1 -1
- package/script/registration/verifyRegistrationResponse.js +24 -13
- package/script/services/metadataService.d.ts +4 -0
- package/script/services/metadataService.d.ts.map +1 -1
- package/script/services/metadataService.js +15 -9
- package/script/services/settingsService.d.ts +4 -0
- package/script/services/settingsService.d.ts.map +1 -1
- package/script/services/settingsService.js +12 -0
- package/script/types/dom.d.ts +236 -3
- package/script/types/dom.d.ts.map +1 -1
- package/script/types/index.d.ts +158 -44
- package/script/types/index.d.ts.map +1 -1
- package/esm/helpers/iso/isoCrypto/importKey.d.ts +0 -5
- package/esm/helpers/iso/isoCrypto/importKey.d.ts.map +0 -1
- package/esm/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoAlg.d.ts +0 -7
- package/esm/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoAlg.d.ts.map +0 -1
- package/script/helpers/iso/isoCrypto/importKey.d.ts +0 -5
- package/script/helpers/iso/isoCrypto/importKey.d.ts.map +0 -1
- package/script/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoAlg.d.ts +0 -7
- package/script/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoAlg.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateRegistrationOptions.d.ts","sourceRoot":"","sources":["../../src/registration/generateRegistrationOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oCAAoC,EACpC,8BAA8B,EAC9B,
|
|
1
|
+
{"version":3,"file":"generateRegistrationOptions.d.ts","sourceRoot":"","sources":["../../src/registration/generateRegistrationOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oCAAoC,EACpC,8BAA8B,EAC9B,eAAe,EACf,sCAAsC,EAGtC,WAAW,EACZ,MAAM,mBAAmB,CAAC;AAK3B,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7C,MAAM,MAAM,+BAA+B,GAAG,UAAU,CAAC,OAAO,2BAA2B,CAAC,CAAC,CAAC,CAAC,CAAC;AAchG;;;;;GAKG;AACH,eAAO,IAAI,4BAA4B,EAAE,OAAO,EAI/C,CAAC;AAMF;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,2BAA2B,CAC/C,OAAO,EAAE;IACP,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,GAAG,WAAW,CAAC;IACjC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,eAAe,CAAC,EAAE,QAAQ,GAAG,YAAY,GAAG,MAAM,CAAC;IACnD,kBAAkB,CAAC,EAAE;QACnB,EAAE,EAAE,eAAe,CAAC;QACpB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;KACvB,EAAE,CAAC;IACJ,sBAAsB,CAAC,EAAE,8BAA8B,CAAC;IACxD,UAAU,CAAC,EAAE,oCAAoC,CAAC;IAClD,qBAAqB,CAAC,EAAE,MAAM,EAAE,CAAC;IACjC,0BAA0B,CAAC,EAAE,aAAa,GAAG,aAAa,GAAG,cAAc,CAAC;CAC7E,GACA,OAAO,CAAC,sCAAsC,CAAC,CAqIjD"}
|
|
@@ -1,37 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.defaultSupportedAlgorithmIDs = void 0;
|
|
4
4
|
exports.generateRegistrationOptions = generateRegistrationOptions;
|
|
5
|
+
const settingsService_js_1 = require("../services/settingsService.js");
|
|
5
6
|
const generateChallenge_js_1 = require("../helpers/generateChallenge.js");
|
|
6
7
|
const generateUserID_js_1 = require("../helpers/generateUserID.js");
|
|
7
8
|
const index_js_1 = require("../helpers/iso/index.js");
|
|
8
|
-
|
|
9
|
-
* Supported crypto algo identifiers
|
|
10
|
-
* See https://w3c.github.io/webauthn/#sctn-alg-identifier
|
|
11
|
-
* and https://www.iana.org/assignments/cose/cose.xhtml#algorithms
|
|
12
|
-
*/
|
|
13
|
-
exports.supportedCOSEAlgorithmIdentifiers = [
|
|
14
|
-
// EdDSA (In first position to encourage authenticators to use this over ES256)
|
|
15
|
-
-8,
|
|
16
|
-
// ECDSA w/ SHA-256
|
|
17
|
-
-7,
|
|
18
|
-
// ECDSA w/ SHA-512
|
|
19
|
-
-36,
|
|
20
|
-
// RSASSA-PSS w/ SHA-256
|
|
21
|
-
-37,
|
|
22
|
-
// RSASSA-PSS w/ SHA-384
|
|
23
|
-
-38,
|
|
24
|
-
// RSASSA-PSS w/ SHA-512
|
|
25
|
-
-39,
|
|
26
|
-
// RSASSA-PKCS1-v1_5 w/ SHA-256
|
|
27
|
-
-257,
|
|
28
|
-
// RSASSA-PKCS1-v1_5 w/ SHA-384
|
|
29
|
-
-258,
|
|
30
|
-
// RSASSA-PKCS1-v1_5 w/ SHA-512
|
|
31
|
-
-259,
|
|
32
|
-
// RSASSA-PKCS1-v1_5 w/ SHA-1 (Deprecated; here for legacy support)
|
|
33
|
-
-65535,
|
|
34
|
-
];
|
|
9
|
+
const cose_js_1 = require("../helpers/cose.js");
|
|
35
10
|
/**
|
|
36
11
|
* Set up some default authenticator selection options as per the latest spec:
|
|
37
12
|
* https://www.w3.org/TR/webauthn-2/#dictdef-authenticatorselectioncriteria
|
|
@@ -49,7 +24,14 @@ const defaultAuthenticatorSelection = {
|
|
|
49
24
|
* - https://www.iana.org/assignments/cose/cose.xhtml#algorithms
|
|
50
25
|
* - https://w3c.github.io/webauthn/#dom-publickeycredentialcreationoptions-pubkeycredparams
|
|
51
26
|
*/
|
|
52
|
-
|
|
27
|
+
exports.defaultSupportedAlgorithmIDs = [
|
|
28
|
+
cose_js_1.COSEALG.EdDSA,
|
|
29
|
+
cose_js_1.COSEALG.ES256,
|
|
30
|
+
cose_js_1.COSEALG.RS256,
|
|
31
|
+
];
|
|
32
|
+
if (settingsService_js_1.SettingsService.runtimeSupportsPQC()) {
|
|
33
|
+
exports.defaultSupportedAlgorithmIDs = [cose_js_1.COSEALG.ML_DSA_44, ...exports.defaultSupportedAlgorithmIDs];
|
|
34
|
+
}
|
|
53
35
|
/**
|
|
54
36
|
* Prepare a value to pass into navigator.credentials.create(...) for authenticator registration
|
|
55
37
|
*
|
|
@@ -66,11 +48,11 @@ const defaultSupportedAlgorithmIDs = [-8, -7, -257];
|
|
|
66
48
|
* @param excludeCredentials **(Optional)** - Authenticators registered by the user so the user can't register the same credential multiple times. Defaults to `[]`
|
|
67
49
|
* @param authenticatorSelection **(Optional)** - Advanced criteria for restricting the types of authenticators that may be used. Defaults to `{ residentKey: 'preferred', userVerification: 'preferred' }`
|
|
68
50
|
* @param extensions **(Optional)** - Additional plugins the authenticator or browser should use during attestation
|
|
69
|
-
* @param supportedAlgorithmIDs **(Optional)** - Array of numeric COSE algorithm identifiers supported
|
|
51
|
+
* @param supportedAlgorithmIDs **(Optional)** - Array of numeric COSE algorithm identifiers indicating supported public key algorithms. Import `COSEALG` from \@simplewebauthn/server/helpers for suitable values. Defaults to `[COSEALG.EdDSA, COSEALG.ES256, COSEALG.RS256]`
|
|
70
52
|
* @param preferredAuthenticatorType **(Optional)** - Encourage the browser to prompt the user to register a specific type of authenticator
|
|
71
53
|
*/
|
|
72
54
|
async function generateRegistrationOptions(options) {
|
|
73
|
-
const { rpName, rpID, userName, userID, challenge = await (0, generateChallenge_js_1.generateChallenge)(), userDisplayName = '', timeout = 60000, attestationType = 'none', excludeCredentials = [], authenticatorSelection = defaultAuthenticatorSelection, extensions, supportedAlgorithmIDs = defaultSupportedAlgorithmIDs, preferredAuthenticatorType, } = options;
|
|
55
|
+
const { rpName, rpID, userName, userID, challenge = await (0, generateChallenge_js_1.generateChallenge)(), userDisplayName = '', timeout = 60000, attestationType = 'none', excludeCredentials = [], authenticatorSelection = defaultAuthenticatorSelection, extensions, supportedAlgorithmIDs = exports.defaultSupportedAlgorithmIDs, preferredAuthenticatorType, } = options;
|
|
74
56
|
/**
|
|
75
57
|
* Prepare pubKeyCredParams from the array of algorithm ID's
|
|
76
58
|
*/
|
|
@@ -25,7 +25,7 @@ export declare const TPM_ALG: {
|
|
|
25
25
|
export declare const TPM_ECC_CURVE: {
|
|
26
26
|
[key: number]: string;
|
|
27
27
|
};
|
|
28
|
-
type ManufacturerInfo = {
|
|
28
|
+
export type ManufacturerInfo = {
|
|
29
29
|
name: string;
|
|
30
30
|
id: string;
|
|
31
31
|
};
|
|
@@ -44,5 +44,4 @@ export declare const TPM_MANUFACTURERS: {
|
|
|
44
44
|
export declare const TPM_ECC_CURVE_COSE_CRV_MAP: {
|
|
45
45
|
[key: string]: number;
|
|
46
46
|
};
|
|
47
|
-
export {};
|
|
48
47
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/registration/verifications/tpm/constants.ts"],"names":[],"mappings":"AACA;;;;;;;;GAQG;AAEH;;GAEG;AACH,eAAO,MAAM,MAAM,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAkB3C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,OAAO,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAsC5C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAUlD,CAAC;AAEF,
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/registration/verifications/tpm/constants.ts"],"names":[],"mappings":"AACA;;;;;;;;GAQG;AAEH;;GAEG;AACH,eAAO,MAAM,MAAM,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAkB3C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,OAAO,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAsC5C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAUlD,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,gBAAgB,CAAA;CA+BhE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,0BAA0B,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAM/D,CAAC"}
|
|
@@ -107,8 +107,7 @@ exports.TPM_MANUFACTURERS = {
|
|
|
107
107
|
'id:48504900': { name: 'HPI', id: 'HPI' },
|
|
108
108
|
'id:48504500': { name: 'HPE', id: 'HPE' },
|
|
109
109
|
'id:48495349': { name: 'Huawei', id: 'HISI' },
|
|
110
|
-
'id:
|
|
111
|
-
'id:49424D00': { name: 'IBM', id: 'IBM' }, // Same ID for IBM as above, except the "D" is capitalized as per TPM spec
|
|
110
|
+
'id:49424D00': { name: 'IBM', id: 'IBM' }, // IBM is "id:49424d00" in the TPM spec. It's been normalized here
|
|
112
111
|
'id:49465800': { name: 'Infineon', id: 'IFX' },
|
|
113
112
|
'id:494E5443': { name: 'Intel', id: 'INTC' },
|
|
114
113
|
'id:4C454E00': { name: 'Lenovo', id: 'LEN' },
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isValidTPMManufacturerID.d.ts","sourceRoot":"","sources":["../../../../src/registration/verifications/tpm/isValidTPMManufacturerID.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAAqB,MAAM,gBAAgB,CAAC;AAE1E,wBAAgB,sBAAsB,CAAC,EAAE,EAAE,MAAM,GAAG,gBAAgB,GAAG,SAAS,CAK/E"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getTPMManufacturerInfo = getTPMManufacturerInfo;
|
|
4
|
+
const constants_js_1 = require("./constants.js");
|
|
5
|
+
function getTPMManufacturerInfo(id) {
|
|
6
|
+
// e.g. "id:51434f4d" -> "id:51434f4D"
|
|
7
|
+
const _normalized = `id:${id.substring(3).toUpperCase()}`;
|
|
8
|
+
return constants_js_1.TPM_MANUFACTURERS[_normalized];
|
|
9
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verifyAttestationTPM.d.ts","sourceRoot":"","sources":["../../../../src/registration/verifications/tpm/verifyAttestationTPM.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,qCAAqC,CAAC;
|
|
1
|
+
{"version":3,"file":"verifyAttestationTPM.d.ts","sourceRoot":"","sources":["../../../../src/registration/verifications/tpm/verifyAttestationTPM.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,qCAAqC,CAAC;AAyBzF,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,6BAA6B,GACrC,OAAO,CAAC,OAAO,CAAC,CA+VlB"}
|
|
@@ -17,6 +17,7 @@ const verifyAttestationWithMetadata_js_1 = require("../../../metadata/verifyAtte
|
|
|
17
17
|
const constants_js_1 = require("./constants.js");
|
|
18
18
|
const parseCertInfo_js_1 = require("./parseCertInfo.js");
|
|
19
19
|
const parsePubArea_js_1 = require("./parsePubArea.js");
|
|
20
|
+
const isValidTPMManufacturerID_js_1 = require("./isValidTPMManufacturerID.js");
|
|
20
21
|
async function verifyAttestationTPM(options) {
|
|
21
22
|
const { aaguid, attStmt, authData, credentialPublicKey, clientDataHash, rootCertificates, } = options;
|
|
22
23
|
const ver = attStmt.get('ver');
|
|
@@ -203,7 +204,7 @@ async function verifyAttestationTPM(options) {
|
|
|
203
204
|
throw new Error('Certificate did not contain ExtendedKeyUsage extension (TPM)');
|
|
204
205
|
}
|
|
205
206
|
// Check that tcpaTpmManufacturer (2.23.133.2.1) field is set to a valid manufacturer ID.
|
|
206
|
-
if (!
|
|
207
|
+
if (!(0, isValidTPMManufacturerID_js_1.getTPMManufacturerInfo)(tcgAtTpmManufacturer)) {
|
|
207
208
|
throw new Error(`Could not match TPM manufacturer "${tcgAtTpmManufacturer}" (TPM)`);
|
|
208
209
|
}
|
|
209
210
|
// Check that certificate contains extKeyUsage (2.5.29.37) extension and it must contain
|
|
@@ -94,7 +94,7 @@ async function verifyAttestationPacked(options) {
|
|
|
94
94
|
}
|
|
95
95
|
catch (err) {
|
|
96
96
|
const _err = err;
|
|
97
|
-
throw new Error(`${_err.message} (Packed|Full)
|
|
97
|
+
throw new Error(`${_err.message} (Packed|Full)`, { cause: _err });
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
100
|
verified = await (0, verifySignature_js_1.verifySignature)({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { CredentialDeviceType, RegistrationResponseJSON, Uint8Array_, WebAuthnCredential } from '../types/index.js';
|
|
2
2
|
import { type AttestationFormat, type AttestationStatement } from '../helpers/decodeAttestationObject.js';
|
|
3
3
|
import type { AuthenticationExtensionsAuthenticatorOutputs } from '../helpers/decodeAuthenticatorExtensions.js';
|
|
4
4
|
/**
|
|
@@ -17,7 +17,7 @@ export type VerifyRegistrationResponseOpts = Parameters<typeof verifyRegistratio
|
|
|
17
17
|
* @param expectedType **(Optional)** - The response type expected ('webauthn.create')
|
|
18
18
|
* @param requireUserPresence **(Optional)** - Enforce user presence by the authenticator (or skip it during auto registration) Defaults to `true`
|
|
19
19
|
* @param requireUserVerification **(Optional)** - Enforce user verification by the authenticator (via PIN, fingerprint, etc...) Defaults to `true`
|
|
20
|
-
* @param supportedAlgorithmIDs **(Optional)** - Array of numeric COSE algorithm identifiers supported
|
|
20
|
+
* @param supportedAlgorithmIDs **(Optional)** - Array of numeric COSE algorithm identifiers indicating supported public key algorithms. Import `COSEALG` from \@simplewebauthn/server/helpers for suitable values. Should be the same value that was specified for this same argument when calling `generateRegistrationOptions()`. Defaults to `[COSEALG.EdDSA, COSEALG.ES256, COSEALG.RS256]`
|
|
21
21
|
* @param attestationSafetyNetEnforceCTSCheck **(Optional)** - Require that an Android device's system integrity has not been tampered with if it uses SafetyNet attestation. Defaults to `true`
|
|
22
22
|
*/
|
|
23
23
|
export declare function verifyRegistrationResponse(options: {
|
|
@@ -28,7 +28,7 @@ export declare function verifyRegistrationResponse(options: {
|
|
|
28
28
|
expectedType?: string | string[];
|
|
29
29
|
requireUserPresence?: boolean;
|
|
30
30
|
requireUserVerification?: boolean;
|
|
31
|
-
supportedAlgorithmIDs?:
|
|
31
|
+
supportedAlgorithmIDs?: number[];
|
|
32
32
|
attestationSafetyNetEnforceCTSCheck?: boolean;
|
|
33
33
|
}): Promise<VerifiedRegistrationResponse>;
|
|
34
34
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verifyRegistrationResponse.d.ts","sourceRoot":"","sources":["../../src/registration/verifyRegistrationResponse.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,
|
|
1
|
+
{"version":3,"file":"verifyRegistrationResponse.d.ts","sourceRoot":"","sources":["../../src/registration/verifyRegistrationResponse.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EACpB,wBAAwB,EACxB,WAAW,EACX,kBAAkB,EACnB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,EAE1B,MAAM,uCAAuC,CAAC;AAC/C,OAAO,KAAK,EAAE,4CAA4C,EAAE,MAAM,6CAA6C,CAAC;AAoBhH;;GAEG;AACH,MAAM,MAAM,8BAA8B,GAAG,UAAU,CAAC,OAAO,0BAA0B,CAAC,CAAC,CAAC,CAAC,CAAC;AAE9F;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,0BAA0B,CAC9C,OAAO,EAAE;IACP,QAAQ,EAAE,wBAAwB,CAAC;IACnC,iBAAiB,EAAE,MAAM,GAAG,CAAC,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;IAChF,cAAc,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAClC,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACjC,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACjC,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,qBAAqB,CAAC,EAAE,MAAM,EAAE,CAAC;IACjC,mCAAmC,CAAC,EAAE,OAAO,CAAC;CAC/C,GACA,OAAO,CAAC,4BAA4B,CAAC,CA8PvC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,MAAM,4BAA4B,GAAG;IACzC,QAAQ,EAAE,KAAK,CAAC;IAChB,gBAAgB,CAAC,EAAE,KAAK,CAAC;CAC1B,GAAG;IACF,QAAQ,EAAE,IAAI,CAAC;IACf,gBAAgB,EAAE;QAChB,GAAG,EAAE,iBAAiB,CAAC;QACvB,MAAM,EAAE,MAAM,CAAC;QACf,UAAU,EAAE,kBAAkB,CAAC;QAC/B,cAAc,EAAE,YAAY,CAAC;QAC7B,iBAAiB,EAAE,WAAW,CAAC;QAC/B,YAAY,EAAE,OAAO,CAAC;QACtB,oBAAoB,EAAE,oBAAoB,CAAC;QAC3C,kBAAkB,EAAE,OAAO,CAAC;QAC5B,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,6BAA6B,CAAC,EAAE,4CAA4C,CAAC;KAC9E,CAAC;CACH,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,6BAA6B,GAAG;IAC1C,MAAM,EAAE,WAAW,CAAC;IACpB,OAAO,EAAE,oBAAoB,CAAC;IAC9B,QAAQ,EAAE,WAAW,CAAC;IACtB,cAAc,EAAE,WAAW,CAAC;IAC5B,YAAY,EAAE,WAAW,CAAC;IAC1B,mBAAmB,EAAE,WAAW,CAAC;IACjC,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,QAAQ,EAAE,WAAW,CAAC;IACtB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,mCAAmC,CAAC,EAAE,OAAO,CAAC;CAC/C,CAAC"}
|
|
@@ -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");
|
|
@@ -31,11 +32,11 @@ const verifyAttestationApple_js_1 = require("./verifications/verifyAttestationAp
|
|
|
31
32
|
* @param expectedType **(Optional)** - The response type expected ('webauthn.create')
|
|
32
33
|
* @param requireUserPresence **(Optional)** - Enforce user presence by the authenticator (or skip it during auto registration) Defaults to `true`
|
|
33
34
|
* @param requireUserVerification **(Optional)** - Enforce user verification by the authenticator (via PIN, fingerprint, etc...) Defaults to `true`
|
|
34
|
-
* @param supportedAlgorithmIDs **(Optional)** - Array of numeric COSE algorithm identifiers supported
|
|
35
|
+
* @param supportedAlgorithmIDs **(Optional)** - Array of numeric COSE algorithm identifiers indicating supported public key algorithms. Import `COSEALG` from \@simplewebauthn/server/helpers for suitable values. Should be the same value that was specified for this same argument when calling `generateRegistrationOptions()`. Defaults to `[COSEALG.EdDSA, COSEALG.ES256, COSEALG.RS256]`
|
|
35
36
|
* @param attestationSafetyNetEnforceCTSCheck **(Optional)** - Require that an Android device's system integrity has not been tampered with if it uses SafetyNet attestation. Defaults to `true`
|
|
36
37
|
*/
|
|
37
38
|
async function verifyRegistrationResponse(options) {
|
|
38
|
-
const { response, expectedChallenge, expectedOrigin, expectedRPID, expectedType, requireUserPresence = true, requireUserVerification = true, supportedAlgorithmIDs = generateRegistrationOptions_js_1.
|
|
39
|
+
const { response, expectedChallenge, expectedOrigin, expectedRPID, expectedType, requireUserPresence = true, requireUserVerification = true, supportedAlgorithmIDs = generateRegistrationOptions_js_1.defaultSupportedAlgorithmIDs, attestationSafetyNetEnforceCTSCheck = true, } = options;
|
|
39
40
|
const { id, rawId, type: credentialType, response: attestationResponse } = response;
|
|
40
41
|
// Ensure credential specified an ID
|
|
41
42
|
if (!id) {
|
|
@@ -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,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { MetadataStatement } from '../metadata/mdsTypes.js';
|
|
2
|
+
import { type SimpleWebAuthnLogger } from '../helpers/logging.js';
|
|
2
3
|
import type { Uint8Array_ } from '../types/index.js';
|
|
3
4
|
/**
|
|
4
5
|
* Allow MetadataService to accommodate unregistered AAGUIDs (`"permissive"`), or only allow
|
|
@@ -24,6 +25,7 @@ interface MetadataService {
|
|
|
24
25
|
mdsServers?: string[];
|
|
25
26
|
statements?: MetadataStatement[];
|
|
26
27
|
verificationMode?: VerificationMode;
|
|
28
|
+
logger?: SimpleWebAuthnLogger;
|
|
27
29
|
}): Promise<void>;
|
|
28
30
|
/**
|
|
29
31
|
* Get a metadata statement for a given AAGUID.
|
|
@@ -44,10 +46,12 @@ export declare class BaseMetadataService implements MetadataService {
|
|
|
44
46
|
private statementCache;
|
|
45
47
|
private state;
|
|
46
48
|
private verificationMode;
|
|
49
|
+
private logger;
|
|
47
50
|
initialize(opts?: {
|
|
48
51
|
mdsServers?: string[];
|
|
49
52
|
statements?: MetadataStatement[];
|
|
50
53
|
verificationMode?: VerificationMode;
|
|
54
|
+
logger?: SimpleWebAuthnLogger;
|
|
51
55
|
}): Promise<void>;
|
|
52
56
|
getStatement(aaguid: string | Uint8Array_): Promise<MetadataStatement | undefined>;
|
|
53
57
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metadataService.d.ts","sourceRoot":"","sources":["../../src/services/metadataService.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAA4B,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"metadataService.d.ts","sourceRoot":"","sources":["../../src/services/metadataService.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAA4B,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE3F,OAAO,EAGL,KAAK,oBAAoB,EAC1B,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAmCrD;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG,YAAY,GAAG,QAAQ,CAAC;AAEvD,UAAU,eAAe;IACvB;;;;;;;;;;;;;OAaG;IACH,UAAU,CAAC,IAAI,CAAC,EAAE;QAChB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;QACtB,UAAU,CAAC,EAAE,iBAAiB,EAAE,CAAC;QACjC,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;QACpC,MAAM,CAAC,EAAE,oBAAoB,CAAC;KAC/B,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAClB;;;;;OAKG;IACH,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,GAAG,OAAO,CAAC,iBAAiB,GAAG,SAAS,CAAC,CAAC;CACnF;AAED;;;;;GAKG;AACH,qBAAa,mBAAoB,YAAW,eAAe;IACzD,OAAO,CAAC,QAAQ,CAAoC;IACpD,OAAO,CAAC,cAAc,CAA6C;IACnE,OAAO,CAAC,KAAK,CAAyC;IACtD,OAAO,CAAC,gBAAgB,CAA8B;IACtD,OAAO,CAAC,MAAM,CAAqD;IAE7D,UAAU,CACd,IAAI,GAAE;QACJ,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;QACtB,UAAU,CAAC,EAAE,iBAAiB,EAAE,CAAC;QACjC,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;QACpC,MAAM,CAAC,EAAE,oBAAoB,CAAC;KAC1B,GACL,OAAO,CAAC,IAAI,CAAC;IAmFV,YAAY,CAChB,MAAM,EAAE,MAAM,GAAG,WAAW,GAC3B,OAAO,CAAC,iBAAiB,GAAG,SAAS,CAAC;IA8DzC;;OAEG;YACW,YAAY;IAU1B;;OAEG;YACW,UAAU;IA8CxB;;OAEG;IACH,OAAO,CAAC,eAAe;IAgCvB;;OAEG;IACH,OAAO,CAAC,QAAQ;CAWjB;AAED;;;;;GAKG;AACH,eAAO,MAAM,eAAe,EAAE,eAA2C,CAAC"}
|
|
@@ -20,7 +20,6 @@ var SERVICE_STATE;
|
|
|
20
20
|
SERVICE_STATE[SERVICE_STATE["REFRESHING"] = 1] = "REFRESHING";
|
|
21
21
|
SERVICE_STATE[SERVICE_STATE["READY"] = 2] = "READY";
|
|
22
22
|
})(SERVICE_STATE || (SERVICE_STATE = {}));
|
|
23
|
-
const log = (0, logging_js_1.getLogger)('MetadataService');
|
|
24
23
|
/**
|
|
25
24
|
* An implementation of `MetadataService` that can download and parse BLOBs, and support on-demand
|
|
26
25
|
* requesting and caching of individual metadata statements.
|
|
@@ -53,11 +52,18 @@ class BaseMetadataService {
|
|
|
53
52
|
writable: true,
|
|
54
53
|
value: 'strict'
|
|
55
54
|
});
|
|
55
|
+
Object.defineProperty(this, "logger", {
|
|
56
|
+
enumerable: true,
|
|
57
|
+
configurable: true,
|
|
58
|
+
writable: true,
|
|
59
|
+
value: logging_js_1.DefaultNoopLogger
|
|
60
|
+
});
|
|
56
61
|
}
|
|
57
62
|
async initialize(opts = {}) {
|
|
58
63
|
// Reset statement cache
|
|
59
64
|
this.statementCache = {};
|
|
60
|
-
const { mdsServers = [defaultURLMDS], statements, verificationMode } = opts;
|
|
65
|
+
const { mdsServers = [defaultURLMDS], statements, verificationMode, logger = logging_js_1.DefaultNoopLogger, } = opts;
|
|
66
|
+
this.logger = (0, logging_js_1.buildLoggerAllMethods)(logger);
|
|
61
67
|
this.setState(SERVICE_STATE.REFRESHING);
|
|
62
68
|
/**
|
|
63
69
|
* If metadata statements are provided, load them into the cache first. These statements will
|
|
@@ -79,7 +85,7 @@ class BaseMetadataService {
|
|
|
79
85
|
statementsAdded += 1;
|
|
80
86
|
}
|
|
81
87
|
});
|
|
82
|
-
|
|
88
|
+
this.logger.info(`Cached ${statementsAdded} local statements`);
|
|
83
89
|
}
|
|
84
90
|
/**
|
|
85
91
|
* If MDS servers are provided, then download blobs from them, verify them, and then add their
|
|
@@ -102,14 +108,14 @@ class BaseMetadataService {
|
|
|
102
108
|
}
|
|
103
109
|
catch (err) {
|
|
104
110
|
// Notify of the error and move on
|
|
105
|
-
|
|
111
|
+
this.logger.error(`Could not download BLOB from ${url}:`, err);
|
|
106
112
|
numServers -= 1;
|
|
107
113
|
}
|
|
108
114
|
}
|
|
109
115
|
// Calculate the difference to get the total number of new statements we successfully added
|
|
110
116
|
const newCacheCount = Object.keys(this.statementCache).length;
|
|
111
117
|
const cacheDiff = newCacheCount - currentCacheCount;
|
|
112
|
-
|
|
118
|
+
this.logger.info(`Cached ${cacheDiff} statements from ${numServers} metadata server(s)`);
|
|
113
119
|
}
|
|
114
120
|
if (verificationMode) {
|
|
115
121
|
this.verificationMode = verificationMode;
|
|
@@ -213,7 +219,7 @@ class BaseMetadataService {
|
|
|
213
219
|
// TODO (Feb 2026): It'd be more actionable for devs if a specific error was raised here,
|
|
214
220
|
// then this message was logged higher up when it can include the array index of the stale
|
|
215
221
|
// blob.
|
|
216
|
-
|
|
222
|
+
this.logger.warn(`⚠️ This MDS blob (serial: ${payload.no}) contains stale data as of ${parsedNextUpdate.toISOString()}. Please consider re-initializing MetadataService with a newer MDS blob.`);
|
|
217
223
|
}
|
|
218
224
|
}
|
|
219
225
|
}
|
|
@@ -252,13 +258,13 @@ class BaseMetadataService {
|
|
|
252
258
|
setState(newState) {
|
|
253
259
|
this.state = newState;
|
|
254
260
|
if (newState === SERVICE_STATE.DISABLED) {
|
|
255
|
-
|
|
261
|
+
this.logger.debug('MetadataService is DISABLED');
|
|
256
262
|
}
|
|
257
263
|
else if (newState === SERVICE_STATE.REFRESHING) {
|
|
258
|
-
|
|
264
|
+
this.logger.debug('MetadataService is REFRESHING');
|
|
259
265
|
}
|
|
260
266
|
else if (newState === SERVICE_STATE.READY) {
|
|
261
|
-
|
|
267
|
+
this.logger.debug('MetadataService is READY');
|
|
262
268
|
}
|
|
263
269
|
}
|
|
264
270
|
}
|
|
@@ -19,6 +19,10 @@ interface SettingsService {
|
|
|
19
19
|
getRootCertificates(opts: {
|
|
20
20
|
identifier: RootCertIdentifier;
|
|
21
21
|
}): string[];
|
|
22
|
+
/**
|
|
23
|
+
* Get the runtime's ability to support PQC algorithms by detecting support for ML-DSA-44
|
|
24
|
+
*/
|
|
25
|
+
runtimeSupportsPQC(): boolean;
|
|
22
26
|
}
|
|
23
27
|
/**
|
|
24
28
|
* A basic service for specifying acceptable root certificates for all supported attestation
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settingsService.d.ts","sourceRoot":"","sources":["../../src/services/settingsService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAE/E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"settingsService.d.ts","sourceRoot":"","sources":["../../src/services/settingsService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAE/E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAarD,MAAM,MAAM,kBAAkB,GAAG,iBAAiB,GAAG,KAAK,CAAC;AAE3D,UAAU,eAAe;IACvB;;;;;;OAMG;IACH,mBAAmB,CAAC,IAAI,EAAE;QACxB,UAAU,EAAE,kBAAkB,CAAC;QAC/B,YAAY,EAAE,CAAC,WAAW,GAAG,MAAM,CAAC,EAAE,CAAC;KACxC,GAAG,IAAI,CAAC;IAET;;OAEG;IACH,mBAAmB,CAAC,IAAI,EAAE;QAAE,UAAU,EAAE,kBAAkB,CAAA;KAAE,GAAG,MAAM,EAAE,CAAC;IAExE;;OAEG;IACH,kBAAkB,IAAI,OAAO,CAAC;CAC/B;AAyCD;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,eAAe,EAAE,eAA2C,CAAC"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SettingsService = void 0;
|
|
4
4
|
const convertCertBufferToPEM_js_1 = require("../helpers/convertCertBufferToPEM.js");
|
|
5
|
+
const runtimeSupportsWebCryptoKeyAlg_js_1 = require("../helpers/iso/isoCrypto/runtimeSupportsWebCryptoKeyAlg.js");
|
|
5
6
|
const android_safetynet_js_1 = require("./defaultRootCerts/android-safetynet.js");
|
|
6
7
|
const android_key_js_1 = require("./defaultRootCerts/android-key.js");
|
|
7
8
|
const apple_js_1 = require("./defaultRootCerts/apple.js");
|
|
@@ -15,7 +16,15 @@ class BaseSettingsService {
|
|
|
15
16
|
writable: true,
|
|
16
17
|
value: void 0
|
|
17
18
|
});
|
|
19
|
+
// Track whether the runtime supports PQC algorithms
|
|
20
|
+
Object.defineProperty(this, "_runtimeSupportsPQC", {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
configurable: true,
|
|
23
|
+
writable: true,
|
|
24
|
+
value: false
|
|
25
|
+
});
|
|
18
26
|
this.pemCertificates = new Map();
|
|
27
|
+
this._runtimeSupportsPQC = (0, runtimeSupportsWebCryptoKeyAlg_js_1.runtimeSupportsWebCryptoKeyAlg)('ML-DSA-44');
|
|
19
28
|
}
|
|
20
29
|
setRootCertificates(opts) {
|
|
21
30
|
const { identifier, certificates } = opts;
|
|
@@ -34,6 +43,9 @@ class BaseSettingsService {
|
|
|
34
43
|
const { identifier } = opts;
|
|
35
44
|
return this.pemCertificates.get(identifier) ?? [];
|
|
36
45
|
}
|
|
46
|
+
runtimeSupportsPQC() {
|
|
47
|
+
return this._runtimeSupportsPQC;
|
|
48
|
+
}
|
|
37
49
|
}
|
|
38
50
|
/**
|
|
39
51
|
* A basic service for specifying acceptable root certificates for all supported attestation
|