@simplewebauthn/server 7.4.0 → 8.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (343) hide show
  1. package/LICENSE.md +11 -14
  2. package/README.md +20 -7
  3. package/{dist → esm}/authentication/generateAuthenticationOptions.d.ts +2 -2
  4. package/esm/authentication/generateAuthenticationOptions.js +36 -0
  5. package/{dist → esm}/authentication/verifyAuthenticationResponse.d.ts +2 -2
  6. package/esm/authentication/verifyAuthenticationResponse.js +164 -0
  7. package/esm/deps.d.ts +11 -0
  8. package/esm/deps.js +14 -0
  9. package/esm/helpers/convertAAGUIDToString.js +17 -0
  10. package/esm/helpers/convertCOSEtoPKCS.js +21 -0
  11. package/{dist → esm}/helpers/convertCertBufferToPEM.d.ts +1 -1
  12. package/esm/helpers/convertCertBufferToPEM.js +31 -0
  13. package/esm/helpers/convertPEMToBytes.js +11 -0
  14. package/{dist → esm}/helpers/convertX509PublicKeyToCOSE.d.ts +1 -1
  15. package/esm/helpers/convertX509PublicKeyToCOSE.js +70 -0
  16. package/{dist → esm}/helpers/cose.d.ts +2 -1
  17. package/esm/helpers/cose.js +81 -0
  18. package/{dist → esm}/helpers/decodeAttestationObject.d.ts +3 -0
  19. package/esm/helpers/decodeAttestationObject.js +13 -0
  20. package/esm/helpers/decodeAuthenticatorExtensions.js +34 -0
  21. package/{dist → esm}/helpers/decodeClientDataJSON.d.ts +3 -0
  22. package/esm/helpers/decodeClientDataJSON.js +13 -0
  23. package/esm/helpers/decodeCredentialPublicKey.d.ts +5 -0
  24. package/esm/helpers/decodeCredentialPublicKey.js +8 -0
  25. package/esm/helpers/fetch.d.ts +8 -0
  26. package/esm/helpers/fetch.js +12 -0
  27. package/esm/helpers/generateChallenge.d.ts +7 -0
  28. package/esm/helpers/generateChallenge.js +21 -0
  29. package/{dist → esm}/helpers/getCertificateInfo.d.ts +1 -1
  30. package/esm/helpers/getCertificateInfo.js +76 -0
  31. package/esm/helpers/index.d.ts +22 -0
  32. package/esm/helpers/index.js +16 -0
  33. package/{dist → esm}/helpers/isCertRevoked.d.ts +1 -1
  34. package/esm/helpers/isCertRevoked.js +98 -0
  35. package/{dist → esm}/helpers/iso/index.d.ts +4 -4
  36. package/esm/helpers/iso/index.js +11 -0
  37. package/esm/helpers/iso/isoBase64URL.js +57 -0
  38. package/{dist → esm}/helpers/iso/isoCBOR.d.ts +1 -1
  39. package/esm/helpers/iso/isoCBOR.js +44 -0
  40. package/{dist → esm}/helpers/iso/isoCrypto/digest.d.ts +1 -1
  41. package/esm/helpers/iso/isoCrypto/digest.js +14 -0
  42. package/{dist → esm}/helpers/iso/isoCrypto/getRandomValues.d.ts +1 -1
  43. package/esm/helpers/iso/isoCrypto/getRandomValues.js +11 -0
  44. package/esm/helpers/iso/isoCrypto/getWebCrypto.d.ts +6 -0
  45. package/esm/helpers/iso/isoCrypto/getWebCrypto.js +40 -0
  46. package/esm/helpers/iso/isoCrypto/importKey.js +8 -0
  47. package/esm/helpers/iso/isoCrypto/index.d.ts +3 -0
  48. package/esm/helpers/iso/isoCrypto/index.js +3 -0
  49. package/{dist → esm}/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoAlg.d.ts +2 -2
  50. package/esm/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoAlg.js +20 -0
  51. package/{dist → esm}/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoKeyAlgName.d.ts +2 -2
  52. package/esm/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoKeyAlgName.js +19 -0
  53. package/esm/helpers/iso/isoCrypto/structs.js +1 -0
  54. package/esm/helpers/iso/isoCrypto/unwrapEC2Signature.js +30 -0
  55. package/{dist → esm}/helpers/iso/isoCrypto/verify.d.ts +1 -1
  56. package/esm/helpers/iso/isoCrypto/verify.js +28 -0
  57. package/{dist → esm}/helpers/iso/isoCrypto/verifyEC2.d.ts +1 -1
  58. package/esm/helpers/iso/isoCrypto/verifyEC2.js +73 -0
  59. package/{dist → esm}/helpers/iso/isoCrypto/verifyOKP.d.ts +1 -1
  60. package/esm/helpers/iso/isoCrypto/verifyOKP.js +51 -0
  61. package/{dist → esm}/helpers/iso/isoCrypto/verifyRSA.d.ts +1 -1
  62. package/esm/helpers/iso/isoCrypto/verifyRSA.js +91 -0
  63. package/esm/helpers/iso/isoUint8Array.js +75 -0
  64. package/{dist → esm}/helpers/logging.d.ts +1 -1
  65. package/esm/helpers/logging.js +19 -0
  66. package/{dist → esm}/helpers/mapX509SignatureAlgToCOSEAlg.d.ts +1 -1
  67. package/esm/helpers/mapX509SignatureAlgToCOSEAlg.js +35 -0
  68. package/esm/helpers/matchExpectedRPID.js +41 -0
  69. package/{dist → esm}/helpers/parseAuthenticatorData.d.ts +4 -1
  70. package/esm/helpers/parseAuthenticatorData.js +71 -0
  71. package/{dist → esm}/helpers/parseBackupFlags.d.ts +4 -1
  72. package/esm/helpers/parseBackupFlags.js +25 -0
  73. package/{dist → esm}/helpers/toHash.d.ts +1 -1
  74. package/esm/helpers/toHash.js +12 -0
  75. package/esm/helpers/validateCertificatePath.js +122 -0
  76. package/{dist → esm}/helpers/verifySignature.d.ts +4 -1
  77. package/esm/helpers/verifySignature.js +32 -0
  78. package/esm/index.d.ts +17 -0
  79. package/esm/index.js +11 -0
  80. package/{dist → esm}/metadata/mdsTypes.d.ts +1 -1
  81. package/esm/metadata/mdsTypes.js +17 -0
  82. package/esm/metadata/parseJWT.js +12 -0
  83. package/{dist → esm}/metadata/verifyAttestationWithMetadata.d.ts +3 -3
  84. package/esm/metadata/verifyAttestationWithMetadata.js +159 -0
  85. package/esm/metadata/verifyJWT.js +37 -0
  86. package/esm/package.json +3 -0
  87. package/{dist → esm}/registration/generateRegistrationOptions.d.ts +2 -2
  88. package/esm/registration/generateRegistrationOptions.js +142 -0
  89. package/esm/registration/verifications/tpm/constants.js +182 -0
  90. package/esm/registration/verifications/tpm/parseCertInfo.js +58 -0
  91. package/esm/registration/verifications/tpm/parsePubArea.js +94 -0
  92. package/{dist → esm}/registration/verifications/tpm/verifyAttestationTPM.d.ts +1 -1
  93. package/esm/registration/verifications/tpm/verifyAttestationTPM.js +323 -0
  94. package/{dist → esm}/registration/verifications/verifyAttestationAndroidKey.d.ts +1 -1
  95. package/esm/registration/verifications/verifyAttestationAndroidKey.js +90 -0
  96. package/{dist → esm}/registration/verifications/verifyAttestationAndroidSafetyNet.d.ts +1 -1
  97. package/esm/registration/verifications/verifyAttestationAndroidSafetyNet.js +112 -0
  98. package/{dist → esm}/registration/verifications/verifyAttestationApple.d.ts +1 -1
  99. package/esm/registration/verifications/verifyAttestationApple.js +57 -0
  100. package/{dist → esm}/registration/verifications/verifyAttestationFIDOU2F.d.ts +1 -1
  101. package/esm/registration/verifications/verifyAttestationFIDOU2F.js +48 -0
  102. package/{dist → esm}/registration/verifications/verifyAttestationPacked.d.ts +1 -1
  103. package/esm/registration/verifications/verifyAttestationPacked.js +105 -0
  104. package/{dist → esm}/registration/verifyRegistrationResponse.d.ts +3 -3
  105. package/esm/registration/verifyRegistrationResponse.js +198 -0
  106. package/esm/services/defaultRootCerts/android-key.js +85 -0
  107. package/esm/services/defaultRootCerts/android-safetynet.js +32 -0
  108. package/esm/services/defaultRootCerts/apple.js +25 -0
  109. package/esm/services/defaultRootCerts/mds.js +32 -0
  110. package/{dist → esm}/services/metadataService.d.ts +1 -1
  111. package/{dist → esm}/services/metadataService.js +52 -36
  112. package/{dist → esm}/services/settingsService.d.ts +1 -1
  113. package/esm/services/settingsService.js +65 -0
  114. package/package.json +40 -42
  115. package/script/authentication/generateAuthenticationOptions.d.ts +23 -0
  116. package/{dist → script}/authentication/generateAuthenticationOptions.js +8 -9
  117. package/script/authentication/verifyAuthenticationResponse.d.ts +66 -0
  118. package/{dist → script}/authentication/verifyAuthenticationResponse.js +25 -23
  119. package/script/deps.d.ts +11 -0
  120. package/script/deps.js +71 -0
  121. package/script/helpers/convertAAGUIDToString.d.ts +4 -0
  122. package/{dist → script}/helpers/convertAAGUIDToString.js +2 -3
  123. package/script/helpers/convertCOSEtoPKCS.d.ts +4 -0
  124. package/{dist → script}/helpers/convertCOSEtoPKCS.js +7 -8
  125. package/script/helpers/convertCertBufferToPEM.d.ts +5 -0
  126. package/{dist → script}/helpers/convertCertBufferToPEM.js +5 -6
  127. package/script/helpers/convertPEMToBytes.d.ts +4 -0
  128. package/{dist → script}/helpers/convertPEMToBytes.js +2 -3
  129. package/script/helpers/convertX509PublicKeyToCOSE.d.ts +2 -0
  130. package/{dist → script}/helpers/convertX509PublicKeyToCOSE.js +21 -25
  131. package/script/helpers/cose.d.ts +98 -0
  132. package/{dist → script}/helpers/cose.js +1 -1
  133. package/script/helpers/decodeAttestationObject.d.ts +29 -0
  134. package/script/helpers/decodeAttestationObject.js +17 -0
  135. package/script/helpers/decodeAuthenticatorExtensions.d.ts +20 -0
  136. package/{dist → script}/helpers/decodeAuthenticatorExtensions.js +2 -3
  137. package/script/helpers/decodeClientDataJSON.d.ts +17 -0
  138. package/script/helpers/decodeClientDataJSON.js +17 -0
  139. package/script/helpers/decodeCredentialPublicKey.d.ts +5 -0
  140. package/script/helpers/decodeCredentialPublicKey.js +12 -0
  141. package/script/helpers/fetch.d.ts +8 -0
  142. package/script/helpers/fetch.js +16 -0
  143. package/script/helpers/generateChallenge.d.ts +7 -0
  144. package/{dist → script}/helpers/generateChallenge.js +9 -6
  145. package/script/helpers/getCertificateInfo.d.ts +31 -0
  146. package/{dist → script}/helpers/getCertificateInfo.js +4 -6
  147. package/script/helpers/index.d.ts +22 -0
  148. package/script/helpers/index.js +59 -0
  149. package/script/helpers/isCertRevoked.d.ts +8 -0
  150. package/{dist → script}/helpers/isCertRevoked.js +20 -25
  151. package/script/helpers/iso/index.d.ts +11 -0
  152. package/{dist → script}/helpers/iso/index.js +4 -5
  153. package/script/helpers/iso/isoBase64URL.d.ts +37 -0
  154. package/{dist → script}/helpers/iso/isoBase64URL.js +9 -13
  155. package/script/helpers/iso/isoCBOR.d.ts +12 -0
  156. package/{dist → script}/helpers/iso/isoCBOR.js +8 -28
  157. package/script/helpers/iso/isoCrypto/digest.d.ts +8 -0
  158. package/script/helpers/iso/isoCrypto/digest.js +18 -0
  159. package/script/helpers/iso/isoCrypto/getRandomValues.d.ts +6 -0
  160. package/script/helpers/iso/isoCrypto/getRandomValues.js +15 -0
  161. package/script/helpers/iso/isoCrypto/getWebCrypto.d.ts +6 -0
  162. package/script/helpers/iso/isoCrypto/getWebCrypto.js +44 -0
  163. package/script/helpers/iso/isoCrypto/importKey.d.ts +4 -0
  164. package/script/helpers/iso/isoCrypto/importKey.js +12 -0
  165. package/script/helpers/iso/isoCrypto/index.d.ts +3 -0
  166. package/{dist → script}/helpers/iso/isoCrypto/index.js +6 -7
  167. package/script/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoAlg.d.ts +6 -0
  168. package/{dist → script}/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoAlg.js +6 -6
  169. package/script/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoKeyAlgName.d.ts +6 -0
  170. package/{dist → script}/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoKeyAlgName.js +5 -6
  171. package/script/helpers/iso/isoCrypto/structs.d.ts +3 -0
  172. package/{dist → script}/helpers/iso/isoCrypto/structs.js +0 -1
  173. package/script/helpers/iso/isoCrypto/unwrapEC2Signature.d.ts +6 -0
  174. package/{dist → script}/helpers/iso/isoCrypto/unwrapEC2Signature.js +4 -6
  175. package/script/helpers/iso/isoCrypto/verify.d.ts +10 -0
  176. package/script/helpers/iso/isoCrypto/verify.js +32 -0
  177. package/script/helpers/iso/isoCrypto/verifyEC2.d.ts +10 -0
  178. package/{dist → script}/helpers/iso/isoCrypto/verifyEC2.js +19 -22
  179. package/script/helpers/iso/isoCrypto/verifyOKP.d.ts +6 -0
  180. package/{dist → script}/helpers/iso/isoCrypto/verifyOKP.js +13 -16
  181. package/script/helpers/iso/isoCrypto/verifyRSA.d.ts +10 -0
  182. package/{dist → script}/helpers/iso/isoCrypto/verifyRSA.js +19 -22
  183. package/script/helpers/iso/isoUint8Array.d.ts +36 -0
  184. package/{dist → script}/helpers/iso/isoUint8Array.js +7 -8
  185. package/script/helpers/logging.d.ts +17 -0
  186. package/{dist → script}/helpers/logging.js +2 -6
  187. package/script/helpers/mapX509SignatureAlgToCOSEAlg.d.ts +8 -0
  188. package/{dist → script}/helpers/mapX509SignatureAlgToCOSEAlg.js +8 -9
  189. package/script/helpers/matchExpectedRPID.d.ts +7 -0
  190. package/{dist → script}/helpers/matchExpectedRPID.js +5 -6
  191. package/script/helpers/parseAuthenticatorData.d.ts +28 -0
  192. package/{dist → script}/helpers/parseAuthenticatorData.js +19 -16
  193. package/script/helpers/parseBackupFlags.d.ts +19 -0
  194. package/{dist → script}/helpers/parseBackupFlags.js +2 -2
  195. package/script/helpers/toHash.d.ts +6 -0
  196. package/{dist → script}/helpers/toHash.js +4 -5
  197. package/script/helpers/validateCertificatePath.d.ts +6 -0
  198. package/{dist → script}/helpers/validateCertificatePath.js +13 -15
  199. package/script/helpers/verifySignature.d.ts +14 -0
  200. package/script/helpers/verifySignature.js +36 -0
  201. package/script/index.d.ts +17 -0
  202. package/script/index.js +19 -0
  203. package/script/metadata/mdsTypes.d.ts +216 -0
  204. package/{dist → script}/metadata/mdsTypes.js +0 -1
  205. package/script/metadata/parseJWT.d.ts +4 -0
  206. package/{dist → script}/metadata/parseJWT.js +3 -4
  207. package/script/metadata/verifyAttestationWithMetadata.d.ts +29 -0
  208. package/{dist → script}/metadata/verifyAttestationWithMetadata.js +24 -22
  209. package/script/metadata/verifyJWT.d.ts +10 -0
  210. package/script/metadata/verifyJWT.js +41 -0
  211. package/script/package.json +3 -0
  212. package/script/registration/generateRegistrationOptions.d.ts +43 -0
  213. package/{dist → script}/registration/generateRegistrationOptions.js +9 -10
  214. package/script/registration/verifications/tpm/constants.d.ts +47 -0
  215. package/{dist → script}/registration/verifications/tpm/constants.js +1 -2
  216. package/script/registration/verifications/tpm/parseCertInfo.d.ts +24 -0
  217. package/{dist → script}/registration/verifications/tpm/parseCertInfo.js +13 -14
  218. package/script/registration/verifications/tpm/parsePubArea.d.ts +43 -0
  219. package/{dist → script}/registration/verifications/tpm/parsePubArea.js +16 -17
  220. package/script/registration/verifications/tpm/verifyAttestationTPM.d.ts +2 -0
  221. package/{dist → script}/registration/verifications/tpm/verifyAttestationTPM.js +58 -58
  222. package/script/registration/verifications/verifyAttestationAndroidKey.d.ts +5 -0
  223. package/{dist → script}/registration/verifications/verifyAttestationAndroidKey.js +22 -26
  224. package/script/registration/verifications/verifyAttestationAndroidSafetyNet.d.ts +5 -0
  225. package/{dist → script}/registration/verifications/verifyAttestationAndroidSafetyNet.js +22 -23
  226. package/script/registration/verifications/verifyAttestationApple.d.ts +2 -0
  227. package/{dist → script}/registration/verifications/verifyAttestationApple.js +15 -17
  228. package/script/registration/verifications/verifyAttestationFIDOU2F.d.ts +5 -0
  229. package/{dist → script}/registration/verifications/verifyAttestationFIDOU2F.js +12 -13
  230. package/script/registration/verifications/verifyAttestationPacked.d.ts +5 -0
  231. package/{dist → script}/registration/verifications/verifyAttestationPacked.js +17 -18
  232. package/script/registration/verifyRegistrationResponse.d.ts +85 -0
  233. package/{dist → script}/registration/verifyRegistrationResponse.js +39 -38
  234. package/script/services/defaultRootCerts/android-key.d.ts +24 -0
  235. package/{dist → script}/services/defaultRootCerts/android-key.js +0 -1
  236. package/script/services/defaultRootCerts/android-safetynet.d.ts +11 -0
  237. package/{dist → script}/services/defaultRootCerts/android-safetynet.js +0 -1
  238. package/script/services/defaultRootCerts/apple.d.ts +11 -0
  239. package/{dist → script}/services/defaultRootCerts/apple.js +0 -1
  240. package/script/services/defaultRootCerts/mds.d.ts +11 -0
  241. package/{dist → script}/services/defaultRootCerts/mds.js +0 -1
  242. package/script/services/metadataService.d.ts +53 -0
  243. package/script/services/metadataService.js +277 -0
  244. package/script/services/settingsService.d.ts +25 -0
  245. package/{dist → script}/services/settingsService.js +21 -13
  246. package/dist/authentication/generateAuthenticationOptions.js.map +0 -1
  247. package/dist/authentication/verifyAuthenticationResponse.js.map +0 -1
  248. package/dist/helpers/convertAAGUIDToString.js.map +0 -1
  249. package/dist/helpers/convertCOSEtoPKCS.js.map +0 -1
  250. package/dist/helpers/convertCertBufferToPEM.js.map +0 -1
  251. package/dist/helpers/convertPEMToBytes.js.map +0 -1
  252. package/dist/helpers/convertX509PublicKeyToCOSE.js.map +0 -1
  253. package/dist/helpers/cose.js.map +0 -1
  254. package/dist/helpers/decodeAttestationObject.js +0 -14
  255. package/dist/helpers/decodeAttestationObject.js.map +0 -1
  256. package/dist/helpers/decodeAuthenticatorExtensions.js.map +0 -1
  257. package/dist/helpers/decodeClientDataJSON.js +0 -14
  258. package/dist/helpers/decodeClientDataJSON.js.map +0 -1
  259. package/dist/helpers/decodeCredentialPublicKey.d.ts +0 -2
  260. package/dist/helpers/decodeCredentialPublicKey.js +0 -9
  261. package/dist/helpers/decodeCredentialPublicKey.js.map +0 -1
  262. package/dist/helpers/generateChallenge.d.ts +0 -4
  263. package/dist/helpers/generateChallenge.js.map +0 -1
  264. package/dist/helpers/getCertificateInfo.js.map +0 -1
  265. package/dist/helpers/index.d.ts +0 -22
  266. package/dist/helpers/index.js +0 -60
  267. package/dist/helpers/index.js.map +0 -1
  268. package/dist/helpers/isCertRevoked.js.map +0 -1
  269. package/dist/helpers/iso/index.js.map +0 -1
  270. package/dist/helpers/iso/isoBase64URL.js.map +0 -1
  271. package/dist/helpers/iso/isoCBOR.js.map +0 -1
  272. package/dist/helpers/iso/isoCrypto/digest.js +0 -21
  273. package/dist/helpers/iso/isoCrypto/digest.js.map +0 -1
  274. package/dist/helpers/iso/isoCrypto/getRandomValues.js +0 -18
  275. package/dist/helpers/iso/isoCrypto/getRandomValues.js.map +0 -1
  276. package/dist/helpers/iso/isoCrypto/importKey.js +0 -13
  277. package/dist/helpers/iso/isoCrypto/importKey.js.map +0 -1
  278. package/dist/helpers/iso/isoCrypto/index.d.ts +0 -3
  279. package/dist/helpers/iso/isoCrypto/index.js.map +0 -1
  280. package/dist/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoAlg.js.map +0 -1
  281. package/dist/helpers/iso/isoCrypto/mapCoseAlgToWebCryptoKeyAlgName.js.map +0 -1
  282. package/dist/helpers/iso/isoCrypto/structs.js.map +0 -1
  283. package/dist/helpers/iso/isoCrypto/unwrapEC2Signature.js.map +0 -1
  284. package/dist/helpers/iso/isoCrypto/verify.js +0 -28
  285. package/dist/helpers/iso/isoCrypto/verify.js.map +0 -1
  286. package/dist/helpers/iso/isoCrypto/verifyEC2.js.map +0 -1
  287. package/dist/helpers/iso/isoCrypto/verifyOKP.js.map +0 -1
  288. package/dist/helpers/iso/isoCrypto/verifyRSA.js.map +0 -1
  289. package/dist/helpers/iso/isoUint8Array.js.map +0 -1
  290. package/dist/helpers/logging.js.map +0 -1
  291. package/dist/helpers/mapX509SignatureAlgToCOSEAlg.js.map +0 -1
  292. package/dist/helpers/matchExpectedRPID.js.map +0 -1
  293. package/dist/helpers/parseAuthenticatorData.js.map +0 -1
  294. package/dist/helpers/parseBackupFlags.js.map +0 -1
  295. package/dist/helpers/toHash.js.map +0 -1
  296. package/dist/helpers/validateCertificatePath.js.map +0 -1
  297. package/dist/helpers/verifySignature.js +0 -33
  298. package/dist/helpers/verifySignature.js.map +0 -1
  299. package/dist/index.d.ts +0 -17
  300. package/dist/index.js +0 -20
  301. package/dist/index.js.map +0 -1
  302. package/dist/metadata/mdsTypes.js.map +0 -1
  303. package/dist/metadata/parseJWT.js.map +0 -1
  304. package/dist/metadata/verifyAttestationWithMetadata.js.map +0 -1
  305. package/dist/metadata/verifyJWT.js +0 -42
  306. package/dist/metadata/verifyJWT.js.map +0 -1
  307. package/dist/registration/generateRegistrationOptions.js.map +0 -1
  308. package/dist/registration/verifications/tpm/constants.js.map +0 -1
  309. package/dist/registration/verifications/tpm/parseCertInfo.js.map +0 -1
  310. package/dist/registration/verifications/tpm/parsePubArea.js.map +0 -1
  311. package/dist/registration/verifications/tpm/verifyAttestationTPM.js.map +0 -1
  312. package/dist/registration/verifications/verifyAttestationAndroidKey.js.map +0 -1
  313. package/dist/registration/verifications/verifyAttestationAndroidSafetyNet.js.map +0 -1
  314. package/dist/registration/verifications/verifyAttestationApple.js.map +0 -1
  315. package/dist/registration/verifications/verifyAttestationFIDOU2F.js.map +0 -1
  316. package/dist/registration/verifications/verifyAttestationPacked.js.map +0 -1
  317. package/dist/registration/verifyRegistrationResponse.js.map +0 -1
  318. package/dist/services/defaultRootCerts/android-key.js.map +0 -1
  319. package/dist/services/defaultRootCerts/android-safetynet.js.map +0 -1
  320. package/dist/services/defaultRootCerts/apple.js.map +0 -1
  321. package/dist/services/defaultRootCerts/mds.js.map +0 -1
  322. package/dist/services/metadataService.js.map +0 -1
  323. package/dist/services/settingsService.js.map +0 -1
  324. /package/{dist → esm}/helpers/convertAAGUIDToString.d.ts +0 -0
  325. /package/{dist → esm}/helpers/convertCOSEtoPKCS.d.ts +0 -0
  326. /package/{dist → esm}/helpers/convertPEMToBytes.d.ts +0 -0
  327. /package/{dist → esm}/helpers/decodeAuthenticatorExtensions.d.ts +0 -0
  328. /package/{dist → esm}/helpers/iso/isoBase64URL.d.ts +0 -0
  329. /package/{dist → esm}/helpers/iso/isoCrypto/importKey.d.ts +0 -0
  330. /package/{dist → esm}/helpers/iso/isoCrypto/structs.d.ts +0 -0
  331. /package/{dist → esm}/helpers/iso/isoCrypto/unwrapEC2Signature.d.ts +0 -0
  332. /package/{dist → esm}/helpers/iso/isoUint8Array.d.ts +0 -0
  333. /package/{dist → esm}/helpers/matchExpectedRPID.d.ts +0 -0
  334. /package/{dist → esm}/helpers/validateCertificatePath.d.ts +0 -0
  335. /package/{dist → esm}/metadata/parseJWT.d.ts +0 -0
  336. /package/{dist → esm}/metadata/verifyJWT.d.ts +0 -0
  337. /package/{dist → esm}/registration/verifications/tpm/constants.d.ts +0 -0
  338. /package/{dist → esm}/registration/verifications/tpm/parseCertInfo.d.ts +0 -0
  339. /package/{dist → esm}/registration/verifications/tpm/parsePubArea.d.ts +0 -0
  340. /package/{dist → esm}/services/defaultRootCerts/android-key.d.ts +0 -0
  341. /package/{dist → esm}/services/defaultRootCerts/android-safetynet.d.ts +0 -0
  342. /package/{dist → esm}/services/defaultRootCerts/apple.d.ts +0 -0
  343. /package/{dist → esm}/services/defaultRootCerts/mds.d.ts +0 -0
@@ -0,0 +1,85 @@
1
+ /**
2
+ * Google Hardware Attestation Root 1
3
+ *
4
+ * Downloaded from https://developer.android.com/training/articles/security-key-attestation#root_certificate
5
+ * (first entry)
6
+ *
7
+ * Valid until 2026-05-24 @ 09:28 PST
8
+ *
9
+ * SHA256 Fingerprint
10
+ * C1:98:4A:3E:F4:5C:1E:2A:91:85:51:DE:10:60:3C:86:F7:05:1B:22:49:C4:89:1C:AE:32:30:EA:BD:0C:97:D5
11
+ */
12
+ export const Google_Hardware_Attestation_Root_1 = `-----BEGIN CERTIFICATE-----
13
+ MIIFYDCCA0igAwIBAgIJAOj6GWMU0voYMA0GCSqGSIb3DQEBCwUAMBsxGTAXBgNV
14
+ BAUTEGY5MjAwOWU4NTNiNmIwNDUwHhcNMTYwNTI2MTYyODUyWhcNMjYwNTI0MTYy
15
+ ODUyWjAbMRkwFwYDVQQFExBmOTIwMDllODUzYjZiMDQ1MIICIjANBgkqhkiG9w0B
16
+ AQEFAAOCAg8AMIICCgKCAgEAr7bHgiuxpwHsK7Qui8xUFmOr75gvMsd/dTEDDJdS
17
+ Sxtf6An7xyqpRR90PL2abxM1dEqlXnf2tqw1Ne4Xwl5jlRfdnJLmN0pTy/4lj4/7
18
+ tv0Sk3iiKkypnEUtR6WfMgH0QZfKHM1+di+y9TFRtv6y//0rb+T+W8a9nsNL/ggj
19
+ nar86461qO0rOs2cXjp3kOG1FEJ5MVmFmBGtnrKpa73XpXyTqRxB/M0n1n/W9nGq
20
+ C4FSYa04T6N5RIZGBN2z2MT5IKGbFlbC8UrW0DxW7AYImQQcHtGl/m00QLVWutHQ
21
+ oVJYnFPlXTcHYvASLu+RhhsbDmxMgJJ0mcDpvsC4PjvB+TxywElgS70vE0XmLD+O
22
+ JtvsBslHZvPBKCOdT0MS+tgSOIfga+z1Z1g7+DVagf7quvmag8jfPioyKvxnK/Eg
23
+ sTUVi2ghzq8wm27ud/mIM7AY2qEORR8Go3TVB4HzWQgpZrt3i5MIlCaY504LzSRi
24
+ igHCzAPlHws+W0rB5N+er5/2pJKnfBSDiCiFAVtCLOZ7gLiMm0jhO2B6tUXHI/+M
25
+ RPjy02i59lINMRRev56GKtcd9qO/0kUJWdZTdA2XoS82ixPvZtXQpUpuL12ab+9E
26
+ aDK8Z4RHJYYfCT3Q5vNAXaiWQ+8PTWm2QgBR/bkwSWc+NpUFgNPN9PvQi8WEg5Um
27
+ AGMCAwEAAaOBpjCBozAdBgNVHQ4EFgQUNmHhAHyIBQlRi0RsR/8aTMnqTxIwHwYD
28
+ VR0jBBgwFoAUNmHhAHyIBQlRi0RsR/8aTMnqTxIwDwYDVR0TAQH/BAUwAwEB/zAO
29
+ BgNVHQ8BAf8EBAMCAYYwQAYDVR0fBDkwNzA1oDOgMYYvaHR0cHM6Ly9hbmRyb2lk
30
+ Lmdvb2dsZWFwaXMuY29tL2F0dGVzdGF0aW9uL2NybC8wDQYJKoZIhvcNAQELBQAD
31
+ ggIBACDIw41L3KlXG0aMiS//cqrG+EShHUGo8HNsw30W1kJtjn6UBwRM6jnmiwfB
32
+ Pb8VA91chb2vssAtX2zbTvqBJ9+LBPGCdw/E53Rbf86qhxKaiAHOjpvAy5Y3m00m
33
+ qC0w/Zwvju1twb4vhLaJ5NkUJYsUS7rmJKHHBnETLi8GFqiEsqTWpG/6ibYCv7rY
34
+ DBJDcR9W62BW9jfIoBQcxUCUJouMPH25lLNcDc1ssqvC2v7iUgI9LeoM1sNovqPm
35
+ QUiG9rHli1vXxzCyaMTjwftkJLkf6724DFhuKug2jITV0QkXvaJWF4nUaHOTNA4u
36
+ JU9WDvZLI1j83A+/xnAJUucIv/zGJ1AMH2boHqF8CY16LpsYgBt6tKxxWH00XcyD
37
+ CdW2KlBCeqbQPcsFmWyWugxdcekhYsAWyoSf818NUsZdBWBaR/OukXrNLfkQ79Iy
38
+ ZohZbvabO/X+MVT3rriAoKc8oE2Uws6DF+60PV7/WIPjNvXySdqspImSN78mflxD
39
+ qwLqRBYkA3I75qppLGG9rp7UCdRjxMl8ZDBld+7yvHVgt1cVzJx9xnyGCC23Uaic
40
+ MDSXYrB4I4WHXPGjxhZuCuPBLTdOLU8YRvMYdEvYebWHMpvwGCF6bAx3JBpIeOQ1
41
+ wDB5y0USicV3YgYGmi+NZfhA4URSh77Yd6uuJOJENRaNVTzk
42
+ -----END CERTIFICATE-----
43
+ `;
44
+ /**
45
+ * Google Hardware Attestation Root 2
46
+ *
47
+ * Downloaded from https://developer.android.com/training/articles/security-key-attestation#root_certificate
48
+ * (second entry)
49
+ *
50
+ * Valid until 2034-11-18 @ 12:37 PST
51
+ *
52
+ * SHA256 Fingerprint
53
+ * 1E:F1:A0:4B:8B:A5:8A:B9:45:89:AC:49:8C:89:82:A7:83:F2:4E:A7:30:7E:01:59:A0:C3:A7:3B:37:7D:87:CC
54
+ */
55
+ export const Google_Hardware_Attestation_Root_2 = `-----BEGIN CERTIFICATE-----
56
+ MIIFHDCCAwSgAwIBAgIJANUP8luj8tazMA0GCSqGSIb3DQEBCwUAMBsxGTAXBgNV
57
+ BAUTEGY5MjAwOWU4NTNiNmIwNDUwHhcNMTkxMTIyMjAzNzU4WhcNMzQxMTE4MjAz
58
+ NzU4WjAbMRkwFwYDVQQFExBmOTIwMDllODUzYjZiMDQ1MIICIjANBgkqhkiG9w0B
59
+ AQEFAAOCAg8AMIICCgKCAgEAr7bHgiuxpwHsK7Qui8xUFmOr75gvMsd/dTEDDJdS
60
+ Sxtf6An7xyqpRR90PL2abxM1dEqlXnf2tqw1Ne4Xwl5jlRfdnJLmN0pTy/4lj4/7
61
+ tv0Sk3iiKkypnEUtR6WfMgH0QZfKHM1+di+y9TFRtv6y//0rb+T+W8a9nsNL/ggj
62
+ nar86461qO0rOs2cXjp3kOG1FEJ5MVmFmBGtnrKpa73XpXyTqRxB/M0n1n/W9nGq
63
+ C4FSYa04T6N5RIZGBN2z2MT5IKGbFlbC8UrW0DxW7AYImQQcHtGl/m00QLVWutHQ
64
+ oVJYnFPlXTcHYvASLu+RhhsbDmxMgJJ0mcDpvsC4PjvB+TxywElgS70vE0XmLD+O
65
+ JtvsBslHZvPBKCOdT0MS+tgSOIfga+z1Z1g7+DVagf7quvmag8jfPioyKvxnK/Eg
66
+ sTUVi2ghzq8wm27ud/mIM7AY2qEORR8Go3TVB4HzWQgpZrt3i5MIlCaY504LzSRi
67
+ igHCzAPlHws+W0rB5N+er5/2pJKnfBSDiCiFAVtCLOZ7gLiMm0jhO2B6tUXHI/+M
68
+ RPjy02i59lINMRRev56GKtcd9qO/0kUJWdZTdA2XoS82ixPvZtXQpUpuL12ab+9E
69
+ aDK8Z4RHJYYfCT3Q5vNAXaiWQ+8PTWm2QgBR/bkwSWc+NpUFgNPN9PvQi8WEg5Um
70
+ AGMCAwEAAaNjMGEwHQYDVR0OBBYEFDZh4QB8iAUJUYtEbEf/GkzJ6k8SMB8GA1Ud
71
+ IwQYMBaAFDZh4QB8iAUJUYtEbEf/GkzJ6k8SMA8GA1UdEwEB/wQFMAMBAf8wDgYD
72
+ VR0PAQH/BAQDAgIEMA0GCSqGSIb3DQEBCwUAA4ICAQBOMaBc8oumXb2voc7XCWnu
73
+ XKhBBK3e2KMGz39t7lA3XXRe2ZLLAkLM5y3J7tURkf5a1SutfdOyXAmeE6SRo83U
74
+ h6WszodmMkxK5GM4JGrnt4pBisu5igXEydaW7qq2CdC6DOGjG+mEkN8/TA6p3cno
75
+ L/sPyz6evdjLlSeJ8rFBH6xWyIZCbrcpYEJzXaUOEaxxXxgYz5/cTiVKN2M1G2ok
76
+ QBUIYSY6bjEL4aUN5cfo7ogP3UvliEo3Eo0YgwuzR2v0KR6C1cZqZJSTnghIC/vA
77
+ D32KdNQ+c3N+vl2OTsUVMC1GiWkngNx1OO1+kXW+YTnnTUOtOIswUP/Vqd5SYgAI
78
+ mMAfY8U9/iIgkQj6T2W6FsScy94IN9fFhE1UtzmLoBIuUFsVXJMTz+Jucth+IqoW
79
+ Fua9v1R93/k98p41pjtFX+H8DslVgfP097vju4KDlqN64xV1grw3ZLl4CiOe/A91
80
+ oeLm2UHOq6wn3esB4r2EIQKb6jTVGu5sYCcdWpXr0AUVqcABPdgL+H7qJguBw09o
81
+ jm6xNIrw2OocrDKsudk/okr/AwqEyPKw9WnMlQgLIKw1rODG2NvU9oR3GVGdMkUB
82
+ ZutL8VuFkERQGt6vQ2OCw0sV47VMkuYbacK/xyZFiRcrPJPb41zgbQj9XAEyLKCH
83
+ ex0SdDrx+tWUDqG8At2JHA==
84
+ -----END CERTIFICATE-----
85
+ `;
@@ -0,0 +1,32 @@
1
+ /**
2
+ * GlobalSign Root CA
3
+ *
4
+ * Downloaded from https://pki.goog/roots.pem
5
+ *
6
+ * Valid until 2028-01-28 @ 04:00 PST
7
+ *
8
+ * SHA256 Fingerprint
9
+ * EB:D4:10:40:E4:BB:3E:C7:42:C9:E3:81:D3:1E:F2:A4:1A:48:B6:68:5C:96:E7:CE:F3:C1:DF:6C:D4:33:1C:99
10
+ */
11
+ export const GlobalSign_Root_CA = `-----BEGIN CERTIFICATE-----
12
+ MIIDdTCCAl2gAwIBAgILBAAAAAABFUtaw5QwDQYJKoZIhvcNAQEFBQAwVzELMAkG
13
+ A1UEBhMCQkUxGTAXBgNVBAoTEEdsb2JhbFNpZ24gbnYtc2ExEDAOBgNVBAsTB1Jv
14
+ b3QgQ0ExGzAZBgNVBAMTEkdsb2JhbFNpZ24gUm9vdCBDQTAeFw05ODA5MDExMjAw
15
+ MDBaFw0yODAxMjgxMjAwMDBaMFcxCzAJBgNVBAYTAkJFMRkwFwYDVQQKExBHbG9i
16
+ YWxTaWduIG52LXNhMRAwDgYDVQQLEwdSb290IENBMRswGQYDVQQDExJHbG9iYWxT
17
+ aWduIFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDaDuaZ
18
+ jc6j40+Kfvvxi4Mla+pIH/EqsLmVEQS98GPR4mdmzxzdzxtIK+6NiY6arymAZavp
19
+ xy0Sy6scTHAHoT0KMM0VjU/43dSMUBUc71DuxC73/OlS8pF94G3VNTCOXkNz8kHp
20
+ 1Wrjsok6Vjk4bwY8iGlbKk3Fp1S4bInMm/k8yuX9ifUSPJJ4ltbcdG6TRGHRjcdG
21
+ snUOhugZitVtbNV4FpWi6cgKOOvyJBNPc1STE4U6G7weNLWLBYy5d4ux2x8gkasJ
22
+ U26Qzns3dLlwR5EiUWMWea6xrkEmCMgZK9FGqkjWZCrXgzT/LCrBbBlDSgeF59N8
23
+ 9iFo7+ryUp9/k5DPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8E
24
+ BTADAQH/MB0GA1UdDgQWBBRge2YaRQ2XyolQL30EzTSo//z9SzANBgkqhkiG9w0B
25
+ AQUFAAOCAQEA1nPnfE920I2/7LqivjTFKDK1fPxsnCwrvQmeU79rXqoRSLblCKOz
26
+ yj1hTdNGCbM+w6DjY1Ub8rrvrTnhQ7k4o+YviiY776BQVvnGCv04zcQLcFGUl5gE
27
+ 38NflNUVyRRBnMRddWQVDf9VMOyGj/8N7yy5Y0b2qvzfvGn9LhJIZJrglfCm7ymP
28
+ AbEVtQwdpf5pLGkkeB6zpxxxYu7KyJesF12KwvhHhm4qxFYxldBniYUr+WymXUad
29
+ DKqC5JlR3XC321Y9YeRq4VzW9v493kHMB65jUr9TU/Qr6cf9tveCX4XSQRjbgbME
30
+ HMUfpIBvFSDJ3gyICh3WZlXi/EjJKSZp4A==
31
+ -----END CERTIFICATE-----
32
+ `;
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Apple WebAuthn Root CA
3
+ *
4
+ * Downloaded from https://www.apple.com/certificateauthority/Apple_WebAuthn_Root_CA.pem
5
+ *
6
+ * Valid until 2045-03-14 @ 17:00 PST
7
+ *
8
+ * SHA256 Fingerprint
9
+ * 09:15:DD:5C:07:A2:8D:B5:49:D1:F6:77:BB:5A:75:D4:BF:BE:95:61:A7:73:42:43:27:76:2E:9E:02:F9:BB:29
10
+ */
11
+ export const Apple_WebAuthn_Root_CA = `-----BEGIN CERTIFICATE-----
12
+ MIICEjCCAZmgAwIBAgIQaB0BbHo84wIlpQGUKEdXcTAKBggqhkjOPQQDAzBLMR8w
13
+ HQYDVQQDDBZBcHBsZSBXZWJBdXRobiBSb290IENBMRMwEQYDVQQKDApBcHBsZSBJ
14
+ bmMuMRMwEQYDVQQIDApDYWxpZm9ybmlhMB4XDTIwMDMxODE4MjEzMloXDTQ1MDMx
15
+ NTAwMDAwMFowSzEfMB0GA1UEAwwWQXBwbGUgV2ViQXV0aG4gUm9vdCBDQTETMBEG
16
+ A1UECgwKQXBwbGUgSW5jLjETMBEGA1UECAwKQ2FsaWZvcm5pYTB2MBAGByqGSM49
17
+ AgEGBSuBBAAiA2IABCJCQ2pTVhzjl4Wo6IhHtMSAzO2cv+H9DQKev3//fG59G11k
18
+ xu9eI0/7o6V5uShBpe1u6l6mS19S1FEh6yGljnZAJ+2GNP1mi/YK2kSXIuTHjxA/
19
+ pcoRf7XkOtO4o1qlcaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUJtdk
20
+ 2cV4wlpn0afeaxLQG2PxxtcwDgYDVR0PAQH/BAQDAgEGMAoGCCqGSM49BAMDA2cA
21
+ MGQCMFrZ+9DsJ1PW9hfNdBywZDsWDbWFp28it1d/5w2RPkRX3Bbn/UbDTNLx7Jr3
22
+ jAGGiQIwHFj+dJZYUJR786osByBelJYsVZd2GbHQu209b5RCmGQ21gpSAk9QZW4B
23
+ 1bWeT0vT
24
+ -----END CERTIFICATE-----
25
+ `;
@@ -0,0 +1,32 @@
1
+ /**
2
+ * GlobalSign Root CA - R3
3
+ *
4
+ * Downloaded from https://valid.r3.roots.globalsign.com/
5
+ *
6
+ * Valid until 2029-03-18 @ 00:00 PST
7
+ *
8
+ * SHA256 Fingerprint
9
+ * CB:B5:22:D7:B7:F1:27:AD:6A:01:13:86:5B:DF:1C:D4:10:2E:7D:07:59:AF:63:5A:7C:F4:72:0D:C9:63:C5:3B
10
+ */
11
+ export const GlobalSign_Root_CA_R3 = `-----BEGIN CERTIFICATE-----
12
+ MIIDXzCCAkegAwIBAgILBAAAAAABIVhTCKIwDQYJKoZIhvcNAQELBQAwTDEgMB4G
13
+ A1UECxMXR2xvYmFsU2lnbiBSb290IENBIC0gUjMxEzARBgNVBAoTCkdsb2JhbFNp
14
+ Z24xEzARBgNVBAMTCkdsb2JhbFNpZ24wHhcNMDkwMzE4MTAwMDAwWhcNMjkwMzE4
15
+ MTAwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxTaWduIFJvb3QgQ0EgLSBSMzETMBEG
16
+ A1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2lnbjCCASIwDQYJKoZI
17
+ hvcNAQEBBQADggEPADCCAQoCggEBAMwldpB5BngiFvXAg7aEyiie/QV2EcWtiHL8
18
+ RgJDx7KKnQRfJMsuS+FggkbhUqsMgUdwbN1k0ev1LKMPgj0MK66X17YUhhB5uzsT
19
+ gHeMCOFJ0mpiLx9e+pZo34knlTifBtc+ycsmWQ1z3rDI6SYOgxXG71uL0gRgykmm
20
+ KPZpO/bLyCiR5Z2KYVc3rHQU3HTgOu5yLy6c+9C7v/U9AOEGM+iCK65TpjoWc4zd
21
+ QQ4gOsC0p6Hpsk+QLjJg6VfLuQSSaGjlOCZgdbKfd/+RFO+uIEn8rUAVSNECMWEZ
22
+ XriX7613t2Saer9fwRPvm2L7DWzgVGkWqQPabumDk3F2xmmFghcCAwEAAaNCMEAw
23
+ DgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFI/wS3+o
24
+ LkUkrk1Q+mOai97i3Ru8MA0GCSqGSIb3DQEBCwUAA4IBAQBLQNvAUKr+yAzv95ZU
25
+ RUm7lgAJQayzE4aGKAczymvmdLm6AC2upArT9fHxD4q/c2dKg8dEe3jgr25sbwMp
26
+ jjM5RcOO5LlXbKr8EpbsU8Yt5CRsuZRj+9xTaGdWPoO4zzUhw8lo/s7awlOqzJCK
27
+ 6fBdRoyV3XpYKBovHd7NADdBj+1EbddTKJd+82cEHhXXipa0095MJ6RMG3NzdvQX
28
+ mcIfeg7jLQitChws/zyrVQ4PkX4268NXSb7hLi18YIvDQVETI53O9zJrlAGomecs
29
+ Mx86OyXShkDOOyyGeMlhLxS67ttVb9+E7gUJTb0o2HLO02JQZR7rkpeDMdmztcpH
30
+ WD9f
31
+ -----END CERTIFICATE-----
32
+ `;
@@ -1,4 +1,4 @@
1
- import type { MetadataStatement } from '../metadata/mdsTypes';
1
+ import type { MetadataStatement } from '../metadata/mdsTypes.js';
2
2
  type VerificationMode = 'permissive' | 'strict';
3
3
  /**
4
4
  * A basic service for coordinating interactions with the FIDO Metadata Service. This includes BLOB
@@ -1,18 +1,12 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.MetadataService = exports.BaseMetadataService = void 0;
7
- const cross_fetch_1 = __importDefault(require("cross-fetch"));
8
- const validateCertificatePath_1 = require("../helpers/validateCertificatePath");
9
- const convertCertBufferToPEM_1 = require("../helpers/convertCertBufferToPEM");
10
- const convertAAGUIDToString_1 = require("../helpers/convertAAGUIDToString");
11
- const settingsService_1 = require("../services/settingsService");
12
- const logging_1 = require("../helpers/logging");
13
- const convertPEMToBytes_1 = require("../helpers/convertPEMToBytes");
14
- const parseJWT_1 = require("../metadata/parseJWT");
15
- const verifyJWT_1 = require("../metadata/verifyJWT");
1
+ import { validateCertificatePath } from '../helpers/validateCertificatePath.js';
2
+ import { convertCertBufferToPEM } from '../helpers/convertCertBufferToPEM.js';
3
+ import { convertAAGUIDToString } from '../helpers/convertAAGUIDToString.js';
4
+ import { SettingsService } from './settingsService.js';
5
+ import { getLogger } from '../helpers/logging.js';
6
+ import { convertPEMToBytes } from '../helpers/convertPEMToBytes.js';
7
+ import { fetch } from '../helpers/fetch.js';
8
+ import { parseJWT } from '../metadata/parseJWT.js';
9
+ import { verifyJWT } from '../metadata/verifyJWT.js';
16
10
  const defaultURLMDS = 'https://mds.fidoalliance.org/'; // v3
17
11
  var SERVICE_STATE;
18
12
  (function (SERVICE_STATE) {
@@ -20,19 +14,39 @@ var SERVICE_STATE;
20
14
  SERVICE_STATE[SERVICE_STATE["REFRESHING"] = 1] = "REFRESHING";
21
15
  SERVICE_STATE[SERVICE_STATE["READY"] = 2] = "READY";
22
16
  })(SERVICE_STATE || (SERVICE_STATE = {}));
23
- const log = (0, logging_1.getLogger)('MetadataService');
17
+ const log = getLogger('MetadataService');
24
18
  /**
25
19
  * A basic service for coordinating interactions with the FIDO Metadata Service. This includes BLOB
26
20
  * download and parsing, and on-demand requesting and caching of individual metadata statements.
27
21
  *
28
22
  * https://fidoalliance.org/metadata/
29
23
  */
30
- class BaseMetadataService {
24
+ export class BaseMetadataService {
31
25
  constructor() {
32
- this.mdsCache = {};
33
- this.statementCache = {};
34
- this.state = SERVICE_STATE.DISABLED;
35
- this.verificationMode = 'strict';
26
+ Object.defineProperty(this, "mdsCache", {
27
+ enumerable: true,
28
+ configurable: true,
29
+ writable: true,
30
+ value: {}
31
+ });
32
+ Object.defineProperty(this, "statementCache", {
33
+ enumerable: true,
34
+ configurable: true,
35
+ writable: true,
36
+ value: {}
37
+ });
38
+ Object.defineProperty(this, "state", {
39
+ enumerable: true,
40
+ configurable: true,
41
+ writable: true,
42
+ value: SERVICE_STATE.DISABLED
43
+ });
44
+ Object.defineProperty(this, "verificationMode", {
45
+ enumerable: true,
46
+ configurable: true,
47
+ writable: true,
48
+ value: 'strict'
49
+ });
36
50
  }
37
51
  /**
38
52
  * Prepare the service to handle remote MDS servers and/or cache local metadata statements.
@@ -51,9 +65,9 @@ class BaseMetadataService {
51
65
  const { mdsServers = [defaultURLMDS], statements, verificationMode } = opts;
52
66
  this.setState(SERVICE_STATE.REFRESHING);
53
67
  // If metadata statements are provided, load them into the cache first
54
- if (statements === null || statements === void 0 ? void 0 : statements.length) {
68
+ if (statements?.length) {
55
69
  let statementsAdded = 0;
56
- statements.forEach(statement => {
70
+ statements.forEach((statement) => {
57
71
  // Only cache statements that are for FIDO2-compatible authenticators
58
72
  if (statement.aaguid) {
59
73
  this.statementCache[statement.aaguid] = {
@@ -70,7 +84,7 @@ class BaseMetadataService {
70
84
  log(`Cached ${statementsAdded} local statements`);
71
85
  }
72
86
  // If MDS servers are provided, then process them and add their statements to the cache
73
- if (mdsServers === null || mdsServers === void 0 ? void 0 : mdsServers.length) {
87
+ if (mdsServers?.length) {
74
88
  // Get a current count so we know how many new statements we've added from MDS servers
75
89
  const currentCacheCount = Object.keys(this.statementCache).length;
76
90
  let numServers = mdsServers.length;
@@ -112,7 +126,7 @@ class BaseMetadataService {
112
126
  return;
113
127
  }
114
128
  if (aaguid instanceof Uint8Array) {
115
- aaguid = (0, convertAAGUIDToString_1.convertAAGUIDToString)(aaguid);
129
+ aaguid = convertAAGUIDToString(aaguid);
116
130
  }
117
131
  // If a cache refresh is in progress then pause this until the service is ready
118
132
  await this.pauseUntilReady();
@@ -159,10 +173,10 @@ class BaseMetadataService {
159
173
  async downloadBlob(mds) {
160
174
  const { url, no } = mds;
161
175
  // Get latest "BLOB" (FIDO's terminology, not mine)
162
- const resp = await (0, cross_fetch_1.default)(url);
176
+ const resp = await fetch(url);
163
177
  const data = await resp.text();
164
178
  // Parse the JWT
165
- const parsedJWT = (0, parseJWT_1.parseJWT)(data);
179
+ const parsedJWT = parseJWT(data);
166
180
  const header = parsedJWT[0];
167
181
  const payload = parsedJWT[1];
168
182
  if (payload.no <= no) {
@@ -170,11 +184,13 @@ class BaseMetadataService {
170
184
  // number of the last BLOB cached locally."
171
185
  throw new Error(`Latest BLOB no. "${payload.no}" is not greater than previous ${no}`);
172
186
  }
173
- const headerCertsPEM = header.x5c.map(convertCertBufferToPEM_1.convertCertBufferToPEM);
187
+ const headerCertsPEM = header.x5c.map(convertCertBufferToPEM);
174
188
  try {
175
189
  // Validate the certificate chain
176
- const rootCerts = settingsService_1.SettingsService.getRootCertificates({ identifier: 'mds' });
177
- await (0, validateCertificatePath_1.validateCertificatePath)(headerCertsPEM, rootCerts);
190
+ const rootCerts = SettingsService.getRootCertificates({
191
+ identifier: 'mds',
192
+ });
193
+ await validateCertificatePath(headerCertsPEM, rootCerts);
178
194
  }
179
195
  catch (error) {
180
196
  const _error = error;
@@ -184,7 +200,7 @@ class BaseMetadataService {
184
200
  }
185
201
  // Verify the BLOB JWT signature
186
202
  const leafCert = headerCertsPEM[0];
187
- const verified = await (0, verifyJWT_1.verifyJWT)(data, (0, convertPEMToBytes_1.convertPEMToBytes)(leafCert));
203
+ const verified = await verifyJWT(data, convertPEMToBytes(leafCert));
188
204
  if (!verified) {
189
205
  // From FIDO MDS docs: "The FIDO Server SHOULD ignore the file if the signature is invalid."
190
206
  throw new Error('BLOB signature could not be verified');
@@ -211,9 +227,11 @@ class BaseMetadataService {
211
227
  /**
212
228
  * A helper method to pause execution until the service is ready
213
229
  */
214
- async pauseUntilReady() {
230
+ pauseUntilReady() {
215
231
  if (this.state === SERVICE_STATE.READY) {
216
- return;
232
+ return new Promise((resolve) => {
233
+ resolve();
234
+ });
217
235
  }
218
236
  // State isn't ready, so set up polling
219
237
  const readyPromise = new Promise((resolve, reject) => {
@@ -251,7 +269,5 @@ class BaseMetadataService {
251
269
  }
252
270
  }
253
271
  }
254
- exports.BaseMetadataService = BaseMetadataService;
255
272
  // Export a service singleton
256
- exports.MetadataService = new BaseMetadataService();
257
- //# sourceMappingURL=metadataService.js.map
273
+ export const MetadataService = new BaseMetadataService();
@@ -1,4 +1,4 @@
1
- import { AttestationFormat } from '../helpers/decodeAttestationObject';
1
+ import { AttestationFormat } from '../helpers/decodeAttestationObject.js';
2
2
  type RootCertIdentifier = AttestationFormat | 'mds';
3
3
  declare class BaseSettingsService {
4
4
  private pemCertificates;
@@ -0,0 +1,65 @@
1
+ import { convertCertBufferToPEM } from '../helpers/convertCertBufferToPEM.js';
2
+ import { GlobalSign_Root_CA } from './defaultRootCerts/android-safetynet.js';
3
+ import { Google_Hardware_Attestation_Root_1, Google_Hardware_Attestation_Root_2, } from './defaultRootCerts/android-key.js';
4
+ import { Apple_WebAuthn_Root_CA } from './defaultRootCerts/apple.js';
5
+ import { GlobalSign_Root_CA_R3 } from './defaultRootCerts/mds.js';
6
+ class BaseSettingsService {
7
+ constructor() {
8
+ // Certificates are stored as PEM-formatted strings
9
+ Object.defineProperty(this, "pemCertificates", {
10
+ enumerable: true,
11
+ configurable: true,
12
+ writable: true,
13
+ value: void 0
14
+ });
15
+ this.pemCertificates = new Map();
16
+ }
17
+ /**
18
+ * Set potential root certificates for attestation formats that use them. Root certs will be tried
19
+ * one-by-one when validating a certificate path.
20
+ *
21
+ * Certificates can be specified as a raw `Buffer`, or as a PEM-formatted string. If a
22
+ * `Buffer` is passed in it will be converted to PEM format.
23
+ */
24
+ setRootCertificates(opts) {
25
+ const { identifier, certificates } = opts;
26
+ const newCertificates = [];
27
+ for (const cert of certificates) {
28
+ if (cert instanceof Uint8Array) {
29
+ newCertificates.push(convertCertBufferToPEM(cert));
30
+ }
31
+ else {
32
+ newCertificates.push(cert);
33
+ }
34
+ }
35
+ this.pemCertificates.set(identifier, newCertificates);
36
+ }
37
+ /**
38
+ * Get any registered root certificates for the specified attestation format
39
+ */
40
+ getRootCertificates(opts) {
41
+ const { identifier } = opts;
42
+ return this.pemCertificates.get(identifier) ?? [];
43
+ }
44
+ }
45
+ export const SettingsService = new BaseSettingsService();
46
+ // Initialize default certificates
47
+ SettingsService.setRootCertificates({
48
+ identifier: 'android-key',
49
+ certificates: [
50
+ Google_Hardware_Attestation_Root_1,
51
+ Google_Hardware_Attestation_Root_2,
52
+ ],
53
+ });
54
+ SettingsService.setRootCertificates({
55
+ identifier: 'android-safetynet',
56
+ certificates: [GlobalSign_Root_CA],
57
+ });
58
+ SettingsService.setRootCertificates({
59
+ identifier: 'apple',
60
+ certificates: [Apple_WebAuthn_Root_CA],
61
+ });
62
+ SettingsService.setRootCertificates({
63
+ identifier: 'mds',
64
+ certificates: [GlobalSign_Root_CA_R3],
65
+ });
package/package.json CHANGED
@@ -1,28 +1,14 @@
1
1
  {
2
+ "module": "./esm/index.js",
3
+ "main": "./script/index.js",
2
4
  "name": "@simplewebauthn/server",
3
- "version": "7.4.0",
5
+ "version": "8.0.0",
4
6
  "description": "SimpleWebAuthn for Servers",
5
- "main": "dist/index.js",
6
- "types": "dist/index.d.ts",
7
- "exports": {
8
- ".": "./dist/index.js",
9
- "./helpers": "./dist/helpers/index.js"
10
- },
11
- "typesVersions": {
12
- "*": {
13
- "./dist/index.d.ts": [
14
- "./dist/index.d.ts"
15
- ],
16
- "helpers": [
17
- "./dist/helpers/index.d.ts"
18
- ]
19
- }
20
- },
21
- "author": "Matthew Miller <matthew@millerti.me>",
22
7
  "license": "MIT",
8
+ "author": "Matthew Miller <matthew@millerti.me>",
23
9
  "repository": {
24
10
  "type": "git",
25
- "url": "https://github.com/MasterKale/SimpleWebAuthn.git",
11
+ "url": "git+https://github.com/MasterKale/SimpleWebAuthn.git",
26
12
  "directory": "packages/server"
27
13
  },
28
14
  "homepage": "https://github.com/MasterKale/SimpleWebAuthn/tree/master/packages/server#readme",
@@ -32,13 +18,8 @@
32
18
  "engines": {
33
19
  "node": ">=16.0.0"
34
20
  },
35
- "scripts": {
36
- "build": "rimraf dist && tsc",
37
- "build:lerna-debug": "rimraf dist && tsc > output.txt; cat output.txt; rm output.txt",
38
- "test": "jest",
39
- "test:watch": "jest --watch",
40
- "test:coverage": "npm test -- --coverage",
41
- "prepublish": "npm run build"
21
+ "bugs": {
22
+ "url": "https://github.com/MasterKale/SimpleWebAuthn/issues"
42
23
  },
43
24
  "keywords": [
44
25
  "typescript",
@@ -47,20 +28,37 @@
47
28
  "fido",
48
29
  "node"
49
30
  ],
50
- "dependencies": {
51
- "@hexagon/base64": "^1.1.25",
52
- "@peculiar/asn1-android": "^2.3.3",
53
- "@peculiar/asn1-ecc": "^2.3.4",
54
- "@peculiar/asn1-rsa": "^2.3.4",
55
- "@peculiar/asn1-schema": "^2.3.3",
56
- "@peculiar/asn1-x509": "^2.3.4",
57
- "@simplewebauthn/iso-webcrypto": "^7.4.0",
58
- "@simplewebauthn/typescript-types": "^7.4.0",
59
- "@types/debug": "^4.1.7",
60
- "@types/node": "^18.11.9",
61
- "cbor-x": "^1.4.1",
62
- "cross-fetch": "^3.1.5",
63
- "debug": "^4.3.2"
31
+ "typesVersions": {
32
+ "*": {
33
+ ".": [
34
+ "esm/index.d.ts"
35
+ ],
36
+ "helpers": [
37
+ "esm/helpers/index.d.ts"
38
+ ]
39
+ }
64
40
  },
65
- "gitHead": "f21955a5947f575858db0cd9ee728abc6b5f4310"
66
- }
41
+ "exports": {
42
+ ".": {
43
+ "import": "./esm/index.js",
44
+ "require": "./script/index.js"
45
+ },
46
+ "./helpers": {
47
+ "import": "./esm/helpers/index.js",
48
+ "require": "./script/helpers/index.js"
49
+ }
50
+ },
51
+ "dependencies": {
52
+ "@hexagon/base64": "^1.1.27",
53
+ "@peculiar/asn1-android": "^2.3.6",
54
+ "@peculiar/asn1-ecc": "^2.3.6",
55
+ "@peculiar/asn1-rsa": "^2.3.6",
56
+ "@peculiar/asn1-schema": "^2.3.6",
57
+ "@peculiar/asn1-x509": "^2.3.6",
58
+ "@simplewebauthn/typescript-types": "^8.0.0",
59
+ "@types/debug": "^4.1.8",
60
+ "cbor-x": "^1.5.2",
61
+ "cross-fetch": "^4.0.0",
62
+ "debug": "^4.3.4"
63
+ }
64
+ }
@@ -0,0 +1,23 @@
1
+ import type { AuthenticationExtensionsClientInputs, PublicKeyCredentialDescriptorFuture, PublicKeyCredentialRequestOptionsJSON, UserVerificationRequirement } from '../deps.js';
2
+ export type GenerateAuthenticationOptionsOpts = {
3
+ allowCredentials?: PublicKeyCredentialDescriptorFuture[];
4
+ challenge?: string | Uint8Array;
5
+ timeout?: number;
6
+ userVerification?: UserVerificationRequirement;
7
+ extensions?: AuthenticationExtensionsClientInputs;
8
+ rpID?: string;
9
+ };
10
+ /**
11
+ * Prepare a value to pass into navigator.credentials.get(...) for authenticator "login"
12
+ *
13
+ * @param allowCredentials Authenticators previously registered by the user, if any. If undefined
14
+ * the client will ask the user which credential they want to use
15
+ * @param challenge Random value the authenticator needs to sign and pass back
16
+ * user for authentication
17
+ * @param timeout How long (in ms) the user can take to complete authentication
18
+ * @param userVerification Set to `'discouraged'` when asserting as part of a 2FA flow, otherwise
19
+ * set to `'preferred'` or `'required'` as desired.
20
+ * @param extensions Additional plugins the authenticator or browser should use during authentication
21
+ * @param rpID Valid domain name (after `https://`)
22
+ */
23
+ export declare function generateAuthenticationOptions(options?: GenerateAuthenticationOptionsOpts): Promise<PublicKeyCredentialRequestOptionsJSON>;
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.generateAuthenticationOptions = void 0;
4
- const iso_1 = require("../helpers/iso");
5
- const generateChallenge_1 = require("../helpers/generateChallenge");
4
+ const index_js_1 = require("../helpers/iso/index.js");
5
+ const generateChallenge_js_1 = require("../helpers/generateChallenge.js");
6
6
  /**
7
7
  * Prepare a value to pass into navigator.credentials.get(...) for authenticator "login"
8
8
  *
@@ -16,20 +16,20 @@ const generateChallenge_1 = require("../helpers/generateChallenge");
16
16
  * @param extensions Additional plugins the authenticator or browser should use during authentication
17
17
  * @param rpID Valid domain name (after `https://`)
18
18
  */
19
- function generateAuthenticationOptions(options = {}) {
20
- const { allowCredentials, challenge = (0, generateChallenge_1.generateChallenge)(), timeout = 60000, userVerification = 'preferred', extensions, rpID, } = options;
19
+ async function generateAuthenticationOptions(options = {}) {
20
+ const { allowCredentials, challenge = await (0, generateChallenge_js_1.generateChallenge)(), timeout = 60000, userVerification = 'preferred', extensions, rpID, } = options;
21
21
  /**
22
22
  * Preserve ability to specify `string` values for challenges
23
23
  */
24
24
  let _challenge = challenge;
25
25
  if (typeof _challenge === 'string') {
26
- _challenge = iso_1.isoUint8Array.fromUTF8String(_challenge);
26
+ _challenge = index_js_1.isoUint8Array.fromUTF8String(_challenge);
27
27
  }
28
28
  return {
29
- challenge: iso_1.isoBase64URL.fromBuffer(_challenge),
30
- allowCredentials: allowCredentials === null || allowCredentials === void 0 ? void 0 : allowCredentials.map(cred => ({
29
+ challenge: index_js_1.isoBase64URL.fromBuffer(_challenge),
30
+ allowCredentials: allowCredentials?.map((cred) => ({
31
31
  ...cred,
32
- id: iso_1.isoBase64URL.fromBuffer(cred.id),
32
+ id: index_js_1.isoBase64URL.fromBuffer(cred.id),
33
33
  })),
34
34
  timeout,
35
35
  userVerification,
@@ -38,4 +38,3 @@ function generateAuthenticationOptions(options = {}) {
38
38
  };
39
39
  }
40
40
  exports.generateAuthenticationOptions = generateAuthenticationOptions;
41
- //# sourceMappingURL=generateAuthenticationOptions.js.map
@@ -0,0 +1,66 @@
1
+ import type { AuthenticationResponseJSON, AuthenticatorDevice, CredentialDeviceType, UserVerificationRequirement } from '../deps.js';
2
+ import { AuthenticationExtensionsAuthenticatorOutputs } from '../helpers/decodeAuthenticatorExtensions.js';
3
+ export type VerifyAuthenticationResponseOpts = {
4
+ response: AuthenticationResponseJSON;
5
+ expectedChallenge: string | ((challenge: string) => boolean);
6
+ expectedOrigin: string | string[];
7
+ expectedRPID: string | string[];
8
+ authenticator: AuthenticatorDevice;
9
+ requireUserVerification?: boolean;
10
+ advancedFIDOConfig?: {
11
+ userVerification?: UserVerificationRequirement;
12
+ };
13
+ };
14
+ /**
15
+ * Verify that the user has legitimately completed the login process
16
+ *
17
+ * **Options:**
18
+ *
19
+ * @param response Response returned by **@simplewebauthn/browser**'s `startAssertion()`
20
+ * @param expectedChallenge The base64url-encoded `options.challenge` returned by
21
+ * `generateAuthenticationOptions()`
22
+ * @param expectedOrigin Website URL (or array of URLs) that the registration should have occurred on
23
+ * @param expectedRPID RP ID (or array of IDs) that was specified in the registration options
24
+ * @param authenticator An internal {@link AuthenticatorDevice} matching the credential's ID
25
+ * @param requireUserVerification (Optional) Enforce user verification by the authenticator
26
+ * (via PIN, fingerprint, etc...)
27
+ * @param advancedFIDOConfig (Optional) Options for satisfying more stringent FIDO RP feature
28
+ * requirements
29
+ * @param advancedFIDOConfig.userVerification (Optional) Enable alternative rules for evaluating the
30
+ * User Presence and User Verified flags in authenticator data: UV (and UP) flags are optional
31
+ * unless this value is `"required"`
32
+ */
33
+ export declare function verifyAuthenticationResponse(options: VerifyAuthenticationResponseOpts): Promise<VerifiedAuthenticationResponse>;
34
+ /**
35
+ * Result of authentication verification
36
+ *
37
+ * @param verified If the authentication response could be verified
38
+ * @param authenticationInfo.credentialID The ID of the authenticator used during authentication.
39
+ * Should be used to identify which DB authenticator entry needs its `counter` updated to the value
40
+ * below
41
+ * @param authenticationInfo.newCounter The number of times the authenticator identified above
42
+ * reported it has been used. **Should be kept in a DB for later reference to help prevent replay
43
+ * attacks!**
44
+ * @param authenticationInfo.credentialDeviceType Whether this is a single-device or multi-device
45
+ * credential. **Should be kept in a DB for later reference!**
46
+ * @param authenticationInfo.credentialBackedUp Whether or not the multi-device credential has been
47
+ * backed up. Always `false` for single-device credentials. **Should be kept in a DB for later
48
+ * reference!**
49
+ * @param authenticationInfo.origin The origin of the website that the authentication occurred on
50
+ * @param authenticationInfo.rpID The RP ID that the authentication occurred on
51
+ * @param authenticationInfo?.authenticatorExtensionResults The authenticator extensions returned
52
+ * by the browser
53
+ */
54
+ export type VerifiedAuthenticationResponse = {
55
+ verified: boolean;
56
+ authenticationInfo: {
57
+ credentialID: Uint8Array;
58
+ newCounter: number;
59
+ userVerified: boolean;
60
+ credentialDeviceType: CredentialDeviceType;
61
+ credentialBackedUp: boolean;
62
+ origin: string;
63
+ rpID: string;
64
+ authenticatorExtensionResults?: AuthenticationExtensionsAuthenticatorOutputs;
65
+ };
66
+ };