@metamask/passkey-controller 3.1.0 → 4.1.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/CHANGELOG.md +38 -1
- package/README.md +101 -9
- package/dist/{PasskeyController-method-action-types.d.mts → PasskeyController-method-action-types.d.ts} +44 -3
- package/dist/PasskeyController-method-action-types.d.ts.map +1 -0
- package/dist/{PasskeyController-method-action-types.mjs → PasskeyController-method-action-types.js} +1 -1
- package/dist/PasskeyController-method-action-types.js.map +1 -0
- package/dist/{PasskeyController.d.cts → PasskeyController.d.ts} +41 -6
- package/dist/PasskeyController.d.ts.map +1 -0
- package/dist/PasskeyController.js +828 -0
- package/dist/PasskeyController.js.map +1 -0
- package/dist/{ceremony-manager.d.cts → ceremony-manager.d.ts} +2 -2
- package/dist/ceremony-manager.d.ts.map +1 -0
- package/dist/ceremony-manager.js +150 -0
- package/dist/ceremony-manager.js.map +1 -0
- package/dist/{constants.d.mts → constants.d.ts} +18 -12
- package/dist/constants.d.ts.map +1 -0
- package/dist/{constants.mjs → constants.js} +7 -1
- package/dist/constants.js.map +1 -0
- package/dist/{errors.d.mts → errors.d.ts} +2 -2
- package/dist/errors.d.ts.map +1 -0
- package/dist/{errors.mjs → errors.js} +4 -1
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/{key-derivation.d.cts → key-derivation.d.ts} +3 -3
- package/dist/key-derivation.d.ts.map +1 -0
- package/dist/{key-derivation.mjs → key-derivation.js} +5 -5
- package/dist/key-derivation.js.map +1 -0
- package/dist/logger.d.ts +4 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/logger.js +6 -0
- package/dist/logger.js.map +1 -0
- package/dist/{types.d.cts → types.d.ts} +23 -9
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/{crypto.d.mts → crypto.d.ts} +1 -1
- package/dist/utils/crypto.d.ts.map +1 -0
- package/dist/utils/{crypto.mjs → crypto.js} +10 -8
- package/dist/utils/crypto.js.map +1 -0
- package/dist/utils/{encoding.d.cts → encoding.d.ts} +1 -1
- package/dist/utils/encoding.d.ts.map +1 -0
- package/dist/utils/{encoding.mjs → encoding.js} +2 -2
- package/dist/utils/encoding.js.map +1 -0
- package/dist/webauthn/{constants.d.mts → constants.d.ts} +1 -1
- package/dist/webauthn/constants.d.ts.map +1 -0
- package/dist/webauthn/{constants.mjs → constants.js} +1 -1
- package/dist/webauthn/constants.js.map +1 -0
- package/dist/webauthn/{decode-attestation-object.d.mts → decode-attestation-object.d.ts} +2 -2
- package/dist/webauthn/decode-attestation-object.d.ts.map +1 -0
- package/dist/webauthn/{decode-attestation-object.mjs → decode-attestation-object.js} +2 -2
- package/dist/webauthn/decode-attestation-object.js.map +1 -0
- package/dist/webauthn/{decode-client-data-json.d.cts → decode-client-data-json.d.ts} +2 -2
- package/dist/webauthn/decode-client-data-json.d.ts.map +1 -0
- package/dist/webauthn/{decode-client-data-json.mjs → decode-client-data-json.js} +2 -2
- package/dist/webauthn/decode-client-data-json.js.map +1 -0
- package/dist/webauthn/{match-expected-rp-id.d.cts → match-expected-rp-id.d.ts} +3 -3
- package/dist/webauthn/match-expected-rp-id.d.ts.map +1 -0
- package/dist/webauthn/{match-expected-rp-id.mjs → match-expected-rp-id.js} +6 -7
- package/dist/webauthn/match-expected-rp-id.js.map +1 -0
- package/dist/webauthn/{parse-authenticator-data.d.cts → parse-authenticator-data.d.ts} +2 -2
- package/dist/webauthn/parse-authenticator-data.d.ts.map +1 -0
- package/dist/webauthn/{parse-authenticator-data.mjs → parse-authenticator-data.js} +2 -2
- package/dist/webauthn/parse-authenticator-data.js.map +1 -0
- package/dist/webauthn/{types.d.mts → types.d.ts} +2 -2
- package/dist/webauthn/types.d.ts.map +1 -0
- package/dist/webauthn/types.js +2 -0
- package/dist/webauthn/types.js.map +1 -0
- package/dist/webauthn/{verify-authentication-response.d.cts → verify-authentication-response.d.ts} +3 -3
- package/dist/webauthn/verify-authentication-response.d.ts.map +1 -0
- package/dist/webauthn/{verify-authentication-response.mjs → verify-authentication-response.js} +13 -11
- package/dist/webauthn/verify-authentication-response.js.map +1 -0
- package/dist/webauthn/{verify-registration-response.d.mts → verify-registration-response.d.ts} +3 -3
- package/dist/webauthn/verify-registration-response.d.ts.map +1 -0
- package/dist/webauthn/{verify-registration-response.mjs → verify-registration-response.js} +12 -13
- package/dist/webauthn/verify-registration-response.js.map +1 -0
- package/dist/webauthn/{verify-signature.d.cts → verify-signature.d.ts} +4 -3
- package/dist/webauthn/verify-signature.d.ts.map +1 -0
- package/dist/webauthn/{verify-signature.mjs → verify-signature.js} +17 -16
- package/dist/webauthn/verify-signature.js.map +1 -0
- package/package.json +16 -21
- package/dist/PasskeyController-method-action-types.cjs +0 -7
- package/dist/PasskeyController-method-action-types.cjs.map +0 -1
- package/dist/PasskeyController-method-action-types.d.cts +0 -204
- package/dist/PasskeyController-method-action-types.d.cts.map +0 -1
- package/dist/PasskeyController-method-action-types.d.mts.map +0 -1
- package/dist/PasskeyController-method-action-types.mjs.map +0 -1
- package/dist/PasskeyController.cjs +0 -685
- package/dist/PasskeyController.cjs.map +0 -1
- package/dist/PasskeyController.d.cts.map +0 -1
- package/dist/PasskeyController.d.mts +0 -208
- package/dist/PasskeyController.d.mts.map +0 -1
- package/dist/PasskeyController.mjs +0 -680
- package/dist/PasskeyController.mjs.map +0 -1
- package/dist/ceremony-manager.cjs +0 -135
- package/dist/ceremony-manager.cjs.map +0 -1
- package/dist/ceremony-manager.d.cts.map +0 -1
- package/dist/ceremony-manager.d.mts +0 -72
- package/dist/ceremony-manager.d.mts.map +0 -1
- package/dist/ceremony-manager.mjs +0 -131
- package/dist/ceremony-manager.mjs.map +0 -1
- package/dist/constants.cjs +0 -39
- package/dist/constants.cjs.map +0 -1
- package/dist/constants.d.cts +0 -36
- package/dist/constants.d.cts.map +0 -1
- package/dist/constants.d.mts.map +0 -1
- package/dist/constants.mjs.map +0 -1
- package/dist/errors.cjs +0 -57
- package/dist/errors.cjs.map +0 -1
- package/dist/errors.d.cts +0 -34
- package/dist/errors.d.cts.map +0 -1
- package/dist/errors.d.mts.map +0 -1
- package/dist/errors.mjs.map +0 -1
- package/dist/index.cjs +0 -15
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -8
- package/dist/index.d.cts.map +0 -1
- package/dist/index.d.mts +0 -8
- package/dist/index.d.mts.map +0 -1
- package/dist/index.mjs +0 -5
- package/dist/index.mjs.map +0 -1
- package/dist/key-derivation.cjs +0 -44
- package/dist/key-derivation.cjs.map +0 -1
- package/dist/key-derivation.d.cts.map +0 -1
- package/dist/key-derivation.d.mts +0 -20
- package/dist/key-derivation.d.mts.map +0 -1
- package/dist/key-derivation.mjs.map +0 -1
- package/dist/logger.cjs +0 -9
- package/dist/logger.cjs.map +0 -1
- package/dist/logger.d.cts +0 -5
- package/dist/logger.d.cts.map +0 -1
- package/dist/logger.d.mts +0 -5
- package/dist/logger.d.mts.map +0 -1
- package/dist/logger.mjs +0 -6
- package/dist/logger.mjs.map +0 -1
- package/dist/types.cjs +0 -4
- package/dist/types.cjs.map +0 -1
- package/dist/types.d.cts.map +0 -1
- package/dist/types.d.mts +0 -132
- package/dist/types.d.mts.map +0 -1
- package/dist/types.mjs +0 -2
- package/dist/types.mjs.map +0 -1
- package/dist/utils/crypto.cjs +0 -66
- package/dist/utils/crypto.cjs.map +0 -1
- package/dist/utils/crypto.d.cts +0 -37
- package/dist/utils/crypto.d.cts.map +0 -1
- package/dist/utils/crypto.d.mts.map +0 -1
- package/dist/utils/crypto.mjs.map +0 -1
- package/dist/utils/encoding.cjs +0 -42
- package/dist/utils/encoding.cjs.map +0 -1
- package/dist/utils/encoding.d.cts.map +0 -1
- package/dist/utils/encoding.d.mts +0 -22
- package/dist/utils/encoding.d.mts.map +0 -1
- package/dist/utils/encoding.mjs.map +0 -1
- package/dist/webauthn/constants.cjs +0 -74
- package/dist/webauthn/constants.cjs.map +0 -1
- package/dist/webauthn/constants.d.cts +0 -68
- package/dist/webauthn/constants.d.cts.map +0 -1
- package/dist/webauthn/constants.d.mts.map +0 -1
- package/dist/webauthn/constants.mjs.map +0 -1
- package/dist/webauthn/decode-attestation-object.cjs +0 -18
- package/dist/webauthn/decode-attestation-object.cjs.map +0 -1
- package/dist/webauthn/decode-attestation-object.d.cts +0 -10
- package/dist/webauthn/decode-attestation-object.d.cts.map +0 -1
- package/dist/webauthn/decode-attestation-object.d.mts.map +0 -1
- package/dist/webauthn/decode-attestation-object.mjs.map +0 -1
- package/dist/webauthn/decode-client-data-json.cjs +0 -17
- package/dist/webauthn/decode-client-data-json.cjs.map +0 -1
- package/dist/webauthn/decode-client-data-json.d.cts.map +0 -1
- package/dist/webauthn/decode-client-data-json.d.mts +0 -9
- package/dist/webauthn/decode-client-data-json.d.mts.map +0 -1
- package/dist/webauthn/decode-client-data-json.mjs.map +0 -1
- package/dist/webauthn/match-expected-rp-id.cjs +0 -26
- package/dist/webauthn/match-expected-rp-id.cjs.map +0 -1
- package/dist/webauthn/match-expected-rp-id.d.cts.map +0 -1
- package/dist/webauthn/match-expected-rp-id.d.mts +0 -11
- package/dist/webauthn/match-expected-rp-id.d.mts.map +0 -1
- package/dist/webauthn/match-expected-rp-id.mjs.map +0 -1
- package/dist/webauthn/parse-authenticator-data.cjs +0 -69
- package/dist/webauthn/parse-authenticator-data.cjs.map +0 -1
- package/dist/webauthn/parse-authenticator-data.d.cts.map +0 -1
- package/dist/webauthn/parse-authenticator-data.d.mts +0 -10
- package/dist/webauthn/parse-authenticator-data.d.mts.map +0 -1
- package/dist/webauthn/parse-authenticator-data.mjs.map +0 -1
- package/dist/webauthn/types.cjs +0 -3
- package/dist/webauthn/types.cjs.map +0 -1
- package/dist/webauthn/types.d.cts +0 -113
- package/dist/webauthn/types.d.cts.map +0 -1
- package/dist/webauthn/types.d.mts.map +0 -1
- package/dist/webauthn/types.mjs +0 -2
- package/dist/webauthn/types.mjs.map +0 -1
- package/dist/webauthn/verify-authentication-response.cjs +0 -133
- package/dist/webauthn/verify-authentication-response.cjs.map +0 -1
- package/dist/webauthn/verify-authentication-response.d.cts.map +0 -1
- package/dist/webauthn/verify-authentication-response.d.mts +0 -64
- package/dist/webauthn/verify-authentication-response.d.mts.map +0 -1
- package/dist/webauthn/verify-authentication-response.mjs.map +0 -1
- package/dist/webauthn/verify-registration-response.cjs +0 -242
- package/dist/webauthn/verify-registration-response.cjs.map +0 -1
- package/dist/webauthn/verify-registration-response.d.cts +0 -81
- package/dist/webauthn/verify-registration-response.d.cts.map +0 -1
- package/dist/webauthn/verify-registration-response.d.mts.map +0 -1
- package/dist/webauthn/verify-registration-response.mjs.map +0 -1
- package/dist/webauthn/verify-signature.cjs +0 -176
- package/dist/webauthn/verify-signature.cjs.map +0 -1
- package/dist/webauthn/verify-signature.d.cts.map +0 -1
- package/dist/webauthn/verify-signature.d.mts +0 -21
- package/dist/webauthn/verify-signature.d.mts.map +0 -1
- package/dist/webauthn/verify-signature.mjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,41 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [4.1.0]
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- Add PRF migration methods for enrolled legacy `userHandle` passkeys ([#10310](https://github.com/MetaMask/core/pull/10310))
|
|
15
|
+
- `generatePasskeyReplacementRegistrationOptions` stages a PRF-only
|
|
16
|
+
replacement registration while retaining the existing record.
|
|
17
|
+
- `completePasskeyReplacement` verifies the replacement registration and PRF
|
|
18
|
+
assertion, re-wraps the vault key, and atomically commits the new record.
|
|
19
|
+
- `cancelPasskeyReplacement` removes the targeted replacement ceremony and
|
|
20
|
+
its linked post-registration authentication ceremony.
|
|
21
|
+
|
|
22
|
+
### Changed
|
|
23
|
+
|
|
24
|
+
- Use `@metamask/utils` SHA-256, SHA-384, and SHA-512 digests for asynchronous WebAuthn verification and RP ID matching, while retaining Noble SHA-256 for synchronous HKDF ([#10188](https://github.com/MetaMask/core/pull/10188))
|
|
25
|
+
- Bump `@metamask/utils` from `^11.12.0` to `^12.0.0` ([#10192](https://github.com/MetaMask/core/pull/10192))
|
|
26
|
+
|
|
27
|
+
### Fixed
|
|
28
|
+
|
|
29
|
+
- Keep replacement ceremonies retryable after password and vault-key export failures ([#10310](https://github.com/MetaMask/core/pull/10310))
|
|
30
|
+
|
|
31
|
+
## [4.0.0]
|
|
32
|
+
|
|
33
|
+
### Changed
|
|
34
|
+
|
|
35
|
+
- **BREAKING:** Drop CommonJS support ([#9536](https://github.com/MetaMask/core/pull/9536))
|
|
36
|
+
- This package is now ESM-only, but can still be used in CommonJS projects via `require(esm)` in modern Node.js versions (22+), or dynamic imports in older Node.js versions.
|
|
37
|
+
- **BREAKING:** Bump minimum Node.js version to 22 ([#9976](https://github.com/MetaMask/core/pull/9976))
|
|
38
|
+
- **BREAKING:** Bump TypeScript target to ES2022 ([#10019](https://github.com/MetaMask/core/pull/10019))
|
|
39
|
+
- This package now ships ES2022 code, requiring a compatible modern environment or bundler configuration to consume.
|
|
40
|
+
- Bump `@metamask/utils` from `^11.11.0` to `^11.12.0` ([#10076](https://github.com/MetaMask/core/pull/10076))
|
|
41
|
+
- Bump `@metamask/base-controller` from `^9.1.0` to `^10.0.0` ([#10160](https://github.com/MetaMask/core/pull/10160))
|
|
42
|
+
- Bump `@metamask/keyring-controller` from `^27.1.1` to `^28.0.0` ([#10160](https://github.com/MetaMask/core/pull/10160))
|
|
43
|
+
- Bump `@metamask/messenger` from `^2.0.0` to `^3.0.0` ([#10160](https://github.com/MetaMask/core/pull/10160))
|
|
44
|
+
|
|
10
45
|
## [3.1.0]
|
|
11
46
|
|
|
12
47
|
### Added
|
|
@@ -112,7 +147,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
112
147
|
- Registration verification requires the credential `id`/`rawId` to match the credential id in authenticator data; vault wrapping key derivation uses that verified credential id so enrollment keys align with the stored credential.
|
|
113
148
|
- Registration options request attestation conveyance `'none'` so clients are not asked for direct attestation formats the verifier does not implement (`none` and self-attested `packed` only).
|
|
114
149
|
|
|
115
|
-
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/passkey-controller@
|
|
150
|
+
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/passkey-controller@4.1.0...HEAD
|
|
151
|
+
[4.1.0]: https://github.com/MetaMask/core/compare/@metamask/passkey-controller@4.0.0...@metamask/passkey-controller@4.1.0
|
|
152
|
+
[4.0.0]: https://github.com/MetaMask/core/compare/@metamask/passkey-controller@3.1.0...@metamask/passkey-controller@4.0.0
|
|
116
153
|
[3.1.0]: https://github.com/MetaMask/core/compare/@metamask/passkey-controller@3.0.0...@metamask/passkey-controller@3.1.0
|
|
117
154
|
[3.0.0]: https://github.com/MetaMask/core/compare/@metamask/passkey-controller@2.1.0...@metamask/passkey-controller@3.0.0
|
|
118
155
|
[2.1.0]: https://github.com/MetaMask/core/compare/@metamask/passkey-controller@2.0.1...@metamask/passkey-controller@2.1.0
|
package/README.md
CHANGED
|
@@ -87,6 +87,91 @@ await controller.protectVaultKeyWithPasskey({
|
|
|
87
87
|
});
|
|
88
88
|
```
|
|
89
89
|
|
|
90
|
+
### Migrating a `userHandle` passkey to PRF
|
|
91
|
+
|
|
92
|
+
Use the dedicated replacement flow for an enrolled passkey whose
|
|
93
|
+
`passkeyRecord.keyDerivation.method` is `userHandle`. The existing record
|
|
94
|
+
remains active until the replacement is fully verified and the vault key has
|
|
95
|
+
been wrapped with the new PRF-derived key.
|
|
96
|
+
|
|
97
|
+
```mermaid
|
|
98
|
+
flowchart LR
|
|
99
|
+
n1["PasskeyCtrl:migrateToPRF"] --> n2["PasskeyCtrl:register"]
|
|
100
|
+
n2 --> n3["PRF Supported"]
|
|
101
|
+
n3 --> n6["YES"] & n7["NO"]
|
|
102
|
+
n7 --> n4["Do Nothing"]
|
|
103
|
+
n6 --> n5["PasskeyCtrl:verify"]
|
|
104
|
+
n5 --> n8["Success"]
|
|
105
|
+
n8 --> n9["YES"] & n10["NO"]
|
|
106
|
+
n10 --> n4
|
|
107
|
+
n9 --> n11["PasskeyCtrl:replaceUserHandleRecord"]
|
|
108
|
+
n4 --> n12["Continue with current userHandle passkey"]
|
|
109
|
+
|
|
110
|
+
n1@{ shape: rounded}
|
|
111
|
+
n2@{ shape: rounded}
|
|
112
|
+
n3@{ shape: diam}
|
|
113
|
+
n6@{ shape: rect}
|
|
114
|
+
n7@{ shape: rect}
|
|
115
|
+
n4@{ shape: rect}
|
|
116
|
+
n5@{ shape: rounded}
|
|
117
|
+
n8@{ shape: diam}
|
|
118
|
+
n9@{ shape: rect}
|
|
119
|
+
n10@{ shape: rect}
|
|
120
|
+
n11@{ shape: rounded}
|
|
121
|
+
n12@{ shape: rect}
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
In the client side,
|
|
125
|
+
|
|
126
|
+
```typescript
|
|
127
|
+
// 1. Stage a PRF-only replacement registration.
|
|
128
|
+
const replacementOptions =
|
|
129
|
+
controller.generatePasskeyReplacementRegistrationOptions();
|
|
130
|
+
|
|
131
|
+
let replacementRegistrationResponse;
|
|
132
|
+
let replacementAuthenticationResponse;
|
|
133
|
+
try {
|
|
134
|
+
// 2. Register the new authenticator. The old credential is excluded.
|
|
135
|
+
replacementRegistrationResponse = await navigator.credentials.create({
|
|
136
|
+
publicKey: replacementOptions,
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
// 3. Request the post-registration PRF assertion.
|
|
140
|
+
const replacementAuthenticationOptions =
|
|
141
|
+
controller.generatePostRegistrationAuthenticationOptions({
|
|
142
|
+
registrationResponse: replacementRegistrationResponse,
|
|
143
|
+
});
|
|
144
|
+
replacementAuthenticationResponse = await navigator.credentials.get({
|
|
145
|
+
publicKey: replacementAuthenticationOptions,
|
|
146
|
+
});
|
|
147
|
+
} catch (error) {
|
|
148
|
+
// Call this when the browser ceremony is canceled or abandoned before
|
|
149
|
+
// completion. TTL pruning remains the fallback if this is not called.
|
|
150
|
+
controller.cancelPasskeyReplacement(replacementOptions.challenge);
|
|
151
|
+
throw error;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// 4. Verify both responses and atomically replace the persisted record.
|
|
155
|
+
await controller.completePasskeyReplacement({
|
|
156
|
+
registrationResponse: replacementRegistrationResponse,
|
|
157
|
+
authenticationResponse: replacementAuthenticationResponse,
|
|
158
|
+
password: settingsEnroll ? walletPassword : undefined,
|
|
159
|
+
});
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
The replacement authentication response must contain non-empty PRF output;
|
|
163
|
+
there is no `userHandle` fallback. After onboarding, the `password` argument
|
|
164
|
+
is required for the same step-up authorization used by normal enrollment.
|
|
165
|
+
A missing or wrong password, or a failed vault-key export, leaves the
|
|
166
|
+
replacement ceremony in place so the same `create()`/`get()` responses can be
|
|
167
|
+
retried. `cancelPasskeyReplacement` removes only the targeted replacement
|
|
168
|
+
ceremony and its linked post-registration authentication ceremony; it does
|
|
169
|
+
not remove the enrolled passkey.
|
|
170
|
+
|
|
171
|
+
The atomicity guarantee applies to the controller state update. If the wallet's
|
|
172
|
+
generic persistence subscriber cannot write the new state, it logs the failure
|
|
173
|
+
and the previous record may remain on disk for the next restart.
|
|
174
|
+
|
|
90
175
|
### Passkey unlock (authentication)
|
|
91
176
|
|
|
92
177
|
Prefer `unlockWithPasskey`, which verifies the assertion and submits the vault key to KeyringController.
|
|
@@ -102,14 +187,17 @@ await controller.unlockWithPasskey(response);
|
|
|
102
187
|
|
|
103
188
|
These methods combine passkey verification with KeyringController calls. Use them from UI layers that already performed `navigator.credentials.get()`.
|
|
104
189
|
|
|
105
|
-
| Method
|
|
106
|
-
|
|
|
107
|
-
| `unlockWithPasskey`
|
|
108
|
-
| `
|
|
109
|
-
| `
|
|
110
|
-
| `
|
|
111
|
-
| `
|
|
112
|
-
| `
|
|
190
|
+
| Method | Purpose |
|
|
191
|
+
| ----------------------------------------------- | ------------------------------------------------------------ |
|
|
192
|
+
| `unlockWithPasskey` | Unlock keyring after passkey assertion |
|
|
193
|
+
| `generatePasskeyReplacementRegistrationOptions` | Generate PRF-only replacement registration options |
|
|
194
|
+
| `completePasskeyReplacement` | Verify and atomically complete `userHandle` → PRF migration |
|
|
195
|
+
| `cancelPasskeyReplacement` | Cancel one replacement ceremony and its linked auth ceremony |
|
|
196
|
+
| `removePasskeyWithPasskeyVerification` | Remove passkey after assertion step-up |
|
|
197
|
+
| `removePasskeyWithPasswordVerification` | Remove passkey after password step-up |
|
|
198
|
+
| `changePasswordWithPasskeyVerification` | Change password; re-wrap vault key by default |
|
|
199
|
+
| `exportSeedPhraseWithPasskey` | Export SRP bytes after assertion step-up |
|
|
200
|
+
| `exportAccountsWithPasskey` | Export private keys for addresses after assertion step-up |
|
|
113
201
|
|
|
114
202
|
```typescript
|
|
115
203
|
// Change password (re-wraps passkey protection by default)
|
|
@@ -164,7 +252,8 @@ passkeyControllerSelectors.selectIsPasskeyEnrolled(state); // boolean
|
|
|
164
252
|
cases use a stable `code` from `PasskeyControllerErrorCode` (for example:
|
|
165
253
|
`not_enrolled`, `already_enrolled`, `no_registration_ceremony`,
|
|
166
254
|
`authentication_verification_failed`, `missing_key_material`, `vault_key_decryption_failed`,
|
|
167
|
-
`vault_key_mismatch`, `vault_key_renewal_failed`, `enrollment_password_required
|
|
255
|
+
`vault_key_mismatch`, `vault_key_renewal_failed`, `enrollment_password_required`,
|
|
256
|
+
`migration_not_required`, `prf_required`, `replacement_source_changed`). Human-readable strings
|
|
168
257
|
live on `PasskeyControllerErrorMessage`. Use `instanceof PasskeyControllerError`
|
|
169
258
|
and a defined `error.code` to tell these apart from malformed WebAuthn payloads
|
|
170
259
|
and other `Error` values. Thrown errors from the internal WebAuthn verify helpers
|
|
@@ -188,6 +277,9 @@ those controller errors (with `code`) and rethrows everything else.
|
|
|
188
277
|
| `PasskeyController:getState` | Persisted `passkeyRecord` |
|
|
189
278
|
| `PasskeyController:isPasskeyEnrolled` | Enrollment boolean |
|
|
190
279
|
| `PasskeyController:generateRegistrationOptions` | WebAuthn `create()` options |
|
|
280
|
+
| `PasskeyController:generatePasskeyReplacementRegistrationOptions` | PRF replacement `create()` options |
|
|
281
|
+
| `PasskeyController:completePasskeyReplacement` | Complete PRF replacement |
|
|
282
|
+
| `PasskeyController:cancelPasskeyReplacement` | Cancel one replacement ceremony |
|
|
191
283
|
| `PasskeyController:generatePostRegistrationAuthenticationOptions` | WebAuthn `get()` after `create()` |
|
|
192
284
|
| `PasskeyController:generateAuthenticationOptions` | WebAuthn `get()` for unlock / step-up |
|
|
193
285
|
| `PasskeyController:protectVaultKeyWithPasskey` | Enroll: verify ceremonies + wrap vault key |
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* This file is auto generated.
|
|
3
3
|
* Do not edit manually.
|
|
4
4
|
*/
|
|
5
|
-
import type { PasskeyController } from
|
|
5
|
+
import type { PasskeyController } from './PasskeyController.js';
|
|
6
6
|
/**
|
|
7
7
|
* Whether a passkey is enrolled and vault key material is stored.
|
|
8
8
|
*
|
|
@@ -23,6 +23,47 @@ export type PasskeyControllerGenerateRegistrationOptionsAction = {
|
|
|
23
23
|
type: `PasskeyController:generateRegistrationOptions`;
|
|
24
24
|
handler: PasskeyController['generateRegistrationOptions'];
|
|
25
25
|
};
|
|
26
|
+
/**
|
|
27
|
+
* Builds WebAuthn credential creation options for replacing a userHandle
|
|
28
|
+
* passkey with a PRF-capable passkey.
|
|
29
|
+
*
|
|
30
|
+
* The existing passkey record is retained while the replacement ceremony is
|
|
31
|
+
* in flight.
|
|
32
|
+
*
|
|
33
|
+
* @returns Public key credential creation options for `navigator.credentials.create()`.
|
|
34
|
+
*/
|
|
35
|
+
export type PasskeyControllerGeneratePasskeyReplacementRegistrationOptionsAction = {
|
|
36
|
+
type: `PasskeyController:generatePasskeyReplacementRegistrationOptions`;
|
|
37
|
+
handler: PasskeyController['generatePasskeyReplacementRegistrationOptions'];
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Verifies and completes replacement of an enrolled userHandle passkey with
|
|
41
|
+
* a PRF-capable passkey.
|
|
42
|
+
*
|
|
43
|
+
* The existing passkey record remains active until the replacement
|
|
44
|
+
* registration and post-registration authentication have both been verified
|
|
45
|
+
* and the existing vault key has been wrapped with the new PRF-derived key.
|
|
46
|
+
*
|
|
47
|
+
* @param params - Replacement completion inputs.
|
|
48
|
+
* @param params.registrationResponse - Result of `navigator.credentials.create()`.
|
|
49
|
+
* @param params.authenticationResponse - Result of `navigator.credentials.get()`
|
|
50
|
+
* after {@link generatePostRegistrationAuthenticationOptions}.
|
|
51
|
+
* @returns Resolves when the replacement completes.
|
|
52
|
+
*/
|
|
53
|
+
export type PasskeyControllerCompletePasskeyReplacementAction = {
|
|
54
|
+
type: `PasskeyController:completePasskeyReplacement`;
|
|
55
|
+
handler: PasskeyController['completePasskeyReplacement'];
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Cancels an in-flight passkey replacement ceremony.
|
|
59
|
+
*
|
|
60
|
+
* @param registrationChallenge - Challenge returned by
|
|
61
|
+
* {@link generatePasskeyReplacementRegistrationOptions}.
|
|
62
|
+
*/
|
|
63
|
+
export type PasskeyControllerCancelPasskeyReplacementAction = {
|
|
64
|
+
type: `PasskeyController:cancelPasskeyReplacement`;
|
|
65
|
+
handler: PasskeyController['cancelPasskeyReplacement'];
|
|
66
|
+
};
|
|
26
67
|
/**
|
|
27
68
|
* Builds WebAuthn credential request options for the post-registration
|
|
28
69
|
* authentication step (between `create` and {@link protectVaultKeyWithPasskey}).
|
|
@@ -200,5 +241,5 @@ export type PasskeyControllerDestroyAction = {
|
|
|
200
241
|
/**
|
|
201
242
|
* Union of all PasskeyController action types.
|
|
202
243
|
*/
|
|
203
|
-
export type PasskeyControllerMethodActions = PasskeyControllerIsPasskeyEnrolledAction | PasskeyControllerGenerateRegistrationOptionsAction | PasskeyControllerGeneratePostRegistrationAuthenticationOptionsAction | PasskeyControllerGenerateAuthenticationOptionsAction | PasskeyControllerProtectVaultKeyWithPasskeyAction | PasskeyControllerRetrieveVaultKeyWithPasskeyAction | PasskeyControllerUnlockWithPasskeyAction | PasskeyControllerExportSeedPhraseWithPasskeyAction | PasskeyControllerExportAccountsWithPasskeyAction | PasskeyControllerVerifyPasskeyAuthenticationAction | PasskeyControllerRenewVaultKeyProtectionAction | PasskeyControllerChangePasswordWithPasskeyVerificationAction | PasskeyControllerRemovePasskeyWithPasskeyVerificationAction | PasskeyControllerRemovePasskeyWithPasswordVerificationAction | PasskeyControllerClearStateAction | PasskeyControllerDestroyAction;
|
|
204
|
-
//# sourceMappingURL=PasskeyController-method-action-types.d.
|
|
244
|
+
export type PasskeyControllerMethodActions = PasskeyControllerIsPasskeyEnrolledAction | PasskeyControllerGenerateRegistrationOptionsAction | PasskeyControllerGeneratePasskeyReplacementRegistrationOptionsAction | PasskeyControllerCompletePasskeyReplacementAction | PasskeyControllerCancelPasskeyReplacementAction | PasskeyControllerGeneratePostRegistrationAuthenticationOptionsAction | PasskeyControllerGenerateAuthenticationOptionsAction | PasskeyControllerProtectVaultKeyWithPasskeyAction | PasskeyControllerRetrieveVaultKeyWithPasskeyAction | PasskeyControllerUnlockWithPasskeyAction | PasskeyControllerExportSeedPhraseWithPasskeyAction | PasskeyControllerExportAccountsWithPasskeyAction | PasskeyControllerVerifyPasskeyAuthenticationAction | PasskeyControllerRenewVaultKeyProtectionAction | PasskeyControllerChangePasswordWithPasskeyVerificationAction | PasskeyControllerRemovePasskeyWithPasskeyVerificationAction | PasskeyControllerRemovePasskeyWithPasswordVerificationAction | PasskeyControllerClearStateAction | PasskeyControllerDestroyAction;
|
|
245
|
+
//# sourceMappingURL=PasskeyController-method-action-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PasskeyController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AAI,EAAE,wDAAwD,CAAC;IAC/D,OAAO,EAAE,iBAAiB,CAAC,sCAAsC,CAAC,CAAC;CACpE,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,4DAA4D,GAAG;IACzE,IAAI,EAAE,yDAAyD,CAAC;IAChE,OAAO,EAAE,iBAAiB,CAAC,uCAAuC,CAAC,CAAC;CACrE,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,iCAAiC,GAAG;IAC9C,IAAI,EAAE,8BAA8B,CAAC;IACrC,OAAO,EAAE,iBAAiB,CAAC,YAAY,CAAC,CAAC;CAC1C,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,8BAA8B,GAAG;IAC3C,IAAI,EAAE,2BAA2B,CAAC;IAClC,OAAO,EAAE,iBAAiB,CAAC,SAAS,CAAC,CAAC;CACvC,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,8BAA8B,GACtC,wCAAwC,GACxC,kDAAkD,GAClD,oEAAoE,GACpE,iDAAiD,GACjD,+CAA+C,GAC/C,oEAAoE,GACpE,oDAAoD,GACpD,iDAAiD,GACjD,kDAAkD,GAClD,wCAAwC,GACxC,kDAAkD,GAClD,gDAAgD,GAChD,kDAAkD,GAClD,8CAA8C,GAC9C,4DAA4D,GAC5D,2DAA2D,GAC3D,4DAA4D,GAC5D,iCAAiC,GACjC,8BAA8B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PasskeyController-method-action-types.js","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 creation options for replacing a userHandle\n * passkey with a PRF-capable passkey.\n *\n * The existing passkey record is retained while the replacement ceremony is\n * in flight.\n *\n * @returns Public key credential creation options for `navigator.credentials.create()`.\n */\nexport type PasskeyControllerGeneratePasskeyReplacementRegistrationOptionsAction =\n {\n type: `PasskeyController:generatePasskeyReplacementRegistrationOptions`;\n handler: PasskeyController['generatePasskeyReplacementRegistrationOptions'];\n };\n\n/**\n * Verifies and completes replacement of an enrolled userHandle passkey with\n * a PRF-capable passkey.\n *\n * The existing passkey record remains active until the replacement\n * registration and post-registration authentication have both been verified\n * and the existing vault key has been wrapped with the new PRF-derived key.\n *\n * @param params - Replacement completion inputs.\n * @param params.registrationResponse - Result of `navigator.credentials.create()`.\n * @param params.authenticationResponse - Result of `navigator.credentials.get()`\n * after {@link generatePostRegistrationAuthenticationOptions}.\n * @returns Resolves when the replacement completes.\n */\nexport type PasskeyControllerCompletePasskeyReplacementAction = {\n type: `PasskeyController:completePasskeyReplacement`;\n handler: PasskeyController['completePasskeyReplacement'];\n};\n\n/**\n * Cancels an in-flight passkey replacement ceremony.\n *\n * @param registrationChallenge - Challenge returned by\n * {@link generatePasskeyReplacementRegistrationOptions}.\n */\nexport type PasskeyControllerCancelPasskeyReplacementAction = {\n type: `PasskeyController:cancelPasskeyReplacement`;\n handler: PasskeyController['cancelPasskeyReplacement'];\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 | PasskeyControllerGeneratePasskeyReplacementRegistrationOptionsAction\n | PasskeyControllerCompletePasskeyReplacementAction\n | PasskeyControllerCancelPasskeyReplacementAction\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,8 +1,8 @@
|
|
|
1
|
-
import { BaseController } from
|
|
2
|
-
import { controllerName } from
|
|
3
|
-
import type { PasskeyControllerMessenger, PasskeyControllerOptions, PasskeyControllerState } from
|
|
4
|
-
import type { PasskeyAuthenticationOptions, PasskeyAuthenticationResponse, PasskeyRegistrationOptions, PasskeyRegistrationResponse } from
|
|
5
|
-
export type { PasskeyControllerActions, PasskeyControllerAllowedActions, PasskeyControllerEvents, PasskeyControllerGetStateAction, PasskeyControllerMessenger, PasskeyControllerOptions, PasskeyControllerState, PasskeyControllerStateChangedEvent, } from
|
|
1
|
+
import { BaseController } from '@metamask/base-controller';
|
|
2
|
+
import { controllerName } from './constants.js';
|
|
3
|
+
import type { PasskeyControllerMessenger, PasskeyControllerOptions, PasskeyControllerState } from './types.js';
|
|
4
|
+
import type { PasskeyAuthenticationOptions, PasskeyAuthenticationResponse, PasskeyRegistrationOptions, PasskeyRegistrationResponse } from './webauthn/types.js';
|
|
5
|
+
export type { PasskeyControllerActions, PasskeyControllerAllowedActions, PasskeyControllerEvents, PasskeyControllerGetStateAction, PasskeyControllerMessenger, PasskeyControllerOptions, PasskeyControllerState, PasskeyControllerStateChangedEvent, } from './types.js';
|
|
6
6
|
/**
|
|
7
7
|
* Returns the default (empty) state for {@link PasskeyController}.
|
|
8
8
|
*
|
|
@@ -56,6 +56,41 @@ export declare class PasskeyController extends BaseController<typeof controllerN
|
|
|
56
56
|
generateRegistrationOptions(creationOptionsConfig?: {
|
|
57
57
|
prfAvailable?: boolean;
|
|
58
58
|
}): PasskeyRegistrationOptions;
|
|
59
|
+
/**
|
|
60
|
+
* Builds WebAuthn credential creation options for replacing a userHandle
|
|
61
|
+
* passkey with a PRF-capable passkey.
|
|
62
|
+
*
|
|
63
|
+
* The existing passkey record is retained while the replacement ceremony is
|
|
64
|
+
* in flight.
|
|
65
|
+
*
|
|
66
|
+
* @returns Public key credential creation options for `navigator.credentials.create()`.
|
|
67
|
+
*/
|
|
68
|
+
generatePasskeyReplacementRegistrationOptions(): PasskeyRegistrationOptions;
|
|
69
|
+
/**
|
|
70
|
+
* Verifies and completes replacement of an enrolled userHandle passkey with
|
|
71
|
+
* a PRF-capable passkey.
|
|
72
|
+
*
|
|
73
|
+
* The existing passkey record remains active until the replacement
|
|
74
|
+
* registration and post-registration authentication have both been verified
|
|
75
|
+
* and the existing vault key has been wrapped with the new PRF-derived key.
|
|
76
|
+
*
|
|
77
|
+
* @param params - Replacement completion inputs.
|
|
78
|
+
* @param params.registrationResponse - Result of `navigator.credentials.create()`.
|
|
79
|
+
* @param params.authenticationResponse - Result of `navigator.credentials.get()`
|
|
80
|
+
* after {@link generatePostRegistrationAuthenticationOptions}.
|
|
81
|
+
* @returns Resolves when the replacement completes.
|
|
82
|
+
*/
|
|
83
|
+
completePasskeyReplacement(params: {
|
|
84
|
+
registrationResponse: PasskeyRegistrationResponse;
|
|
85
|
+
authenticationResponse: PasskeyAuthenticationResponse;
|
|
86
|
+
}): Promise<void>;
|
|
87
|
+
/**
|
|
88
|
+
* Cancels an in-flight passkey replacement ceremony.
|
|
89
|
+
*
|
|
90
|
+
* @param registrationChallenge - Challenge returned by
|
|
91
|
+
* {@link generatePasskeyReplacementRegistrationOptions}.
|
|
92
|
+
*/
|
|
93
|
+
cancelPasskeyReplacement(registrationChallenge: string): void;
|
|
59
94
|
/**
|
|
60
95
|
* Builds WebAuthn credential request options for the post-registration
|
|
61
96
|
* authentication step (between `create` and {@link protectVaultKeyWithPasskey}).
|
|
@@ -205,4 +240,4 @@ export declare class PasskeyController extends BaseController<typeof controllerN
|
|
|
205
240
|
*/
|
|
206
241
|
destroy(): void;
|
|
207
242
|
}
|
|
208
|
-
//# sourceMappingURL=PasskeyController.d.
|
|
243
|
+
//# sourceMappingURL=PasskeyController.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PasskeyController.d.ts","sourceRoot":"","sources":["../src/PasskeyController.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAK3D,OAAO,EACL,cAAc,EAGf,MAAM,gBAAgB,CAAC;AAIxB,OAAO,KAAK,EAEV,0BAA0B,EAC1B,wBAAwB,EACxB,sBAAsB,EAMvB,MAAM,YAAY,CAAC;AASpB,OAAO,KAAK,EACV,4BAA4B,EAC5B,6BAA6B,EAC7B,0BAA0B,EAC1B,2BAA2B,EAC5B,MAAM,qBAAqB,CAAC;AAI7B,YAAY,EACV,wBAAwB,EACxB,+BAA+B,EAC/B,uBAAuB,EACvB,+BAA+B,EAC/B,0BAA0B,EAC1B,wBAAwB,EACxB,sBAAsB,EACtB,kCAAkC,GACnC,MAAM,YAAY,CAAC;AAEpB;;;;GAIG;AACH,wBAAgB,gCAAgC,IAAI,sBAAsB,CAEzE;AA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