@simplewebauthn/server 10.0.0 → 11.0.0-alpha3

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 (348) hide show
  1. package/README.md +14 -6
  2. package/esm/authentication/generateAuthenticationOptions.d.ts +2 -1
  3. package/esm/authentication/generateAuthenticationOptions.d.ts.map +1 -0
  4. package/esm/authentication/verifyAuthenticationResponse.d.ts +4 -3
  5. package/esm/authentication/verifyAuthenticationResponse.d.ts.map +1 -0
  6. package/esm/authentication/verifyAuthenticationResponse.js +7 -7
  7. package/esm/helpers/convertAAGUIDToString.d.ts +1 -0
  8. package/esm/helpers/convertAAGUIDToString.d.ts.map +1 -0
  9. package/esm/helpers/convertAAGUIDToString.js +4 -4
  10. package/esm/helpers/convertCOSEtoPKCS.d.ts +1 -0
  11. package/esm/helpers/convertCOSEtoPKCS.d.ts.map +1 -0
  12. package/esm/helpers/convertCertBufferToPEM.d.ts +2 -1
  13. package/esm/helpers/convertCertBufferToPEM.d.ts.map +1 -0
  14. package/esm/helpers/convertPEMToBytes.d.ts +1 -0
  15. package/esm/helpers/convertPEMToBytes.d.ts.map +1 -0
  16. package/esm/helpers/convertX509PublicKeyToCOSE.d.ts +1 -0
  17. package/esm/helpers/convertX509PublicKeyToCOSE.d.ts.map +1 -0
  18. package/esm/helpers/convertX509PublicKeyToCOSE.js +4 -1
  19. package/esm/helpers/cose.d.ts +1 -0
  20. package/esm/helpers/cose.d.ts.map +1 -0
  21. package/esm/helpers/decodeAttestationObject.d.ts +1 -0
  22. package/esm/helpers/decodeAttestationObject.d.ts.map +1 -0
  23. package/esm/helpers/decodeAuthenticatorExtensions.d.ts +5 -14
  24. package/esm/helpers/decodeAuthenticatorExtensions.d.ts.map +1 -0
  25. package/esm/helpers/decodeClientDataJSON.d.ts +2 -1
  26. package/esm/helpers/decodeClientDataJSON.d.ts.map +1 -0
  27. package/esm/helpers/decodeCredentialPublicKey.d.ts +1 -0
  28. package/esm/helpers/decodeCredentialPublicKey.d.ts.map +1 -0
  29. package/esm/helpers/fetch.d.ts +1 -0
  30. package/esm/helpers/fetch.d.ts.map +1 -0
  31. package/esm/helpers/fetch.js +1 -1
  32. package/esm/helpers/generateChallenge.d.ts +1 -0
  33. package/esm/helpers/generateChallenge.d.ts.map +1 -0
  34. package/esm/helpers/generateUserID.d.ts +1 -0
  35. package/esm/helpers/generateUserID.d.ts.map +1 -0
  36. package/esm/helpers/getCertificateInfo.d.ts +2 -1
  37. package/esm/helpers/getCertificateInfo.d.ts.map +1 -0
  38. package/esm/helpers/getCertificateInfo.js +2 -1
  39. package/esm/helpers/index.d.ts +1 -0
  40. package/esm/helpers/index.d.ts.map +1 -0
  41. package/esm/helpers/isCertRevoked.d.ts +2 -1
  42. package/esm/helpers/isCertRevoked.d.ts.map +1 -0
  43. package/esm/helpers/isCertRevoked.js +2 -1
  44. package/esm/helpers/iso/index.d.ts +1 -0
  45. package/esm/helpers/iso/index.d.ts.map +1 -0
  46. package/esm/helpers/iso/isoBase64URL.d.ts +2 -1
  47. package/esm/helpers/iso/isoBase64URL.d.ts.map +1 -0
  48. package/esm/helpers/iso/isoBase64URL.js +1 -1
  49. package/esm/helpers/iso/isoCBOR.d.ts +2 -1
  50. package/esm/helpers/iso/isoCBOR.d.ts.map +1 -0
  51. package/esm/helpers/iso/isoCBOR.js +1 -1
  52. package/esm/helpers/iso/isoCrypto/digest.d.ts +1 -0
  53. package/esm/helpers/iso/isoCrypto/digest.d.ts.map +1 -0
  54. package/esm/helpers/iso/isoCrypto/getRandomValues.d.ts +1 -0
  55. package/esm/helpers/iso/isoCrypto/getRandomValues.d.ts.map +1 -0
  56. package/esm/helpers/iso/isoCrypto/getWebCrypto.d.ts +2 -1
  57. package/esm/helpers/iso/isoCrypto/getWebCrypto.d.ts.map +1 -0
  58. package/esm/helpers/iso/isoCrypto/importKey.d.ts +1 -0
  59. package/esm/helpers/iso/isoCrypto/importKey.d.ts.map +1 -0
  60. package/esm/helpers/iso/isoCrypto/index.d.ts +1 -0
  61. package/esm/helpers/iso/isoCrypto/index.d.ts.map +1 -0
  62. package/esm/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoAlg.d.ts +1 -0
  63. package/esm/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoAlg.d.ts.map +1 -0
  64. package/esm/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoKeyAlgName.d.ts +1 -0
  65. package/esm/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoKeyAlgName.d.ts.map +1 -0
  66. package/esm/helpers/iso/isoCrypto/structs.d.ts +1 -0
  67. package/esm/helpers/iso/isoCrypto/structs.d.ts.map +1 -0
  68. package/esm/helpers/iso/isoCrypto/unwrapEC2Signature.d.ts +3 -1
  69. package/esm/helpers/iso/isoCrypto/unwrapEC2Signature.d.ts.map +1 -0
  70. package/esm/helpers/iso/isoCrypto/unwrapEC2Signature.js +60 -17
  71. package/esm/helpers/iso/isoCrypto/verify.d.ts +1 -0
  72. package/esm/helpers/iso/isoCrypto/verify.d.ts.map +1 -0
  73. package/esm/helpers/iso/isoCrypto/verify.js +6 -2
  74. package/esm/helpers/iso/isoCrypto/verifyEC2.d.ts +1 -0
  75. package/esm/helpers/iso/isoCrypto/verifyEC2.d.ts.map +1 -0
  76. package/esm/helpers/iso/isoCrypto/verifyOKP.d.ts +1 -0
  77. package/esm/helpers/iso/isoCrypto/verifyOKP.d.ts.map +1 -0
  78. package/esm/helpers/iso/isoCrypto/verifyRSA.d.ts +1 -0
  79. package/esm/helpers/iso/isoCrypto/verifyRSA.d.ts.map +1 -0
  80. package/esm/helpers/iso/isoUint8Array.d.ts +1 -0
  81. package/esm/helpers/iso/isoUint8Array.d.ts.map +1 -0
  82. package/esm/helpers/logging.d.ts +1 -0
  83. package/esm/helpers/logging.d.ts.map +1 -0
  84. package/esm/helpers/logging.js +0 -1
  85. package/esm/helpers/mapX509SignatureAlgToCOSEAlg.d.ts +1 -0
  86. package/esm/helpers/mapX509SignatureAlgToCOSEAlg.d.ts.map +1 -0
  87. package/esm/helpers/matchExpectedRPID.d.ts +1 -0
  88. package/esm/helpers/matchExpectedRPID.d.ts.map +1 -0
  89. package/esm/helpers/parseAuthenticatorData.d.ts +1 -0
  90. package/esm/helpers/parseAuthenticatorData.d.ts.map +1 -0
  91. package/esm/helpers/parseAuthenticatorData.js +6 -6
  92. package/esm/helpers/parseBackupFlags.d.ts +2 -1
  93. package/esm/helpers/parseBackupFlags.d.ts.map +1 -0
  94. package/esm/helpers/toHash.d.ts +1 -0
  95. package/esm/helpers/toHash.d.ts.map +1 -0
  96. package/esm/helpers/validateCertificatePath.d.ts +1 -0
  97. package/esm/helpers/validateCertificatePath.d.ts.map +1 -0
  98. package/esm/helpers/validateCertificatePath.js +1 -1
  99. package/esm/helpers/validateExtFIDOGenCEAAGUID.d.ts +7 -0
  100. package/esm/helpers/validateExtFIDOGenCEAAGUID.d.ts.map +1 -0
  101. package/esm/helpers/validateExtFIDOGenCEAAGUID.js +34 -0
  102. package/esm/helpers/verifySignature.d.ts +1 -0
  103. package/esm/helpers/verifySignature.d.ts.map +1 -0
  104. package/esm/index.d.ts +1 -0
  105. package/esm/index.d.ts.map +1 -0
  106. package/esm/metadata/mdsTypes.d.ts +2 -1
  107. package/esm/metadata/mdsTypes.d.ts.map +1 -0
  108. package/esm/metadata/parseJWT.d.ts +1 -0
  109. package/esm/metadata/parseJWT.d.ts.map +1 -0
  110. package/esm/metadata/verifyAttestationWithMetadata.d.ts +2 -1
  111. package/esm/metadata/verifyAttestationWithMetadata.d.ts.map +1 -0
  112. package/esm/metadata/verifyJWT.d.ts +1 -0
  113. package/esm/metadata/verifyJWT.d.ts.map +1 -0
  114. package/esm/registration/generateRegistrationOptions.d.ts +2 -1
  115. package/esm/registration/generateRegistrationOptions.d.ts.map +1 -0
  116. package/esm/registration/verifications/tpm/constants.d.ts +1 -0
  117. package/esm/registration/verifications/tpm/constants.d.ts.map +1 -0
  118. package/esm/registration/verifications/tpm/constants.js +8 -4
  119. package/esm/registration/verifications/tpm/parseCertInfo.d.ts +1 -0
  120. package/esm/registration/verifications/tpm/parseCertInfo.d.ts.map +1 -0
  121. package/esm/registration/verifications/tpm/parsePubArea.d.ts +1 -0
  122. package/esm/registration/verifications/tpm/parsePubArea.d.ts.map +1 -0
  123. package/esm/registration/verifications/tpm/verifyAttestationTPM.d.ts +1 -0
  124. package/esm/registration/verifications/tpm/verifyAttestationTPM.d.ts.map +1 -0
  125. package/esm/registration/verifications/tpm/verifyAttestationTPM.js +11 -3
  126. package/esm/registration/verifications/verifyAttestationAndroidKey.d.ts +1 -0
  127. package/esm/registration/verifications/verifyAttestationAndroidKey.d.ts.map +1 -0
  128. package/esm/registration/verifications/verifyAttestationAndroidKey.js +3 -1
  129. package/esm/registration/verifications/verifyAttestationAndroidSafetyNet.d.ts +1 -0
  130. package/esm/registration/verifications/verifyAttestationAndroidSafetyNet.d.ts.map +1 -0
  131. package/esm/registration/verifications/verifyAttestationApple.d.ts +1 -0
  132. package/esm/registration/verifications/verifyAttestationApple.d.ts.map +1 -0
  133. package/esm/registration/verifications/verifyAttestationApple.js +2 -1
  134. package/esm/registration/verifications/verifyAttestationFIDOU2F.d.ts +1 -0
  135. package/esm/registration/verifications/verifyAttestationFIDOU2F.d.ts.map +1 -0
  136. package/esm/registration/verifications/verifyAttestationPacked.d.ts +1 -0
  137. package/esm/registration/verifications/verifyAttestationPacked.d.ts.map +1 -0
  138. package/esm/registration/verifications/verifyAttestationPacked.js +10 -3
  139. package/esm/registration/verifyRegistrationResponse.d.ts +5 -4
  140. package/esm/registration/verifyRegistrationResponse.d.ts.map +1 -0
  141. package/esm/registration/verifyRegistrationResponse.js +11 -7
  142. package/esm/services/defaultRootCerts/android-key.d.ts +1 -0
  143. package/esm/services/defaultRootCerts/android-key.d.ts.map +1 -0
  144. package/esm/services/defaultRootCerts/android-safetynet.d.ts +1 -0
  145. package/esm/services/defaultRootCerts/android-safetynet.d.ts.map +1 -0
  146. package/esm/services/defaultRootCerts/apple.d.ts +1 -0
  147. package/esm/services/defaultRootCerts/apple.d.ts.map +1 -0
  148. package/esm/services/defaultRootCerts/mds.d.ts +1 -0
  149. package/esm/services/defaultRootCerts/mds.d.ts.map +1 -0
  150. package/esm/services/metadataService.d.ts +19 -4
  151. package/esm/services/metadataService.d.ts.map +1 -0
  152. package/esm/services/metadataService.js +8 -3
  153. package/esm/services/settingsService.d.ts +17 -14
  154. package/esm/services/settingsService.d.ts.map +1 -0
  155. package/esm/services/settingsService.js +14 -0
  156. package/package.json +29 -33
  157. package/script/authentication/generateAuthenticationOptions.d.ts +2 -1
  158. package/script/authentication/generateAuthenticationOptions.d.ts.map +1 -0
  159. package/script/authentication/generateAuthenticationOptions.js +1 -2
  160. package/script/authentication/verifyAuthenticationResponse.d.ts +4 -3
  161. package/script/authentication/verifyAuthenticationResponse.d.ts.map +1 -0
  162. package/script/authentication/verifyAuthenticationResponse.js +8 -9
  163. package/script/helpers/convertAAGUIDToString.d.ts +1 -0
  164. package/script/helpers/convertAAGUIDToString.d.ts.map +1 -0
  165. package/script/helpers/convertAAGUIDToString.js +5 -6
  166. package/script/helpers/convertCOSEtoPKCS.d.ts +1 -0
  167. package/script/helpers/convertCOSEtoPKCS.d.ts.map +1 -0
  168. package/script/helpers/convertCOSEtoPKCS.js +1 -2
  169. package/script/helpers/convertCertBufferToPEM.d.ts +2 -1
  170. package/script/helpers/convertCertBufferToPEM.d.ts.map +1 -0
  171. package/script/helpers/convertCertBufferToPEM.js +1 -2
  172. package/script/helpers/convertPEMToBytes.d.ts +1 -0
  173. package/script/helpers/convertPEMToBytes.d.ts.map +1 -0
  174. package/script/helpers/convertPEMToBytes.js +1 -2
  175. package/script/helpers/convertX509PublicKeyToCOSE.d.ts +1 -0
  176. package/script/helpers/convertX509PublicKeyToCOSE.d.ts.map +1 -0
  177. package/script/helpers/convertX509PublicKeyToCOSE.js +11 -9
  178. package/script/helpers/cose.d.ts +1 -0
  179. package/script/helpers/cose.d.ts.map +1 -0
  180. package/script/helpers/cose.js +11 -11
  181. package/script/helpers/decodeAttestationObject.d.ts +1 -0
  182. package/script/helpers/decodeAttestationObject.d.ts.map +1 -0
  183. package/script/helpers/decodeAttestationObject.js +2 -2
  184. package/script/helpers/decodeAuthenticatorExtensions.d.ts +5 -14
  185. package/script/helpers/decodeAuthenticatorExtensions.d.ts.map +1 -0
  186. package/script/helpers/decodeAuthenticatorExtensions.js +1 -2
  187. package/script/helpers/decodeClientDataJSON.d.ts +2 -1
  188. package/script/helpers/decodeClientDataJSON.d.ts.map +1 -0
  189. package/script/helpers/decodeClientDataJSON.js +2 -2
  190. package/script/helpers/decodeCredentialPublicKey.d.ts +1 -0
  191. package/script/helpers/decodeCredentialPublicKey.d.ts.map +1 -0
  192. package/script/helpers/decodeCredentialPublicKey.js +2 -2
  193. package/script/helpers/fetch.d.ts +1 -0
  194. package/script/helpers/fetch.d.ts.map +1 -0
  195. package/script/helpers/fetch.js +4 -4
  196. package/script/helpers/generateChallenge.d.ts +1 -0
  197. package/script/helpers/generateChallenge.d.ts.map +1 -0
  198. package/script/helpers/generateChallenge.js +2 -2
  199. package/script/helpers/generateUserID.d.ts +1 -0
  200. package/script/helpers/generateUserID.d.ts.map +1 -0
  201. package/script/helpers/generateUserID.js +2 -2
  202. package/script/helpers/getCertificateInfo.d.ts +2 -1
  203. package/script/helpers/getCertificateInfo.d.ts.map +1 -0
  204. package/script/helpers/getCertificateInfo.js +6 -6
  205. package/script/helpers/index.d.ts +1 -0
  206. package/script/helpers/index.d.ts.map +1 -0
  207. package/script/helpers/isCertRevoked.d.ts +2 -1
  208. package/script/helpers/isCertRevoked.d.ts.map +1 -0
  209. package/script/helpers/isCertRevoked.js +10 -10
  210. package/script/helpers/iso/index.d.ts +1 -0
  211. package/script/helpers/iso/index.d.ts.map +1 -0
  212. package/script/helpers/iso/isoBase64URL.d.ts +2 -1
  213. package/script/helpers/iso/isoBase64URL.d.ts.map +1 -0
  214. package/script/helpers/iso/isoBase64URL.js +20 -18
  215. package/script/helpers/iso/isoCBOR.d.ts +2 -1
  216. package/script/helpers/iso/isoCBOR.d.ts.map +1 -0
  217. package/script/helpers/iso/isoCBOR.js +28 -6
  218. package/script/helpers/iso/isoCrypto/digest.d.ts +1 -0
  219. package/script/helpers/iso/isoCrypto/digest.d.ts.map +1 -0
  220. package/script/helpers/iso/isoCrypto/digest.js +1 -2
  221. package/script/helpers/iso/isoCrypto/getRandomValues.d.ts +1 -0
  222. package/script/helpers/iso/isoCrypto/getRandomValues.d.ts.map +1 -0
  223. package/script/helpers/iso/isoCrypto/getRandomValues.js +1 -2
  224. package/script/helpers/iso/isoCrypto/getWebCrypto.d.ts +2 -1
  225. package/script/helpers/iso/isoCrypto/getWebCrypto.d.ts.map +1 -0
  226. package/script/helpers/iso/isoCrypto/getWebCrypto.js +2 -2
  227. package/script/helpers/iso/isoCrypto/importKey.d.ts +1 -0
  228. package/script/helpers/iso/isoCrypto/importKey.d.ts.map +1 -0
  229. package/script/helpers/iso/isoCrypto/importKey.js +1 -2
  230. package/script/helpers/iso/isoCrypto/index.d.ts +1 -0
  231. package/script/helpers/iso/isoCrypto/index.d.ts.map +1 -0
  232. package/script/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoAlg.d.ts +1 -0
  233. package/script/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoAlg.d.ts.map +1 -0
  234. package/script/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoAlg.js +1 -2
  235. package/script/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoKeyAlgName.d.ts +1 -0
  236. package/script/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoKeyAlgName.d.ts.map +1 -0
  237. package/script/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoKeyAlgName.js +1 -2
  238. package/script/helpers/iso/isoCrypto/structs.d.ts +1 -0
  239. package/script/helpers/iso/isoCrypto/structs.d.ts.map +1 -0
  240. package/script/helpers/iso/isoCrypto/unwrapEC2Signature.d.ts +3 -1
  241. package/script/helpers/iso/isoCrypto/unwrapEC2Signature.d.ts.map +1 -0
  242. package/script/helpers/iso/isoCrypto/unwrapEC2Signature.js +62 -20
  243. package/script/helpers/iso/isoCrypto/verify.d.ts +1 -0
  244. package/script/helpers/iso/isoCrypto/verify.d.ts.map +1 -0
  245. package/script/helpers/iso/isoCrypto/verify.js +6 -3
  246. package/script/helpers/iso/isoCrypto/verifyEC2.d.ts +1 -0
  247. package/script/helpers/iso/isoCrypto/verifyEC2.d.ts.map +1 -0
  248. package/script/helpers/iso/isoCrypto/verifyEC2.js +1 -2
  249. package/script/helpers/iso/isoCrypto/verifyOKP.d.ts +1 -0
  250. package/script/helpers/iso/isoCrypto/verifyOKP.d.ts.map +1 -0
  251. package/script/helpers/iso/isoCrypto/verifyOKP.js +1 -2
  252. package/script/helpers/iso/isoCrypto/verifyRSA.d.ts +1 -0
  253. package/script/helpers/iso/isoCrypto/verifyRSA.d.ts.map +1 -0
  254. package/script/helpers/iso/isoCrypto/verifyRSA.js +1 -2
  255. package/script/helpers/iso/isoUint8Array.d.ts +1 -0
  256. package/script/helpers/iso/isoUint8Array.d.ts.map +1 -0
  257. package/script/helpers/iso/isoUint8Array.js +8 -9
  258. package/script/helpers/logging.d.ts +1 -0
  259. package/script/helpers/logging.d.ts.map +1 -0
  260. package/script/helpers/logging.js +2 -4
  261. package/script/helpers/mapX509SignatureAlgToCOSEAlg.d.ts +1 -0
  262. package/script/helpers/mapX509SignatureAlgToCOSEAlg.d.ts.map +1 -0
  263. package/script/helpers/mapX509SignatureAlgToCOSEAlg.js +1 -2
  264. package/script/helpers/matchExpectedRPID.d.ts +1 -0
  265. package/script/helpers/matchExpectedRPID.d.ts.map +1 -0
  266. package/script/helpers/matchExpectedRPID.js +1 -2
  267. package/script/helpers/parseAuthenticatorData.d.ts +1 -0
  268. package/script/helpers/parseAuthenticatorData.d.ts.map +1 -0
  269. package/script/helpers/parseAuthenticatorData.js +8 -8
  270. package/script/helpers/parseBackupFlags.d.ts +2 -1
  271. package/script/helpers/parseBackupFlags.d.ts.map +1 -0
  272. package/script/helpers/parseBackupFlags.js +2 -2
  273. package/script/helpers/toHash.d.ts +1 -0
  274. package/script/helpers/toHash.d.ts.map +1 -0
  275. package/script/helpers/toHash.js +1 -2
  276. package/script/helpers/validateCertificatePath.d.ts +1 -0
  277. package/script/helpers/validateCertificatePath.d.ts.map +1 -0
  278. package/script/helpers/validateCertificatePath.js +3 -4
  279. package/script/helpers/validateExtFIDOGenCEAAGUID.d.ts +7 -0
  280. package/script/helpers/validateExtFIDOGenCEAAGUID.d.ts.map +1 -0
  281. package/script/helpers/validateExtFIDOGenCEAAGUID.js +37 -0
  282. package/script/helpers/verifySignature.d.ts +1 -0
  283. package/script/helpers/verifySignature.d.ts.map +1 -0
  284. package/script/helpers/verifySignature.js +2 -2
  285. package/script/index.d.ts +1 -0
  286. package/script/index.d.ts.map +1 -0
  287. package/script/metadata/mdsTypes.d.ts +2 -1
  288. package/script/metadata/mdsTypes.d.ts.map +1 -0
  289. package/script/metadata/parseJWT.d.ts +1 -0
  290. package/script/metadata/parseJWT.d.ts.map +1 -0
  291. package/script/metadata/parseJWT.js +1 -2
  292. package/script/metadata/verifyAttestationWithMetadata.d.ts +2 -1
  293. package/script/metadata/verifyAttestationWithMetadata.d.ts.map +1 -0
  294. package/script/metadata/verifyAttestationWithMetadata.js +2 -2
  295. package/script/metadata/verifyJWT.d.ts +1 -0
  296. package/script/metadata/verifyJWT.d.ts.map +1 -0
  297. package/script/metadata/verifyJWT.js +1 -2
  298. package/script/registration/generateRegistrationOptions.d.ts +2 -1
  299. package/script/registration/generateRegistrationOptions.d.ts.map +1 -0
  300. package/script/registration/generateRegistrationOptions.js +2 -2
  301. package/script/registration/verifications/tpm/constants.d.ts +1 -0
  302. package/script/registration/verifications/tpm/constants.d.ts.map +1 -0
  303. package/script/registration/verifications/tpm/constants.js +8 -4
  304. package/script/registration/verifications/tpm/parseCertInfo.d.ts +1 -0
  305. package/script/registration/verifications/tpm/parseCertInfo.d.ts.map +1 -0
  306. package/script/registration/verifications/tpm/parseCertInfo.js +1 -2
  307. package/script/registration/verifications/tpm/parsePubArea.d.ts +1 -0
  308. package/script/registration/verifications/tpm/parsePubArea.d.ts.map +1 -0
  309. package/script/registration/verifications/tpm/parsePubArea.js +1 -2
  310. package/script/registration/verifications/tpm/verifyAttestationTPM.d.ts +1 -0
  311. package/script/registration/verifications/tpm/verifyAttestationTPM.d.ts.map +1 -0
  312. package/script/registration/verifications/tpm/verifyAttestationTPM.js +17 -10
  313. package/script/registration/verifications/verifyAttestationAndroidKey.d.ts +1 -0
  314. package/script/registration/verifications/verifyAttestationAndroidKey.d.ts.map +1 -0
  315. package/script/registration/verifications/verifyAttestationAndroidKey.js +7 -6
  316. package/script/registration/verifications/verifyAttestationAndroidSafetyNet.d.ts +1 -0
  317. package/script/registration/verifications/verifyAttestationAndroidSafetyNet.d.ts.map +1 -0
  318. package/script/registration/verifications/verifyAttestationAndroidSafetyNet.js +1 -2
  319. package/script/registration/verifications/verifyAttestationApple.d.ts +1 -0
  320. package/script/registration/verifications/verifyAttestationApple.d.ts.map +1 -0
  321. package/script/registration/verifications/verifyAttestationApple.js +4 -4
  322. package/script/registration/verifications/verifyAttestationFIDOU2F.d.ts +1 -0
  323. package/script/registration/verifications/verifyAttestationFIDOU2F.d.ts.map +1 -0
  324. package/script/registration/verifications/verifyAttestationFIDOU2F.js +1 -2
  325. package/script/registration/verifications/verifyAttestationPacked.d.ts +1 -0
  326. package/script/registration/verifications/verifyAttestationPacked.d.ts.map +1 -0
  327. package/script/registration/verifications/verifyAttestationPacked.js +11 -5
  328. package/script/registration/verifyRegistrationResponse.d.ts +5 -4
  329. package/script/registration/verifyRegistrationResponse.d.ts.map +1 -0
  330. package/script/registration/verifyRegistrationResponse.js +12 -9
  331. package/script/services/defaultRootCerts/android-key.d.ts +1 -0
  332. package/script/services/defaultRootCerts/android-key.d.ts.map +1 -0
  333. package/script/services/defaultRootCerts/android-safetynet.d.ts +1 -0
  334. package/script/services/defaultRootCerts/android-safetynet.d.ts.map +1 -0
  335. package/script/services/defaultRootCerts/apple.d.ts +1 -0
  336. package/script/services/defaultRootCerts/apple.d.ts.map +1 -0
  337. package/script/services/defaultRootCerts/mds.d.ts +1 -0
  338. package/script/services/defaultRootCerts/mds.d.ts.map +1 -0
  339. package/script/services/metadataService.d.ts +19 -4
  340. package/script/services/metadataService.d.ts.map +1 -0
  341. package/script/services/metadataService.js +8 -3
  342. package/script/services/settingsService.d.ts +17 -14
  343. package/script/services/settingsService.d.ts.map +1 -0
  344. package/script/services/settingsService.js +14 -0
  345. package/esm/deps.d.ts +0 -9
  346. package/esm/deps.js +0 -12
  347. package/script/deps.d.ts +0 -9
  348. package/script/deps.js +0 -68
@@ -1,7 +1,17 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.trimPadding = exports.isBase64URL = exports.isBase64 = exports.toUTF8String = exports.fromUTF8String = exports.toBase64 = exports.fromBuffer = exports.toBuffer = void 0;
4
- const deps_js_1 = require("../../deps.js");
6
+ exports.toBuffer = toBuffer;
7
+ exports.fromBuffer = fromBuffer;
8
+ exports.toBase64 = toBase64;
9
+ exports.fromUTF8String = fromUTF8String;
10
+ exports.toUTF8String = toUTF8String;
11
+ exports.isBase64 = isBase64;
12
+ exports.isBase64URL = isBase64URL;
13
+ exports.trimPadding = trimPadding;
14
+ const base64_1 = __importDefault(require("@hexagon/base64"));
5
15
  /**
6
16
  * Decode from a Base64URL-encoded string to an ArrayBuffer. Best used when converting a
7
17
  * credential ID from a JSON string to an ArrayBuffer, like in allowCredentials or
@@ -11,10 +21,9 @@ const deps_js_1 = require("../../deps.js");
11
21
  * @param to (optional) The decoding to use, in case it's desirable to decode from base64 instead
12
22
  */
13
23
  function toBuffer(base64urlString, from = 'base64url') {
14
- const _buffer = deps_js_1.base64.toArrayBuffer(base64urlString, from === 'base64url');
24
+ const _buffer = base64_1.default.toArrayBuffer(base64urlString, from === 'base64url');
15
25
  return new Uint8Array(_buffer);
16
26
  }
17
- exports.toBuffer = toBuffer;
18
27
  /**
19
28
  * Encode the given array buffer into a Base64URL-encoded string. Ideal for converting various
20
29
  * credential response ArrayBuffers to string for sending back to the server as JSON.
@@ -23,52 +32,45 @@ exports.toBuffer = toBuffer;
23
32
  * @param to (optional) The encoding to use, in case it's desirable to encode to base64 instead
24
33
  */
25
34
  function fromBuffer(buffer, to = 'base64url') {
26
- return deps_js_1.base64.fromArrayBuffer(buffer, to === 'base64url');
35
+ return base64_1.default.fromArrayBuffer(buffer, to === 'base64url');
27
36
  }
28
- exports.fromBuffer = fromBuffer;
29
37
  /**
30
38
  * Convert a base64url string into base64
31
39
  */
32
40
  function toBase64(base64urlString) {
33
- const fromBase64Url = deps_js_1.base64.toArrayBuffer(base64urlString, true);
34
- const toBase64 = deps_js_1.base64.fromArrayBuffer(fromBase64Url);
41
+ const fromBase64Url = base64_1.default.toArrayBuffer(base64urlString, true);
42
+ const toBase64 = base64_1.default.fromArrayBuffer(fromBase64Url);
35
43
  return toBase64;
36
44
  }
37
- exports.toBase64 = toBase64;
38
45
  /**
39
46
  * Encode a UTF-8 string to base64url
40
47
  */
41
48
  function fromUTF8String(utf8String) {
42
- return deps_js_1.base64.fromString(utf8String, true);
49
+ return base64_1.default.fromString(utf8String, true);
43
50
  }
44
- exports.fromUTF8String = fromUTF8String;
45
51
  /**
46
52
  * Decode a base64url string into its original UTF-8 string
47
53
  */
48
54
  function toUTF8String(base64urlString) {
49
- return deps_js_1.base64.toString(base64urlString, true);
55
+ return base64_1.default.toString(base64urlString, true);
50
56
  }
51
- exports.toUTF8String = toUTF8String;
52
57
  /**
53
58
  * Confirm that the string is encoded into base64
54
59
  */
55
60
  function isBase64(input) {
56
- return deps_js_1.base64.validate(input, false);
61
+ return base64_1.default.validate(input, false);
57
62
  }
58
- exports.isBase64 = isBase64;
59
63
  /**
60
64
  * Confirm that the string is encoded into base64url, with support for optional padding
61
65
  */
62
66
  function isBase64URL(input) {
63
67
  // Trim padding characters from the string if present
64
68
  input = trimPadding(input);
65
- return deps_js_1.base64.validate(input, true);
69
+ return base64_1.default.validate(input, true);
66
70
  }
67
- exports.isBase64URL = isBase64URL;
68
71
  /**
69
72
  * Remove optional padding from a base64url-encoded string
70
73
  */
71
74
  function trimPadding(input) {
72
75
  return input.replace(/=/g, '');
73
76
  }
74
- exports.trimPadding = trimPadding;
@@ -1,4 +1,4 @@
1
- import { tinyCbor } from '../../deps.js';
1
+ import * as tinyCbor from '@levischuck/tiny-cbor';
2
2
  /**
3
3
  * Whatever CBOR encoder is used should keep CBOR data the same length when data is re-encoded
4
4
  *
@@ -21,3 +21,4 @@ export declare function decodeFirst<Type>(input: Uint8Array): Type;
21
21
  * Encode data to CBOR
22
22
  */
23
23
  export declare function encode(input: tinyCbor.CBORType): Uint8Array;
24
+ //# sourceMappingURL=isoCBOR.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isoCBOR.d.ts","sourceRoot":"","sources":["../../../src/helpers/iso/isoCBOR.ts"],"names":[],"mappings":"AAAA,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,7 +1,31 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.encode = exports.decodeFirst = void 0;
4
- const deps_js_1 = require("../../deps.js");
26
+ exports.decodeFirst = decodeFirst;
27
+ exports.encode = encode;
28
+ const tinyCbor = __importStar(require("@levischuck/tiny-cbor"));
5
29
  /**
6
30
  * Whatever CBOR encoder is used should keep CBOR data the same length when data is re-encoded
7
31
  *
@@ -22,15 +46,13 @@ const deps_js_1 = require("../../deps.js");
22
46
  function decodeFirst(input) {
23
47
  // Make a copy so we don't mutate the original
24
48
  const _input = new Uint8Array(input);
25
- const decoded = deps_js_1.tinyCbor.decodePartialCBOR(_input, 0);
49
+ const decoded = tinyCbor.decodePartialCBOR(_input, 0);
26
50
  const [first] = decoded;
27
51
  return first;
28
52
  }
29
- exports.decodeFirst = decodeFirst;
30
53
  /**
31
54
  * Encode data to CBOR
32
55
  */
33
56
  function encode(input) {
34
- return deps_js_1.tinyCbor.encodeCBOR(input);
57
+ return tinyCbor.encodeCBOR(input);
35
58
  }
36
- exports.encode = encode;
@@ -6,3 +6,4 @@ import { COSEALG } from '../../cose.js';
6
6
  * @param algorithm A COSE algorithm ID that maps to a desired SHA algorithm
7
7
  */
8
8
  export declare function digest(data: Uint8Array, algorithm: COSEALG): Promise<Uint8Array>;
9
+ //# sourceMappingURL=digest.d.ts.map
@@ -0,0 +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,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.digest = void 0;
3
+ exports.digest = digest;
4
4
  const mapCoseAlgToWebCryptoAlg_js_1 = require("./mapCoseAlgToWebCryptoAlg.js");
5
5
  const getWebCrypto_js_1 = require("./getWebCrypto.js");
6
6
  /**
@@ -15,4 +15,3 @@ async function digest(data, algorithm) {
15
15
  const hashed = await WebCrypto.subtle.digest(subtleAlgorithm, data);
16
16
  return new Uint8Array(hashed);
17
17
  }
18
- exports.digest = digest;
@@ -4,3 +4,4 @@
4
4
  * @returns the same bytes array passed into the method
5
5
  */
6
6
  export declare function getRandomValues(array: Uint8Array): Promise<Uint8Array>;
7
+ //# sourceMappingURL=getRandomValues.d.ts.map
@@ -0,0 +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,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getRandomValues = void 0;
3
+ exports.getRandomValues = getRandomValues;
4
4
  const getWebCrypto_js_1 = require("./getWebCrypto.js");
5
5
  /**
6
6
  * Fill up the provided bytes array with random bytes equal to its length.
@@ -12,4 +12,3 @@ async function getRandomValues(array) {
12
12
  WebCrypto.getRandomValues(array);
13
13
  return array;
14
14
  }
15
- exports.getRandomValues = getRandomValues;
@@ -1,4 +1,4 @@
1
- import type { Crypto } from '../../../deps.js';
1
+ import type { Crypto } from '@simplewebauthn/types';
2
2
  /**
3
3
  * Try to get an instance of the Crypto API from the current runtime. Should support Node,
4
4
  * as well as others, like Deno, that implement Web APIs.
@@ -11,3 +11,4 @@ export declare const _getWebCryptoInternals: {
11
11
  stubThisGlobalThisCrypto: () => globalThis.Crypto;
12
12
  setCachedCrypto: (newCrypto: Crypto | undefined) => void;
13
13
  };
14
+ //# sourceMappingURL=getWebCrypto.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getWebCrypto.d.ts","sourceRoot":"","sources":["../../../../src/helpers/iso/isoCrypto/getWebCrypto.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAIpD;;;GAGG;AACH,wBAAgB,YAAY,IAAI,OAAO,CAAC,MAAM,CAAC,CAgC9C;AAED,qBAAa,gBAAiB,SAAQ,KAAK;;CAM1C;AAGD,eAAO,MAAM,sBAAsB;;iCAGJ,MAAM,GAAG,SAAS;CAGhD,CAAC"}
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports._getWebCryptoInternals = exports.MissingWebCrypto = exports.getWebCrypto = void 0;
3
+ exports._getWebCryptoInternals = exports.MissingWebCrypto = void 0;
4
+ exports.getWebCrypto = getWebCrypto;
4
5
  let webCrypto = undefined;
5
6
  /**
6
7
  * Try to get an instance of the Crypto API from the current runtime. Should support Node,
@@ -35,7 +36,6 @@ function getWebCrypto() {
35
36
  });
36
37
  return toResolve;
37
38
  }
38
- exports.getWebCrypto = getWebCrypto;
39
39
  class MissingWebCrypto extends Error {
40
40
  constructor() {
41
41
  const message = 'An instance of the Crypto API could not be located';
@@ -2,3 +2,4 @@ export declare function importKey(opts: {
2
2
  keyData: JsonWebKey;
3
3
  algorithm: AlgorithmIdentifier | RsaHashedImportParams | EcKeyImportParams;
4
4
  }): Promise<CryptoKey>;
5
+ //# sourceMappingURL=importKey.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"importKey.d.ts","sourceRoot":"","sources":["../../../../src/helpers/iso/isoCrypto/importKey.ts"],"names":[],"mappings":"AAEA,wBAAsB,SAAS,CAAC,IAAI,EAAE;IACpC,OAAO,EAAE,UAAU,CAAC;IACpB,SAAS,EAAE,mBAAmB,GAAG,qBAAqB,GAAG,iBAAiB,CAAC;CAC5E,GAAG,OAAO,CAAC,SAAS,CAAC,CAQrB"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.importKey = void 0;
3
+ exports.importKey = importKey;
4
4
  const getWebCrypto_js_1 = require("./getWebCrypto.js");
5
5
  async function importKey(opts) {
6
6
  const WebCrypto = await (0, getWebCrypto_js_1.getWebCrypto)();
@@ -9,4 +9,3 @@ async function importKey(opts) {
9
9
  'verify',
10
10
  ]);
11
11
  }
12
- exports.importKey = importKey;
@@ -1,3 +1,4 @@
1
1
  export { digest } from './digest.js';
2
2
  export { getRandomValues } from './getRandomValues.js';
3
3
  export { verify } from './verify.js';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/helpers/iso/isoCrypto/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC"}
@@ -4,3 +4,4 @@ import { COSEALG } from '../../cose.js';
4
4
  * Convert a COSE alg ID into a corresponding string value that WebCrypto APIs expect
5
5
  */
6
6
  export declare function mapCoseAlgToWebCryptoAlg(alg: COSEALG): SubtleCryptoAlg;
7
+ //# sourceMappingURL=mapCoseAlgToWebCryptoAlg.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mapCoseAlgToWebCryptoAlg.d.ts","sourceRoot":"","sources":["../../../../src/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoAlg.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,OAAO,GAAG,eAAe,CAetE"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.mapCoseAlgToWebCryptoAlg = void 0;
3
+ exports.mapCoseAlgToWebCryptoAlg = mapCoseAlgToWebCryptoAlg;
4
4
  const cose_js_1 = require("../../cose.js");
5
5
  /**
6
6
  * Convert a COSE alg ID into a corresponding string value that WebCrypto APIs expect
@@ -21,4 +21,3 @@ function mapCoseAlgToWebCryptoAlg(alg) {
21
21
  }
22
22
  throw new Error(`Could not map COSE alg value of ${alg} to a WebCrypto alg`);
23
23
  }
24
- exports.mapCoseAlgToWebCryptoAlg = mapCoseAlgToWebCryptoAlg;
@@ -4,3 +4,4 @@ import { SubtleCryptoKeyAlgName } from './structs.js';
4
4
  * Convert a COSE alg ID into a corresponding key algorithm string value that WebCrypto APIs expect
5
5
  */
6
6
  export declare function mapCoseAlgToWebCryptoKeyAlgName(alg: COSEALG): SubtleCryptoKeyAlgName;
7
+ //# sourceMappingURL=mapCoseAlgToWebCryptoKeyAlgName.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mapCoseAlgToWebCryptoKeyAlgName.d.ts","sourceRoot":"","sources":["../../../../src/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoKeyAlgName.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAEtD;;GAEG;AACH,wBAAgB,+BAA+B,CAC7C,GAAG,EAAE,OAAO,GACX,sBAAsB,CAoBxB"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.mapCoseAlgToWebCryptoKeyAlgName = void 0;
3
+ exports.mapCoseAlgToWebCryptoKeyAlgName = mapCoseAlgToWebCryptoKeyAlgName;
4
4
  const cose_js_1 = require("../../cose.js");
5
5
  /**
6
6
  * Convert a COSE alg ID into a corresponding key algorithm string value that WebCrypto APIs expect
@@ -20,4 +20,3 @@ function mapCoseAlgToWebCryptoKeyAlgName(alg) {
20
20
  }
21
21
  throw new Error(`Could not map COSE alg value of ${alg} to a WebCrypto key alg name`);
22
22
  }
23
- exports.mapCoseAlgToWebCryptoKeyAlgName = mapCoseAlgToWebCryptoKeyAlgName;
@@ -1,3 +1,4 @@
1
1
  export type SubtleCryptoAlg = 'SHA-1' | 'SHA-256' | 'SHA-384' | 'SHA-512';
2
2
  export type SubtleCryptoCrv = 'P-256' | 'P-384' | 'P-521' | 'Ed25519';
3
3
  export type SubtleCryptoKeyAlgName = 'ECDSA' | 'Ed25519' | 'RSASSA-PKCS1-v1_5' | 'RSA-PSS';
4
+ //# sourceMappingURL=structs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"structs.d.ts","sourceRoot":"","sources":["../../../../src/helpers/iso/isoCrypto/structs.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,CAAC;AAC1E,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,SAAS,CAAC;AACtE,MAAM,MAAM,sBAAsB,GAC9B,OAAO,GACP,SAAS,GACT,mBAAmB,GACnB,SAAS,CAAC"}
@@ -1,6 +1,8 @@
1
+ import { COSECRV } from '../../cose.js';
1
2
  /**
2
3
  * In WebAuthn, EC2 signatures are wrapped in ASN.1 structure so we need to peel r and s apart.
3
4
  *
4
5
  * See https://www.w3.org/TR/webauthn-2/#sctn-signature-attestation-types
5
6
  */
6
- export declare function unwrapEC2Signature(signature: Uint8Array): Uint8Array;
7
+ export declare function unwrapEC2Signature(signature: Uint8Array, crv: COSECRV): Uint8Array;
8
+ //# sourceMappingURL=unwrapEC2Signature.d.ts.map
@@ -0,0 +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,34 +1,76 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.unwrapEC2Signature = void 0;
4
- const deps_js_1 = require("../../../deps.js");
3
+ exports.unwrapEC2Signature = unwrapEC2Signature;
4
+ const asn1_schema_1 = require("@peculiar/asn1-schema");
5
+ const asn1_ecc_1 = require("@peculiar/asn1-ecc");
6
+ const cose_js_1 = require("../../cose.js");
5
7
  const index_js_1 = require("../index.js");
6
8
  /**
7
9
  * In WebAuthn, EC2 signatures are wrapped in ASN.1 structure so we need to peel r and s apart.
8
10
  *
9
11
  * See https://www.w3.org/TR/webauthn-2/#sctn-signature-attestation-types
10
12
  */
11
- function unwrapEC2Signature(signature) {
12
- const parsedSignature = deps_js_1.AsnParser.parse(signature, deps_js_1.ECDSASigValue);
13
- let rBytes = new Uint8Array(parsedSignature.r);
14
- let sBytes = new Uint8Array(parsedSignature.s);
15
- if (shouldRemoveLeadingZero(rBytes)) {
16
- rBytes = rBytes.slice(1);
17
- }
18
- if (shouldRemoveLeadingZero(sBytes)) {
19
- sBytes = sBytes.slice(1);
20
- }
21
- const finalSignature = index_js_1.isoUint8Array.concat([rBytes, sBytes]);
13
+ function unwrapEC2Signature(signature, crv) {
14
+ const parsedSignature = asn1_schema_1.AsnParser.parse(signature, asn1_ecc_1.ECDSASigValue);
15
+ const rBytes = new Uint8Array(parsedSignature.r);
16
+ const sBytes = new Uint8Array(parsedSignature.s);
17
+ const componentLength = getSignatureComponentLength(crv);
18
+ const rNormalizedBytes = toNormalizedBytes(rBytes, componentLength);
19
+ const sNormalizedBytes = toNormalizedBytes(sBytes, componentLength);
20
+ const finalSignature = index_js_1.isoUint8Array.concat([
21
+ rNormalizedBytes,
22
+ sNormalizedBytes,
23
+ ]);
22
24
  return finalSignature;
23
25
  }
24
- exports.unwrapEC2Signature = unwrapEC2Signature;
25
26
  /**
26
- * Determine if the DER-specific `00` byte at the start of an ECDSA signature byte sequence
27
- * should be removed based on the following logic:
27
+ * The SubtleCrypto Web Crypto API expects ECDSA signatures with `r` and `s` values to be encoded
28
+ * to a specific length depending on the order of the curve. This function returns the expected
29
+ * byte-length for each of the `r` and `s` signature components.
30
+ *
31
+ * See <https://www.w3.org/TR/WebCryptoAPI/#ecdsa-operations>
32
+ */
33
+ function getSignatureComponentLength(crv) {
34
+ switch (crv) {
35
+ case cose_js_1.COSECRV.P256:
36
+ return 32;
37
+ case cose_js_1.COSECRV.P384:
38
+ return 48;
39
+ case cose_js_1.COSECRV.P521:
40
+ return 66;
41
+ default:
42
+ throw new Error(`Unexpected COSE crv value of ${crv} (EC2)`);
43
+ }
44
+ }
45
+ /**
46
+ * Converts the ASN.1 integer representation to bytes of a specific length `n`.
28
47
  *
29
- * "If the leading byte is 0x0, and the the high order bit on the second byte is not set to 0,
30
- * then remove the leading 0x0 byte"
48
+ * DER encodes integers as big-endian byte arrays, with as small as possible representation and
49
+ * requires a leading `0` byte to disambiguate between negative and positive numbers. This means
50
+ * that `r` and `s` can potentially not be the expected byte-length that is needed by the
51
+ * SubtleCrypto Web Crypto API: if there are leading `0`s it can be shorter than expected, and if
52
+ * it has a leading `1` bit, it can be one byte longer.
53
+ *
54
+ * See <https://www.itu.int/rec/T-REC-X.690-202102-I/en>
55
+ * See <https://www.w3.org/TR/WebCryptoAPI/#ecdsa-operations>
31
56
  */
32
- function shouldRemoveLeadingZero(bytes) {
33
- return bytes[0] === 0x0 && (bytes[1] & (1 << 7)) !== 0;
57
+ function toNormalizedBytes(bytes, componentLength) {
58
+ let normalizedBytes;
59
+ if (bytes.length < componentLength) {
60
+ // In case the bytes are shorter than expected, we need to pad it with leading `0`s.
61
+ normalizedBytes = new Uint8Array(componentLength);
62
+ normalizedBytes.set(bytes, componentLength - bytes.length);
63
+ }
64
+ else if (bytes.length === componentLength) {
65
+ normalizedBytes = bytes;
66
+ }
67
+ else if (bytes.length === componentLength + 1 && bytes[0] === 0 && (bytes[1] & 0x80) === 0x80) {
68
+ // The bytes contain a leading `0` to encode that the integer is positive. This leading `0`
69
+ // needs to be removed for compatibility with the SubtleCrypto Web Crypto API.
70
+ normalizedBytes = bytes.subarray(1);
71
+ }
72
+ else {
73
+ throw new Error(`Invalid signature component length ${bytes.length}, expected ${componentLength}`);
74
+ }
75
+ return normalizedBytes;
34
76
  }
@@ -8,3 +8,4 @@ export declare function verify(opts: {
8
8
  data: Uint8Array;
9
9
  shaHashOverride?: COSEALG;
10
10
  }): Promise<boolean>;
11
+ //# sourceMappingURL=verify.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verify.d.ts","sourceRoot":"","sources":["../../../../src/helpers/iso/isoCrypto/verify.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EAEP,aAAa,EAKd,MAAM,eAAe,CAAC;AAMvB;;GAEG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE;IAC3B,aAAa,EAAE,aAAa,CAAC;IAC7B,SAAS,EAAE,UAAU,CAAC;IACtB,IAAI,EAAE,UAAU,CAAC;IACjB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,GAAG,OAAO,CAAC,OAAO,CAAC,CAyBnB"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.verify = void 0;
3
+ exports.verify = verify;
4
4
  const cose_js_1 = require("../../cose.js");
5
5
  const verifyEC2_js_1 = require("./verifyEC2.js");
6
6
  const verifyRSA_js_1 = require("./verifyRSA.js");
@@ -12,7 +12,11 @@ const unwrapEC2Signature_js_1 = require("./unwrapEC2Signature.js");
12
12
  function verify(opts) {
13
13
  const { cosePublicKey, signature, data, shaHashOverride } = opts;
14
14
  if ((0, cose_js_1.isCOSEPublicKeyEC2)(cosePublicKey)) {
15
- const unwrappedSignature = (0, unwrapEC2Signature_js_1.unwrapEC2Signature)(signature);
15
+ const crv = cosePublicKey.get(cose_js_1.COSEKEYS.crv);
16
+ if (!(0, cose_js_1.isCOSECrv)(crv)) {
17
+ throw new Error(`unknown COSE curve ${crv}`);
18
+ }
19
+ const unwrappedSignature = (0, unwrapEC2Signature_js_1.unwrapEC2Signature)(signature, crv);
16
20
  return (0, verifyEC2_js_1.verifyEC2)({
17
21
  cosePublicKey,
18
22
  signature: unwrappedSignature,
@@ -29,4 +33,3 @@ function verify(opts) {
29
33
  const kty = cosePublicKey.get(cose_js_1.COSEKEYS.kty);
30
34
  throw new Error(`Signature verification with public key of kty ${kty} is not supported by this method`);
31
35
  }
32
- exports.verify = verify;
@@ -8,3 +8,4 @@ export declare function verifyEC2(opts: {
8
8
  data: Uint8Array;
9
9
  shaHashOverride?: COSEALG;
10
10
  }): Promise<boolean>;
11
+ //# sourceMappingURL=verifyEC2.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verifyEC2.d.ts","sourceRoot":"","sources":["../../../../src/helpers/iso/isoCrypto/verifyEC2.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAqB,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAO7E;;GAEG;AACH,wBAAsB,SAAS,CAAC,IAAI,EAAE;IACpC,aAAa,EAAE,gBAAgB,CAAC;IAChC,SAAS,EAAE,UAAU,CAAC;IACtB,IAAI,EAAE,UAAU,CAAC;IACjB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,GAAG,OAAO,CAAC,OAAO,CAAC,CA0EnB"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.verifyEC2 = void 0;
3
+ exports.verifyEC2 = verifyEC2;
4
4
  const cose_js_1 = require("../../cose.js");
5
5
  const mapCoseAlgToWebCryptoAlg_js_1 = require("./mapCoseAlgToWebCryptoAlg.js");
6
6
  const importKey_js_1 = require("./importKey.js");
@@ -74,4 +74,3 @@ async function verifyEC2(opts) {
74
74
  };
75
75
  return WebCrypto.subtle.verify(verifyAlgorithm, key, signature, data);
76
76
  }
77
- exports.verifyEC2 = verifyEC2;
@@ -4,3 +4,4 @@ export declare function verifyOKP(opts: {
4
4
  signature: Uint8Array;
5
5
  data: Uint8Array;
6
6
  }): Promise<boolean>;
7
+ //# sourceMappingURL=verifyOKP.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verifyOKP.d.ts","sourceRoot":"","sources":["../../../../src/helpers/iso/isoCrypto/verifyOKP.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,gBAAgB,EAAa,MAAM,eAAe,CAAC;AAM/E,wBAAsB,SAAS,CAAC,IAAI,EAAE;IACpC,aAAa,EAAE,gBAAgB,CAAC;IAChC,SAAS,EAAE,UAAU,CAAC;IACtB,IAAI,EAAE,UAAU,CAAC;CAClB,GAAG,OAAO,CAAC,OAAO,CAAC,CAyDnB"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.verifyOKP = void 0;
3
+ exports.verifyOKP = verifyOKP;
4
4
  const cose_js_1 = require("../../cose.js");
5
5
  const index_js_1 = require("../../index.js");
6
6
  const importKey_js_1 = require("./importKey.js");
@@ -52,4 +52,3 @@ async function verifyOKP(opts) {
52
52
  };
53
53
  return WebCrypto.subtle.verify(verifyAlgorithm, key, signature, data);
54
54
  }
55
- exports.verifyOKP = verifyOKP;
@@ -8,3 +8,4 @@ export declare function verifyRSA(opts: {
8
8
  data: Uint8Array;
9
9
  shaHashOverride?: COSEALG;
10
10
  }): Promise<boolean>;
11
+ //# sourceMappingURL=verifyRSA.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verifyRSA.d.ts","sourceRoot":"","sources":["../../../../src/helpers/iso/isoCrypto/verifyRSA.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAY,gBAAgB,EAAa,MAAM,eAAe,CAAC;AAO/E;;GAEG;AACH,wBAAsB,SAAS,CAAC,IAAI,EAAE;IACpC,aAAa,EAAE,gBAAgB,CAAC;IAChC,SAAS,EAAE,UAAU,CAAC;IACtB,IAAI,EAAE,UAAU,CAAC;IACjB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,GAAG,OAAO,CAAC,OAAO,CAAC,CA2FnB"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.verifyRSA = void 0;
3
+ exports.verifyRSA = verifyRSA;
4
4
  const cose_js_1 = require("../../cose.js");
5
5
  const mapCoseAlgToWebCryptoAlg_js_1 = require("./mapCoseAlgToWebCryptoAlg.js");
6
6
  const importKey_js_1 = require("./importKey.js");
@@ -92,4 +92,3 @@ async function verifyRSA(opts) {
92
92
  });
93
93
  return WebCrypto.subtle.verify(verifyAlgorithm, key, signature, data);
94
94
  }
95
- exports.verifyRSA = verifyRSA;
@@ -34,3 +34,4 @@ export declare function fromASCIIString(value: string): Uint8Array;
34
34
  * Prepare a DataView we can slice our way around in as we parse the bytes in a Uint8Array
35
35
  */
36
36
  export declare function toDataView(array: Uint8Array): DataView;
37
+ //# sourceMappingURL=isoUint8Array.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isoUint8Array.d.ts","sourceRoot":"","sources":["../../../src/helpers/iso/isoUint8Array.ts"],"names":[],"mappings":"AAAA;;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,6 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toDataView = exports.fromASCIIString = exports.fromUTF8String = exports.toUTF8String = exports.concat = exports.fromHex = exports.toHex = exports.areEqual = void 0;
3
+ exports.areEqual = areEqual;
4
+ exports.toHex = toHex;
5
+ exports.fromHex = fromHex;
6
+ exports.concat = concat;
7
+ exports.toUTF8String = toUTF8String;
8
+ exports.fromUTF8String = fromUTF8String;
9
+ exports.fromASCIIString = fromASCIIString;
10
+ exports.toDataView = toDataView;
4
11
  /**
5
12
  * Make sure two Uint8Arrays are deeply equivalent
6
13
  */
@@ -10,7 +17,6 @@ function areEqual(array1, array2) {
10
17
  }
11
18
  return array1.every((val, i) => val === array2[i]);
12
19
  }
13
- exports.areEqual = areEqual;
14
20
  /**
15
21
  * Convert a Uint8Array to Hexadecimal.
16
22
  *
@@ -21,7 +27,6 @@ function toHex(array) {
21
27
  // adce000235bcc60a648b0b25f1f05503
22
28
  return hexParts.join('');
23
29
  }
24
- exports.toHex = toHex;
25
30
  /**
26
31
  * Convert a hexadecimal string to isoUint8Array.
27
32
  *
@@ -39,7 +44,6 @@ function fromHex(hex) {
39
44
  const byteStrings = hex.match(/.{1,2}/g) ?? [];
40
45
  return Uint8Array.from(byteStrings.map((byte) => parseInt(byte, 16)));
41
46
  }
42
- exports.fromHex = fromHex;
43
47
  /**
44
48
  * Combine multiple Uint8Arrays into a single Uint8Array
45
49
  */
@@ -53,7 +57,6 @@ function concat(arrays) {
53
57
  });
54
58
  return toReturn;
55
59
  }
56
- exports.concat = concat;
57
60
  /**
58
61
  * Convert bytes into a UTF-8 string
59
62
  */
@@ -61,7 +64,6 @@ function toUTF8String(array) {
61
64
  const decoder = new globalThis.TextDecoder('utf-8');
62
65
  return decoder.decode(array);
63
66
  }
64
- exports.toUTF8String = toUTF8String;
65
67
  /**
66
68
  * Convert a UTF-8 string back into bytes
67
69
  */
@@ -69,18 +71,15 @@ function fromUTF8String(utf8String) {
69
71
  const encoder = new globalThis.TextEncoder();
70
72
  return encoder.encode(utf8String);
71
73
  }
72
- exports.fromUTF8String = fromUTF8String;
73
74
  /**
74
75
  * Convert an ASCII string to Uint8Array
75
76
  */
76
77
  function fromASCIIString(value) {
77
78
  return Uint8Array.from(value.split('').map((x) => x.charCodeAt(0)));
78
79
  }
79
- exports.fromASCIIString = fromASCIIString;
80
80
  /**
81
81
  * Prepare a DataView we can slice our way around in as we parse the bytes in a Uint8Array
82
82
  */
83
83
  function toDataView(array) {
84
84
  return new DataView(array.buffer, array.byteOffset, array.length);
85
85
  }
86
- exports.toDataView = toDataView;