@simplewebauthn/server 13.1.2 → 13.2.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.
Files changed (184) hide show
  1. package/esm/authentication/generateAuthenticationOptions.d.ts +2 -2
  2. package/esm/authentication/generateAuthenticationOptions.d.ts.map +1 -1
  3. package/esm/helpers/convertAAGUIDToString.d.ts +2 -1
  4. package/esm/helpers/convertAAGUIDToString.d.ts.map +1 -1
  5. package/esm/helpers/convertCOSEtoPKCS.d.ts +2 -1
  6. package/esm/helpers/convertCOSEtoPKCS.d.ts.map +1 -1
  7. package/esm/helpers/convertCertBufferToPEM.d.ts +2 -2
  8. package/esm/helpers/convertCertBufferToPEM.d.ts.map +1 -1
  9. package/esm/helpers/convertPEMToBytes.d.ts +2 -1
  10. package/esm/helpers/convertPEMToBytes.d.ts.map +1 -1
  11. package/esm/helpers/convertX509PublicKeyToCOSE.d.ts +2 -1
  12. package/esm/helpers/convertX509PublicKeyToCOSE.d.ts.map +1 -1
  13. package/esm/helpers/convertX509PublicKeyToCOSE.js +2 -2
  14. package/esm/helpers/cose.d.ts +11 -10
  15. package/esm/helpers/cose.d.ts.map +1 -1
  16. package/esm/helpers/cose.js +0 -11
  17. package/esm/helpers/decodeAttestationObject.d.ts +8 -7
  18. package/esm/helpers/decodeAttestationObject.d.ts.map +1 -1
  19. package/esm/helpers/decodeAuthenticatorExtensions.d.ts +2 -1
  20. package/esm/helpers/decodeAuthenticatorExtensions.d.ts.map +1 -1
  21. package/esm/helpers/decodeCredentialPublicKey.d.ts +3 -2
  22. package/esm/helpers/decodeCredentialPublicKey.d.ts.map +1 -1
  23. package/esm/helpers/generateChallenge.d.ts +3 -2
  24. package/esm/helpers/generateChallenge.d.ts.map +1 -1
  25. package/esm/helpers/generateUserID.d.ts +3 -2
  26. package/esm/helpers/generateUserID.d.ts.map +1 -1
  27. package/esm/helpers/getCertificateInfo.d.ts +2 -1
  28. package/esm/helpers/getCertificateInfo.d.ts.map +1 -1
  29. package/esm/helpers/isCertRevoked.d.ts +2 -2
  30. package/esm/helpers/isCertRevoked.d.ts.map +1 -1
  31. package/esm/helpers/isCertRevoked.js +19 -22
  32. package/esm/helpers/iso/isoBase64URL.d.ts +3 -3
  33. package/esm/helpers/iso/isoBase64URL.d.ts.map +1 -1
  34. package/esm/helpers/iso/isoBase64URL.js +6 -1
  35. package/esm/helpers/iso/isoCBOR.d.ts +3 -2
  36. package/esm/helpers/iso/isoCBOR.d.ts.map +1 -1
  37. package/esm/helpers/iso/isoCrypto/digest.d.ts +3 -2
  38. package/esm/helpers/iso/isoCrypto/digest.d.ts.map +1 -1
  39. package/esm/helpers/iso/isoCrypto/getRandomValues.d.ts +2 -1
  40. package/esm/helpers/iso/isoCrypto/getRandomValues.d.ts.map +1 -1
  41. package/esm/helpers/iso/isoCrypto/unwrapEC2Signature.d.ts +2 -1
  42. package/esm/helpers/iso/isoCrypto/unwrapEC2Signature.d.ts.map +1 -1
  43. package/esm/helpers/iso/isoCrypto/verify.d.ts +4 -3
  44. package/esm/helpers/iso/isoCrypto/verify.d.ts.map +1 -1
  45. package/esm/helpers/iso/isoCrypto/verifyEC2.d.ts +4 -3
  46. package/esm/helpers/iso/isoCrypto/verifyEC2.d.ts.map +1 -1
  47. package/esm/helpers/iso/isoCrypto/verifyOKP.d.ts +4 -3
  48. package/esm/helpers/iso/isoCrypto/verifyOKP.d.ts.map +1 -1
  49. package/esm/helpers/iso/isoCrypto/verifyRSA.d.ts +4 -3
  50. package/esm/helpers/iso/isoCrypto/verifyRSA.d.ts.map +1 -1
  51. package/esm/helpers/iso/isoUint8Array.d.ts +9 -8
  52. package/esm/helpers/iso/isoUint8Array.d.ts.map +1 -1
  53. package/esm/helpers/matchExpectedRPID.d.ts +2 -1
  54. package/esm/helpers/matchExpectedRPID.d.ts.map +1 -1
  55. package/esm/helpers/parseAuthenticatorData.d.ts +10 -9
  56. package/esm/helpers/parseAuthenticatorData.d.ts.map +1 -1
  57. package/esm/helpers/toHash.d.ts +3 -2
  58. package/esm/helpers/toHash.d.ts.map +1 -1
  59. package/esm/helpers/validateCertificatePath.d.ts.map +1 -1
  60. package/esm/helpers/validateCertificatePath.js +85 -90
  61. package/esm/helpers/validateExtFIDOGenCEAAGUID.d.ts +3 -2
  62. package/esm/helpers/validateExtFIDOGenCEAAGUID.d.ts.map +1 -1
  63. package/esm/helpers/verifySignature.d.ts +5 -4
  64. package/esm/helpers/verifySignature.d.ts.map +1 -1
  65. package/esm/metadata/verifyAttestationWithMetadata.d.ts +3 -2
  66. package/esm/metadata/verifyAttestationWithMetadata.d.ts.map +1 -1
  67. package/esm/metadata/verifyJWT.d.ts +2 -1
  68. package/esm/metadata/verifyJWT.d.ts.map +1 -1
  69. package/esm/registration/generateRegistrationOptions.d.ts +3 -3
  70. package/esm/registration/generateRegistrationOptions.d.ts.map +1 -1
  71. package/esm/registration/verifications/tpm/parseCertInfo.d.ts +9 -8
  72. package/esm/registration/verifications/tpm/parseCertInfo.d.ts.map +1 -1
  73. package/esm/registration/verifications/tpm/parsePubArea.d.ts +4 -3
  74. package/esm/registration/verifications/tpm/parsePubArea.d.ts.map +1 -1
  75. package/esm/registration/verifications/tpm/verifyAttestationTPM.d.ts.map +1 -1
  76. package/esm/registration/verifications/verifyAttestationAndroidKey.js +2 -2
  77. package/esm/registration/verifications/verifyAttestationAndroidSafetyNet.d.ts.map +1 -1
  78. package/esm/registration/verifications/verifyAttestationAndroidSafetyNet.js +2 -2
  79. package/esm/registration/verifyRegistrationResponse.d.ts +16 -10
  80. package/esm/registration/verifyRegistrationResponse.d.ts.map +1 -1
  81. package/esm/registration/verifyRegistrationResponse.js +12 -10
  82. package/esm/services/defaultRootCerts/mds.d.ts +1 -1
  83. package/esm/services/defaultRootCerts/mds.d.ts.map +1 -1
  84. package/esm/services/defaultRootCerts/mds.js +20 -20
  85. package/esm/services/metadataService.d.ts +2 -1
  86. package/esm/services/metadataService.d.ts.map +1 -1
  87. package/esm/services/metadataService.js +1 -1
  88. package/esm/services/settingsService.d.ts +2 -1
  89. package/esm/services/settingsService.d.ts.map +1 -1
  90. package/esm/types/index.d.ts +16 -1
  91. package/esm/types/index.d.ts.map +1 -1
  92. package/package.json +3 -2
  93. package/script/authentication/generateAuthenticationOptions.d.ts +2 -2
  94. package/script/authentication/generateAuthenticationOptions.d.ts.map +1 -1
  95. package/script/helpers/convertAAGUIDToString.d.ts +2 -1
  96. package/script/helpers/convertAAGUIDToString.d.ts.map +1 -1
  97. package/script/helpers/convertCOSEtoPKCS.d.ts +2 -1
  98. package/script/helpers/convertCOSEtoPKCS.d.ts.map +1 -1
  99. package/script/helpers/convertCertBufferToPEM.d.ts +2 -2
  100. package/script/helpers/convertCertBufferToPEM.d.ts.map +1 -1
  101. package/script/helpers/convertPEMToBytes.d.ts +2 -1
  102. package/script/helpers/convertPEMToBytes.d.ts.map +1 -1
  103. package/script/helpers/convertX509PublicKeyToCOSE.d.ts +2 -1
  104. package/script/helpers/convertX509PublicKeyToCOSE.d.ts.map +1 -1
  105. package/script/helpers/convertX509PublicKeyToCOSE.js +2 -2
  106. package/script/helpers/cose.d.ts +11 -10
  107. package/script/helpers/cose.d.ts.map +1 -1
  108. package/script/helpers/cose.js +0 -11
  109. package/script/helpers/decodeAttestationObject.d.ts +8 -7
  110. package/script/helpers/decodeAttestationObject.d.ts.map +1 -1
  111. package/script/helpers/decodeAuthenticatorExtensions.d.ts +2 -1
  112. package/script/helpers/decodeAuthenticatorExtensions.d.ts.map +1 -1
  113. package/script/helpers/decodeCredentialPublicKey.d.ts +3 -2
  114. package/script/helpers/decodeCredentialPublicKey.d.ts.map +1 -1
  115. package/script/helpers/generateChallenge.d.ts +3 -2
  116. package/script/helpers/generateChallenge.d.ts.map +1 -1
  117. package/script/helpers/generateUserID.d.ts +3 -2
  118. package/script/helpers/generateUserID.d.ts.map +1 -1
  119. package/script/helpers/getCertificateInfo.d.ts +2 -1
  120. package/script/helpers/getCertificateInfo.d.ts.map +1 -1
  121. package/script/helpers/isCertRevoked.d.ts +2 -2
  122. package/script/helpers/isCertRevoked.d.ts.map +1 -1
  123. package/script/helpers/isCertRevoked.js +19 -22
  124. package/script/helpers/iso/isoBase64URL.d.ts +3 -3
  125. package/script/helpers/iso/isoBase64URL.d.ts.map +1 -1
  126. package/script/helpers/iso/isoBase64URL.js +6 -1
  127. package/script/helpers/iso/isoCBOR.d.ts +3 -2
  128. package/script/helpers/iso/isoCBOR.d.ts.map +1 -1
  129. package/script/helpers/iso/isoCrypto/digest.d.ts +3 -2
  130. package/script/helpers/iso/isoCrypto/digest.d.ts.map +1 -1
  131. package/script/helpers/iso/isoCrypto/getRandomValues.d.ts +2 -1
  132. package/script/helpers/iso/isoCrypto/getRandomValues.d.ts.map +1 -1
  133. package/script/helpers/iso/isoCrypto/unwrapEC2Signature.d.ts +2 -1
  134. package/script/helpers/iso/isoCrypto/unwrapEC2Signature.d.ts.map +1 -1
  135. package/script/helpers/iso/isoCrypto/verify.d.ts +4 -3
  136. package/script/helpers/iso/isoCrypto/verify.d.ts.map +1 -1
  137. package/script/helpers/iso/isoCrypto/verifyEC2.d.ts +4 -3
  138. package/script/helpers/iso/isoCrypto/verifyEC2.d.ts.map +1 -1
  139. package/script/helpers/iso/isoCrypto/verifyOKP.d.ts +4 -3
  140. package/script/helpers/iso/isoCrypto/verifyOKP.d.ts.map +1 -1
  141. package/script/helpers/iso/isoCrypto/verifyRSA.d.ts +4 -3
  142. package/script/helpers/iso/isoCrypto/verifyRSA.d.ts.map +1 -1
  143. package/script/helpers/iso/isoUint8Array.d.ts +9 -8
  144. package/script/helpers/iso/isoUint8Array.d.ts.map +1 -1
  145. package/script/helpers/iso/isoUint8Array.js +4 -4
  146. package/script/helpers/matchExpectedRPID.d.ts +2 -1
  147. package/script/helpers/matchExpectedRPID.d.ts.map +1 -1
  148. package/script/helpers/parseAuthenticatorData.d.ts +10 -9
  149. package/script/helpers/parseAuthenticatorData.d.ts.map +1 -1
  150. package/script/helpers/toHash.d.ts +3 -2
  151. package/script/helpers/toHash.d.ts.map +1 -1
  152. package/script/helpers/validateCertificatePath.d.ts.map +1 -1
  153. package/script/helpers/validateCertificatePath.js +85 -90
  154. package/script/helpers/validateExtFIDOGenCEAAGUID.d.ts +3 -2
  155. package/script/helpers/validateExtFIDOGenCEAAGUID.d.ts.map +1 -1
  156. package/script/helpers/verifySignature.d.ts +5 -4
  157. package/script/helpers/verifySignature.d.ts.map +1 -1
  158. package/script/metadata/verifyAttestationWithMetadata.d.ts +3 -2
  159. package/script/metadata/verifyAttestationWithMetadata.d.ts.map +1 -1
  160. package/script/metadata/verifyJWT.d.ts +2 -1
  161. package/script/metadata/verifyJWT.d.ts.map +1 -1
  162. package/script/registration/generateRegistrationOptions.d.ts +3 -3
  163. package/script/registration/generateRegistrationOptions.d.ts.map +1 -1
  164. package/script/registration/verifications/tpm/parseCertInfo.d.ts +9 -8
  165. package/script/registration/verifications/tpm/parseCertInfo.d.ts.map +1 -1
  166. package/script/registration/verifications/tpm/parsePubArea.d.ts +4 -3
  167. package/script/registration/verifications/tpm/parsePubArea.d.ts.map +1 -1
  168. package/script/registration/verifications/tpm/verifyAttestationTPM.d.ts.map +1 -1
  169. package/script/registration/verifications/verifyAttestationAndroidKey.js +2 -2
  170. package/script/registration/verifications/verifyAttestationAndroidSafetyNet.d.ts.map +1 -1
  171. package/script/registration/verifications/verifyAttestationAndroidSafetyNet.js +2 -2
  172. package/script/registration/verifyRegistrationResponse.d.ts +16 -10
  173. package/script/registration/verifyRegistrationResponse.d.ts.map +1 -1
  174. package/script/registration/verifyRegistrationResponse.js +12 -10
  175. package/script/services/defaultRootCerts/mds.d.ts +1 -1
  176. package/script/services/defaultRootCerts/mds.d.ts.map +1 -1
  177. package/script/services/defaultRootCerts/mds.js +20 -20
  178. package/script/services/metadataService.d.ts +2 -1
  179. package/script/services/metadataService.d.ts.map +1 -1
  180. package/script/services/metadataService.js +1 -1
  181. package/script/services/settingsService.d.ts +2 -1
  182. package/script/services/settingsService.d.ts.map +1 -1
  183. package/script/types/index.d.ts +16 -1
  184. package/script/types/index.d.ts.map +1 -1
@@ -1,4 +1,4 @@
1
- import type { AuthenticationExtensionsClientInputs, AuthenticatorTransportFuture, Base64URLString, PublicKeyCredentialRequestOptionsJSON } from '../types/index.js';
1
+ import type { AuthenticationExtensionsClientInputs, AuthenticatorTransportFuture, Base64URLString, PublicKeyCredentialRequestOptionsJSON, Uint8Array_ } from '../types/index.js';
2
2
  export type GenerateAuthenticationOptionsOpts = Parameters<typeof generateAuthenticationOptions>[0];
3
3
  /**
4
4
  * Prepare a value to pass into navigator.credentials.get(...) for authenticator authentication
@@ -18,7 +18,7 @@ export declare function generateAuthenticationOptions(options: {
18
18
  id: Base64URLString;
19
19
  transports?: AuthenticatorTransportFuture[];
20
20
  }[];
21
- challenge?: string | Uint8Array;
21
+ challenge?: string | Uint8Array_;
22
22
  timeout?: number;
23
23
  userVerification?: 'required' | 'preferred' | 'discouraged';
24
24
  extensions?: AuthenticationExtensionsClientInputs;
@@ -1 +1 @@
1
- {"version":3,"file":"generateAuthenticationOptions.d.ts","sourceRoot":"","sources":["../../src/authentication/generateAuthenticationOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oCAAoC,EACpC,4BAA4B,EAC5B,eAAe,EACf,qCAAqC,EACtC,MAAM,mBAAmB,CAAC;AAI3B,MAAM,MAAM,iCAAiC,GAAG,UAAU,CAAC,OAAO,6BAA6B,CAAC,CAAC,CAAC,CAAC,CAAC;AAEpG;;;;;;;;;;;GAWG;AACH,wBAAsB,6BAA6B,CACjD,OAAO,EAAE;IACP,IAAI,EAAE,MAAM,CAAC;IACb,gBAAgB,CAAC,EAAE;QACjB,EAAE,EAAE,eAAe,CAAC;QACpB,UAAU,CAAC,EAAE,4BAA4B,EAAE,CAAC;KAC7C,EAAE,CAAC;IACJ,SAAS,CAAC,EAAE,MAAM,GAAG,UAAU,CAAC;IAChC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gBAAgB,CAAC,EAAE,UAAU,GAAG,WAAW,GAAG,aAAa,CAAC;IAC5D,UAAU,CAAC,EAAE,oCAAoC,CAAC;CACnD,GACA,OAAO,CAAC,qCAAqC,CAAC,CAoChD"}
1
+ {"version":3,"file":"generateAuthenticationOptions.d.ts","sourceRoot":"","sources":["../../src/authentication/generateAuthenticationOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oCAAoC,EACpC,4BAA4B,EAC5B,eAAe,EACf,qCAAqC,EACrC,WAAW,EACZ,MAAM,mBAAmB,CAAC;AAI3B,MAAM,MAAM,iCAAiC,GAAG,UAAU,CAAC,OAAO,6BAA6B,CAAC,CAAC,CAAC,CAAC,CAAC;AAEpG;;;;;;;;;;;GAWG;AACH,wBAAsB,6BAA6B,CACjD,OAAO,EAAE;IACP,IAAI,EAAE,MAAM,CAAC;IACb,gBAAgB,CAAC,EAAE;QACjB,EAAE,EAAE,eAAe,CAAC;QACpB,UAAU,CAAC,EAAE,4BAA4B,EAAE,CAAC;KAC7C,EAAE,CAAC;IACJ,SAAS,CAAC,EAAE,MAAM,GAAG,WAAW,CAAC;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gBAAgB,CAAC,EAAE,UAAU,GAAG,WAAW,GAAG,aAAa,CAAC;IAC5D,UAAU,CAAC,EAAE,oCAAoC,CAAC;CACnD,GACA,OAAO,CAAC,qCAAqC,CAAC,CAoChD"}
@@ -1,5 +1,6 @@
1
+ import type { Uint8Array_ } from '../types/index.js';
1
2
  /**
2
3
  * Convert the aaguid buffer in authData into a UUID string
3
4
  */
4
- export declare function convertAAGUIDToString(aaguid: Uint8Array): string;
5
+ export declare function convertAAGUIDToString(aaguid: Uint8Array_): string;
5
6
  //# sourceMappingURL=convertAAGUIDToString.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"convertAAGUIDToString.d.ts","sourceRoot":"","sources":["../../src/helpers/convertAAGUIDToString.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,CAchE"}
1
+ {"version":3,"file":"convertAAGUIDToString.d.ts","sourceRoot":"","sources":["../../src/helpers/convertAAGUIDToString.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAcjE"}
@@ -1,5 +1,6 @@
1
+ import type { Uint8Array_ } from '../types/index.js';
1
2
  /**
2
3
  * Takes COSE-encoded public key and converts it to PKCS key
3
4
  */
4
- export declare function convertCOSEtoPKCS(cosePublicKey: Uint8Array): Uint8Array;
5
+ export declare function convertCOSEtoPKCS(cosePublicKey: Uint8Array_): Uint8Array_;
5
6
  //# sourceMappingURL=convertCOSEtoPKCS.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"convertCOSEtoPKCS.d.ts","sourceRoot":"","sources":["../../src/helpers/convertCOSEtoPKCS.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,aAAa,EAAE,UAAU,GAAG,UAAU,CAmBvE"}
1
+ {"version":3,"file":"convertCOSEtoPKCS.d.ts","sourceRoot":"","sources":["../../src/helpers/convertCOSEtoPKCS.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,aAAa,EAAE,WAAW,GAAG,WAAW,CAmBzE"}
@@ -1,6 +1,6 @@
1
- import type { Base64URLString } from '../types/index.js';
1
+ import type { Base64URLString, Uint8Array_ } from '../types/index.js';
2
2
  /**
3
3
  * Convert buffer to an OpenSSL-compatible PEM text format.
4
4
  */
5
- export declare function convertCertBufferToPEM(certBuffer: Uint8Array | Base64URLString): string;
5
+ export declare function convertCertBufferToPEM(certBuffer: Uint8Array_ | Base64URLString): string;
6
6
  //# sourceMappingURL=convertCertBufferToPEM.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"convertCertBufferToPEM.d.ts","sourceRoot":"","sources":["../../src/helpers/convertCertBufferToPEM.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAGzD;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,UAAU,GAAG,eAAe,GACvC,MAAM,CA4BR"}
1
+ {"version":3,"file":"convertCertBufferToPEM.d.ts","sourceRoot":"","sources":["../../src/helpers/convertCertBufferToPEM.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGtE;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,WAAW,GAAG,eAAe,GACxC,MAAM,CA4BR"}
@@ -1,5 +1,6 @@
1
+ import type { Uint8Array_ } from '../types/index.js';
1
2
  /**
2
3
  * Take a certificate in PEM format and convert it to bytes
3
4
  */
4
- export declare function convertPEMToBytes(pem: string): Uint8Array;
5
+ export declare function convertPEMToBytes(pem: string): Uint8Array_;
5
6
  //# sourceMappingURL=convertPEMToBytes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"convertPEMToBytes.d.ts","sourceRoot":"","sources":["../../src/helpers/convertPEMToBytes.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,CAOzD"}
1
+ {"version":3,"file":"convertPEMToBytes.d.ts","sourceRoot":"","sources":["../../src/helpers/convertPEMToBytes.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW,CAO1D"}
@@ -1,3 +1,4 @@
1
1
  import { COSEPublicKey } from './cose.js';
2
- export declare function convertX509PublicKeyToCOSE(x509Certificate: Uint8Array): COSEPublicKey;
2
+ import type { Uint8Array_ } from '../types/index.js';
3
+ export declare function convertX509PublicKeyToCOSE(x509Certificate: Uint8Array_): COSEPublicKey;
3
4
  //# sourceMappingURL=convertX509PublicKeyToCOSE.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"convertX509PublicKeyToCOSE.d.ts","sourceRoot":"","sources":["../../src/helpers/convertX509PublicKeyToCOSE.ts"],"names":[],"mappings":"AAGA,OAAO,EAIL,aAAa,EAGd,MAAM,WAAW,CAAC;AAKnB,wBAAgB,0BAA0B,CACxC,eAAe,EAAE,UAAU,GAC1B,aAAa,CA+Ff"}
1
+ {"version":3,"file":"convertX509PublicKeyToCOSE.d.ts","sourceRoot":"","sources":["../../src/helpers/convertX509PublicKeyToCOSE.ts"],"names":[],"mappings":"AAKA,OAAO,EAIL,aAAa,EAGd,MAAM,WAAW,CAAC;AAEnB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,wBAAgB,0BAA0B,CACxC,eAAe,EAAE,WAAW,GAC3B,aAAa,CA+Ff"}
@@ -1,8 +1,8 @@
1
1
  import { AsnParser } from '@peculiar/asn1-schema';
2
2
  import { Certificate } from '@peculiar/asn1-x509';
3
3
  import { ECParameters, id_ecPublicKey, id_secp256r1, id_secp384r1 } from '@peculiar/asn1-ecc';
4
+ import { id_rsaEncryption, RSAPublicKey } from '@peculiar/asn1-rsa';
4
5
  import { COSECRV, COSEKEYS, COSEKTY, } from './cose.js';
5
- import { RSAPublicKey } from '@peculiar/asn1-rsa';
6
6
  import { mapX509SignatureAlgToCOSEAlg } from './mapX509SignatureAlgToCOSEAlg.js';
7
7
  export function convertX509PublicKeyToCOSE(x509Certificate) {
8
8
  let cosePublicKey = new Map();
@@ -54,7 +54,7 @@ export function convertX509PublicKeyToCOSE(x509Certificate) {
54
54
  coseEC2PubKey.set(COSEKEYS.y, y);
55
55
  cosePublicKey = coseEC2PubKey;
56
56
  }
57
- else if (publicKeyAlgorithmID === '1.2.840.113549.1.1.1') {
57
+ else if (publicKeyAlgorithmID === id_rsaEncryption) {
58
58
  /**
59
59
  * RSA public key
60
60
  */
@@ -1,3 +1,4 @@
1
+ import type { Uint8Array_ } from '../types/index.js';
1
2
  /**
2
3
  * Fundamental values that are needed to discern the more specific COSE public key types below.
3
4
  *
@@ -23,29 +24,29 @@ export type COSEPublicKey = {
23
24
  */
24
25
  export type COSEPublicKeyOKP = COSEPublicKey & {
25
26
  get(key: COSEKEYS.crv): number | undefined;
26
- get(key: COSEKEYS.x): Uint8Array | undefined;
27
+ get(key: COSEKEYS.x): Uint8Array_ | undefined;
27
28
  set(key: COSEKEYS.crv, value: number): void;
28
- set(key: COSEKEYS.x, value: Uint8Array): void;
29
+ set(key: COSEKEYS.x, value: Uint8Array_): void;
29
30
  };
30
31
  /**
31
32
  * Values specific to Elliptic Curve Cryptography public keys
32
33
  */
33
34
  export type COSEPublicKeyEC2 = COSEPublicKey & {
34
35
  get(key: COSEKEYS.crv): number | undefined;
35
- get(key: COSEKEYS.x): Uint8Array | undefined;
36
- get(key: COSEKEYS.y): Uint8Array | undefined;
36
+ get(key: COSEKEYS.x): Uint8Array_ | undefined;
37
+ get(key: COSEKEYS.y): Uint8Array_ | undefined;
37
38
  set(key: COSEKEYS.crv, value: number): void;
38
- set(key: COSEKEYS.x, value: Uint8Array): void;
39
- set(key: COSEKEYS.y, value: Uint8Array): void;
39
+ set(key: COSEKEYS.x, value: Uint8Array_): void;
40
+ set(key: COSEKEYS.y, value: Uint8Array_): void;
40
41
  };
41
42
  /**
42
43
  * Values specific to RSA public keys
43
44
  */
44
45
  export type COSEPublicKeyRSA = COSEPublicKey & {
45
- get(key: COSEKEYS.n): Uint8Array | undefined;
46
- get(key: COSEKEYS.e): Uint8Array | undefined;
47
- set(key: COSEKEYS.n, value: Uint8Array): void;
48
- set(key: COSEKEYS.e, value: Uint8Array): void;
46
+ get(key: COSEKEYS.n): Uint8Array_ | undefined;
47
+ get(key: COSEKEYS.e): Uint8Array_ | undefined;
48
+ set(key: COSEKEYS.n, value: Uint8Array_): void;
49
+ set(key: COSEKEYS.e, value: Uint8Array_): void;
49
50
  };
50
51
  /**
51
52
  * A type guard for determining if a COSE public key is an OKP key pair
@@ -1 +1 @@
1
- {"version":3,"file":"cose.d.ts","sourceRoot":"","sources":["../../src/helpers/cose.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;IAE1B,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,GAAG,GAAG,OAAO,GAAG,SAAS,CAAC;IAC5C,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,GAAG,GAAG,OAAO,GAAG,SAAS,CAAC;IAE5C,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,GAAG,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;IAC7C,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,GAAG,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;CAC9C,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,aAAa,GAAG;IAE7C,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,GAAG,GAAG,MAAM,GAAG,SAAS,CAAC;IAC3C,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,GAAG,UAAU,GAAG,SAAS,CAAC;IAE7C,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,GAAG,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5C,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,EAAE,KAAK,EAAE,UAAU,GAAG,IAAI,CAAC;CAC/C,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,aAAa,GAAG;IAE7C,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,GAAG,GAAG,MAAM,GAAG,SAAS,CAAC;IAC3C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MAAM;IACX,KAAK,MAAM;IACX,KAAK,MAAM;IACX,MAAM,MAAM;IACZ,KAAK,OAAO;IACZ,KAAK,OAAO;IACZ,KAAK,OAAO;IACZ,GAAG,SAAS;CACb;AAED,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,GAAG,IAAI,OAAO,CAEjE"}
@@ -1,14 +1,3 @@
1
- /**
2
- * Fundamental values that are needed to discern the more specific COSE public key types below.
3
- *
4
- * The use of `Maps` here is due to CBOR encoding being used with public keys, and the CBOR "Map"
5
- * type is being decoded to JavaScript's `Map` type instead of, say, a basic Object as us JS
6
- * developers might prefer.
7
- *
8
- * These types are an unorthodox way of saying "these Maps should involve these discrete lists of
9
- * keys", but it works.
10
- * @module
11
- */
12
1
  /**
13
2
  * A type guard for determining if a COSE public key is an OKP key pair
14
3
  */
@@ -1,27 +1,28 @@
1
+ import type { Uint8Array_ } from '../types/index.js';
1
2
  /**
2
3
  * Convert an AttestationObject buffer to a proper object
3
4
  *
4
5
  * @param base64AttestationObject Attestation Object buffer
5
6
  */
6
- export declare function decodeAttestationObject(attestationObject: Uint8Array): AttestationObject;
7
+ export declare function decodeAttestationObject(attestationObject: Uint8Array_): AttestationObject;
7
8
  export type AttestationFormat = 'fido-u2f' | 'packed' | 'android-safetynet' | 'android-key' | 'tpm' | 'apple' | 'none';
8
9
  export type AttestationObject = {
9
10
  get(key: 'fmt'): AttestationFormat;
10
11
  get(key: 'attStmt'): AttestationStatement;
11
- get(key: 'authData'): Uint8Array;
12
+ get(key: 'authData'): Uint8Array_;
12
13
  };
13
14
  /**
14
15
  * `AttestationStatement` will be an instance of `Map`, but these keys help make finite the list of
15
16
  * possible values within it.
16
17
  */
17
18
  export type AttestationStatement = {
18
- get(key: 'sig'): Uint8Array | undefined;
19
- get(key: 'x5c'): Uint8Array[] | undefined;
20
- get(key: 'response'): Uint8Array | undefined;
19
+ get(key: 'sig'): Uint8Array_ | undefined;
20
+ get(key: 'x5c'): Uint8Array_[] | undefined;
21
+ get(key: 'response'): Uint8Array_ | undefined;
21
22
  get(key: 'alg'): number | undefined;
22
23
  get(key: 'ver'): string | undefined;
23
- get(key: 'certInfo'): Uint8Array | undefined;
24
- get(key: 'pubArea'): Uint8Array | undefined;
24
+ get(key: 'certInfo'): Uint8Array_ | undefined;
25
+ get(key: 'pubArea'): Uint8Array_ | undefined;
25
26
  readonly size: number;
26
27
  };
27
28
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"decodeAttestationObject.d.ts","sourceRoot":"","sources":["../../src/helpers/decodeAttestationObject.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,wBAAgB,uBAAuB,CACrC,iBAAiB,EAAE,UAAU,GAC5B,iBAAiB,CAInB;AAED,MAAM,MAAM,iBAAiB,GACzB,UAAU,GACV,QAAQ,GACR,mBAAmB,GACnB,aAAa,GACb,KAAK,GACL,OAAO,GACP,MAAM,CAAC;AAEX,MAAM,MAAM,iBAAiB,GAAG;IAC9B,GAAG,CAAC,GAAG,EAAE,KAAK,GAAG,iBAAiB,CAAC;IACnC,GAAG,CAAC,GAAG,EAAE,SAAS,GAAG,oBAAoB,CAAC;IAC1C,GAAG,CAAC,GAAG,EAAE,UAAU,GAAG,UAAU,CAAC;CAClC,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,GAAG,CAAC,GAAG,EAAE,KAAK,GAAG,UAAU,GAAG,SAAS,CAAC;IACxC,GAAG,CAAC,GAAG,EAAE,KAAK,GAAG,UAAU,EAAE,GAAG,SAAS,CAAC;IAC1C,GAAG,CAAC,GAAG,EAAE,UAAU,GAAG,UAAU,GAAG,SAAS,CAAC;IAC7C,GAAG,CAAC,GAAG,EAAE,KAAK,GAAG,MAAM,GAAG,SAAS,CAAC;IACpC,GAAG,CAAC,GAAG,EAAE,KAAK,GAAG,MAAM,GAAG,SAAS,CAAC;IACpC,GAAG,CAAC,GAAG,EAAE,UAAU,GAAG,UAAU,GAAG,SAAS,CA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,EAAE,SAAS,GAAG,WAAW,GAAG,SAAS,CAAC;IAE7C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,iCAAiC;sBAC1B,iBAAiB;CACpC,CAAC"}
@@ -1,9 +1,10 @@
1
+ import type { Uint8Array_ } from '../types/index.js';
1
2
  /**
2
3
  * Convert authenticator extension data buffer to a proper object
3
4
  *
4
5
  * @param extensionData Authenticator Extension Data buffer
5
6
  */
6
- export declare function decodeAuthenticatorExtensions(extensionData: Uint8Array): AuthenticationExtensionsAuthenticatorOutputs | undefined;
7
+ export declare function decodeAuthenticatorExtensions(extensionData: Uint8Array_): AuthenticationExtensionsAuthenticatorOutputs | undefined;
7
8
  /**
8
9
  * Attempt to support authenticator extensions we might not know about in WebAuthn
9
10
  */
@@ -1 +1 @@
1
- {"version":3,"file":"decodeAuthenticatorExtensions.d.ts","sourceRoot":"","sources":["../../src/helpers/decodeAuthenticatorExtensions.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,wBAAgB,6BAA6B,CAC3C,aAAa,EAAE,UAAU,GACxB,4CAA4C,GAAG,SAAS,CAU1D;AAED;;GAEG;AACH,MAAM,MAAM,4CAA4C,GAAG,OAAO,CAAC"}
1
+ {"version":3,"file":"decodeAuthenticatorExtensions.d.ts","sourceRoot":"","sources":["../../src/helpers/decodeAuthenticatorExtensions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD;;;;GAIG;AACH,wBAAgB,6BAA6B,CAC3C,aAAa,EAAE,WAAW,GACzB,4CAA4C,GAAG,SAAS,CAU1D;AAED;;GAEG;AACH,MAAM,MAAM,4CAA4C,GAAG,OAAO,CAAC"}
@@ -1,5 +1,6 @@
1
- import { COSEPublicKey } from './cose.js';
2
- export declare function decodeCredentialPublicKey(publicKey: Uint8Array): COSEPublicKey;
1
+ import type { COSEPublicKey } from './cose.js';
2
+ import type { Uint8Array_ } from '../types/index.js';
3
+ export declare function decodeCredentialPublicKey(publicKey: Uint8Array_): COSEPublicKey;
3
4
  /**
4
5
  * Make it possible to stub the return value during testing
5
6
  * @ignore Don't include this in docs output
@@ -1 +1 @@
1
- {"version":3,"file":"decodeCredentialPublicKey.d.ts","sourceRoot":"","sources":["../../src/helpers/decodeCredentialPublicKey.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAG1C,wBAAgB,yBAAyB,CACvC,SAAS,EAAE,UAAU,GACpB,aAAa,CAIf;AAED;;;GAGG;AACH,eAAO,MAAM,mCAAmC;sBAC5B,aAAa;CAChC,CAAC"}
1
+ {"version":3,"file":"decodeCredentialPublicKey.d.ts","sourceRoot":"","sources":["../../src/helpers/decodeCredentialPublicKey.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE/C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,wBAAgB,yBAAyB,CACvC,SAAS,EAAE,WAAW,GACrB,aAAa,CAIf;AAED;;;GAGG;AACH,eAAO,MAAM,mCAAmC;sBAC5B,aAAa;CAChC,CAAC"}
@@ -1,12 +1,13 @@
1
+ import type { Uint8Array_ } from '../types/index.js';
1
2
  /**
2
3
  * Generate a suitably random value to be used as an attestation or assertion challenge
3
4
  */
4
- export declare function generateChallenge(): Promise<Uint8Array>;
5
+ export declare function generateChallenge(): Promise<Uint8Array_>;
5
6
  /**
6
7
  * Make it possible to stub the return value during testing
7
8
  * @ignore Don't include this in docs output
8
9
  */
9
10
  export declare const _generateChallengeInternals: {
10
- stubThis: (value: Uint8Array) => Uint8Array;
11
+ stubThis: (value: Uint8Array_) => Uint8Array;
11
12
  };
12
13
  //# sourceMappingURL=generateChallenge.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"generateChallenge.d.ts","sourceRoot":"","sources":["../../src/helpers/generateChallenge.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,UAAU,CAAC,CAc7D;AAED;;;GAGG;AACH,eAAO,MAAM,2BAA2B;sBACpB,UAAU;CAC7B,CAAC"}
1
+ {"version":3,"file":"generateChallenge.d.ts","sourceRoot":"","sources":["../../src/helpers/generateChallenge.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD;;GAEG;AACH,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,WAAW,CAAC,CAc9D;AAED;;;GAGG;AACH,eAAO,MAAM,2BAA2B;sBACpB,WAAW;CAC9B,CAAC"}
@@ -1,12 +1,13 @@
1
+ import type { Uint8Array_ } from '../types/index.js';
1
2
  /**
2
3
  * Generate a suitably random value to be used as user ID
3
4
  */
4
- export declare function generateUserID(): Promise<Uint8Array>;
5
+ export declare function generateUserID(): Promise<Uint8Array_>;
5
6
  /**
6
7
  * Make it possible to stub the return value during testing
7
8
  * @ignore Don't include this in docs output
8
9
  */
9
10
  export declare const _generateUserIDInternals: {
10
- stubThis: (value: Uint8Array) => Uint8Array;
11
+ stubThis: (value: Uint8Array_) => Uint8Array;
11
12
  };
12
13
  //# sourceMappingURL=generateUserID.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"generateUserID.d.ts","sourceRoot":"","sources":["../../src/helpers/generateUserID.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,wBAAsB,cAAc,IAAI,OAAO,CAAC,UAAU,CAAC,CAU1D;AAED;;;GAGG;AACH,eAAO,MAAM,wBAAwB;sBACjB,UAAU;CAC7B,CAAC"}
1
+ {"version":3,"file":"generateUserID.d.ts","sourceRoot":"","sources":["../../src/helpers/generateUserID.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD;;GAEG;AACH,wBAAsB,cAAc,IAAI,OAAO,CAAC,WAAW,CAAC,CAU3D;AAED;;;GAGG;AACH,eAAO,MAAM,wBAAwB;sBACjB,WAAW;CAC9B,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import { Certificate } from '@peculiar/asn1-x509';
2
+ import type { Uint8Array_ } from '../types/index.js';
2
3
  export type CertificateInfo = {
3
4
  issuer: Issuer;
4
5
  subject: Subject;
@@ -27,6 +28,6 @@ type Subject = {
27
28
  *
28
29
  * @param pemCertificate Result from call to `convertASN1toPEM(x5c[0])`
29
30
  */
30
- export declare function getCertificateInfo(leafCertBuffer: Uint8Array): CertificateInfo;
31
+ export declare function getCertificateInfo(leafCertBuffer: Uint8Array_): CertificateInfo;
31
32
  export {};
32
33
  //# sourceMappingURL=getCertificateInfo.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getCertificateInfo.d.ts","sourceRoot":"","sources":["../../src/helpers/getCertificateInfo.ts"],"names":[],"mappings":"AACA,OAAO,EAAoB,WAAW,EAA0B,MAAM,qBAAqB,CAAC;AAE5F,MAAM,MAAM,eAAe,GAAG;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,kBAAkB,EAAE,OAAO,CAAC;IAC5B,SAAS,EAAE,IAAI,CAAC;IAChB,QAAQ,EAAE,IAAI,CAAC;IACf,iBAAiB,EAAE,WAAW,CAAC;CAChC,CAAC;AAEF,KAAK,MAAM,GAAG;IACZ,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,KAAK,OAAO,GAAG;IACb,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AASF;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,cAAc,EAAE,UAAU,GACzB,eAAe,CA+CjB"}
1
+ {"version":3,"file":"getCertificateInfo.d.ts","sourceRoot":"","sources":["../../src/helpers/getCertificateInfo.ts"],"names":[],"mappings":"AACA,OAAO,EAAoB,WAAW,EAA0B,MAAM,qBAAqB,CAAC;AAE5F,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,MAAM,MAAM,eAAe,GAAG;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,kBAAkB,EAAE,OAAO,CAAC;IAC5B,SAAS,EAAE,IAAI,CAAC;IAChB,QAAQ,EAAE,IAAI,CAAC;IACf,iBAAiB,EAAE,WAAW,CAAC;CAChC,CAAC;AAEF,KAAK,MAAM,GAAG;IACZ,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,KAAK,OAAO,GAAG;IACb,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AASF;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,cAAc,EAAE,WAAW,GAC1B,eAAe,CA+CjB"}
@@ -1,9 +1,9 @@
1
- import { Certificate } from '@peculiar/asn1-x509';
1
+ import { type X509Certificate } from '@peculiar/x509';
2
2
  /**
3
3
  * A method to pull a CRL from a certificate and compare its serial number to the list of revoked
4
4
  * certificate serial numbers within the CRL.
5
5
  *
6
6
  * CRL certificate structure referenced from https://tools.ietf.org/html/rfc5280#page-117
7
7
  */
8
- export declare function isCertRevoked(cert: Certificate): Promise<boolean>;
8
+ export declare function isCertRevoked(cert: X509Certificate): Promise<boolean>;
9
9
  //# sourceMappingURL=isCertRevoked.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"isCertRevoked.d.ts","sourceRoot":"","sources":["../../src/helpers/isCertRevoked.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,WAAW,EAOZ,MAAM,qBAAqB,CAAC;AAgB7B;;;;;GAKG;AACH,wBAAsB,aAAa,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,CAgHvE"}
1
+ {"version":3,"file":"isCertRevoked.d.ts","sourceRoot":"","sources":["../../src/helpers/isCertRevoked.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,eAAe,EAErB,MAAM,gBAAgB,CAAC;AAexB;;;;;GAKG;AACH,wBAAsB,aAAa,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,OAAO,CAAC,CAkG3E"}
@@ -1,6 +1,4 @@
1
- import { AsnParser } from '@peculiar/asn1-schema';
2
- import { AuthorityKeyIdentifier, CertificateList, CRLDistributionPoints, id_ce_authorityKeyIdentifier, id_ce_cRLDistributionPoints, id_ce_subjectKeyIdentifier, SubjectKeyIdentifier, } from '@peculiar/asn1-x509';
3
- import { isoUint8Array } from './iso/index.js';
1
+ import { AuthorityKeyIdentifierExtension, CRLDistributionPointsExtension, SubjectKeyIdentifierExtension, X509Crl, } from '@peculiar/x509';
4
2
  import { fetch } from './fetch.js';
5
3
  const cacheRevokedCerts = {};
6
4
  /**
@@ -10,7 +8,7 @@ const cacheRevokedCerts = {};
10
8
  * CRL certificate structure referenced from https://tools.ietf.org/html/rfc5280#page-117
11
9
  */
12
10
  export async function isCertRevoked(cert) {
13
- const { extensions } = cert.tbsCertificate;
11
+ const { extensions } = cert;
14
12
  if (!extensions) {
15
13
  return false;
16
14
  }
@@ -18,40 +16,39 @@ export async function isCertRevoked(cert) {
18
16
  let extSubjectKeyID;
19
17
  let extCRLDistributionPoints;
20
18
  extensions.forEach((ext) => {
21
- if (ext.extnID === id_ce_authorityKeyIdentifier) {
22
- extAuthorityKeyID = AsnParser.parse(ext.extnValue, AuthorityKeyIdentifier);
19
+ if (ext instanceof AuthorityKeyIdentifierExtension) {
20
+ extAuthorityKeyID = ext;
23
21
  }
24
- else if (ext.extnID === id_ce_subjectKeyIdentifier) {
25
- extSubjectKeyID = AsnParser.parse(ext.extnValue, SubjectKeyIdentifier);
22
+ else if (ext instanceof SubjectKeyIdentifierExtension) {
23
+ extSubjectKeyID = ext;
26
24
  }
27
- else if (ext.extnID === id_ce_cRLDistributionPoints) {
28
- extCRLDistributionPoints = AsnParser.parse(ext.extnValue, CRLDistributionPoints);
25
+ else if (ext instanceof CRLDistributionPointsExtension) {
26
+ extCRLDistributionPoints = ext;
29
27
  }
30
28
  });
31
29
  // Check to see if we've got cached info for the cert's CA
32
30
  let keyIdentifier = undefined;
33
- if (extAuthorityKeyID && extAuthorityKeyID.keyIdentifier) {
34
- keyIdentifier = isoUint8Array.toHex(new Uint8Array(extAuthorityKeyID.keyIdentifier.buffer));
31
+ if (extAuthorityKeyID && extAuthorityKeyID.keyId) {
32
+ keyIdentifier = extAuthorityKeyID.keyId;
35
33
  }
36
34
  else if (extSubjectKeyID) {
37
35
  /**
38
36
  * We might be dealing with a self-signed root certificate. Check the
39
37
  * Subject key Identifier extension next.
40
38
  */
41
- keyIdentifier = isoUint8Array.toHex(new Uint8Array(extSubjectKeyID.buffer));
39
+ keyIdentifier = extSubjectKeyID.keyId;
42
40
  }
43
- const certSerialHex = isoUint8Array.toHex(new Uint8Array(cert.tbsCertificate.serialNumber));
44
41
  if (keyIdentifier) {
45
42
  const cached = cacheRevokedCerts[keyIdentifier];
46
43
  if (cached) {
47
44
  const now = new Date();
48
45
  // If there's a nextUpdate then make sure we're before it
49
46
  if (!cached.nextUpdate || cached.nextUpdate > now) {
50
- return cached.revokedCerts.indexOf(certSerialHex) >= 0;
47
+ return cached.revokedCerts.indexOf(cert.serialNumber) >= 0;
51
48
  }
52
49
  }
53
50
  }
54
- const crlURL = extCRLDistributionPoints?.[0].distributionPoint?.fullName?.[0]
51
+ const crlURL = extCRLDistributionPoints?.distributionPoints?.[0].distributionPoint?.fullName?.[0]
55
52
  .uniformResourceIdentifier;
56
53
  // If no URL is provided then we have nothing to check
57
54
  if (!crlURL) {
@@ -68,7 +65,7 @@ export async function isCertRevoked(cert) {
68
65
  }
69
66
  let data;
70
67
  try {
71
- data = AsnParser.parse(certListBytes, CertificateList);
68
+ data = new X509Crl(certListBytes);
72
69
  }
73
70
  catch (_err) {
74
71
  // Something was malformed with the CRL, so pass
@@ -79,21 +76,21 @@ export async function isCertRevoked(cert) {
79
76
  nextUpdate: undefined,
80
77
  };
81
78
  // nextUpdate
82
- if (data.tbsCertList.nextUpdate) {
83
- newCached.nextUpdate = data.tbsCertList.nextUpdate.getTime();
79
+ if (data.nextUpdate) {
80
+ newCached.nextUpdate = data.nextUpdate;
84
81
  }
85
82
  // revokedCertificates
86
- const revokedCerts = data.tbsCertList.revokedCertificates;
83
+ const revokedCerts = data.entries;
87
84
  if (revokedCerts) {
88
85
  for (const cert of revokedCerts) {
89
- const revokedHex = isoUint8Array.toHex(new Uint8Array(cert.userCertificate));
86
+ const revokedHex = cert.serialNumber;
90
87
  newCached.revokedCerts.push(revokedHex);
91
88
  }
92
89
  // Cache the results
93
90
  if (keyIdentifier) {
94
91
  cacheRevokedCerts[keyIdentifier] = newCached;
95
92
  }
96
- return newCached.revokedCerts.indexOf(certSerialHex) >= 0;
93
+ return newCached.revokedCerts.indexOf(cert.serialNumber) >= 0;
97
94
  }
98
95
  return false;
99
96
  }
@@ -1,4 +1,4 @@
1
- import type { Base64URLString } from '../../types/index.js';
1
+ import type { Base64URLString, Uint8Array_ } from '../../types/index.js';
2
2
  /**
3
3
  * Decode from a Base64URL-encoded string to an ArrayBuffer. Best used when converting a
4
4
  * credential ID from a JSON string to an ArrayBuffer, like in allowCredentials or
@@ -7,7 +7,7 @@ import type { Base64URLString } from '../../types/index.js';
7
7
  * @param buffer Value to decode from base64
8
8
  * @param to (optional) The decoding to use, in case it's desirable to decode from base64 instead
9
9
  */
10
- export declare function toBuffer(base64urlString: string, from?: 'base64' | 'base64url'): Uint8Array;
10
+ export declare function toBuffer(base64urlString: string, from?: 'base64' | 'base64url'): Uint8Array_;
11
11
  /**
12
12
  * Encode the given array buffer into a Base64URL-encoded string. Ideal for converting various
13
13
  * credential response ArrayBuffers to string for sending back to the server as JSON.
@@ -15,7 +15,7 @@ export declare function toBuffer(base64urlString: string, from?: 'base64' | 'bas
15
15
  * @param buffer Value to encode to base64
16
16
  * @param to (optional) The encoding to use, in case it's desirable to encode to base64 instead
17
17
  */
18
- export declare function fromBuffer(buffer: Uint8Array, to?: 'base64' | 'base64url'): string;
18
+ export declare function fromBuffer(buffer: Uint8Array_, to?: 'base64' | 'base64url'): string;
19
19
  /**
20
20
  * Convert a base64url string into base64
21
21
  */
@@ -1 +1 @@
1
- {"version":3,"file":"isoBase64URL.d.ts","sourceRoot":"","sources":["../../../src/helpers/iso/isoBase64URL.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CACtB,eAAe,EAAE,MAAM,EACvB,IAAI,GAAE,QAAQ,GAAG,WAAyB,GACzC,UAAU,CAGZ;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CACxB,MAAM,EAAE,UAAU,EAClB,EAAE,GAAE,QAAQ,GAAG,WAAyB,GACvC,MAAM,CAER;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,eAAe,EAAE,MAAM,GAAG,MAAM,CAIxD;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAEzD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,eAAe,EAAE,MAAM,GAAG,MAAM,CAE5D;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAE/C;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAIlD;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,eAAe,GAAG,eAAe,CAEnE"}
1
+ {"version":3,"file":"isoBase64URL.d.ts","sourceRoot":"","sources":["../../../src/helpers/iso/isoBase64URL.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEzE;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CACtB,eAAe,EAAE,MAAM,EACvB,IAAI,GAAE,QAAQ,GAAG,WAAyB,GACzC,WAAW,CAGb;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CACxB,MAAM,EAAE,WAAW,EACnB,EAAE,GAAE,QAAQ,GAAG,WAAyB,GACvC,MAAM,CAOR;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,eAAe,EAAE,MAAM,GAAG,MAAM,CAIxD;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAEzD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,eAAe,EAAE,MAAM,GAAG,MAAM,CAE5D;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAE/C;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAIlD;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,eAAe,GAAG,eAAe,CAEnE"}
@@ -23,7 +23,12 @@ export function toBuffer(base64urlString, from = 'base64url') {
23
23
  * @param to (optional) The encoding to use, in case it's desirable to encode to base64 instead
24
24
  */
25
25
  export function fromBuffer(buffer, to = 'base64url') {
26
- return base64.fromArrayBuffer(buffer, to === 'base64url');
26
+ /**
27
+ * Gracefully handle Uint8Array subclass types, like Node's Buffer, that can have a large
28
+ * ArrayBuffer backing it.
29
+ */
30
+ const _normalized = new Uint8Array(buffer);
31
+ return base64.fromArrayBuffer(_normalized.buffer, to === 'base64url');
27
32
  }
28
33
  /**
29
34
  * Convert a base64url string into base64
@@ -3,6 +3,7 @@
3
3
  * @module
4
4
  */
5
5
  import * as tinyCbor from '@levischuck/tiny-cbor';
6
+ import type { Uint8Array_ } from '../../types/index.js';
6
7
  /**
7
8
  * Whatever CBOR encoder is used should keep CBOR data the same length when data is re-encoded
8
9
  *
@@ -20,9 +21,9 @@ import * as tinyCbor from '@levischuck/tiny-cbor';
20
21
  * @param asObject (optional) Whether to convert any CBOR Maps into JavaScript Objects. Defaults to
21
22
  * `false`
22
23
  */
23
- export declare function decodeFirst<Type>(input: Uint8Array): Type;
24
+ export declare function decodeFirst<Type>(input: Uint8Array_): Type;
24
25
  /**
25
26
  * Encode data to CBOR
26
27
  */
27
- export declare function encode(input: tinyCbor.CBORType): Uint8Array;
28
+ export declare function encode(input: tinyCbor.CBORType): Uint8Array_;
28
29
  //# sourceMappingURL=isoCBOR.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"isoCBOR.d.ts","sourceRoot":"","sources":["../../../src/helpers/iso/isoCBOR.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,QAAQ,MAAM,uBAAuB,CAAC;AAElD;;;;;;;;;GASG;AAEH;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,KAAK,EAAE,UAAU,GAAG,IAAI,CAQzD;AAED;;GAEG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,QAAQ,GAAG,UAAU,CAE3D"}
1
+ {"version":3,"file":"isoCBOR.d.ts","sourceRoot":"","sources":["../../../src/helpers/iso/isoCBOR.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,QAAQ,MAAM,uBAAuB,CAAC;AAElD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAExD;;;;;;;;;GASG;AAEH;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,KAAK,EAAE,WAAW,GAAG,IAAI,CAQ1D;AAED;;GAEG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,QAAQ,GAAG,WAAW,CAE5D"}
@@ -1,9 +1,10 @@
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
  * Generate a digest of the provided data.
4
5
  *
5
6
  * @param data The data to generate a digest of
6
7
  * @param algorithm A COSE algorithm ID that maps to a desired SHA algorithm
7
8
  */
8
- export declare function digest(data: Uint8Array, algorithm: COSEALG): Promise<Uint8Array>;
9
+ export declare function digest(data: Uint8Array_, algorithm: COSEALG): Promise<Uint8Array_>;
9
10
  //# sourceMappingURL=digest.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"digest.d.ts","sourceRoot":"","sources":["../../../../src/helpers/iso/isoCrypto/digest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAIxC;;;;;GAKG;AACH,wBAAsB,MAAM,CAC1B,IAAI,EAAE,UAAU,EAChB,SAAS,EAAE,OAAO,GACjB,OAAO,CAAC,UAAU,CAAC,CAQrB"}
1
+ {"version":3,"file":"digest.d.ts","sourceRoot":"","sources":["../../../../src/helpers/iso/isoCrypto/digest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAG7C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE3D;;;;;GAKG;AACH,wBAAsB,MAAM,CAC1B,IAAI,EAAE,WAAW,EACjB,SAAS,EAAE,OAAO,GACjB,OAAO,CAAC,WAAW,CAAC,CAQtB"}
@@ -1,7 +1,8 @@
1
+ import type { Uint8Array_ } from '../../../types/index.js';
1
2
  /**
2
3
  * Fill up the provided bytes array with random bytes equal to its length.
3
4
  *
4
5
  * @returns the same bytes array passed into the method
5
6
  */
6
- export declare function getRandomValues(array: Uint8Array): Promise<Uint8Array>;
7
+ export declare function getRandomValues(array: Uint8Array_): Promise<Uint8Array_>;
7
8
  //# sourceMappingURL=getRandomValues.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getRandomValues.d.ts","sourceRoot":"","sources":["../../../../src/helpers/iso/isoCrypto/getRandomValues.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,wBAAsB,eAAe,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAM5E"}
1
+ {"version":3,"file":"getRandomValues.d.ts","sourceRoot":"","sources":["../../../../src/helpers/iso/isoCrypto/getRandomValues.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE3D;;;;GAIG;AACH,wBAAsB,eAAe,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,CAM9E"}
@@ -1,8 +1,9 @@
1
1
  import { COSECRV } from '../../cose.js';
2
+ import type { Uint8Array_ } from '../../../types/index.js';
2
3
  /**
3
4
  * In WebAuthn, EC2 signatures are wrapped in ASN.1 structure so we need to peel r and s apart.
4
5
  *
5
6
  * See https://www.w3.org/TR/webauthn-2/#sctn-signature-attestation-types
6
7
  */
7
- export declare function unwrapEC2Signature(signature: Uint8Array, crv: COSECRV): Uint8Array;
8
+ export declare function unwrapEC2Signature(signature: Uint8Array_, crv: COSECRV): Uint8Array_;
8
9
  //# sourceMappingURL=unwrapEC2Signature.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"unwrapEC2Signature.d.ts","sourceRoot":"","sources":["../../../../src/helpers/iso/isoCrypto/unwrapEC2Signature.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAGxC;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,UAAU,EAAE,GAAG,EAAE,OAAO,GAAG,UAAU,CAelF"}
1
+ {"version":3,"file":"unwrapEC2Signature.d.ts","sourceRoot":"","sources":["../../../../src/helpers/iso/isoCrypto/unwrapEC2Signature.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE3D;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,WAAW,EAAE,GAAG,EAAE,OAAO,GAAG,WAAW,CAepF"}
@@ -1,11 +1,12 @@
1
- import { COSEALG, COSEPublicKey } from '../../cose.js';
1
+ import { type COSEALG, type COSEPublicKey } from '../../cose.js';
2
+ import type { Uint8Array_ } from '../../../types/index.js';
2
3
  /**
3
4
  * Verify signatures with their public key. Supports EC2 and RSA public keys.
4
5
  */
5
6
  export declare function verify(opts: {
6
7
  cosePublicKey: COSEPublicKey;
7
- signature: Uint8Array;
8
- data: Uint8Array;
8
+ signature: Uint8Array_;
9
+ data: Uint8Array_;
9
10
  shaHashOverride?: COSEALG;
10
11
  }): Promise<boolean>;
11
12
  //# sourceMappingURL=verify.d.ts.map