@metamask-previews/passkey-controller 3.0.0-preview-11d78534e → 3.0.0-preview-a3ea429
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/dist/PasskeyController-method-action-types.cjs.map +1 -1
- package/dist/PasskeyController-method-action-types.d.cts.map +1 -1
- package/dist/PasskeyController-method-action-types.d.mts.map +1 -1
- package/dist/PasskeyController-method-action-types.mjs.map +1 -1
- package/dist/PasskeyController.cjs +67 -67
- package/dist/PasskeyController.cjs.map +1 -1
- package/dist/PasskeyController.d.cts.map +1 -1
- package/dist/PasskeyController.d.mts.map +1 -1
- package/dist/PasskeyController.mjs.map +1 -1
- package/dist/ceremony-manager.cjs.map +1 -1
- package/dist/ceremony-manager.d.cts.map +1 -1
- package/dist/ceremony-manager.d.mts.map +1 -1
- package/dist/ceremony-manager.mjs.map +1 -1
- package/dist/errors.cjs.map +1 -1
- package/dist/errors.d.cts.map +1 -1
- package/dist/errors.d.mts.map +1 -1
- package/dist/errors.mjs.map +1 -1
- package/dist/index.cjs +9 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/key-derivation.cjs +9 -9
- package/dist/key-derivation.cjs.map +1 -1
- package/dist/key-derivation.d.cts.map +1 -1
- package/dist/key-derivation.d.mts.map +1 -1
- package/dist/key-derivation.mjs.map +1 -1
- package/dist/logger.cjs +2 -2
- package/dist/logger.cjs.map +1 -1
- package/dist/logger.mjs.map +1 -1
- package/dist/types.cjs +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.mts.map +1 -1
- package/dist/types.mjs.map +1 -1
- package/dist/utils/crypto.cjs +2 -2
- package/dist/utils/crypto.cjs.map +1 -1
- package/dist/utils/crypto.mjs.map +1 -1
- package/dist/webauthn/decode-attestation-object.cjs.map +1 -1
- package/dist/webauthn/decode-attestation-object.d.cts.map +1 -1
- package/dist/webauthn/decode-attestation-object.d.mts.map +1 -1
- package/dist/webauthn/decode-attestation-object.mjs.map +1 -1
- package/dist/webauthn/decode-client-data-json.cjs +2 -2
- package/dist/webauthn/decode-client-data-json.cjs.map +1 -1
- package/dist/webauthn/decode-client-data-json.d.cts.map +1 -1
- package/dist/webauthn/decode-client-data-json.d.mts.map +1 -1
- package/dist/webauthn/decode-client-data-json.mjs.map +1 -1
- package/dist/webauthn/match-expected-rp-id.cjs +2 -2
- package/dist/webauthn/match-expected-rp-id.cjs.map +1 -1
- package/dist/webauthn/match-expected-rp-id.mjs.map +1 -1
- package/dist/webauthn/parse-authenticator-data.cjs.map +1 -1
- package/dist/webauthn/parse-authenticator-data.d.cts.map +1 -1
- package/dist/webauthn/parse-authenticator-data.d.mts.map +1 -1
- package/dist/webauthn/parse-authenticator-data.mjs.map +1 -1
- package/dist/webauthn/types.cjs.map +1 -1
- package/dist/webauthn/types.d.cts.map +1 -1
- package/dist/webauthn/types.d.mts.map +1 -1
- package/dist/webauthn/types.mjs.map +1 -1
- package/dist/webauthn/verify-authentication-response.cjs +12 -12
- package/dist/webauthn/verify-authentication-response.cjs.map +1 -1
- package/dist/webauthn/verify-authentication-response.d.cts.map +1 -1
- package/dist/webauthn/verify-authentication-response.d.mts.map +1 -1
- package/dist/webauthn/verify-authentication-response.mjs.map +1 -1
- package/dist/webauthn/verify-registration-response.cjs +19 -19
- package/dist/webauthn/verify-registration-response.cjs.map +1 -1
- package/dist/webauthn/verify-registration-response.d.cts.map +1 -1
- package/dist/webauthn/verify-registration-response.d.mts.map +1 -1
- package/dist/webauthn/verify-registration-response.mjs.map +1 -1
- package/dist/webauthn/verify-signature.cjs +30 -30
- package/dist/webauthn/verify-signature.cjs.map +1 -1
- package/dist/webauthn/verify-signature.mjs.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PasskeyController-method-action-types.cjs","sourceRoot":"","sources":["../src/PasskeyController-method-action-types.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated.\n * Do not edit manually.\n */\n\nimport type { PasskeyController } from './PasskeyController';\n\n/**\n * Whether a passkey is enrolled and vault key material is stored.\n *\n * @returns `true` if enrolled, otherwise `false`.\n */\nexport type PasskeyControllerIsPasskeyEnrolledAction = {\n type: `PasskeyController:isPasskeyEnrolled`;\n handler: PasskeyController['isPasskeyEnrolled'];\n};\n\n/**\n * Builds WebAuthn credential creation options for passkey enrollment.\n *\n * @param creationOptionsConfig - Optional creation behavior.\n * @param creationOptionsConfig.prfAvailable - Request the PRF extension unless `false`. Defaults to `true`.\n * @returns Public key credential creation options for `navigator.credentials.create()`.\n */\nexport type PasskeyControllerGenerateRegistrationOptionsAction = {\n type: `PasskeyController:generateRegistrationOptions`;\n handler: PasskeyController['generateRegistrationOptions'];\n};\n\n/**\n * Builds WebAuthn credential request options for the post-registration\n * authentication step (between `create` and {@link protectVaultKeyWithPasskey}).\n *\n * @param params - Input for the pending registration ceremony.\n * @param params.registrationResponse - Result of `navigator.credentials.create()`.\n * @returns Public key credential request options for `navigator.credentials.get()`.\n */\nexport type PasskeyControllerGeneratePostRegistrationAuthenticationOptionsAction =\n {\n type: `PasskeyController:generatePostRegistrationAuthenticationOptions`;\n handler: PasskeyController['generatePostRegistrationAuthenticationOptions'];\n };\n\n/**\n * Builds WebAuthn credential request options for the enrolled passkey.\n *\n * @returns Public key credential request options for `navigator.credentials.get()`.\n */\nexport type PasskeyControllerGenerateAuthenticationOptionsAction = {\n type: `PasskeyController:generateAuthenticationOptions`;\n handler: PasskeyController['generateAuthenticationOptions'];\n};\n\n/**\n * Verifies registration and post-registration authentication, then stores the\n * vault key encrypted under the new passkey.\n *\n * Fetches the current vault encryption key from KeyringController before wrapping.\n * When onboarding is complete, requires `password` for step-up verification first.\n *\n * @param params - Enrollment completion inputs.\n * @param params.registrationResponse - Result of `navigator.credentials.create()`.\n * @param params.authenticationResponse - Result of `navigator.credentials.get()` after {@link generatePostRegistrationAuthenticationOptions}.\n * @param params.password - Wallet password when onboarding is complete (step-up).\n * @returns Resolves when enrollment completes.\n */\nexport type PasskeyControllerProtectVaultKeyWithPasskeyAction = {\n type: `PasskeyController:protectVaultKeyWithPasskey`;\n handler: PasskeyController['protectVaultKeyWithPasskey'];\n};\n\n/**\n * Verifies an authentication assertion and returns the decrypted vault key.\n *\n * Prefer orchestrated methods ({@link unlockWithPasskey},\n * {@link exportSeedPhraseWithPasskey}, {@link exportAccountsWithPasskey}) for product\n * flows instead of calling KeyringController with the returned key manually.\n *\n * @param authenticationResponse - Result of `navigator.credentials.get()`.\n * @returns The plaintext vault encryption key.\n */\nexport type PasskeyControllerRetrieveVaultKeyWithPasskeyAction = {\n type: `PasskeyController:retrieveVaultKeyWithPasskey`;\n handler: PasskeyController['retrieveVaultKeyWithPasskey'];\n};\n\n/**\n * Unlocks the keyring using a passkey authentication assertion.\n *\n * @param authenticationResponse - Result of `navigator.credentials.get()`.\n * @returns Resolves when the keyring is unlocked.\n */\nexport type PasskeyControllerUnlockWithPasskeyAction = {\n type: `PasskeyController:unlockWithPasskey`;\n handler: PasskeyController['unlockWithPasskey'];\n};\n\n/**\n * Exports the seed phrase after passkey step-up authentication.\n *\n * @param authenticationResponse - Result of `navigator.credentials.get()`.\n * @param keyringId - Optional keyring id; defaults to the primary HD keyring.\n * @returns Raw seed phrase bytes from KeyringController.\n */\nexport type PasskeyControllerExportSeedPhraseWithPasskeyAction = {\n type: `PasskeyController:exportSeedPhraseWithPasskey`;\n handler: PasskeyController['exportSeedPhraseWithPasskey'];\n};\n\n/**\n * Exports private keys for the given addresses after passkey step-up authentication.\n *\n * @param authenticationResponse - Result of `navigator.credentials.get()`.\n * @param addresses - Account addresses to export.\n * @returns Private keys in the same order as `addresses`.\n */\nexport type PasskeyControllerExportAccountsWithPasskeyAction = {\n type: `PasskeyController:exportAccountsWithPasskey`;\n handler: PasskeyController['exportAccountsWithPasskey'];\n};\n\n/**\n * Checks whether the given authentication assertion is valid for the enrolled passkey.\n *\n * On failure, returns `false` for {@link PasskeyControllerError} with a `code`;\n * other errors propagate.\n *\n * @param authenticationResponse - Result of `navigator.credentials.get()`.\n * @returns `true` if verification succeeds, otherwise `false`.\n */\nexport type PasskeyControllerVerifyPasskeyAuthenticationAction = {\n type: `PasskeyController:verifyPasskeyAuthentication`;\n handler: PasskeyController['verifyPasskeyAuthentication'];\n};\n\n/**\n * Re-wraps the vault key after rotation. Updates persisted `encryptedVaultKey` on success.\n *\n * Does not verify WebAuthn or ceremony state—call only after your layer has authenticated\n * the user (passkey `get()` + verified assertion, or verified password). On passkey paths,\n * pass the same `authenticationResponse` you just verified (e.g. from\n * {@link retrieveVaultKeyWithPasskey} / {@link verifyPasskeyAuthentication}).\n *\n * For password change with passkey step-up, prefer\n * {@link changePasswordWithPasskeyVerification}, which orchestrates keyring export,\n * `changePassword`, and re-wrap in one call.\n *\n * @param params - Re-wrap inputs.\n * @param params.authenticationResponse - Used to derive the wrapping key.\n * @param params.oldVaultKey - Expected current vault key.\n * @param params.newVaultKey - New vault key to encrypt under the passkey.\n * @returns Resolves when the passkey record is updated.\n */\nexport type PasskeyControllerRenewVaultKeyProtectionAction = {\n type: `PasskeyController:renewVaultKeyProtection`;\n handler: PasskeyController['renewVaultKeyProtection'];\n};\n\n/**\n * Changes the wallet password after passkey step-up authentication.\n *\n * When `renewVaultKeyProtection` is `true` (default), re-wraps the vault key under the\n * passkey after rotation. When `false`, removes the passkey instead.\n *\n * @param params - Change-password inputs.\n * @param params.newPassword - New wallet password.\n * @param params.authenticationResponse - Result of `navigator.credentials.get()`.\n * @param params.options - Optional flow controls.\n * @param params.options.renewVaultKeyProtection - Re-wrap vault key after password change.\n * @returns Resolves when the password change completes.\n */\nexport type PasskeyControllerChangePasswordWithPasskeyVerificationAction = {\n type: `PasskeyController:changePasswordWithPasskeyVerification`;\n handler: PasskeyController['changePasswordWithPasskeyVerification'];\n};\n\n/**\n * Removes the enrolled passkey after verifying a passkey authentication assertion.\n *\n * @param authenticationResponse - Result of `navigator.credentials.get()`.\n * @returns Resolves when the passkey is removed.\n */\nexport type PasskeyControllerRemovePasskeyWithPasskeyVerificationAction = {\n type: `PasskeyController:removePasskeyWithPasskeyVerification`;\n handler: PasskeyController['removePasskeyWithPasskeyVerification'];\n};\n\n/**\n * Removes the enrolled passkey after verifying the wallet password.\n *\n * @param password - Wallet password for step-up verification.\n * @returns Resolves when the passkey is removed.\n */\nexport type PasskeyControllerRemovePasskeyWithPasswordVerificationAction = {\n type: `PasskeyController:removePasskeyWithPasswordVerification`;\n handler: PasskeyController['removePasskeyWithPasswordVerification'];\n};\n\n/**\n * Resets state and clears in-flight registration/authentication ceremonies.\n *\n * For user-facing passkey removal with step-up, use\n * {@link removePasskeyWithPasskeyVerification} or\n * {@link removePasskeyWithPasswordVerification}.\n */\nexport type PasskeyControllerClearStateAction = {\n type: `PasskeyController:clearState`;\n handler: PasskeyController['clearState'];\n};\n\n/**\n * Releases all in-flight ceremony state and tears down the messenger.\n */\nexport type PasskeyControllerDestroyAction = {\n type: `PasskeyController:destroy`;\n handler: PasskeyController['destroy'];\n};\n\n/**\n * Union of all PasskeyController action types.\n */\nexport type PasskeyControllerMethodActions =\n | PasskeyControllerIsPasskeyEnrolledAction\n | PasskeyControllerGenerateRegistrationOptionsAction\n | PasskeyControllerGeneratePostRegistrationAuthenticationOptionsAction\n | PasskeyControllerGenerateAuthenticationOptionsAction\n | PasskeyControllerProtectVaultKeyWithPasskeyAction\n | PasskeyControllerRetrieveVaultKeyWithPasskeyAction\n | PasskeyControllerUnlockWithPasskeyAction\n | PasskeyControllerExportSeedPhraseWithPasskeyAction\n | PasskeyControllerExportAccountsWithPasskeyAction\n | PasskeyControllerVerifyPasskeyAuthenticationAction\n | PasskeyControllerRenewVaultKeyProtectionAction\n | PasskeyControllerChangePasswordWithPasskeyVerificationAction\n | PasskeyControllerRemovePasskeyWithPasskeyVerificationAction\n | PasskeyControllerRemovePasskeyWithPasswordVerificationAction\n | PasskeyControllerClearStateAction\n | PasskeyControllerDestroyAction;\n"]}
|
|
1
|
+
{"version":3,"file":"PasskeyController-method-action-types.cjs","sourceRoot":"","sources":["../src/PasskeyController-method-action-types.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated.\n * Do not edit manually.\n */\n\nimport type { PasskeyController } from './PasskeyController.js';\n\n/**\n * Whether a passkey is enrolled and vault key material is stored.\n *\n * @returns `true` if enrolled, otherwise `false`.\n */\nexport type PasskeyControllerIsPasskeyEnrolledAction = {\n type: `PasskeyController:isPasskeyEnrolled`;\n handler: PasskeyController['isPasskeyEnrolled'];\n};\n\n/**\n * Builds WebAuthn credential creation options for passkey enrollment.\n *\n * @param creationOptionsConfig - Optional creation behavior.\n * @param creationOptionsConfig.prfAvailable - Request the PRF extension unless `false`. Defaults to `true`.\n * @returns Public key credential creation options for `navigator.credentials.create()`.\n */\nexport type PasskeyControllerGenerateRegistrationOptionsAction = {\n type: `PasskeyController:generateRegistrationOptions`;\n handler: PasskeyController['generateRegistrationOptions'];\n};\n\n/**\n * Builds WebAuthn credential request options for the post-registration\n * authentication step (between `create` and {@link protectVaultKeyWithPasskey}).\n *\n * @param params - Input for the pending registration ceremony.\n * @param params.registrationResponse - Result of `navigator.credentials.create()`.\n * @returns Public key credential request options for `navigator.credentials.get()`.\n */\nexport type PasskeyControllerGeneratePostRegistrationAuthenticationOptionsAction =\n {\n type: `PasskeyController:generatePostRegistrationAuthenticationOptions`;\n handler: PasskeyController['generatePostRegistrationAuthenticationOptions'];\n };\n\n/**\n * Builds WebAuthn credential request options for the enrolled passkey.\n *\n * @returns Public key credential request options for `navigator.credentials.get()`.\n */\nexport type PasskeyControllerGenerateAuthenticationOptionsAction = {\n type: `PasskeyController:generateAuthenticationOptions`;\n handler: PasskeyController['generateAuthenticationOptions'];\n};\n\n/**\n * Verifies registration and post-registration authentication, then stores the\n * vault key encrypted under the new passkey.\n *\n * Fetches the current vault encryption key from KeyringController before wrapping.\n * When onboarding is complete, requires `password` for step-up verification first.\n *\n * @param params - Enrollment completion inputs.\n * @param params.registrationResponse - Result of `navigator.credentials.create()`.\n * @param params.authenticationResponse - Result of `navigator.credentials.get()` after {@link generatePostRegistrationAuthenticationOptions}.\n * @param params.password - Wallet password when onboarding is complete (step-up).\n * @returns Resolves when enrollment completes.\n */\nexport type PasskeyControllerProtectVaultKeyWithPasskeyAction = {\n type: `PasskeyController:protectVaultKeyWithPasskey`;\n handler: PasskeyController['protectVaultKeyWithPasskey'];\n};\n\n/**\n * Verifies an authentication assertion and returns the decrypted vault key.\n *\n * Prefer orchestrated methods ({@link unlockWithPasskey},\n * {@link exportSeedPhraseWithPasskey}, {@link exportAccountsWithPasskey}) for product\n * flows instead of calling KeyringController with the returned key manually.\n *\n * @param authenticationResponse - Result of `navigator.credentials.get()`.\n * @returns The plaintext vault encryption key.\n */\nexport type PasskeyControllerRetrieveVaultKeyWithPasskeyAction = {\n type: `PasskeyController:retrieveVaultKeyWithPasskey`;\n handler: PasskeyController['retrieveVaultKeyWithPasskey'];\n};\n\n/**\n * Unlocks the keyring using a passkey authentication assertion.\n *\n * @param authenticationResponse - Result of `navigator.credentials.get()`.\n * @returns Resolves when the keyring is unlocked.\n */\nexport type PasskeyControllerUnlockWithPasskeyAction = {\n type: `PasskeyController:unlockWithPasskey`;\n handler: PasskeyController['unlockWithPasskey'];\n};\n\n/**\n * Exports the seed phrase after passkey step-up authentication.\n *\n * @param authenticationResponse - Result of `navigator.credentials.get()`.\n * @param keyringId - Optional keyring id; defaults to the primary HD keyring.\n * @returns Raw seed phrase bytes from KeyringController.\n */\nexport type PasskeyControllerExportSeedPhraseWithPasskeyAction = {\n type: `PasskeyController:exportSeedPhraseWithPasskey`;\n handler: PasskeyController['exportSeedPhraseWithPasskey'];\n};\n\n/**\n * Exports private keys for the given addresses after passkey step-up authentication.\n *\n * @param authenticationResponse - Result of `navigator.credentials.get()`.\n * @param addresses - Account addresses to export.\n * @returns Private keys in the same order as `addresses`.\n */\nexport type PasskeyControllerExportAccountsWithPasskeyAction = {\n type: `PasskeyController:exportAccountsWithPasskey`;\n handler: PasskeyController['exportAccountsWithPasskey'];\n};\n\n/**\n * Checks whether the given authentication assertion is valid for the enrolled passkey.\n *\n * On failure, returns `false` for {@link PasskeyControllerError} with a `code`;\n * other errors propagate.\n *\n * @param authenticationResponse - Result of `navigator.credentials.get()`.\n * @returns `true` if verification succeeds, otherwise `false`.\n */\nexport type PasskeyControllerVerifyPasskeyAuthenticationAction = {\n type: `PasskeyController:verifyPasskeyAuthentication`;\n handler: PasskeyController['verifyPasskeyAuthentication'];\n};\n\n/**\n * Re-wraps the vault key after rotation. Updates persisted `encryptedVaultKey` on success.\n *\n * Does not verify WebAuthn or ceremony state—call only after your layer has authenticated\n * the user (passkey `get()` + verified assertion, or verified password). On passkey paths,\n * pass the same `authenticationResponse` you just verified (e.g. from\n * {@link retrieveVaultKeyWithPasskey} / {@link verifyPasskeyAuthentication}).\n *\n * For password change with passkey step-up, prefer\n * {@link changePasswordWithPasskeyVerification}, which orchestrates keyring export,\n * `changePassword`, and re-wrap in one call.\n *\n * @param params - Re-wrap inputs.\n * @param params.authenticationResponse - Used to derive the wrapping key.\n * @param params.oldVaultKey - Expected current vault key.\n * @param params.newVaultKey - New vault key to encrypt under the passkey.\n * @returns Resolves when the passkey record is updated.\n */\nexport type PasskeyControllerRenewVaultKeyProtectionAction = {\n type: `PasskeyController:renewVaultKeyProtection`;\n handler: PasskeyController['renewVaultKeyProtection'];\n};\n\n/**\n * Changes the wallet password after passkey step-up authentication.\n *\n * When `renewVaultKeyProtection` is `true` (default), re-wraps the vault key under the\n * passkey after rotation. When `false`, removes the passkey instead.\n *\n * @param params - Change-password inputs.\n * @param params.newPassword - New wallet password.\n * @param params.authenticationResponse - Result of `navigator.credentials.get()`.\n * @param params.options - Optional flow controls.\n * @param params.options.renewVaultKeyProtection - Re-wrap vault key after password change.\n * @returns Resolves when the password change completes.\n */\nexport type PasskeyControllerChangePasswordWithPasskeyVerificationAction = {\n type: `PasskeyController:changePasswordWithPasskeyVerification`;\n handler: PasskeyController['changePasswordWithPasskeyVerification'];\n};\n\n/**\n * Removes the enrolled passkey after verifying a passkey authentication assertion.\n *\n * @param authenticationResponse - Result of `navigator.credentials.get()`.\n * @returns Resolves when the passkey is removed.\n */\nexport type PasskeyControllerRemovePasskeyWithPasskeyVerificationAction = {\n type: `PasskeyController:removePasskeyWithPasskeyVerification`;\n handler: PasskeyController['removePasskeyWithPasskeyVerification'];\n};\n\n/**\n * Removes the enrolled passkey after verifying the wallet password.\n *\n * @param password - Wallet password for step-up verification.\n * @returns Resolves when the passkey is removed.\n */\nexport type PasskeyControllerRemovePasskeyWithPasswordVerificationAction = {\n type: `PasskeyController:removePasskeyWithPasswordVerification`;\n handler: PasskeyController['removePasskeyWithPasswordVerification'];\n};\n\n/**\n * Resets state and clears in-flight registration/authentication ceremonies.\n *\n * For user-facing passkey removal with step-up, use\n * {@link removePasskeyWithPasskeyVerification} or\n * {@link removePasskeyWithPasswordVerification}.\n */\nexport type PasskeyControllerClearStateAction = {\n type: `PasskeyController:clearState`;\n handler: PasskeyController['clearState'];\n};\n\n/**\n * Releases all in-flight ceremony state and tears down the messenger.\n */\nexport type PasskeyControllerDestroyAction = {\n type: `PasskeyController:destroy`;\n handler: PasskeyController['destroy'];\n};\n\n/**\n * Union of all PasskeyController action types.\n */\nexport type PasskeyControllerMethodActions =\n | PasskeyControllerIsPasskeyEnrolledAction\n | PasskeyControllerGenerateRegistrationOptionsAction\n | PasskeyControllerGeneratePostRegistrationAuthenticationOptionsAction\n | PasskeyControllerGenerateAuthenticationOptionsAction\n | PasskeyControllerProtectVaultKeyWithPasskeyAction\n | PasskeyControllerRetrieveVaultKeyWithPasskeyAction\n | PasskeyControllerUnlockWithPasskeyAction\n | PasskeyControllerExportSeedPhraseWithPasskeyAction\n | PasskeyControllerExportAccountsWithPasskeyAction\n | PasskeyControllerVerifyPasskeyAuthenticationAction\n | PasskeyControllerRenewVaultKeyProtectionAction\n | PasskeyControllerChangePasswordWithPasskeyVerificationAction\n | PasskeyControllerRemovePasskeyWithPasskeyVerificationAction\n | PasskeyControllerRemovePasskeyWithPasswordVerificationAction\n | PasskeyControllerClearStateAction\n | PasskeyControllerDestroyAction;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PasskeyController-method-action-types.d.cts","sourceRoot":"","sources":["../src/PasskeyController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,
|
|
1
|
+
{"version":3,"file":"PasskeyController-method-action-types.d.cts","sourceRoot":"","sources":["../src/PasskeyController-method-action-types.ts"],"names":[],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PasskeyController-method-action-types.d.mts","sourceRoot":"","sources":["../src/PasskeyController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,
|
|
1
|
+
{"version":3,"file":"PasskeyController-method-action-types.d.mts","sourceRoot":"","sources":["../src/PasskeyController-method-action-types.ts"],"names":[],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PasskeyController-method-action-types.mjs","sourceRoot":"","sources":["../src/PasskeyController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated.\n * Do not edit manually.\n */\n\nimport type { PasskeyController } from './PasskeyController';\n\n/**\n * Whether a passkey is enrolled and vault key material is stored.\n *\n * @returns `true` if enrolled, otherwise `false`.\n */\nexport type PasskeyControllerIsPasskeyEnrolledAction = {\n type: `PasskeyController:isPasskeyEnrolled`;\n handler: PasskeyController['isPasskeyEnrolled'];\n};\n\n/**\n * Builds WebAuthn credential creation options for passkey enrollment.\n *\n * @param creationOptionsConfig - Optional creation behavior.\n * @param creationOptionsConfig.prfAvailable - Request the PRF extension unless `false`. Defaults to `true`.\n * @returns Public key credential creation options for `navigator.credentials.create()`.\n */\nexport type PasskeyControllerGenerateRegistrationOptionsAction = {\n type: `PasskeyController:generateRegistrationOptions`;\n handler: PasskeyController['generateRegistrationOptions'];\n};\n\n/**\n * Builds WebAuthn credential request options for the post-registration\n * authentication step (between `create` and {@link protectVaultKeyWithPasskey}).\n *\n * @param params - Input for the pending registration ceremony.\n * @param params.registrationResponse - Result of `navigator.credentials.create()`.\n * @returns Public key credential request options for `navigator.credentials.get()`.\n */\nexport type PasskeyControllerGeneratePostRegistrationAuthenticationOptionsAction =\n {\n type: `PasskeyController:generatePostRegistrationAuthenticationOptions`;\n handler: PasskeyController['generatePostRegistrationAuthenticationOptions'];\n };\n\n/**\n * Builds WebAuthn credential request options for the enrolled passkey.\n *\n * @returns Public key credential request options for `navigator.credentials.get()`.\n */\nexport type PasskeyControllerGenerateAuthenticationOptionsAction = {\n type: `PasskeyController:generateAuthenticationOptions`;\n handler: PasskeyController['generateAuthenticationOptions'];\n};\n\n/**\n * Verifies registration and post-registration authentication, then stores the\n * vault key encrypted under the new passkey.\n *\n * Fetches the current vault encryption key from KeyringController before wrapping.\n * When onboarding is complete, requires `password` for step-up verification first.\n *\n * @param params - Enrollment completion inputs.\n * @param params.registrationResponse - Result of `navigator.credentials.create()`.\n * @param params.authenticationResponse - Result of `navigator.credentials.get()` after {@link generatePostRegistrationAuthenticationOptions}.\n * @param params.password - Wallet password when onboarding is complete (step-up).\n * @returns Resolves when enrollment completes.\n */\nexport type PasskeyControllerProtectVaultKeyWithPasskeyAction = {\n type: `PasskeyController:protectVaultKeyWithPasskey`;\n handler: PasskeyController['protectVaultKeyWithPasskey'];\n};\n\n/**\n * Verifies an authentication assertion and returns the decrypted vault key.\n *\n * Prefer orchestrated methods ({@link unlockWithPasskey},\n * {@link exportSeedPhraseWithPasskey}, {@link exportAccountsWithPasskey}) for product\n * flows instead of calling KeyringController with the returned key manually.\n *\n * @param authenticationResponse - Result of `navigator.credentials.get()`.\n * @returns The plaintext vault encryption key.\n */\nexport type PasskeyControllerRetrieveVaultKeyWithPasskeyAction = {\n type: `PasskeyController:retrieveVaultKeyWithPasskey`;\n handler: PasskeyController['retrieveVaultKeyWithPasskey'];\n};\n\n/**\n * Unlocks the keyring using a passkey authentication assertion.\n *\n * @param authenticationResponse - Result of `navigator.credentials.get()`.\n * @returns Resolves when the keyring is unlocked.\n */\nexport type PasskeyControllerUnlockWithPasskeyAction = {\n type: `PasskeyController:unlockWithPasskey`;\n handler: PasskeyController['unlockWithPasskey'];\n};\n\n/**\n * Exports the seed phrase after passkey step-up authentication.\n *\n * @param authenticationResponse - Result of `navigator.credentials.get()`.\n * @param keyringId - Optional keyring id; defaults to the primary HD keyring.\n * @returns Raw seed phrase bytes from KeyringController.\n */\nexport type PasskeyControllerExportSeedPhraseWithPasskeyAction = {\n type: `PasskeyController:exportSeedPhraseWithPasskey`;\n handler: PasskeyController['exportSeedPhraseWithPasskey'];\n};\n\n/**\n * Exports private keys for the given addresses after passkey step-up authentication.\n *\n * @param authenticationResponse - Result of `navigator.credentials.get()`.\n * @param addresses - Account addresses to export.\n * @returns Private keys in the same order as `addresses`.\n */\nexport type PasskeyControllerExportAccountsWithPasskeyAction = {\n type: `PasskeyController:exportAccountsWithPasskey`;\n handler: PasskeyController['exportAccountsWithPasskey'];\n};\n\n/**\n * Checks whether the given authentication assertion is valid for the enrolled passkey.\n *\n * On failure, returns `false` for {@link PasskeyControllerError} with a `code`;\n * other errors propagate.\n *\n * @param authenticationResponse - Result of `navigator.credentials.get()`.\n * @returns `true` if verification succeeds, otherwise `false`.\n */\nexport type PasskeyControllerVerifyPasskeyAuthenticationAction = {\n type: `PasskeyController:verifyPasskeyAuthentication`;\n handler: PasskeyController['verifyPasskeyAuthentication'];\n};\n\n/**\n * Re-wraps the vault key after rotation. Updates persisted `encryptedVaultKey` on success.\n *\n * Does not verify WebAuthn or ceremony state—call only after your layer has authenticated\n * the user (passkey `get()` + verified assertion, or verified password). On passkey paths,\n * pass the same `authenticationResponse` you just verified (e.g. from\n * {@link retrieveVaultKeyWithPasskey} / {@link verifyPasskeyAuthentication}).\n *\n * For password change with passkey step-up, prefer\n * {@link changePasswordWithPasskeyVerification}, which orchestrates keyring export,\n * `changePassword`, and re-wrap in one call.\n *\n * @param params - Re-wrap inputs.\n * @param params.authenticationResponse - Used to derive the wrapping key.\n * @param params.oldVaultKey - Expected current vault key.\n * @param params.newVaultKey - New vault key to encrypt under the passkey.\n * @returns Resolves when the passkey record is updated.\n */\nexport type PasskeyControllerRenewVaultKeyProtectionAction = {\n type: `PasskeyController:renewVaultKeyProtection`;\n handler: PasskeyController['renewVaultKeyProtection'];\n};\n\n/**\n * Changes the wallet password after passkey step-up authentication.\n *\n * When `renewVaultKeyProtection` is `true` (default), re-wraps the vault key under the\n * passkey after rotation. When `false`, removes the passkey instead.\n *\n * @param params - Change-password inputs.\n * @param params.newPassword - New wallet password.\n * @param params.authenticationResponse - Result of `navigator.credentials.get()`.\n * @param params.options - Optional flow controls.\n * @param params.options.renewVaultKeyProtection - Re-wrap vault key after password change.\n * @returns Resolves when the password change completes.\n */\nexport type PasskeyControllerChangePasswordWithPasskeyVerificationAction = {\n type: `PasskeyController:changePasswordWithPasskeyVerification`;\n handler: PasskeyController['changePasswordWithPasskeyVerification'];\n};\n\n/**\n * Removes the enrolled passkey after verifying a passkey authentication assertion.\n *\n * @param authenticationResponse - Result of `navigator.credentials.get()`.\n * @returns Resolves when the passkey is removed.\n */\nexport type PasskeyControllerRemovePasskeyWithPasskeyVerificationAction = {\n type: `PasskeyController:removePasskeyWithPasskeyVerification`;\n handler: PasskeyController['removePasskeyWithPasskeyVerification'];\n};\n\n/**\n * Removes the enrolled passkey after verifying the wallet password.\n *\n * @param password - Wallet password for step-up verification.\n * @returns Resolves when the passkey is removed.\n */\nexport type PasskeyControllerRemovePasskeyWithPasswordVerificationAction = {\n type: `PasskeyController:removePasskeyWithPasswordVerification`;\n handler: PasskeyController['removePasskeyWithPasswordVerification'];\n};\n\n/**\n * Resets state and clears in-flight registration/authentication ceremonies.\n *\n * For user-facing passkey removal with step-up, use\n * {@link removePasskeyWithPasskeyVerification} or\n * {@link removePasskeyWithPasswordVerification}.\n */\nexport type PasskeyControllerClearStateAction = {\n type: `PasskeyController:clearState`;\n handler: PasskeyController['clearState'];\n};\n\n/**\n * Releases all in-flight ceremony state and tears down the messenger.\n */\nexport type PasskeyControllerDestroyAction = {\n type: `PasskeyController:destroy`;\n handler: PasskeyController['destroy'];\n};\n\n/**\n * Union of all PasskeyController action types.\n */\nexport type PasskeyControllerMethodActions =\n | PasskeyControllerIsPasskeyEnrolledAction\n | PasskeyControllerGenerateRegistrationOptionsAction\n | PasskeyControllerGeneratePostRegistrationAuthenticationOptionsAction\n | PasskeyControllerGenerateAuthenticationOptionsAction\n | PasskeyControllerProtectVaultKeyWithPasskeyAction\n | PasskeyControllerRetrieveVaultKeyWithPasskeyAction\n | PasskeyControllerUnlockWithPasskeyAction\n | PasskeyControllerExportSeedPhraseWithPasskeyAction\n | PasskeyControllerExportAccountsWithPasskeyAction\n | PasskeyControllerVerifyPasskeyAuthenticationAction\n | PasskeyControllerRenewVaultKeyProtectionAction\n | PasskeyControllerChangePasswordWithPasskeyVerificationAction\n | PasskeyControllerRemovePasskeyWithPasskeyVerificationAction\n | PasskeyControllerRemovePasskeyWithPasswordVerificationAction\n | PasskeyControllerClearStateAction\n | PasskeyControllerDestroyAction;\n"]}
|
|
1
|
+
{"version":3,"file":"PasskeyController-method-action-types.mjs","sourceRoot":"","sources":["../src/PasskeyController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated.\n * Do not edit manually.\n */\n\nimport type { PasskeyController } from './PasskeyController.js';\n\n/**\n * Whether a passkey is enrolled and vault key material is stored.\n *\n * @returns `true` if enrolled, otherwise `false`.\n */\nexport type PasskeyControllerIsPasskeyEnrolledAction = {\n type: `PasskeyController:isPasskeyEnrolled`;\n handler: PasskeyController['isPasskeyEnrolled'];\n};\n\n/**\n * Builds WebAuthn credential creation options for passkey enrollment.\n *\n * @param creationOptionsConfig - Optional creation behavior.\n * @param creationOptionsConfig.prfAvailable - Request the PRF extension unless `false`. Defaults to `true`.\n * @returns Public key credential creation options for `navigator.credentials.create()`.\n */\nexport type PasskeyControllerGenerateRegistrationOptionsAction = {\n type: `PasskeyController:generateRegistrationOptions`;\n handler: PasskeyController['generateRegistrationOptions'];\n};\n\n/**\n * Builds WebAuthn credential request options for the post-registration\n * authentication step (between `create` and {@link protectVaultKeyWithPasskey}).\n *\n * @param params - Input for the pending registration ceremony.\n * @param params.registrationResponse - Result of `navigator.credentials.create()`.\n * @returns Public key credential request options for `navigator.credentials.get()`.\n */\nexport type PasskeyControllerGeneratePostRegistrationAuthenticationOptionsAction =\n {\n type: `PasskeyController:generatePostRegistrationAuthenticationOptions`;\n handler: PasskeyController['generatePostRegistrationAuthenticationOptions'];\n };\n\n/**\n * Builds WebAuthn credential request options for the enrolled passkey.\n *\n * @returns Public key credential request options for `navigator.credentials.get()`.\n */\nexport type PasskeyControllerGenerateAuthenticationOptionsAction = {\n type: `PasskeyController:generateAuthenticationOptions`;\n handler: PasskeyController['generateAuthenticationOptions'];\n};\n\n/**\n * Verifies registration and post-registration authentication, then stores the\n * vault key encrypted under the new passkey.\n *\n * Fetches the current vault encryption key from KeyringController before wrapping.\n * When onboarding is complete, requires `password` for step-up verification first.\n *\n * @param params - Enrollment completion inputs.\n * @param params.registrationResponse - Result of `navigator.credentials.create()`.\n * @param params.authenticationResponse - Result of `navigator.credentials.get()` after {@link generatePostRegistrationAuthenticationOptions}.\n * @param params.password - Wallet password when onboarding is complete (step-up).\n * @returns Resolves when enrollment completes.\n */\nexport type PasskeyControllerProtectVaultKeyWithPasskeyAction = {\n type: `PasskeyController:protectVaultKeyWithPasskey`;\n handler: PasskeyController['protectVaultKeyWithPasskey'];\n};\n\n/**\n * Verifies an authentication assertion and returns the decrypted vault key.\n *\n * Prefer orchestrated methods ({@link unlockWithPasskey},\n * {@link exportSeedPhraseWithPasskey}, {@link exportAccountsWithPasskey}) for product\n * flows instead of calling KeyringController with the returned key manually.\n *\n * @param authenticationResponse - Result of `navigator.credentials.get()`.\n * @returns The plaintext vault encryption key.\n */\nexport type PasskeyControllerRetrieveVaultKeyWithPasskeyAction = {\n type: `PasskeyController:retrieveVaultKeyWithPasskey`;\n handler: PasskeyController['retrieveVaultKeyWithPasskey'];\n};\n\n/**\n * Unlocks the keyring using a passkey authentication assertion.\n *\n * @param authenticationResponse - Result of `navigator.credentials.get()`.\n * @returns Resolves when the keyring is unlocked.\n */\nexport type PasskeyControllerUnlockWithPasskeyAction = {\n type: `PasskeyController:unlockWithPasskey`;\n handler: PasskeyController['unlockWithPasskey'];\n};\n\n/**\n * Exports the seed phrase after passkey step-up authentication.\n *\n * @param authenticationResponse - Result of `navigator.credentials.get()`.\n * @param keyringId - Optional keyring id; defaults to the primary HD keyring.\n * @returns Raw seed phrase bytes from KeyringController.\n */\nexport type PasskeyControllerExportSeedPhraseWithPasskeyAction = {\n type: `PasskeyController:exportSeedPhraseWithPasskey`;\n handler: PasskeyController['exportSeedPhraseWithPasskey'];\n};\n\n/**\n * Exports private keys for the given addresses after passkey step-up authentication.\n *\n * @param authenticationResponse - Result of `navigator.credentials.get()`.\n * @param addresses - Account addresses to export.\n * @returns Private keys in the same order as `addresses`.\n */\nexport type PasskeyControllerExportAccountsWithPasskeyAction = {\n type: `PasskeyController:exportAccountsWithPasskey`;\n handler: PasskeyController['exportAccountsWithPasskey'];\n};\n\n/**\n * Checks whether the given authentication assertion is valid for the enrolled passkey.\n *\n * On failure, returns `false` for {@link PasskeyControllerError} with a `code`;\n * other errors propagate.\n *\n * @param authenticationResponse - Result of `navigator.credentials.get()`.\n * @returns `true` if verification succeeds, otherwise `false`.\n */\nexport type PasskeyControllerVerifyPasskeyAuthenticationAction = {\n type: `PasskeyController:verifyPasskeyAuthentication`;\n handler: PasskeyController['verifyPasskeyAuthentication'];\n};\n\n/**\n * Re-wraps the vault key after rotation. Updates persisted `encryptedVaultKey` on success.\n *\n * Does not verify WebAuthn or ceremony state—call only after your layer has authenticated\n * the user (passkey `get()` + verified assertion, or verified password). On passkey paths,\n * pass the same `authenticationResponse` you just verified (e.g. from\n * {@link retrieveVaultKeyWithPasskey} / {@link verifyPasskeyAuthentication}).\n *\n * For password change with passkey step-up, prefer\n * {@link changePasswordWithPasskeyVerification}, which orchestrates keyring export,\n * `changePassword`, and re-wrap in one call.\n *\n * @param params - Re-wrap inputs.\n * @param params.authenticationResponse - Used to derive the wrapping key.\n * @param params.oldVaultKey - Expected current vault key.\n * @param params.newVaultKey - New vault key to encrypt under the passkey.\n * @returns Resolves when the passkey record is updated.\n */\nexport type PasskeyControllerRenewVaultKeyProtectionAction = {\n type: `PasskeyController:renewVaultKeyProtection`;\n handler: PasskeyController['renewVaultKeyProtection'];\n};\n\n/**\n * Changes the wallet password after passkey step-up authentication.\n *\n * When `renewVaultKeyProtection` is `true` (default), re-wraps the vault key under the\n * passkey after rotation. When `false`, removes the passkey instead.\n *\n * @param params - Change-password inputs.\n * @param params.newPassword - New wallet password.\n * @param params.authenticationResponse - Result of `navigator.credentials.get()`.\n * @param params.options - Optional flow controls.\n * @param params.options.renewVaultKeyProtection - Re-wrap vault key after password change.\n * @returns Resolves when the password change completes.\n */\nexport type PasskeyControllerChangePasswordWithPasskeyVerificationAction = {\n type: `PasskeyController:changePasswordWithPasskeyVerification`;\n handler: PasskeyController['changePasswordWithPasskeyVerification'];\n};\n\n/**\n * Removes the enrolled passkey after verifying a passkey authentication assertion.\n *\n * @param authenticationResponse - Result of `navigator.credentials.get()`.\n * @returns Resolves when the passkey is removed.\n */\nexport type PasskeyControllerRemovePasskeyWithPasskeyVerificationAction = {\n type: `PasskeyController:removePasskeyWithPasskeyVerification`;\n handler: PasskeyController['removePasskeyWithPasskeyVerification'];\n};\n\n/**\n * Removes the enrolled passkey after verifying the wallet password.\n *\n * @param password - Wallet password for step-up verification.\n * @returns Resolves when the passkey is removed.\n */\nexport type PasskeyControllerRemovePasskeyWithPasswordVerificationAction = {\n type: `PasskeyController:removePasskeyWithPasswordVerification`;\n handler: PasskeyController['removePasskeyWithPasswordVerification'];\n};\n\n/**\n * Resets state and clears in-flight registration/authentication ceremonies.\n *\n * For user-facing passkey removal with step-up, use\n * {@link removePasskeyWithPasskeyVerification} or\n * {@link removePasskeyWithPasswordVerification}.\n */\nexport type PasskeyControllerClearStateAction = {\n type: `PasskeyController:clearState`;\n handler: PasskeyController['clearState'];\n};\n\n/**\n * Releases all in-flight ceremony state and tears down the messenger.\n */\nexport type PasskeyControllerDestroyAction = {\n type: `PasskeyController:destroy`;\n handler: PasskeyController['destroy'];\n};\n\n/**\n * Union of all PasskeyController action types.\n */\nexport type PasskeyControllerMethodActions =\n | PasskeyControllerIsPasskeyEnrolledAction\n | PasskeyControllerGenerateRegistrationOptionsAction\n | PasskeyControllerGeneratePostRegistrationAuthenticationOptionsAction\n | PasskeyControllerGenerateAuthenticationOptionsAction\n | PasskeyControllerProtectVaultKeyWithPasskeyAction\n | PasskeyControllerRetrieveVaultKeyWithPasskeyAction\n | PasskeyControllerUnlockWithPasskeyAction\n | PasskeyControllerExportSeedPhraseWithPasskeyAction\n | PasskeyControllerExportAccountsWithPasskeyAction\n | PasskeyControllerVerifyPasskeyAuthenticationAction\n | PasskeyControllerRenewVaultKeyProtectionAction\n | PasskeyControllerChangePasswordWithPasskeyVerificationAction\n | PasskeyControllerRemovePasskeyWithPasskeyVerificationAction\n | PasskeyControllerRemovePasskeyWithPasswordVerificationAction\n | PasskeyControllerClearStateAction\n | PasskeyControllerDestroyAction;\n"]}
|
|
@@ -16,17 +16,17 @@ exports.PasskeyController = exports.passkeyControllerSelectors = exports.getDefa
|
|
|
16
16
|
const base_controller_1 = require("@metamask/base-controller");
|
|
17
17
|
const utils_1 = require("@metamask/utils");
|
|
18
18
|
const async_mutex_1 = require("async-mutex");
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
const
|
|
28
|
-
const
|
|
29
|
-
const
|
|
19
|
+
const ceremony_manager_js_1 = require("./ceremony-manager.cjs");
|
|
20
|
+
const constants_js_1 = require("./constants.cjs");
|
|
21
|
+
const errors_js_1 = require("./errors.cjs");
|
|
22
|
+
const key_derivation_js_1 = require("./key-derivation.cjs");
|
|
23
|
+
const logger_js_1 = require("./logger.cjs");
|
|
24
|
+
const crypto_js_1 = require("./utils/crypto.cjs");
|
|
25
|
+
const encoding_js_1 = require("./utils/encoding.cjs");
|
|
26
|
+
const constants_js_2 = require("./webauthn/constants.cjs");
|
|
27
|
+
const decode_client_data_json_js_1 = require("./webauthn/decode-client-data-json.cjs");
|
|
28
|
+
const verify_authentication_response_js_1 = require("./webauthn/verify-authentication-response.cjs");
|
|
29
|
+
const verify_registration_response_js_1 = require("./webauthn/verify-registration-response.cjs");
|
|
30
30
|
/**
|
|
31
31
|
* Returns the default (empty) state for {@link PasskeyController}.
|
|
32
32
|
*
|
|
@@ -44,7 +44,7 @@ const passkeyControllerMetadata = {
|
|
|
44
44
|
usedInUi: true,
|
|
45
45
|
},
|
|
46
46
|
};
|
|
47
|
-
const log = (0,
|
|
47
|
+
const log = (0, logger_js_1.createModuleLogger)(logger_js_1.projectLogger, constants_js_1.controllerName);
|
|
48
48
|
/**
|
|
49
49
|
* Selectors for {@link PasskeyControllerState}.
|
|
50
50
|
*
|
|
@@ -96,11 +96,11 @@ class PasskeyController extends base_controller_1.BaseController {
|
|
|
96
96
|
super({
|
|
97
97
|
messenger,
|
|
98
98
|
metadata: passkeyControllerMetadata,
|
|
99
|
-
name:
|
|
99
|
+
name: constants_js_1.controllerName,
|
|
100
100
|
state: { ...getDefaultPasskeyControllerState(), ...state },
|
|
101
101
|
});
|
|
102
102
|
_PasskeyController_instances.add(this);
|
|
103
|
-
_PasskeyController_ceremonyManager.set(this, new
|
|
103
|
+
_PasskeyController_ceremonyManager.set(this, new ceremony_manager_js_1.CeremonyManager());
|
|
104
104
|
_PasskeyController_expectedRPIDs.set(this, void 0);
|
|
105
105
|
_PasskeyController_rpId.set(this, void 0);
|
|
106
106
|
_PasskeyController_rpName.set(this, void 0);
|
|
@@ -138,12 +138,12 @@ class PasskeyController extends base_controller_1.BaseController {
|
|
|
138
138
|
*/
|
|
139
139
|
generateRegistrationOptions(creationOptionsConfig) {
|
|
140
140
|
if (this.isPasskeyEnrolled()) {
|
|
141
|
-
throw new
|
|
141
|
+
throw new errors_js_1.PasskeyControllerError(constants_js_1.PasskeyControllerErrorMessage.AlreadyEnrolled, { code: constants_js_1.PasskeyControllerErrorCode.AlreadyEnrolled });
|
|
142
142
|
}
|
|
143
143
|
const includePrf = creationOptionsConfig?.prfAvailable !== false;
|
|
144
|
-
const prfSalt = includePrf ? (0,
|
|
145
|
-
const userHandle = (0,
|
|
146
|
-
const challenge = (0,
|
|
144
|
+
const prfSalt = includePrf ? (0, crypto_js_1.randomBytesToBase64URL)(32) : undefined;
|
|
145
|
+
const userHandle = (0, crypto_js_1.randomBytesToBase64URL)(64);
|
|
146
|
+
const challenge = (0, crypto_js_1.randomBytesToBase64URL)(32);
|
|
147
147
|
const extensions = {};
|
|
148
148
|
if (prfSalt) {
|
|
149
149
|
extensions.prf = { eval: { first: prfSalt } };
|
|
@@ -160,11 +160,11 @@ class PasskeyController extends base_controller_1.BaseController {
|
|
|
160
160
|
},
|
|
161
161
|
challenge,
|
|
162
162
|
pubKeyCredParams: [
|
|
163
|
-
{ alg:
|
|
164
|
-
{ alg:
|
|
165
|
-
{ alg:
|
|
163
|
+
{ alg: constants_js_2.COSEALG.EdDSA, type: 'public-key' },
|
|
164
|
+
{ alg: constants_js_2.COSEALG.ES256, type: 'public-key' },
|
|
165
|
+
{ alg: constants_js_2.COSEALG.RS256, type: 'public-key' },
|
|
166
166
|
],
|
|
167
|
-
timeout:
|
|
167
|
+
timeout: ceremony_manager_js_1.WEBAUTHN_TIMEOUT_MS,
|
|
168
168
|
authenticatorSelection: {
|
|
169
169
|
userVerification: 'required',
|
|
170
170
|
authenticatorAttachment: 'platform',
|
|
@@ -197,10 +197,10 @@ class PasskeyController extends base_controller_1.BaseController {
|
|
|
197
197
|
const registrationCeremony = __classPrivateFieldGet(this, _PasskeyController_ceremonyManager, "f").getRegistrationCeremony(regChallenge);
|
|
198
198
|
if (!registrationCeremony) {
|
|
199
199
|
log('No active passkey registration ceremony for challenge');
|
|
200
|
-
throw new
|
|
200
|
+
throw new errors_js_1.PasskeyControllerError(constants_js_1.PasskeyControllerErrorMessage.NoRegistrationCeremony, { code: constants_js_1.PasskeyControllerErrorCode.NoRegistrationCeremony });
|
|
201
201
|
}
|
|
202
202
|
// build auth options
|
|
203
|
-
const challenge = (0,
|
|
203
|
+
const challenge = (0, crypto_js_1.randomBytesToBase64URL)(32);
|
|
204
204
|
const extensions = {};
|
|
205
205
|
if (registrationCeremony.prfSalt) {
|
|
206
206
|
extensions.prf = { eval: { first: registrationCeremony.prfSalt } };
|
|
@@ -217,7 +217,7 @@ class PasskeyController extends base_controller_1.BaseController {
|
|
|
217
217
|
],
|
|
218
218
|
userVerification: 'required',
|
|
219
219
|
hints: ['client-device', 'hybrid'],
|
|
220
|
-
timeout:
|
|
220
|
+
timeout: ceremony_manager_js_1.WEBAUTHN_TIMEOUT_MS,
|
|
221
221
|
extensions,
|
|
222
222
|
};
|
|
223
223
|
// save auth ceremony
|
|
@@ -234,7 +234,7 @@ class PasskeyController extends base_controller_1.BaseController {
|
|
|
234
234
|
*/
|
|
235
235
|
generateAuthenticationOptions() {
|
|
236
236
|
const record = __classPrivateFieldGet(this, _PasskeyController_instances, "m", _PasskeyController_requireEnrolled).call(this);
|
|
237
|
-
const challenge = (0,
|
|
237
|
+
const challenge = (0, crypto_js_1.randomBytesToBase64URL)(32);
|
|
238
238
|
const extensions = {};
|
|
239
239
|
if (record.keyDerivation.method === 'prf') {
|
|
240
240
|
extensions.prf = { eval: { first: record.keyDerivation.prfSalt } };
|
|
@@ -251,7 +251,7 @@ class PasskeyController extends base_controller_1.BaseController {
|
|
|
251
251
|
],
|
|
252
252
|
userVerification: 'required',
|
|
253
253
|
hints: ['client-device', 'hybrid'],
|
|
254
|
-
timeout:
|
|
254
|
+
timeout: ceremony_manager_js_1.WEBAUTHN_TIMEOUT_MS,
|
|
255
255
|
extensions,
|
|
256
256
|
};
|
|
257
257
|
__classPrivateFieldGet(this, _PasskeyController_ceremonyManager, "f").saveAuthenticationCeremony(challenge, {
|
|
@@ -419,7 +419,7 @@ class PasskeyController extends base_controller_1.BaseController {
|
|
|
419
419
|
exports.PasskeyController = PasskeyController;
|
|
420
420
|
_PasskeyController_ceremonyManager = new WeakMap(), _PasskeyController_expectedRPIDs = new WeakMap(), _PasskeyController_rpId = new WeakMap(), _PasskeyController_rpName = new WeakMap(), _PasskeyController_expectedOrigin = new WeakMap(), _PasskeyController_userName = new WeakMap(), _PasskeyController_userDisplayName = new WeakMap(), _PasskeyController_getIsOnboardingCompleted = new WeakMap(), _PasskeyController_operationMutex = new WeakMap(), _PasskeyController_instances = new WeakSet(), _PasskeyController_protectVaultKeyWithPasskey = async function _PasskeyController_protectVaultKeyWithPasskey(params) {
|
|
421
421
|
if (this.isPasskeyEnrolled()) {
|
|
422
|
-
throw new
|
|
422
|
+
throw new errors_js_1.PasskeyControllerError(constants_js_1.PasskeyControllerErrorMessage.AlreadyEnrolled, { code: constants_js_1.PasskeyControllerErrorCode.AlreadyEnrolled });
|
|
423
423
|
}
|
|
424
424
|
await __classPrivateFieldGet(this, _PasskeyController_instances, "m", _PasskeyController_assertEnrollmentAllowed).call(this, params.password);
|
|
425
425
|
const vaultKey = await this.messenger.call('KeyringController:exportEncryptionKey');
|
|
@@ -429,11 +429,11 @@ _PasskeyController_ceremonyManager = new WeakMap(), _PasskeyController_expectedR
|
|
|
429
429
|
const registrationCeremony = __classPrivateFieldGet(this, _PasskeyController_ceremonyManager, "f").getRegistrationCeremony(challenge);
|
|
430
430
|
if (!registrationCeremony) {
|
|
431
431
|
log('No active passkey registration ceremony for challenge');
|
|
432
|
-
throw new
|
|
432
|
+
throw new errors_js_1.PasskeyControllerError(constants_js_1.PasskeyControllerErrorMessage.NoRegistrationCeremony, { code: constants_js_1.PasskeyControllerErrorCode.NoRegistrationCeremony });
|
|
433
433
|
}
|
|
434
434
|
try {
|
|
435
435
|
// verify registration response
|
|
436
|
-
const { verified, registrationInfo } = await (0,
|
|
436
|
+
const { verified, registrationInfo } = await (0, verify_registration_response_js_1.verifyRegistrationResponse)({
|
|
437
437
|
response: registrationResponse,
|
|
438
438
|
expectedChallenge: registrationCeremony.challenge,
|
|
439
439
|
expectedOrigin: __classPrivateFieldGet(this, _PasskeyController_expectedOrigin, "f"),
|
|
@@ -441,19 +441,19 @@ _PasskeyController_ceremonyManager = new WeakMap(), _PasskeyController_expectedR
|
|
|
441
441
|
requireUserVerification: true,
|
|
442
442
|
}).catch((error) => {
|
|
443
443
|
log('Error verifying passkey registration response', error);
|
|
444
|
-
throw new
|
|
445
|
-
code:
|
|
444
|
+
throw new errors_js_1.PasskeyControllerError(constants_js_1.PasskeyControllerErrorMessage.RegistrationVerificationFailed, {
|
|
445
|
+
code: constants_js_1.PasskeyControllerErrorCode.RegistrationVerificationFailed,
|
|
446
446
|
cause: error instanceof Error ? error : new Error(String(error)),
|
|
447
447
|
});
|
|
448
448
|
});
|
|
449
449
|
if (!verified || !registrationInfo) {
|
|
450
450
|
log('Passkey registration verification returned unverified or missing registration info');
|
|
451
|
-
throw new
|
|
451
|
+
throw new errors_js_1.PasskeyControllerError(constants_js_1.PasskeyControllerErrorMessage.RegistrationVerificationFailed, { code: constants_js_1.PasskeyControllerErrorCode.RegistrationVerificationFailed });
|
|
452
452
|
}
|
|
453
453
|
// verify authentication response
|
|
454
454
|
const credential = {
|
|
455
455
|
id: registrationInfo.credentialId,
|
|
456
|
-
publicKey: (0,
|
|
456
|
+
publicKey: (0, encoding_js_1.bytesToBase64URL)(registrationInfo.publicKey),
|
|
457
457
|
counter: registrationInfo.counter,
|
|
458
458
|
transports: registrationInfo.transports,
|
|
459
459
|
aaguid: registrationInfo.aaguid,
|
|
@@ -469,11 +469,11 @@ _PasskeyController_ceremonyManager = new WeakMap(), _PasskeyController_expectedR
|
|
|
469
469
|
authenticationResponse.response.userHandle !==
|
|
470
470
|
registrationCeremony.userHandle) {
|
|
471
471
|
log('Post-registration assertion userHandle does not match registration ceremony');
|
|
472
|
-
throw new
|
|
472
|
+
throw new errors_js_1.PasskeyControllerError(constants_js_1.PasskeyControllerErrorMessage.AuthenticationVerificationFailed, { code: constants_js_1.PasskeyControllerErrorCode.AuthenticationVerificationFailed });
|
|
473
473
|
}
|
|
474
474
|
// derive key and encrypt vault key
|
|
475
|
-
const encKey = (0,
|
|
476
|
-
const { ciphertext, iv } = (0,
|
|
475
|
+
const encKey = (0, key_derivation_js_1.deriveKeyFromAuthenticationResponse)(authenticationResponse, { credential, keyDerivation });
|
|
476
|
+
const { ciphertext, iv } = (0, crypto_js_1.encryptWithKey)(vaultKey, encKey);
|
|
477
477
|
// persist passkey record
|
|
478
478
|
this.update((state) => {
|
|
479
479
|
state.passkeyRecord = {
|
|
@@ -496,21 +496,21 @@ _PasskeyController_ceremonyManager = new WeakMap(), _PasskeyController_expectedR
|
|
|
496
496
|
const { newCounter } = await __classPrivateFieldGet(this, _PasskeyController_instances, "m", _PasskeyController_verifyAuthenticationResponse).call(this, authenticationResponse, passkeyRecord.credential);
|
|
497
497
|
this.update((state) => {
|
|
498
498
|
if (!state.passkeyRecord) {
|
|
499
|
-
throw new
|
|
499
|
+
throw new errors_js_1.PasskeyControllerError(constants_js_1.PasskeyControllerErrorMessage.NotEnrolled, { code: constants_js_1.PasskeyControllerErrorCode.NotEnrolled });
|
|
500
500
|
}
|
|
501
501
|
state.passkeyRecord.credential.counter = Math.max(newCounter, state.passkeyRecord.credential.counter);
|
|
502
502
|
});
|
|
503
503
|
// derive key
|
|
504
|
-
const encKey = (0,
|
|
504
|
+
const encKey = (0, key_derivation_js_1.deriveKeyFromAuthenticationResponse)(authenticationResponse, passkeyRecord);
|
|
505
505
|
// decrypt vault key
|
|
506
506
|
try {
|
|
507
|
-
const vaultKey = (0,
|
|
507
|
+
const vaultKey = (0, crypto_js_1.decryptWithKey)(passkeyRecord.encryptedVaultKey.ciphertext, passkeyRecord.encryptedVaultKey.iv, encKey);
|
|
508
508
|
return vaultKey;
|
|
509
509
|
}
|
|
510
510
|
catch (cause) {
|
|
511
511
|
log('Error decrypting vault key with passkey', cause instanceof Error ? cause : new Error(String(cause)));
|
|
512
|
-
throw new
|
|
513
|
-
code:
|
|
512
|
+
throw new errors_js_1.PasskeyControllerError(constants_js_1.PasskeyControllerErrorMessage.VaultKeyDecryptionFailed, {
|
|
513
|
+
code: constants_js_1.PasskeyControllerErrorCode.VaultKeyDecryptionFailed,
|
|
514
514
|
cause: cause instanceof Error ? cause : new Error(String(cause)),
|
|
515
515
|
});
|
|
516
516
|
}
|
|
@@ -520,7 +520,7 @@ _PasskeyController_ceremonyManager = new WeakMap(), _PasskeyController_expectedR
|
|
|
520
520
|
return true;
|
|
521
521
|
}
|
|
522
522
|
catch (error) {
|
|
523
|
-
if (error instanceof
|
|
523
|
+
if (error instanceof errors_js_1.PasskeyControllerError && error.code !== undefined) {
|
|
524
524
|
return false;
|
|
525
525
|
}
|
|
526
526
|
throw error;
|
|
@@ -529,16 +529,16 @@ _PasskeyController_ceremonyManager = new WeakMap(), _PasskeyController_expectedR
|
|
|
529
529
|
const { authenticationResponse } = params;
|
|
530
530
|
const passkeyRecord = __classPrivateFieldGet(this, _PasskeyController_instances, "m", _PasskeyController_requireEnrolled).call(this);
|
|
531
531
|
// derive key
|
|
532
|
-
const encKey = (0,
|
|
532
|
+
const encKey = (0, key_derivation_js_1.deriveKeyFromAuthenticationResponse)(authenticationResponse, passkeyRecord);
|
|
533
533
|
// decrypt vault key
|
|
534
534
|
let decryptedVaultKey;
|
|
535
535
|
try {
|
|
536
|
-
decryptedVaultKey = (0,
|
|
536
|
+
decryptedVaultKey = (0, crypto_js_1.decryptWithKey)(passkeyRecord.encryptedVaultKey.ciphertext, passkeyRecord.encryptedVaultKey.iv, encKey);
|
|
537
537
|
}
|
|
538
538
|
catch (error) {
|
|
539
539
|
log('Error decrypting vault key during passkey vault key renewal', error instanceof Error ? error : new Error(String(error)));
|
|
540
|
-
throw new
|
|
541
|
-
code:
|
|
540
|
+
throw new errors_js_1.PasskeyControllerError(constants_js_1.PasskeyControllerErrorMessage.VaultKeyDecryptionFailed, {
|
|
541
|
+
code: constants_js_1.PasskeyControllerErrorCode.VaultKeyDecryptionFailed,
|
|
542
542
|
cause: error instanceof Error ? error : new Error(String(error)),
|
|
543
543
|
});
|
|
544
544
|
}
|
|
@@ -546,15 +546,15 @@ _PasskeyController_ceremonyManager = new WeakMap(), _PasskeyController_expectedR
|
|
|
546
546
|
const { oldVaultKey, newVaultKey } = params;
|
|
547
547
|
if (!(0, utils_1.areUint8ArraysEqual)((0, utils_1.stringToBytes)(decryptedVaultKey), (0, utils_1.stringToBytes)(oldVaultKey))) {
|
|
548
548
|
log('Passkey renewal rejected: decrypted vault key does not match oldVaultKey');
|
|
549
|
-
throw new
|
|
549
|
+
throw new errors_js_1.PasskeyControllerError(constants_js_1.PasskeyControllerErrorMessage.VaultKeyMismatch, { code: constants_js_1.PasskeyControllerErrorCode.VaultKeyMismatch });
|
|
550
550
|
}
|
|
551
551
|
// encrypt new vault key
|
|
552
|
-
const { ciphertext, iv } = (0,
|
|
552
|
+
const { ciphertext, iv } = (0, crypto_js_1.encryptWithKey)(newVaultKey, encKey);
|
|
553
553
|
// persist passkey record (mutate current state only for vault key material)
|
|
554
554
|
this.update((state) => {
|
|
555
555
|
if (!state.passkeyRecord) {
|
|
556
|
-
throw new
|
|
557
|
-
code:
|
|
556
|
+
throw new errors_js_1.PasskeyControllerError(constants_js_1.PasskeyControllerErrorMessage.NotEnrolled, {
|
|
557
|
+
code: constants_js_1.PasskeyControllerErrorCode.NotEnrolled,
|
|
558
558
|
});
|
|
559
559
|
}
|
|
560
560
|
state.passkeyRecord.encryptedVaultKey = { ciphertext, iv };
|
|
@@ -563,7 +563,7 @@ _PasskeyController_ceremonyManager = new WeakMap(), _PasskeyController_expectedR
|
|
|
563
563
|
__classPrivateFieldGet(this, _PasskeyController_instances, "m", _PasskeyController_requireEnrolled).call(this);
|
|
564
564
|
const verified = await __classPrivateFieldGet(this, _PasskeyController_instances, "m", _PasskeyController_verifyPasskeyAuthentication).call(this, params.authenticationResponse);
|
|
565
565
|
if (!verified) {
|
|
566
|
-
throw new
|
|
566
|
+
throw new errors_js_1.PasskeyControllerError(constants_js_1.PasskeyControllerErrorMessage.AuthenticationVerificationFailed, { code: constants_js_1.PasskeyControllerErrorCode.AuthenticationVerificationFailed });
|
|
567
567
|
}
|
|
568
568
|
const renewVaultKeyProtection = params.options?.renewVaultKeyProtection ?? true;
|
|
569
569
|
if (!renewVaultKeyProtection) {
|
|
@@ -583,8 +583,8 @@ _PasskeyController_ceremonyManager = new WeakMap(), _PasskeyController_expectedR
|
|
|
583
583
|
}
|
|
584
584
|
catch (error) {
|
|
585
585
|
__classPrivateFieldGet(this, _PasskeyController_instances, "m", _PasskeyController_removePasskey).call(this);
|
|
586
|
-
throw new
|
|
587
|
-
code:
|
|
586
|
+
throw new errors_js_1.PasskeyControllerError(constants_js_1.PasskeyControllerErrorMessage.VaultKeyRenewalFailed, {
|
|
587
|
+
code: constants_js_1.PasskeyControllerErrorCode.VaultKeyRenewalFailed,
|
|
588
588
|
cause: error instanceof Error ? error : new Error(String(error)),
|
|
589
589
|
});
|
|
590
590
|
}
|
|
@@ -592,7 +592,7 @@ _PasskeyController_ceremonyManager = new WeakMap(), _PasskeyController_expectedR
|
|
|
592
592
|
__classPrivateFieldGet(this, _PasskeyController_instances, "m", _PasskeyController_requireEnrolled).call(this);
|
|
593
593
|
const verified = await __classPrivateFieldGet(this, _PasskeyController_instances, "m", _PasskeyController_verifyPasskeyAuthentication).call(this, authenticationResponse);
|
|
594
594
|
if (!verified) {
|
|
595
|
-
throw new
|
|
595
|
+
throw new errors_js_1.PasskeyControllerError(constants_js_1.PasskeyControllerErrorMessage.AuthenticationVerificationFailed, { code: constants_js_1.PasskeyControllerErrorCode.AuthenticationVerificationFailed });
|
|
596
596
|
}
|
|
597
597
|
__classPrivateFieldGet(this, _PasskeyController_instances, "m", _PasskeyController_removePasskey).call(this);
|
|
598
598
|
}, _PasskeyController_removePasskeyWithPasswordVerification = async function _PasskeyController_removePasskeyWithPasswordVerification(password) {
|
|
@@ -614,33 +614,33 @@ async function _PasskeyController_verifyAuthenticationResponse(authenticationRes
|
|
|
614
614
|
const authenticationCeremony = __classPrivateFieldGet(this, _PasskeyController_ceremonyManager, "f").getAuthenticationCeremony(challenge);
|
|
615
615
|
if (!authenticationCeremony) {
|
|
616
616
|
log('No active passkey authentication ceremony for challenge');
|
|
617
|
-
throw new
|
|
617
|
+
throw new errors_js_1.PasskeyControllerError(constants_js_1.PasskeyControllerErrorMessage.NoAuthenticationCeremony, { code: constants_js_1.PasskeyControllerErrorCode.NoAuthenticationCeremony });
|
|
618
618
|
}
|
|
619
619
|
try {
|
|
620
620
|
// verify authentication response
|
|
621
|
-
const result = await (0,
|
|
621
|
+
const result = await (0, verify_authentication_response_js_1.verifyAuthenticationResponse)({
|
|
622
622
|
response: authenticationResponse,
|
|
623
623
|
expectedChallenge: authenticationCeremony.challenge,
|
|
624
624
|
expectedOrigin: __classPrivateFieldGet(this, _PasskeyController_expectedOrigin, "f"),
|
|
625
625
|
expectedRPIDs: __classPrivateFieldGet(this, _PasskeyController_expectedRPIDs, "f"),
|
|
626
626
|
credential: {
|
|
627
627
|
id: credential.id,
|
|
628
|
-
publicKey: (0,
|
|
628
|
+
publicKey: (0, encoding_js_1.base64URLToBytes)(credential.publicKey),
|
|
629
629
|
counter: credential.counter,
|
|
630
630
|
transports: credential.transports,
|
|
631
631
|
},
|
|
632
632
|
requireUserVerification: true,
|
|
633
633
|
}).catch((error) => {
|
|
634
634
|
log('Error verifying passkey authentication response', error instanceof Error ? error : new Error(String(error)));
|
|
635
|
-
throw new
|
|
636
|
-
code:
|
|
635
|
+
throw new errors_js_1.PasskeyControllerError(constants_js_1.PasskeyControllerErrorMessage.AuthenticationVerificationFailed, {
|
|
636
|
+
code: constants_js_1.PasskeyControllerErrorCode.AuthenticationVerificationFailed,
|
|
637
637
|
cause: error instanceof Error ? error : new Error(String(error)),
|
|
638
638
|
});
|
|
639
639
|
});
|
|
640
640
|
if (!result.verified) {
|
|
641
641
|
log('Passkey authentication verification returned unverified');
|
|
642
|
-
throw new
|
|
643
|
-
code:
|
|
642
|
+
throw new errors_js_1.PasskeyControllerError(constants_js_1.PasskeyControllerErrorMessage.AuthenticationVerificationFailed, {
|
|
643
|
+
code: constants_js_1.PasskeyControllerErrorCode.AuthenticationVerificationFailed,
|
|
644
644
|
});
|
|
645
645
|
}
|
|
646
646
|
return { newCounter: result.authenticationInfo.newCounter };
|
|
@@ -663,21 +663,21 @@ async function _PasskeyController_withOperationLock(callback) {
|
|
|
663
663
|
return;
|
|
664
664
|
}
|
|
665
665
|
if (!password) {
|
|
666
|
-
throw new
|
|
667
|
-
code:
|
|
666
|
+
throw new errors_js_1.PasskeyControllerError(constants_js_1.PasskeyControllerErrorMessage.EnrollmentPasswordRequired, {
|
|
667
|
+
code: constants_js_1.PasskeyControllerErrorCode.EnrollmentPasswordRequired,
|
|
668
668
|
});
|
|
669
669
|
}
|
|
670
670
|
await this.messenger.call('KeyringController:verifyPassword', password);
|
|
671
671
|
}, _PasskeyController_requireEnrolled = function _PasskeyController_requireEnrolled() {
|
|
672
672
|
const record = this.state.passkeyRecord;
|
|
673
673
|
if (!record) {
|
|
674
|
-
throw new
|
|
675
|
-
code:
|
|
674
|
+
throw new errors_js_1.PasskeyControllerError(constants_js_1.PasskeyControllerErrorMessage.NotEnrolled, {
|
|
675
|
+
code: constants_js_1.PasskeyControllerErrorCode.NotEnrolled,
|
|
676
676
|
});
|
|
677
677
|
}
|
|
678
678
|
return record;
|
|
679
679
|
}, _PasskeyController_getChallengeFromClientData = function _PasskeyController_getChallengeFromClientData(clientDataJSON) {
|
|
680
|
-
return (0,
|
|
680
|
+
return (0, decode_client_data_json_js_1.decodeClientDataJSON)(clientDataJSON).challenge;
|
|
681
681
|
}, _PasskeyController_removePasskey = function _PasskeyController_removePasskey() {
|
|
682
682
|
this.update(() => getDefaultPasskeyControllerState());
|
|
683
683
|
__classPrivateFieldGet(this, _PasskeyController_ceremonyManager, "f").clear();
|