@simplewebauthn/server 9.0.3 → 10.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.
- package/README.md +2 -2
- package/esm/authentication/generateAuthenticationOptions.d.ts +16 -14
- package/esm/authentication/generateAuthenticationOptions.js +21 -16
- package/esm/authentication/verifyAuthenticationResponse.d.ts +13 -18
- package/esm/authentication/verifyAuthenticationResponse.js +12 -17
- package/esm/deps.d.ts +1 -1
- package/esm/helpers/convertCertBufferToPEM.js +1 -1
- package/esm/helpers/decodeClientDataJSON.d.ts +2 -1
- package/esm/helpers/decodeClientDataJSON.js +1 -1
- package/esm/helpers/generateUserID.d.ts +7 -0
- package/esm/helpers/generateUserID.js +17 -0
- package/esm/helpers/index.d.ts +2 -1
- package/esm/helpers/index.js +2 -1
- package/esm/helpers/iso/isoBase64URL.d.ts +10 -5
- package/esm/helpers/iso/isoBase64URL.js +13 -7
- package/esm/helpers/iso/isoCrypto/getWebCrypto.d.ts +0 -289
- package/esm/helpers/iso/isoCrypto/getWebCrypto.js +26 -41
- package/esm/metadata/parseJWT.js +2 -2
- package/esm/registration/generateRegistrationOptions.d.ts +19 -19
- package/esm/registration/generateRegistrationOptions.js +40 -22
- package/esm/registration/verifications/verifyAttestationAndroidSafetyNet.js +2 -2
- package/esm/registration/verifyRegistrationResponse.d.ts +9 -12
- package/esm/registration/verifyRegistrationResponse.js +8 -11
- package/package.json +3 -3
- package/script/authentication/generateAuthenticationOptions.d.ts +16 -14
- package/script/authentication/generateAuthenticationOptions.js +21 -16
- package/script/authentication/verifyAuthenticationResponse.d.ts +13 -18
- package/script/authentication/verifyAuthenticationResponse.js +12 -17
- package/script/deps.d.ts +1 -1
- package/script/helpers/convertCertBufferToPEM.js +1 -1
- package/script/helpers/decodeClientDataJSON.d.ts +2 -1
- package/script/helpers/decodeClientDataJSON.js +1 -1
- package/script/helpers/generateUserID.d.ts +7 -0
- package/script/helpers/generateUserID.js +21 -0
- package/script/helpers/index.d.ts +2 -1
- package/script/helpers/index.js +3 -1
- package/script/helpers/iso/isoBase64URL.d.ts +10 -5
- package/script/helpers/iso/isoBase64URL.js +18 -11
- package/script/helpers/iso/isoCrypto/getWebCrypto.d.ts +0 -288
- package/script/helpers/iso/isoCrypto/getWebCrypto.js +26 -64
- package/script/metadata/parseJWT.js +2 -2
- package/script/registration/generateRegistrationOptions.d.ts +19 -19
- package/script/registration/generateRegistrationOptions.js +40 -22
- package/script/registration/verifications/verifyAttestationAndroidSafetyNet.js +2 -2
- package/script/registration/verifyRegistrationResponse.d.ts +9 -12
- package/script/registration/verifyRegistrationResponse.js +8 -11
|
@@ -26,8 +26,8 @@ async function verifyAttestationAndroidSafetyNet(options) {
|
|
|
26
26
|
// Prepare to verify a JWT
|
|
27
27
|
const jwt = index_js_1.isoUint8Array.toUTF8String(response);
|
|
28
28
|
const jwtParts = jwt.split('.');
|
|
29
|
-
const HEADER = JSON.parse(index_js_1.isoBase64URL.
|
|
30
|
-
const PAYLOAD = JSON.parse(index_js_1.isoBase64URL.
|
|
29
|
+
const HEADER = JSON.parse(index_js_1.isoBase64URL.toUTF8String(jwtParts[0]));
|
|
30
|
+
const PAYLOAD = JSON.parse(index_js_1.isoBase64URL.toUTF8String(jwtParts[1]));
|
|
31
31
|
const SIGNATURE = jwtParts[2];
|
|
32
32
|
/**
|
|
33
33
|
* START Verify PAYLOAD
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { COSEAlgorithmIdentifier, CredentialDeviceType, RegistrationResponseJSON } from '../deps.js';
|
|
1
|
+
import type { Base64URLString, COSEAlgorithmIdentifier, CredentialDeviceType, RegistrationResponseJSON } from '../deps.js';
|
|
2
2
|
import { AttestationFormat, AttestationStatement } from '../helpers/decodeAttestationObject.js';
|
|
3
3
|
import { AuthenticationExtensionsAuthenticatorOutputs } from '../helpers/decodeAuthenticatorExtensions.js';
|
|
4
4
|
export type VerifyRegistrationResponseOpts = {
|
|
@@ -15,16 +15,13 @@ export type VerifyRegistrationResponseOpts = {
|
|
|
15
15
|
*
|
|
16
16
|
* **Options:**
|
|
17
17
|
*
|
|
18
|
-
* @param response Response returned by **@simplewebauthn/browser**'s `startAuthentication()`
|
|
19
|
-
* @param expectedChallenge The base64url-encoded `options.challenge` returned by
|
|
20
|
-
*
|
|
21
|
-
* @param
|
|
22
|
-
* @param
|
|
23
|
-
* @param
|
|
24
|
-
* @param
|
|
25
|
-
* (via PIN, fingerprint, etc...)
|
|
26
|
-
* @param supportedAlgorithmIDs Array of numeric COSE algorithm identifiers supported for
|
|
27
|
-
* attestation by this RP. See https://www.iana.org/assignments/cose/cose.xhtml#algorithms
|
|
18
|
+
* @param response - Response returned by **@simplewebauthn/browser**'s `startAuthentication()`
|
|
19
|
+
* @param expectedChallenge - The base64url-encoded `options.challenge` returned by `generateRegistrationOptions()`
|
|
20
|
+
* @param expectedOrigin - Website URL (or array of URLs) that the registration should have occurred on
|
|
21
|
+
* @param expectedRPID - RP ID (or array of IDs) that was specified in the registration options
|
|
22
|
+
* @param expectedType **(Optional)** - The response type expected ('webauthn.create')
|
|
23
|
+
* @param requireUserVerification **(Optional)** - Enforce user verification by the authenticator (via PIN, fingerprint, etc...) Defaults to `true`
|
|
24
|
+
* @param supportedAlgorithmIDs **(Optional)** - Array of numeric COSE algorithm identifiers supported for attestation by this RP. See https://www.iana.org/assignments/cose/cose.xhtml#algorithms. Defaults to all supported algorithm IDs
|
|
28
25
|
*/
|
|
29
26
|
export declare function verifyRegistrationResponse(options: VerifyRegistrationResponseOpts): Promise<VerifiedRegistrationResponse>;
|
|
30
27
|
/**
|
|
@@ -59,7 +56,7 @@ export type VerifiedRegistrationResponse = {
|
|
|
59
56
|
fmt: AttestationFormat;
|
|
60
57
|
counter: number;
|
|
61
58
|
aaguid: string;
|
|
62
|
-
credentialID:
|
|
59
|
+
credentialID: Base64URLString;
|
|
63
60
|
credentialPublicKey: Uint8Array;
|
|
64
61
|
credentialType: 'public-key';
|
|
65
62
|
attestationObject: Uint8Array;
|
|
@@ -24,16 +24,13 @@ const verifyAttestationApple_js_1 = require("./verifications/verifyAttestationAp
|
|
|
24
24
|
*
|
|
25
25
|
* **Options:**
|
|
26
26
|
*
|
|
27
|
-
* @param response Response returned by **@simplewebauthn/browser**'s `startAuthentication()`
|
|
28
|
-
* @param expectedChallenge The base64url-encoded `options.challenge` returned by
|
|
29
|
-
*
|
|
30
|
-
* @param
|
|
31
|
-
* @param
|
|
32
|
-
* @param
|
|
33
|
-
* @param
|
|
34
|
-
* (via PIN, fingerprint, etc...)
|
|
35
|
-
* @param supportedAlgorithmIDs Array of numeric COSE algorithm identifiers supported for
|
|
36
|
-
* attestation by this RP. See https://www.iana.org/assignments/cose/cose.xhtml#algorithms
|
|
27
|
+
* @param response - Response returned by **@simplewebauthn/browser**'s `startAuthentication()`
|
|
28
|
+
* @param expectedChallenge - The base64url-encoded `options.challenge` returned by `generateRegistrationOptions()`
|
|
29
|
+
* @param expectedOrigin - Website URL (or array of URLs) that the registration should have occurred on
|
|
30
|
+
* @param expectedRPID - RP ID (or array of IDs) that was specified in the registration options
|
|
31
|
+
* @param expectedType **(Optional)** - The response type expected ('webauthn.create')
|
|
32
|
+
* @param requireUserVerification **(Optional)** - Enforce user verification by the authenticator (via PIN, fingerprint, etc...) Defaults to `true`
|
|
33
|
+
* @param supportedAlgorithmIDs **(Optional)** - Array of numeric COSE algorithm identifiers supported for attestation by this RP. See https://www.iana.org/assignments/cose/cose.xhtml#algorithms. Defaults to all supported algorithm IDs
|
|
37
34
|
*/
|
|
38
35
|
async function verifyRegistrationResponse(options) {
|
|
39
36
|
const { response, expectedChallenge, expectedOrigin, expectedRPID, expectedType, requireUserVerification = true, supportedAlgorithmIDs = generateRegistrationOptions_js_1.supportedCOSEAlgorithmIdentifiers, } = options;
|
|
@@ -197,7 +194,7 @@ async function verifyRegistrationResponse(options) {
|
|
|
197
194
|
fmt,
|
|
198
195
|
counter,
|
|
199
196
|
aaguid: (0, convertAAGUIDToString_js_1.convertAAGUIDToString)(aaguid),
|
|
200
|
-
credentialID,
|
|
197
|
+
credentialID: index_js_1.isoBase64URL.fromBuffer(credentialID),
|
|
201
198
|
credentialPublicKey,
|
|
202
199
|
credentialType,
|
|
203
200
|
attestationObject,
|