@simplewebauthn/server 13.1.1 → 13.2.0

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.
Files changed (190) hide show
  1. package/esm/authentication/generateAuthenticationOptions.d.ts +2 -2
  2. package/esm/authentication/generateAuthenticationOptions.d.ts.map +1 -1
  3. package/esm/authentication/generateAuthenticationOptions.js +1 -1
  4. package/esm/helpers/convertAAGUIDToString.d.ts +2 -1
  5. package/esm/helpers/convertAAGUIDToString.d.ts.map +1 -1
  6. package/esm/helpers/convertCOSEtoPKCS.d.ts +2 -1
  7. package/esm/helpers/convertCOSEtoPKCS.d.ts.map +1 -1
  8. package/esm/helpers/convertCertBufferToPEM.d.ts +2 -2
  9. package/esm/helpers/convertCertBufferToPEM.d.ts.map +1 -1
  10. package/esm/helpers/convertPEMToBytes.d.ts +2 -1
  11. package/esm/helpers/convertPEMToBytes.d.ts.map +1 -1
  12. package/esm/helpers/convertX509PublicKeyToCOSE.d.ts +2 -1
  13. package/esm/helpers/convertX509PublicKeyToCOSE.d.ts.map +1 -1
  14. package/esm/helpers/convertX509PublicKeyToCOSE.js +2 -2
  15. package/esm/helpers/cose.d.ts +11 -10
  16. package/esm/helpers/cose.d.ts.map +1 -1
  17. package/esm/helpers/cose.js +0 -11
  18. package/esm/helpers/decodeAttestationObject.d.ts +8 -7
  19. package/esm/helpers/decodeAttestationObject.d.ts.map +1 -1
  20. package/esm/helpers/decodeAuthenticatorExtensions.d.ts +2 -1
  21. package/esm/helpers/decodeAuthenticatorExtensions.d.ts.map +1 -1
  22. package/esm/helpers/decodeCredentialPublicKey.d.ts +3 -2
  23. package/esm/helpers/decodeCredentialPublicKey.d.ts.map +1 -1
  24. package/esm/helpers/generateChallenge.d.ts +3 -2
  25. package/esm/helpers/generateChallenge.d.ts.map +1 -1
  26. package/esm/helpers/generateUserID.d.ts +3 -2
  27. package/esm/helpers/generateUserID.d.ts.map +1 -1
  28. package/esm/helpers/getCertificateInfo.d.ts +2 -1
  29. package/esm/helpers/getCertificateInfo.d.ts.map +1 -1
  30. package/esm/helpers/isCertRevoked.d.ts +2 -2
  31. package/esm/helpers/isCertRevoked.d.ts.map +1 -1
  32. package/esm/helpers/isCertRevoked.js +19 -22
  33. package/esm/helpers/iso/isoBase64URL.d.ts +3 -3
  34. package/esm/helpers/iso/isoBase64URL.d.ts.map +1 -1
  35. package/esm/helpers/iso/isoBase64URL.js +1 -1
  36. package/esm/helpers/iso/isoCBOR.d.ts +3 -2
  37. package/esm/helpers/iso/isoCBOR.d.ts.map +1 -1
  38. package/esm/helpers/iso/isoCrypto/digest.d.ts +3 -2
  39. package/esm/helpers/iso/isoCrypto/digest.d.ts.map +1 -1
  40. package/esm/helpers/iso/isoCrypto/getRandomValues.d.ts +2 -1
  41. package/esm/helpers/iso/isoCrypto/getRandomValues.d.ts.map +1 -1
  42. package/esm/helpers/iso/isoCrypto/unwrapEC2Signature.d.ts +2 -1
  43. package/esm/helpers/iso/isoCrypto/unwrapEC2Signature.d.ts.map +1 -1
  44. package/esm/helpers/iso/isoCrypto/verify.d.ts +4 -3
  45. package/esm/helpers/iso/isoCrypto/verify.d.ts.map +1 -1
  46. package/esm/helpers/iso/isoCrypto/verifyEC2.d.ts +4 -3
  47. package/esm/helpers/iso/isoCrypto/verifyEC2.d.ts.map +1 -1
  48. package/esm/helpers/iso/isoCrypto/verifyOKP.d.ts +4 -3
  49. package/esm/helpers/iso/isoCrypto/verifyOKP.d.ts.map +1 -1
  50. package/esm/helpers/iso/isoCrypto/verifyRSA.d.ts +4 -3
  51. package/esm/helpers/iso/isoCrypto/verifyRSA.d.ts.map +1 -1
  52. package/esm/helpers/iso/isoUint8Array.d.ts +9 -8
  53. package/esm/helpers/iso/isoUint8Array.d.ts.map +1 -1
  54. package/esm/helpers/matchExpectedRPID.d.ts +2 -1
  55. package/esm/helpers/matchExpectedRPID.d.ts.map +1 -1
  56. package/esm/helpers/parseAuthenticatorData.d.ts +10 -9
  57. package/esm/helpers/parseAuthenticatorData.d.ts.map +1 -1
  58. package/esm/helpers/toHash.d.ts +3 -2
  59. package/esm/helpers/toHash.d.ts.map +1 -1
  60. package/esm/helpers/validateCertificatePath.d.ts.map +1 -1
  61. package/esm/helpers/validateCertificatePath.js +85 -90
  62. package/esm/helpers/validateExtFIDOGenCEAAGUID.d.ts +3 -2
  63. package/esm/helpers/validateExtFIDOGenCEAAGUID.d.ts.map +1 -1
  64. package/esm/helpers/verifySignature.d.ts +5 -4
  65. package/esm/helpers/verifySignature.d.ts.map +1 -1
  66. package/esm/metadata/verifyAttestationWithMetadata.d.ts +3 -2
  67. package/esm/metadata/verifyAttestationWithMetadata.d.ts.map +1 -1
  68. package/esm/metadata/verifyJWT.d.ts +2 -1
  69. package/esm/metadata/verifyJWT.d.ts.map +1 -1
  70. package/esm/registration/generateRegistrationOptions.d.ts +3 -3
  71. package/esm/registration/generateRegistrationOptions.d.ts.map +1 -1
  72. package/esm/registration/verifications/tpm/parseCertInfo.d.ts +9 -8
  73. package/esm/registration/verifications/tpm/parseCertInfo.d.ts.map +1 -1
  74. package/esm/registration/verifications/tpm/parsePubArea.d.ts +4 -3
  75. package/esm/registration/verifications/tpm/parsePubArea.d.ts.map +1 -1
  76. package/esm/registration/verifications/tpm/verifyAttestationTPM.d.ts.map +1 -1
  77. package/esm/registration/verifications/verifyAttestationAndroidKey.js +2 -2
  78. package/esm/registration/verifications/verifyAttestationAndroidSafetyNet.d.ts.map +1 -1
  79. package/esm/registration/verifications/verifyAttestationAndroidSafetyNet.js +2 -2
  80. package/esm/registration/verifyRegistrationResponse.d.ts +16 -10
  81. package/esm/registration/verifyRegistrationResponse.d.ts.map +1 -1
  82. package/esm/registration/verifyRegistrationResponse.js +12 -10
  83. package/esm/services/defaultRootCerts/mds.d.ts +1 -1
  84. package/esm/services/defaultRootCerts/mds.d.ts.map +1 -1
  85. package/esm/services/defaultRootCerts/mds.js +20 -20
  86. package/esm/services/metadataService.d.ts +2 -1
  87. package/esm/services/metadataService.d.ts.map +1 -1
  88. package/esm/services/metadataService.js +1 -1
  89. package/esm/services/settingsService.d.ts +2 -1
  90. package/esm/services/settingsService.d.ts.map +1 -1
  91. package/esm/types/dom.d.ts +1 -1
  92. package/esm/types/dom.d.ts.map +1 -1
  93. package/esm/types/index.d.ts +17 -2
  94. package/esm/types/index.d.ts.map +1 -1
  95. package/package.json +3 -2
  96. package/script/authentication/generateAuthenticationOptions.d.ts +2 -2
  97. package/script/authentication/generateAuthenticationOptions.d.ts.map +1 -1
  98. package/script/authentication/generateAuthenticationOptions.js +1 -1
  99. package/script/helpers/convertAAGUIDToString.d.ts +2 -1
  100. package/script/helpers/convertAAGUIDToString.d.ts.map +1 -1
  101. package/script/helpers/convertCOSEtoPKCS.d.ts +2 -1
  102. package/script/helpers/convertCOSEtoPKCS.d.ts.map +1 -1
  103. package/script/helpers/convertCertBufferToPEM.d.ts +2 -2
  104. package/script/helpers/convertCertBufferToPEM.d.ts.map +1 -1
  105. package/script/helpers/convertPEMToBytes.d.ts +2 -1
  106. package/script/helpers/convertPEMToBytes.d.ts.map +1 -1
  107. package/script/helpers/convertX509PublicKeyToCOSE.d.ts +2 -1
  108. package/script/helpers/convertX509PublicKeyToCOSE.d.ts.map +1 -1
  109. package/script/helpers/convertX509PublicKeyToCOSE.js +2 -2
  110. package/script/helpers/cose.d.ts +11 -10
  111. package/script/helpers/cose.d.ts.map +1 -1
  112. package/script/helpers/cose.js +0 -11
  113. package/script/helpers/decodeAttestationObject.d.ts +8 -7
  114. package/script/helpers/decodeAttestationObject.d.ts.map +1 -1
  115. package/script/helpers/decodeAuthenticatorExtensions.d.ts +2 -1
  116. package/script/helpers/decodeAuthenticatorExtensions.d.ts.map +1 -1
  117. package/script/helpers/decodeCredentialPublicKey.d.ts +3 -2
  118. package/script/helpers/decodeCredentialPublicKey.d.ts.map +1 -1
  119. package/script/helpers/generateChallenge.d.ts +3 -2
  120. package/script/helpers/generateChallenge.d.ts.map +1 -1
  121. package/script/helpers/generateUserID.d.ts +3 -2
  122. package/script/helpers/generateUserID.d.ts.map +1 -1
  123. package/script/helpers/getCertificateInfo.d.ts +2 -1
  124. package/script/helpers/getCertificateInfo.d.ts.map +1 -1
  125. package/script/helpers/isCertRevoked.d.ts +2 -2
  126. package/script/helpers/isCertRevoked.d.ts.map +1 -1
  127. package/script/helpers/isCertRevoked.js +19 -22
  128. package/script/helpers/iso/isoBase64URL.d.ts +3 -3
  129. package/script/helpers/iso/isoBase64URL.d.ts.map +1 -1
  130. package/script/helpers/iso/isoBase64URL.js +1 -1
  131. package/script/helpers/iso/isoCBOR.d.ts +3 -2
  132. package/script/helpers/iso/isoCBOR.d.ts.map +1 -1
  133. package/script/helpers/iso/isoCrypto/digest.d.ts +3 -2
  134. package/script/helpers/iso/isoCrypto/digest.d.ts.map +1 -1
  135. package/script/helpers/iso/isoCrypto/getRandomValues.d.ts +2 -1
  136. package/script/helpers/iso/isoCrypto/getRandomValues.d.ts.map +1 -1
  137. package/script/helpers/iso/isoCrypto/unwrapEC2Signature.d.ts +2 -1
  138. package/script/helpers/iso/isoCrypto/unwrapEC2Signature.d.ts.map +1 -1
  139. package/script/helpers/iso/isoCrypto/verify.d.ts +4 -3
  140. package/script/helpers/iso/isoCrypto/verify.d.ts.map +1 -1
  141. package/script/helpers/iso/isoCrypto/verifyEC2.d.ts +4 -3
  142. package/script/helpers/iso/isoCrypto/verifyEC2.d.ts.map +1 -1
  143. package/script/helpers/iso/isoCrypto/verifyOKP.d.ts +4 -3
  144. package/script/helpers/iso/isoCrypto/verifyOKP.d.ts.map +1 -1
  145. package/script/helpers/iso/isoCrypto/verifyRSA.d.ts +4 -3
  146. package/script/helpers/iso/isoCrypto/verifyRSA.d.ts.map +1 -1
  147. package/script/helpers/iso/isoUint8Array.d.ts +9 -8
  148. package/script/helpers/iso/isoUint8Array.d.ts.map +1 -1
  149. package/script/helpers/iso/isoUint8Array.js +4 -4
  150. package/script/helpers/matchExpectedRPID.d.ts +2 -1
  151. package/script/helpers/matchExpectedRPID.d.ts.map +1 -1
  152. package/script/helpers/parseAuthenticatorData.d.ts +10 -9
  153. package/script/helpers/parseAuthenticatorData.d.ts.map +1 -1
  154. package/script/helpers/toHash.d.ts +3 -2
  155. package/script/helpers/toHash.d.ts.map +1 -1
  156. package/script/helpers/validateCertificatePath.d.ts.map +1 -1
  157. package/script/helpers/validateCertificatePath.js +85 -90
  158. package/script/helpers/validateExtFIDOGenCEAAGUID.d.ts +3 -2
  159. package/script/helpers/validateExtFIDOGenCEAAGUID.d.ts.map +1 -1
  160. package/script/helpers/verifySignature.d.ts +5 -4
  161. package/script/helpers/verifySignature.d.ts.map +1 -1
  162. package/script/metadata/verifyAttestationWithMetadata.d.ts +3 -2
  163. package/script/metadata/verifyAttestationWithMetadata.d.ts.map +1 -1
  164. package/script/metadata/verifyJWT.d.ts +2 -1
  165. package/script/metadata/verifyJWT.d.ts.map +1 -1
  166. package/script/registration/generateRegistrationOptions.d.ts +3 -3
  167. package/script/registration/generateRegistrationOptions.d.ts.map +1 -1
  168. package/script/registration/verifications/tpm/parseCertInfo.d.ts +9 -8
  169. package/script/registration/verifications/tpm/parseCertInfo.d.ts.map +1 -1
  170. package/script/registration/verifications/tpm/parsePubArea.d.ts +4 -3
  171. package/script/registration/verifications/tpm/parsePubArea.d.ts.map +1 -1
  172. package/script/registration/verifications/tpm/verifyAttestationTPM.d.ts.map +1 -1
  173. package/script/registration/verifications/verifyAttestationAndroidKey.js +2 -2
  174. package/script/registration/verifications/verifyAttestationAndroidSafetyNet.d.ts.map +1 -1
  175. package/script/registration/verifications/verifyAttestationAndroidSafetyNet.js +2 -2
  176. package/script/registration/verifyRegistrationResponse.d.ts +16 -10
  177. package/script/registration/verifyRegistrationResponse.d.ts.map +1 -1
  178. package/script/registration/verifyRegistrationResponse.js +12 -10
  179. package/script/services/defaultRootCerts/mds.d.ts +1 -1
  180. package/script/services/defaultRootCerts/mds.d.ts.map +1 -1
  181. package/script/services/defaultRootCerts/mds.js +20 -20
  182. package/script/services/metadataService.d.ts +2 -1
  183. package/script/services/metadataService.d.ts.map +1 -1
  184. package/script/services/metadataService.js +1 -1
  185. package/script/services/settingsService.d.ts +2 -1
  186. package/script/services/settingsService.d.ts.map +1 -1
  187. package/script/types/dom.d.ts +1 -1
  188. package/script/types/dom.d.ts.map +1 -1
  189. package/script/types/index.d.ts +17 -2
  190. package/script/types/index.d.ts.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"isoUint8Array.d.ts","sourceRoot":"","sources":["../../../src/helpers/iso/isoUint8Array.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,GAAG,OAAO,CAMxE;AAED;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAK/C;AAED;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,CAe/C;AAED;;GAEG;AACH,wBAAgB,MAAM,CAAC,MAAM,EAAE,UAAU,EAAE,GAAG,UAAU,CAYvD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAGtD;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,UAAU,CAG7D;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,CAEzD;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,UAAU,GAAG,QAAQ,CAEtD"}
1
+ {"version":3,"file":"isoUint8Array.d.ts","sourceRoot":"","sources":["../../../src/helpers/iso/isoUint8Array.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAExD;;;GAGG;AAEH;;GAEG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAM1E;AAED;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM,CAKhD;AAED;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW,CAehD;AAED;;GAEG;AACH,wBAAgB,MAAM,CAAC,MAAM,EAAE,WAAW,EAAE,GAAG,WAAW,CAYzD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM,CAGvD;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,WAAW,CAG9D;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW,CAE1D;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,WAAW,GAAG,QAAQ,CAEvD"}
@@ -1,8 +1,4 @@
1
1
  "use strict";
2
- /**
3
- * A runtime-agnostic collection of methods for working with Uint8Arrays
4
- * @module
5
- */
6
2
  Object.defineProperty(exports, "__esModule", { value: true });
7
3
  exports.areEqual = areEqual;
8
4
  exports.toHex = toHex;
@@ -12,6 +8,10 @@ exports.toUTF8String = toUTF8String;
12
8
  exports.fromUTF8String = fromUTF8String;
13
9
  exports.fromASCIIString = fromASCIIString;
14
10
  exports.toDataView = toDataView;
11
+ /**
12
+ * A runtime-agnostic collection of methods for working with Uint8Arrays
13
+ * @module
14
+ */
15
15
  /**
16
16
  * Make sure two Uint8Arrays are deeply equivalent
17
17
  */
@@ -1,8 +1,9 @@
1
+ import type { Uint8Array_ } from '../types/index.js';
1
2
  /**
2
3
  * Go through each expected RP ID and try to find one that matches. Returns the unhashed RP ID
3
4
  * that matched the hash in the response.
4
5
  *
5
6
  * Raises an `UnexpectedRPIDHash` error if no match is found
6
7
  */
7
- export declare function matchExpectedRPID(rpIDHash: Uint8Array, expectedRPIDs: string[]): Promise<string>;
8
+ export declare function matchExpectedRPID(rpIDHash: Uint8Array_, expectedRPIDs: string[]): Promise<string>;
8
9
  //# sourceMappingURL=matchExpectedRPID.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"matchExpectedRPID.d.ts","sourceRoot":"","sources":["../../src/helpers/matchExpectedRPID.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,wBAAsB,iBAAiB,CACrC,QAAQ,EAAE,UAAU,EACpB,aAAa,EAAE,MAAM,EAAE,GACtB,OAAO,CAAC,MAAM,CAAC,CA8BjB"}
1
+ {"version":3,"file":"matchExpectedRPID.d.ts","sourceRoot":"","sources":["../../src/helpers/matchExpectedRPID.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD;;;;;GAKG;AACH,wBAAsB,iBAAiB,CACrC,QAAQ,EAAE,WAAW,EACrB,aAAa,EAAE,MAAM,EAAE,GACtB,OAAO,CAAC,MAAM,CAAC,CA8BjB"}
@@ -1,11 +1,12 @@
1
- import { AuthenticationExtensionsAuthenticatorOutputs } from './decodeAuthenticatorExtensions.js';
1
+ import { type AuthenticationExtensionsAuthenticatorOutputs } from './decodeAuthenticatorExtensions.js';
2
+ import type { Uint8Array_ } from '../types/index.js';
2
3
  /**
3
4
  * Make sense of the authData buffer contained in an Attestation
4
5
  */
5
- export declare function parseAuthenticatorData(authData: Uint8Array): ParsedAuthenticatorData;
6
+ export declare function parseAuthenticatorData(authData: Uint8Array_): ParsedAuthenticatorData;
6
7
  export type ParsedAuthenticatorData = {
7
- rpIdHash: Uint8Array;
8
- flagsBuf: Uint8Array;
8
+ rpIdHash: Uint8Array_;
9
+ flagsBuf: Uint8Array_;
9
10
  flags: {
10
11
  up: boolean;
11
12
  uv: boolean;
@@ -16,12 +17,12 @@ export type ParsedAuthenticatorData = {
16
17
  flagsInt: number;
17
18
  };
18
19
  counter: number;
19
- counterBuf: Uint8Array;
20
- aaguid?: Uint8Array;
21
- credentialID?: Uint8Array;
22
- credentialPublicKey?: Uint8Array;
20
+ counterBuf: Uint8Array_;
21
+ aaguid?: Uint8Array_;
22
+ credentialID?: Uint8Array_;
23
+ credentialPublicKey?: Uint8Array_;
23
24
  extensionsData?: AuthenticationExtensionsAuthenticatorOutputs;
24
- extensionsDataBuffer?: Uint8Array;
25
+ extensionsDataBuffer?: Uint8Array_;
25
26
  };
26
27
  /**
27
28
  * Make it possible to stub the return value during testing
@@ -1 +1 @@
1
- {"version":3,"file":"parseAuthenticatorData.d.ts","sourceRoot":"","sources":["../../src/helpers/parseAuthenticatorData.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,4CAA4C,EAE7C,MAAM,oCAAoC,CAAC;AAI5C;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,UAAU,GACnB,uBAAuB,CAwHzB;AAED,MAAM,MAAM,uBAAuB,GAAG;IACpC,QAAQ,EAAE,UAAU,CAAC;IACrB,QAAQ,EAAE,UAAU,CAAC;IACrB,KAAK,EAAE;QACL,EAAE,EAAE,OAAO,CAAC;QACZ,EAAE,EAAE,OAAO,CAAC;QACZ,EAAE,EAAE,OAAO,CAAC;QACZ,EAAE,EAAE,OAAO,CAAC;QACZ,EAAE,EAAE,OAAO,CAAC;QACZ,EAAE,EAAE,OAAO,CAAC;QACZ,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,UAAU,CAAC;IACvB,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,YAAY,CAAC,EAAE,UAAU,CAAC;IAC1B,mBAAmB,CAAC,EAAE,UAAU,CAAC;IACjC,cAAc,CAAC,EAAE,4CAA4C,CAAC;IAC9D,oBAAoB,CAAC,EAAE,UAAU,CAAC;CACnC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,gCAAgC;sBACzB,uBAAuB;CAC1C,CAAC"}
1
+ {"version":3,"file":"parseAuthenticatorData.d.ts","sourceRoot":"","sources":["../../src/helpers/parseAuthenticatorData.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,4CAA4C,EAElD,MAAM,oCAAoC,CAAC;AAG5C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,WAAW,GACpB,uBAAuB,CAwHzB;AAED,MAAM,MAAM,uBAAuB,GAAG;IACpC,QAAQ,EAAE,WAAW,CAAC;IACtB,QAAQ,EAAE,WAAW,CAAC;IACtB,KAAK,EAAE;QACL,EAAE,EAAE,OAAO,CAAC;QACZ,EAAE,EAAE,OAAO,CAAC;QACZ,EAAE,EAAE,OAAO,CAAC;QACZ,EAAE,EAAE,OAAO,CAAC;QACZ,EAAE,EAAE,OAAO,CAAC;QACZ,EAAE,EAAE,OAAO,CAAC;QACZ,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,WAAW,CAAC;IACxB,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,YAAY,CAAC,EAAE,WAAW,CAAC;IAC3B,mBAAmB,CAAC,EAAE,WAAW,CAAC;IAClC,cAAc,CAAC,EAAE,4CAA4C,CAAC;IAC9D,oBAAoB,CAAC,EAAE,WAAW,CAAC;CACpC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,gCAAgC;sBACzB,uBAAuB;CAC1C,CAAC"}
@@ -1,7 +1,8 @@
1
- import { COSEALG } from './cose.js';
1
+ import type { COSEALG } from './cose.js';
2
+ import type { Uint8Array_ } from '../types/index.js';
2
3
  /**
3
4
  * Returns hash digest of the given data, using the given algorithm when provided. Defaults to using
4
5
  * SHA-256.
5
6
  */
6
- export declare function toHash(data: Uint8Array | string, algorithm?: COSEALG): Promise<Uint8Array>;
7
+ export declare function toHash(data: Uint8Array_ | string, algorithm?: COSEALG): Promise<Uint8Array_>;
7
8
  //# sourceMappingURL=toHash.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"toHash.d.ts","sourceRoot":"","sources":["../../src/helpers/toHash.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC;;;GAGG;AACH,wBAAgB,MAAM,CACpB,IAAI,EAAE,UAAU,GAAG,MAAM,EACzB,SAAS,GAAE,OAAY,GACtB,OAAO,CAAC,UAAU,CAAC,CAQrB"}
1
+ {"version":3,"file":"toHash.d.ts","sourceRoot":"","sources":["../../src/helpers/toHash.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD;;;GAGG;AACH,wBAAgB,MAAM,CACpB,IAAI,EAAE,WAAW,GAAG,MAAM,EAC1B,SAAS,GAAE,OAAY,GACtB,OAAO,CAAC,WAAW,CAAC,CAQtB"}
@@ -1 +1 @@
1
- {"version":3,"file":"validateCertificatePath.d.ts","sourceRoot":"","sources":["../../src/helpers/validateCertificatePath.ts"],"names":[],"mappings":"AASA;;;;GAIG;AACH,wBAAsB,uBAAuB,CAC3C,WAAW,EAAE,MAAM,EAAE,EACrB,eAAe,GAAE,MAAM,EAAO,GAC7B,OAAO,CAAC,OAAO,CAAC,CAsClB"}
1
+ {"version":3,"file":"validateCertificatePath.d.ts","sourceRoot":"","sources":["../../src/helpers/validateCertificatePath.ts"],"names":[],"mappings":"AAKA;;;;GAIG;AACH,wBAAsB,uBAAuB,CAC3C,WAAW,EAAE,MAAM,EAAE,EACrB,eAAe,GAAE,MAAM,EAAO,GAC7B,OAAO,CAAC,OAAO,CAAC,CA6HlB"}
@@ -1,12 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.validateCertificatePath = validateCertificatePath;
4
- const asn1_schema_1 = require("@peculiar/asn1-schema");
4
+ const x509_1 = require("@peculiar/x509");
5
5
  const isCertRevoked_js_1 = require("./isCertRevoked.js");
6
- const verifySignature_js_1 = require("./verifySignature.js");
7
- const mapX509SignatureAlgToCOSEAlg_js_1 = require("./mapX509SignatureAlgToCOSEAlg.js");
8
- const getCertificateInfo_js_1 = require("./getCertificateInfo.js");
9
- const convertPEMToBytes_js_1 = require("./convertPEMToBytes.js");
6
+ const getWebCrypto_js_1 = require("./iso/isoCrypto/getWebCrypto.js");
10
7
  /**
11
8
  * Traverse an array of PEM certificates and ensure they form a proper chain
12
9
  * @param x5cCertsPEM Typically the result of `x5c.map(convertASN1toPEM)`
@@ -17,27 +14,97 @@ async function validateCertificatePath(x5cCertsPEM, trustAnchorsPEM = []) {
17
14
  // We have no trust anchors to chain back to, so skip path validation
18
15
  return true;
19
16
  }
17
+ const WebCrypto = await (0, getWebCrypto_js_1.getWebCrypto)();
18
+ // Prepare to work with x5c certs
19
+ const x5cCertsParsed = x5cCertsPEM.map((certPEM) => new x509_1.X509Certificate(certPEM));
20
+ // Check for any expired or temporally invalid certs in x5c
21
+ for (let i = 0; i < x5cCertsParsed.length; i++) {
22
+ const cert = x5cCertsParsed[i];
23
+ const certPEM = x5cCertsPEM[i];
24
+ try {
25
+ await assertCertNotRevoked(cert);
26
+ }
27
+ catch (_err) {
28
+ throw new Error(`Found revoked certificate in x5c:\n${certPEM}`);
29
+ }
30
+ try {
31
+ assertCertIsWithinValidTimeWindow(cert.notBefore, cert.notAfter);
32
+ }
33
+ catch (_err) {
34
+ throw new Error(`Found certificate out of validity period in x5c:\n${certPEM}`);
35
+ }
36
+ }
37
+ // Prepare to work with trust anchor certs
38
+ const trustAnchorsParsed = trustAnchorsPEM.map((certPEM) => {
39
+ try {
40
+ return new x509_1.X509Certificate(certPEM);
41
+ }
42
+ catch (err) {
43
+ const _err = err;
44
+ throw new Error(`Could not parse trust anchor certificate:\n${certPEM}`, { cause: _err });
45
+ }
46
+ });
47
+ // Filter out any expired or temporally invalid trust anchors certs
48
+ const validTrustAnchors = [];
49
+ for (let i = 0; i < trustAnchorsParsed.length; i++) {
50
+ const cert = trustAnchorsParsed[i];
51
+ try {
52
+ await assertCertNotRevoked(cert);
53
+ }
54
+ catch (_err) {
55
+ // Continue processing the other certs
56
+ continue;
57
+ }
58
+ try {
59
+ assertCertIsWithinValidTimeWindow(cert.notBefore, cert.notAfter);
60
+ }
61
+ catch (_err) {
62
+ // Continue processing the other certs
63
+ continue;
64
+ }
65
+ validTrustAnchors.push(cert);
66
+ }
67
+ if (validTrustAnchors.length === 0) {
68
+ throw new Error('No specified trust anchor was valid for verifying x5c');
69
+ }
70
+ // Try to verify x5c with each trust anchor
20
71
  let invalidSubjectAndIssuerError = false;
21
- let certificateNotYetValidOrExpiredErrorMessage = undefined;
22
- for (const anchorPEM of trustAnchorsPEM) {
72
+ for (const anchor of trustAnchorsParsed) {
23
73
  try {
24
- const certsWithTrustAnchor = x5cCertsPEM.concat([anchorPEM]);
25
- await _validatePath(certsWithTrustAnchor);
74
+ const x5cWithTrustAnchor = x5cCertsParsed.concat([anchor]);
75
+ if (new Set(x5cWithTrustAnchor).size !== x5cWithTrustAnchor.length) {
76
+ throw new Error('Invalid certificate path: found duplicate certificates');
77
+ }
78
+ // Check signatures, and notBefore and notAfter
79
+ for (let i = 0; i < x5cWithTrustAnchor.length - 1; i++) {
80
+ const subject = x5cWithTrustAnchor[i];
81
+ const issuer = x5cWithTrustAnchor[i + 1];
82
+ // Leaf or intermediate cert, make sure the next cert in the chain signed it
83
+ const issuerSignedSubject = await subject.verify({ publicKey: issuer.publicKey, signatureOnly: true }, WebCrypto);
84
+ if (!issuerSignedSubject) {
85
+ throw new InvalidSubjectAndIssuer();
86
+ }
87
+ if (issuer.subject === issuer.issuer) {
88
+ // Root cert detected, make sure it signed itself
89
+ const issuerSignedIssuer = await issuer.verify({ publicKey: issuer.publicKey, signatureOnly: true }, WebCrypto);
90
+ if (!issuerSignedIssuer) {
91
+ throw new InvalidSubjectAndIssuer();
92
+ }
93
+ // Don't process anything else after a root cert
94
+ break;
95
+ }
96
+ }
26
97
  // If we successfully validated a path then there's no need to continue. Reset any existing
27
98
  // errors that were thrown by earlier trust anchors
28
99
  invalidSubjectAndIssuerError = false;
29
- certificateNotYetValidOrExpiredErrorMessage = undefined;
30
100
  break;
31
101
  }
32
102
  catch (err) {
33
103
  if (err instanceof InvalidSubjectAndIssuer) {
34
104
  invalidSubjectAndIssuerError = true;
35
105
  }
36
- else if (err instanceof CertificateNotYetValidOrExpired) {
37
- certificateNotYetValidOrExpiredErrorMessage = err.message;
38
- }
39
106
  else {
40
- throw err;
107
+ throw new Error('Unexpected error while validating certificate path', { cause: err });
41
108
  }
42
109
  }
43
110
  }
@@ -45,42 +112,6 @@ async function validateCertificatePath(x5cCertsPEM, trustAnchorsPEM = []) {
45
112
  if (invalidSubjectAndIssuerError) {
46
113
  throw new InvalidSubjectAndIssuer();
47
114
  }
48
- else if (certificateNotYetValidOrExpiredErrorMessage) {
49
- throw new CertificateNotYetValidOrExpired(certificateNotYetValidOrExpiredErrorMessage);
50
- }
51
- return true;
52
- }
53
- /**
54
- * @param x5cCerts X.509 `x5c` certs in PEM string format
55
- * @param anchorCert X.509 trust anchor cert in PEM string format
56
- */
57
- async function _validatePath(x5cCertsWithTrustAnchorPEM) {
58
- if (new Set(x5cCertsWithTrustAnchorPEM).size !== x5cCertsWithTrustAnchorPEM.length) {
59
- throw new Error('Invalid certificate path: found duplicate certificates');
60
- }
61
- // Make sure no certs are revoked, and all are within their time validity window
62
- for (const certificatePEM of x5cCertsWithTrustAnchorPEM) {
63
- const certInfo = (0, getCertificateInfo_js_1.getCertificateInfo)((0, convertPEMToBytes_js_1.convertPEMToBytes)(certificatePEM));
64
- await assertCertNotRevoked(certInfo.parsedCertificate);
65
- assertCertIsWithinValidTimeWindow(certInfo, certificatePEM);
66
- }
67
- // Make sure each x5c cert is issued by the next certificate in the chain
68
- for (let i = 0; i < (x5cCertsWithTrustAnchorPEM.length - 1); i += 1) {
69
- const subjectPem = x5cCertsWithTrustAnchorPEM[i];
70
- const issuerPem = x5cCertsWithTrustAnchorPEM[i + 1];
71
- const subjectInfo = (0, getCertificateInfo_js_1.getCertificateInfo)((0, convertPEMToBytes_js_1.convertPEMToBytes)(subjectPem));
72
- const issuerInfo = (0, getCertificateInfo_js_1.getCertificateInfo)((0, convertPEMToBytes_js_1.convertPEMToBytes)(issuerPem));
73
- // Make sure subject issuer is issuer subject
74
- if (subjectInfo.issuer.combined !== issuerInfo.subject.combined) {
75
- throw new InvalidSubjectAndIssuer();
76
- }
77
- const issuerCertIsRootCert = issuerInfo.issuer.combined === issuerInfo.subject.combined;
78
- await assertSubjectIsSignedByIssuer(subjectInfo.parsedCertificate, issuerPem);
79
- // Perform one final check if the issuer cert is also a root certificate
80
- if (issuerCertIsRootCert) {
81
- await assertSubjectIsSignedByIssuer(issuerInfo.parsedCertificate, issuerPem);
82
- }
83
- }
84
115
  return true;
85
116
  }
86
117
  /**
@@ -90,39 +121,16 @@ async function assertCertNotRevoked(certificate) {
90
121
  // Check for certificate revocation
91
122
  const subjectCertRevoked = await (0, isCertRevoked_js_1.isCertRevoked)(certificate);
92
123
  if (subjectCertRevoked) {
93
- throw new Error(`Found revoked certificate in certificate path`);
124
+ throw new Error('Found revoked certificate in certificate path');
94
125
  }
95
126
  }
96
127
  /**
97
128
  * Require the cert to be within its notBefore and notAfter time window
98
- *
99
- * @param certInfo Parsed cert information
100
- * @param certPEM PEM-formatted certificate, for error reporting
101
129
  */
102
- function assertCertIsWithinValidTimeWindow(certInfo, certPEM) {
103
- const { notBefore, notAfter } = certInfo;
130
+ function assertCertIsWithinValidTimeWindow(certNotBefore, certNotAfter) {
104
131
  const now = new Date(Date.now());
105
- if (notBefore > now || notAfter < now) {
106
- throw new CertificateNotYetValidOrExpired(`Certificate is not yet valid or expired: ${certPEM}`);
107
- }
108
- }
109
- /**
110
- * Ensure that the subject cert has been signed by the next cert in the chain
111
- */
112
- async function assertSubjectIsSignedByIssuer(subjectCert, issuerPEM) {
113
- // Verify the subject certificate's signature with the issuer cert's public key
114
- const data = asn1_schema_1.AsnSerializer.serialize(subjectCert.tbsCertificate);
115
- const signature = subjectCert.signatureValue;
116
- const signatureAlgorithm = (0, mapX509SignatureAlgToCOSEAlg_js_1.mapX509SignatureAlgToCOSEAlg)(subjectCert.signatureAlgorithm.algorithm);
117
- const issuerCertBytes = (0, convertPEMToBytes_js_1.convertPEMToBytes)(issuerPEM);
118
- const verified = await (0, verifySignature_js_1.verifySignature)({
119
- data: new Uint8Array(data),
120
- signature: new Uint8Array(signature),
121
- x509Certificate: issuerCertBytes,
122
- hashAlgorithm: signatureAlgorithm,
123
- });
124
- if (!verified) {
125
- throw new InvalidSubjectSignatureForIssuer();
132
+ if (certNotBefore > now || certNotAfter < now) {
133
+ throw new Error('Certificate is not yet valid or expired');
126
134
  }
127
135
  }
128
136
  // Custom errors to help pass on certain errors
@@ -133,16 +141,3 @@ class InvalidSubjectAndIssuer extends Error {
133
141
  this.name = 'InvalidSubjectAndIssuer';
134
142
  }
135
143
  }
136
- class InvalidSubjectSignatureForIssuer extends Error {
137
- constructor() {
138
- const message = 'Subject signature was invalid for issuer';
139
- super(message);
140
- this.name = 'InvalidSubjectSignatureForIssuer';
141
- }
142
- }
143
- class CertificateNotYetValidOrExpired extends Error {
144
- constructor(message) {
145
- super(message);
146
- this.name = 'CertificateNotYetValidOrExpired';
147
- }
148
- }
@@ -1,7 +1,8 @@
1
- import { Extensions } from '@peculiar/asn1-x509';
1
+ import type { Extensions } from '@peculiar/asn1-x509';
2
+ import type { Uint8Array_ } from '../types/index.js';
2
3
  /**
3
4
  * Look for the id-fido-gen-ce-aaguid certificate extension. If it's present then check it against
4
5
  * the attestation statement AAGUID.
5
6
  */
6
- export declare function validateExtFIDOGenCEAAGUID(certExtensions: Extensions | undefined, aaguid: Uint8Array): boolean;
7
+ export declare function validateExtFIDOGenCEAAGUID(certExtensions: Extensions | undefined, aaguid: Uint8Array_): boolean;
7
8
  //# sourceMappingURL=validateExtFIDOGenCEAAGUID.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"validateExtFIDOGenCEAAGUID.d.ts","sourceRoot":"","sources":["../../src/helpers/validateExtFIDOGenCEAAGUID.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAWjD;;;GAGG;AACH,wBAAgB,0BAA0B,CACxC,cAAc,EAAE,UAAU,GAAG,SAAS,EACtC,MAAM,EAAE,UAAU,GACjB,OAAO,CA6BT"}
1
+ {"version":3,"file":"validateExtFIDOGenCEAAGUID.d.ts","sourceRoot":"","sources":["../../src/helpers/validateExtFIDOGenCEAAGUID.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAGtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AASrD;;;GAGG;AACH,wBAAgB,0BAA0B,CACxC,cAAc,EAAE,UAAU,GAAG,SAAS,EACtC,MAAM,EAAE,WAAW,GAClB,OAAO,CA6BT"}
@@ -1,12 +1,13 @@
1
1
  import { COSEALG } from './cose.js';
2
+ import type { Uint8Array_ } from '../types/index.js';
2
3
  /**
3
4
  * Verify an authenticator's signature
4
5
  */
5
6
  export declare function verifySignature(opts: {
6
- signature: Uint8Array;
7
- data: Uint8Array;
8
- credentialPublicKey?: Uint8Array;
9
- x509Certificate?: Uint8Array;
7
+ signature: Uint8Array_;
8
+ data: Uint8Array_;
9
+ credentialPublicKey?: Uint8Array_;
10
+ x509Certificate?: Uint8Array_;
10
11
  hashAlgorithm?: COSEALG;
11
12
  }): Promise<boolean>;
12
13
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"verifySignature.d.ts","sourceRoot":"","sources":["../../src/helpers/verifySignature.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAiB,MAAM,WAAW,CAAC;AAKnD;;GAEG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE;IACpC,SAAS,EAAE,UAAU,CAAC;IACtB,IAAI,EAAE,UAAU,CAAC;IACjB,mBAAmB,CAAC,EAAE,UAAU,CAAC;IACjC,eAAe,CAAC,EAAE,UAAU,CAAC;IAC7B,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,GAAG,OAAO,CAAC,OAAO,CAAC,CAmCnB;AAED;;;GAGG;AACH,eAAO,MAAM,yBAAyB;sBAClB,OAAO,CAAC,OAAO,CAAC;CACnC,CAAC"}
1
+ {"version":3,"file":"verifySignature.d.ts","sourceRoot":"","sources":["../../src/helpers/verifySignature.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAiB,MAAM,WAAW,CAAC;AAInD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD;;GAEG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE;IACpC,SAAS,EAAE,WAAW,CAAC;IACvB,IAAI,EAAE,WAAW,CAAC;IAClB,mBAAmB,CAAC,EAAE,WAAW,CAAC;IAClC,eAAe,CAAC,EAAE,WAAW,CAAC;IAC9B,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,GAAG,OAAO,CAAC,OAAO,CAAC,CAmCnB;AAED;;;GAGG;AACH,eAAO,MAAM,yBAAyB;sBAClB,OAAO,CAAC,OAAO,CAAC;CACnC,CAAC"}
@@ -1,14 +1,15 @@
1
1
  import type { Base64URLString } from '../types/index.js';
2
2
  import type { AlgSign, MetadataStatement } from './mdsTypes.js';
3
3
  import { type COSEALG, type COSECRV, COSEKTY } from '../helpers/cose.js';
4
+ import type { Uint8Array_ } from '../types/index.js';
4
5
  /**
5
6
  * Match properties of the authenticator's attestation statement against expected values as
6
7
  * registered with the FIDO Alliance Metadata Service
7
8
  */
8
9
  export declare function verifyAttestationWithMetadata({ statement, credentialPublicKey, x5c, attestationStatementAlg, }: {
9
10
  statement: MetadataStatement;
10
- credentialPublicKey: Uint8Array;
11
- x5c: Uint8Array[] | Base64URLString[];
11
+ credentialPublicKey: Uint8Array_;
12
+ x5c: Uint8Array_[] | Base64URLString[];
12
13
  attestationStatementAlg?: number;
13
14
  }): Promise<boolean>;
14
15
  type COSEInfo = {
@@ -1 +1 @@
1
- {"version":3,"file":"verifyAttestationWithMetadata.d.ts","sourceRoot":"","sources":["../../src/metadata/verifyAttestationWithMetadata.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,KAAK,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAIhE,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,OAAO,EAEZ,OAAO,EAER,MAAM,oBAAoB,CAAC;AAE5B;;;GAGG;AACH,wBAAsB,6BAA6B,CAAC,EAClD,SAAS,EACT,mBAAmB,EACnB,GAAG,EACH,uBAAuB,GACxB,EAAE;IACD,SAAS,EAAE,iBAAiB,CAAC;IAC7B,mBAAmB,EAAE,UAAU,CAAC;IAChC,GAAG,EAAE,UAAU,EAAE,GAAG,eAAe,EAAE,CAAC;IACtC,uBAAuB,CAAC,EAAE,MAAM,CAAC;CAClC,GAAG,OAAO,CAAC,OAAO,CAAC,CAoJnB;AAED,KAAK,QAAQ,GAAG;IACd,GAAG,EAAE,OAAO,CAAC;IACb,GAAG,EAAE,OAAO,CAAC;IACb,GAAG,CAAC,EAAE,OAAO,CAAC;CACf,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,EAAE;KAAG,GAAG,IAAI,OAAO,GAAG,QAAQ;CAe9D,CAAC"}
1
+ {"version":3,"file":"verifyAttestationWithMetadata.d.ts","sourceRoot":"","sources":["../../src/metadata/verifyAttestationWithMetadata.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,KAAK,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAIhE,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,OAAO,EAEZ,OAAO,EAER,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD;;;GAGG;AACH,wBAAsB,6BAA6B,CAAC,EAClD,SAAS,EACT,mBAAmB,EACnB,GAAG,EACH,uBAAuB,GACxB,EAAE;IACD,SAAS,EAAE,iBAAiB,CAAC;IAC7B,mBAAmB,EAAE,WAAW,CAAC;IACjC,GAAG,EAAE,WAAW,EAAE,GAAG,eAAe,EAAE,CAAC;IACvC,uBAAuB,CAAC,EAAE,MAAM,CAAC;CAClC,GAAG,OAAO,CAAC,OAAO,CAAC,CAoJnB;AAED,KAAK,QAAQ,GAAG;IACd,GAAG,EAAE,OAAO,CAAC;IACb,GAAG,EAAE,OAAO,CAAC;IACb,GAAG,CAAC,EAAE,OAAO,CAAC;CACf,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,EAAE;KAAG,GAAG,IAAI,OAAO,GAAG,QAAQ;CAe9D,CAAC"}
@@ -1,3 +1,4 @@
1
+ import type { Uint8Array_ } from '../types/index.js';
1
2
  /**
2
3
  * Lightweight verification for FIDO MDS JWTs. Supports use of EC2 and RSA.
3
4
  *
@@ -7,5 +8,5 @@
7
8
  *
8
9
  * (Pulled from https://www.rfc-editor.org/rfc/rfc7515#section-4.1.1)
9
10
  */
10
- export declare function verifyJWT(jwt: string, leafCert: Uint8Array): Promise<boolean>;
11
+ export declare function verifyJWT(jwt: string, leafCert: Uint8Array_): Promise<boolean>;
11
12
  //# sourceMappingURL=verifyJWT.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"verifyJWT.d.ts","sourceRoot":"","sources":["../../src/metadata/verifyJWT.ts"],"names":[],"mappings":"AAMA;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,CA0B7E"}
1
+ {"version":3,"file":"verifyJWT.d.ts","sourceRoot":"","sources":["../../src/metadata/verifyJWT.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,CA0B9E"}
@@ -1,4 +1,4 @@
1
- import type { AuthenticationExtensionsClientInputs, AuthenticatorSelectionCriteria, AuthenticatorTransportFuture, Base64URLString, COSEAlgorithmIdentifier, PublicKeyCredentialCreationOptionsJSON } from '../types/index.js';
1
+ import type { AuthenticationExtensionsClientInputs, AuthenticatorSelectionCriteria, AuthenticatorTransportFuture, Base64URLString, COSEAlgorithmIdentifier, PublicKeyCredentialCreationOptionsJSON, Uint8Array_ } from '../types/index.js';
2
2
  export type GenerateRegistrationOptionsOpts = Parameters<typeof generateRegistrationOptions>[0];
3
3
  /**
4
4
  * Supported crypto algo identifiers
@@ -29,8 +29,8 @@ export declare function generateRegistrationOptions(options: {
29
29
  rpName: string;
30
30
  rpID: string;
31
31
  userName: string;
32
- userID?: Uint8Array;
33
- challenge?: string | Uint8Array;
32
+ userID?: Uint8Array_;
33
+ challenge?: string | Uint8Array_;
34
34
  userDisplayName?: string;
35
35
  timeout?: number;
36
36
  attestationType?: 'direct' | 'enterprise' | 'none';
@@ -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,4BAA4B,EAC5B,eAAe,EACf,uBAAuB,EACvB,sCAAsC,EAGvC,MAAM,mBAAmB,CAAC;AAK3B,MAAM,MAAM,+BAA+B,GAAG,UAAU,CAAC,OAAO,2BAA2B,CAAC,CAAC,CAAC,CAAC,CAAC;AAEhG;;;;GAIG;AACH,eAAO,MAAM,iCAAiC,EAAE,uBAAuB,EAqBtE,CAAC;AAsBF;;;;;;;;;;;;;;;;;;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,UAAU,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,GAAG,UAAU,CAAC;IAChC,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,4BAA4B,EAAE,CAAC;KAC7C,EAAE,CAAC;IACJ,sBAAsB,CAAC,EAAE,8BAA8B,CAAC;IACxD,UAAU,CAAC,EAAE,oCAAoC,CAAC;IAClD,qBAAqB,CAAC,EAAE,uBAAuB,EAAE,CAAC;IAClD,0BAA0B,CAAC,EAAE,aAAa,GAAG,aAAa,GAAG,cAAc,CAAC;CAC7E,GACA,OAAO,CAAC,sCAAsC,CAAC,CAqIjD"}
1
+ {"version":3,"file":"generateRegistrationOptions.d.ts","sourceRoot":"","sources":["../../src/registration/generateRegistrationOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oCAAoC,EACpC,8BAA8B,EAC9B,4BAA4B,EAC5B,eAAe,EACf,uBAAuB,EACvB,sCAAsC,EAGtC,WAAW,EACZ,MAAM,mBAAmB,CAAC;AAK3B,MAAM,MAAM,+BAA+B,GAAG,UAAU,CAAC,OAAO,2BAA2B,CAAC,CAAC,CAAC,CAAC,CAAC;AAEhG;;;;GAIG;AACH,eAAO,MAAM,iCAAiC,EAAE,uBAAuB,EAqBtE,CAAC;AAsBF;;;;;;;;;;;;;;;;;;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,4BAA4B,EAAE,CAAC;KAC7C,EAAE,CAAC;IACJ,sBAAsB,CAAC,EAAE,8BAA8B,CAAC;IACxD,UAAU,CAAC,EAAE,oCAAoC,CAAC;IAClD,qBAAqB,CAAC,EAAE,uBAAuB,EAAE,CAAC;IAClD,0BAA0B,CAAC,EAAE,aAAa,GAAG,aAAa,GAAG,cAAc,CAAC;CAC7E,GACA,OAAO,CAAC,sCAAsC,CAAC,CAqIjD"}
@@ -1,24 +1,25 @@
1
+ import type { Uint8Array_ } from '../../../types/index.js';
1
2
  /**
2
3
  * Cut up a TPM attestation's certInfo into intelligible chunks
3
4
  */
4
- export declare function parseCertInfo(certInfo: Uint8Array): ParsedCertInfo;
5
+ export declare function parseCertInfo(certInfo: Uint8Array_): ParsedCertInfo;
5
6
  type ParsedCertInfo = {
6
7
  magic: number;
7
8
  type: string;
8
- qualifiedSigner: Uint8Array;
9
- extraData: Uint8Array;
9
+ qualifiedSigner: Uint8Array_;
10
+ extraData: Uint8Array_;
10
11
  clockInfo: {
11
- clock: Uint8Array;
12
+ clock: Uint8Array_;
12
13
  resetCount: number;
13
14
  restartCount: number;
14
15
  safe: boolean;
15
16
  };
16
- firmwareVersion: Uint8Array;
17
+ firmwareVersion: Uint8Array_;
17
18
  attested: {
18
19
  nameAlg: string;
19
- nameAlgBuffer: Uint8Array;
20
- name: Uint8Array;
21
- qualifiedName: Uint8Array;
20
+ nameAlgBuffer: Uint8Array_;
21
+ name: Uint8Array_;
22
+ qualifiedName: Uint8Array_;
22
23
  };
23
24
  };
24
25
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"parseCertInfo.d.ts","sourceRoot":"","sources":["../../../../src/registration/verifications/tpm/parseCertInfo.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,UAAU,GAAG,cAAc,CAkElE;AAED,KAAK,cAAc,GAAG;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,eAAe,EAAE,UAAU,CAAC;IAC5B,SAAS,EAAE,UAAU,CAAC;IACtB,SAAS,EAAE;QACT,KAAK,EAAE,UAAU,CAAC;QAClB,UAAU,EAAE,MAAM,CAAC;QACnB,YAAY,EAAE,MAAM,CAAC;QACrB,IAAI,EAAE,OAAO,CAAC;KACf,CAAC;IACF,eAAe,EAAE,UAAU,CAAC;IAC5B,QAAQ,EAAE;QACR,OAAO,EAAE,MAAM,CAAC;QAChB,aAAa,EAAE,UAAU,CAAC;QAC1B,IAAI,EAAE,UAAU,CAAC;QACjB,aAAa,EAAE,UAAU,CAAC;KAC3B,CAAC;CACH,CAAC"}
1
+ {"version":3,"file":"parseCertInfo.d.ts","sourceRoot":"","sources":["../../../../src/registration/verifications/tpm/parseCertInfo.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE3D;;GAEG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,WAAW,GAAG,cAAc,CAkEnE;AAED,KAAK,cAAc,GAAG;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,eAAe,EAAE,WAAW,CAAC;IAC7B,SAAS,EAAE,WAAW,CAAC;IACvB,SAAS,EAAE;QACT,KAAK,EAAE,WAAW,CAAC;QACnB,UAAU,EAAE,MAAM,CAAC;QACnB,YAAY,EAAE,MAAM,CAAC;QACrB,IAAI,EAAE,OAAO,CAAC;KACf,CAAC;IACF,eAAe,EAAE,WAAW,CAAC;IAC7B,QAAQ,EAAE;QACR,OAAO,EAAE,MAAM,CAAC;QAChB,aAAa,EAAE,WAAW,CAAC;QAC3B,IAAI,EAAE,WAAW,CAAC;QAClB,aAAa,EAAE,WAAW,CAAC;KAC5B,CAAC;CACH,CAAC"}
@@ -1,10 +1,11 @@
1
+ import type { Uint8Array_ } from '../../../types/index.js';
1
2
  /**
2
3
  * Break apart a TPM attestation's pubArea buffer
3
4
  *
4
5
  * See 12.2.4 TPMT_PUBLIC here:
5
6
  * https://trustedcomputinggroup.org/wp-content/uploads/TPM-Rev-2.0-Part-2-Structures-00.96-130315.pdf
6
7
  */
7
- export declare function parsePubArea(pubArea: Uint8Array): ParsedPubArea;
8
+ export declare function parsePubArea(pubArea: Uint8Array_): ParsedPubArea;
8
9
  type ParsedPubArea = {
9
10
  type: 'TPM_ALG_RSA' | 'TPM_ALG_ECC';
10
11
  nameAlg: string;
@@ -21,12 +22,12 @@ type ParsedPubArea = {
21
22
  decrypt: boolean;
22
23
  signOrEncrypt: boolean;
23
24
  };
24
- authPolicy: Uint8Array;
25
+ authPolicy: Uint8Array_;
25
26
  parameters: {
26
27
  rsa?: RSAParameters;
27
28
  ecc?: ECCParameters;
28
29
  };
29
- unique: Uint8Array;
30
+ unique: Uint8Array_;
30
31
  };
31
32
  type RSAParameters = {
32
33
  symmetric: string;
@@ -1 +1 @@
1
- {"version":3,"file":"parsePubArea.d.ts","sourceRoot":"","sources":["../../../../src/registration/verifications/tpm/parsePubArea.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,UAAU,GAAG,aAAa,CAyG/D;AAED,KAAK,aAAa,GAAG;IACnB,IAAI,EAAE,aAAa,GAAG,aAAa,CAAC;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,gBAAgB,EAAE;QAChB,QAAQ,EAAE,OAAO,CAAC;QAClB,OAAO,EAAE,OAAO,CAAC;QACjB,WAAW,EAAE,OAAO,CAAC;QACrB,mBAAmB,EAAE,OAAO,CAAC;QAC7B,YAAY,EAAE,OAAO,CAAC;QACtB,eAAe,EAAE,OAAO,CAAC;QACzB,IAAI,EAAE,OAAO,CAAC;QACd,oBAAoB,EAAE,OAAO,CAAC;QAC9B,UAAU,EAAE,OAAO,CAAC;QACpB,OAAO,EAAE,OAAO,CAAC;QACjB,aAAa,EAAE,OAAO,CAAC;KACxB,CAAC;IACF,UAAU,EAAE,UAAU,CAAC;IACvB,UAAU,EAAE;QACV,GAAG,CAAC,EAAE,aAAa,CAAC;QACpB,GAAG,CAAC,EAAE,aAAa,CAAC;KACrB,CAAC;IACF,MAAM,EAAE,UAAU,CAAC;CACpB,CAAC;AAEF,KAAK,aAAa,GAAG;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,KAAK,aAAa,GAAG;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;CACb,CAAC"}
1
+ {"version":3,"file":"parsePubArea.d.ts","sourceRoot":"","sources":["../../../../src/registration/verifications/tpm/parsePubArea.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE3D;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,WAAW,GAAG,aAAa,CAyGhE;AAED,KAAK,aAAa,GAAG;IACnB,IAAI,EAAE,aAAa,GAAG,aAAa,CAAC;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,gBAAgB,EAAE;QAChB,QAAQ,EAAE,OAAO,CAAC;QAClB,OAAO,EAAE,OAAO,CAAC;QACjB,WAAW,EAAE,OAAO,CAAC;QACrB,mBAAmB,EAAE,OAAO,CAAC;QAC7B,YAAY,EAAE,OAAO,CAAC;QACtB,eAAe,EAAE,OAAO,CAAC;QACzB,IAAI,EAAE,OAAO,CAAC;QACd,oBAAoB,EAAE,OAAO,CAAC;QAC9B,UAAU,EAAE,OAAO,CAAC;QACpB,OAAO,EAAE,OAAO,CAAC;QACjB,aAAa,EAAE,OAAO,CAAC;KACxB,CAAC;IACF,UAAU,EAAE,WAAW,CAAC;IACxB,UAAU,EAAE;QACV,GAAG,CAAC,EAAE,aAAa,CAAC;QACpB,GAAG,CAAC,EAAE,aAAa,CAAC;KACrB,CAAC;IACF,MAAM,EAAE,WAAW,CAAC;CACrB,CAAC;AAEF,KAAK,aAAa,GAAG;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,KAAK,aAAa,GAAG;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;CACb,CAAC"}
@@ -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;AAuBzF,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,6BAA6B,GACrC,OAAO,CAAC,OAAO,CAAC,CA+VlB"}
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;AAwBzF,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,6BAA6B,GACrC,OAAO,CAAC,OAAO,CAAC,CA+VlB"}
@@ -83,7 +83,7 @@ async function verifyAttestationAndroidKey(options) {
83
83
  }
84
84
  catch (err) {
85
85
  const _err = err;
86
- throw new Error(`${_err.message} (Android Key)`);
86
+ throw new Error(`${_err.message} (Android Key)`, { cause: _err });
87
87
  }
88
88
  }
89
89
  else {
@@ -97,7 +97,7 @@ async function verifyAttestationAndroidKey(options) {
97
97
  }
98
98
  catch (err) {
99
99
  const _err = err;
100
- throw new Error(`${_err.message} (Android Key)`);
100
+ throw new Error(`${_err.message} (Android Key)`, { cause: _err });
101
101
  }
102
102
  /**
103
103
  * Make sure the root certificate is one of the Google Hardware Attestation Root certificates
@@ -1 +1 @@
1
- {"version":3,"file":"verifyAttestationAndroidSafetyNet.d.ts","sourceRoot":"","sources":["../../../src/registration/verifications/verifyAttestationAndroidSafetyNet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,kCAAkC,CAAC;AAWtF;;GAEG;AACH,wBAAsB,iCAAiC,CACrD,OAAO,EAAE,6BAA6B,GACrC,OAAO,CAAC,OAAO,CAAC,CA2IlB"}
1
+ {"version":3,"file":"verifyAttestationAndroidSafetyNet.d.ts","sourceRoot":"","sources":["../../../src/registration/verifications/verifyAttestationAndroidSafetyNet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,kCAAkC,CAAC;AAWtF;;GAEG;AACH,wBAAsB,iCAAiC,CACrD,OAAO,EAAE,6BAA6B,GACrC,OAAO,CAAC,OAAO,CAAC,CA4IlB"}
@@ -13,7 +13,7 @@ const verifyAttestationWithMetadata_js_1 = require("../../metadata/verifyAttesta
13
13
  * Verify an attestation response with fmt 'android-safetynet'
14
14
  */
15
15
  async function verifyAttestationAndroidSafetyNet(options) {
16
- const { attStmt, clientDataHash, authData, aaguid, rootCertificates, verifyTimestampMS = true, credentialPublicKey, } = options;
16
+ const { attStmt, clientDataHash, authData, aaguid, rootCertificates, verifyTimestampMS = true, credentialPublicKey, attestationSafetyNetEnforceCTSCheck, } = options;
17
17
  const alg = attStmt.get('alg');
18
18
  const response = attStmt.get('response');
19
19
  const ver = attStmt.get('ver');
@@ -52,7 +52,7 @@ async function verifyAttestationAndroidSafetyNet(options) {
52
52
  if (nonce !== expectedNonce) {
53
53
  throw new Error('Could not verify payload nonce (SafetyNet)');
54
54
  }
55
- if (!ctsProfileMatch) {
55
+ if (attestationSafetyNetEnforceCTSCheck && !ctsProfileMatch) {
56
56
  throw new Error('Could not verify device integrity (SafetyNet)');
57
57
  }
58
58
  /**