@passlock/client 2.1.0 → 2.3.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/dist/index.d.ts +118 -22
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +123 -21
- package/dist/index.js.map +1 -1
- package/dist/internal/network.d.ts +14 -1
- package/dist/internal/network.d.ts.map +1 -1
- package/dist/internal/network.js +11 -1
- package/dist/internal/network.js.map +1 -1
- package/dist/internal/promise.d.ts +7 -3
- package/dist/internal/promise.d.ts.map +1 -1
- package/dist/internal/promise.js +9 -5
- package/dist/internal/promise.js.map +1 -1
- package/dist/internal/result.d.ts +33 -0
- package/dist/internal/result.d.ts.map +1 -0
- package/dist/internal/result.js +35 -0
- package/dist/internal/result.js.map +1 -0
- package/dist/logger.d.ts +11 -5
- package/dist/logger.d.ts.map +1 -1
- package/dist/logger.js +11 -5
- package/dist/logger.js.map +1 -1
- package/dist/options.d.ts +5 -5
- package/dist/options.d.ts.map +1 -1
- package/dist/passkey/authentication/authentication.d.ts +11 -4
- package/dist/passkey/authentication/authentication.d.ts.map +1 -1
- package/dist/passkey/authentication/authentication.js +5 -2
- package/dist/passkey/authentication/authentication.js.map +1 -1
- package/dist/passkey/errors.d.ts +19 -13
- package/dist/passkey/errors.d.ts.map +1 -1
- package/dist/passkey/errors.js +16 -16
- package/dist/passkey/errors.js.map +1 -1
- package/dist/passkey/registration/registration.d.ts +7 -4
- package/dist/passkey/registration/registration.d.ts.map +1 -1
- package/dist/passkey/registration/registration.js +4 -4
- package/dist/passkey/registration/registration.js.map +1 -1
- package/dist/passkey/shared.d.ts +16 -4
- package/dist/passkey/shared.d.ts.map +1 -1
- package/dist/passkey/signals/signals.d.ts +219 -29
- package/dist/passkey/signals/signals.d.ts.map +1 -1
- package/dist/passkey/signals/signals.js +144 -24
- package/dist/passkey/signals/signals.js.map +1 -1
- package/dist/safe.d.ts +181 -60
- package/dist/safe.d.ts.map +1 -1
- package/dist/safe.js +179 -54
- package/dist/safe.js.map +1 -1
- package/package.json +7 -7
package/dist/safe.d.ts
CHANGED
|
@@ -1,10 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* _safe_ functions i.e. functions that return
|
|
3
|
-
* success
|
|
4
|
-
*
|
|
2
|
+
* _safe_ functions i.e. functions that return result envelopes over the original
|
|
3
|
+
* tagged success and error payloads. Use `result.success` or `result.failure`
|
|
4
|
+
* to branch between success and error outcomes. Existing type guards and `_tag`
|
|
5
|
+
* checks remain supported.
|
|
5
6
|
*
|
|
6
7
|
* Note: unexpected runtime failures may still throw.
|
|
7
8
|
*
|
|
9
|
+
* @example
|
|
10
|
+
* const result = await registerPasskey({ tenancyId, username: "jdoe@gmail.com" });
|
|
11
|
+
*
|
|
12
|
+
* if (result.success) {
|
|
13
|
+
* console.log(result.value.code);
|
|
14
|
+
* }
|
|
15
|
+
*
|
|
16
|
+
* if (result.failure) {
|
|
17
|
+
* console.log(result.error.message);
|
|
18
|
+
* }
|
|
19
|
+
*
|
|
8
20
|
* @categoryDescription Passkeys (core)
|
|
9
21
|
* Creating, authenticating, updating and deleting passkeys. {@link registerPasskey}
|
|
10
22
|
* and {@link authenticatePasskey} are the key functions.
|
|
@@ -18,11 +30,12 @@
|
|
|
18
30
|
* @showCategories
|
|
19
31
|
* @module safe
|
|
20
32
|
*/
|
|
33
|
+
import type { Result as PasslockClient } from "./internal/result.js";
|
|
21
34
|
import { Logger } from "./logger.js";
|
|
22
35
|
import type { AuthenticationError, AuthenticationOptions, AuthenticationSuccess } from "./passkey/authentication/authentication.js";
|
|
23
36
|
import type { DeleteError, OrphanedPasskeyError, PruningError, UpdateError } from "./passkey/errors.js";
|
|
24
37
|
import type { RegistrationError, RegistrationOptions, RegistrationSuccess } from "./passkey/registration/registration.js";
|
|
25
|
-
import type { DeleteCredentialOptions, DeletePasskeyOptions, DeleteSuccess, PrunePasskeyOptions, PruningSuccess, UpdateCredentialOptions, UpdatePasskeyOptions, UpdateSuccess } from "./passkey/signals/signals.js";
|
|
38
|
+
import type { Credential, DeleteCredentialOptions, DeletePasskeyOptions, DeleteSuccess, PrunePasskeyOptions, PruningSuccess, UpdateCredentialOptions, UpdatePasskeyOptions, UpdateSuccess } from "./passkey/signals/signals.js";
|
|
26
39
|
/**
|
|
27
40
|
* Registers a passkey on the user's device, then saves the server-side component in your vault.
|
|
28
41
|
* If successful, this function returns both a `code` and an `id_token` (JWT).
|
|
@@ -31,11 +44,9 @@ import type { DeleteCredentialOptions, DeletePasskeyOptions, DeleteSuccess, Prun
|
|
|
31
44
|
*
|
|
32
45
|
* @param options
|
|
33
46
|
*
|
|
34
|
-
* @returns
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
* Alternatively test the result's `_tag` property, which acts as a union discriminator.
|
|
47
|
+
* @returns A {@link PasslockClient} whose success branch contains a {@link RegistrationSuccess}
|
|
48
|
+
* and whose error branch contains a {@link RegistrationError}. Existing
|
|
49
|
+
* {@link isRegistrationSuccess} checks and `_tag` discrimination still work.
|
|
39
50
|
*
|
|
40
51
|
* @see {@link isRegistrationSuccess}
|
|
41
52
|
* @see {@link isPasskeyUnsupportedError}
|
|
@@ -49,15 +60,15 @@ import type { DeleteCredentialOptions, DeletePasskeyOptions, DeleteSuccess, Prun
|
|
|
49
60
|
*
|
|
50
61
|
* const result = await registerPasskey({ tenancyId, username });
|
|
51
62
|
*
|
|
52
|
-
* if (
|
|
63
|
+
* if (result.success) {
|
|
53
64
|
* // send this to your backend for verification
|
|
54
|
-
* console.log(result.code);
|
|
55
|
-
* } else if (isPasskeyUnsupportedError(result)) {
|
|
65
|
+
* console.log(result.value.code);
|
|
66
|
+
* } else if (result.failure && isPasskeyUnsupportedError(result.error)) {
|
|
56
67
|
* // ^^ using an error type guard
|
|
57
68
|
* console.log("Device does not support passkeys");
|
|
58
|
-
* } else if (result._tag === "@error/OtherPasskey") {
|
|
69
|
+
* } else if (result.failure && result.error._tag === "@error/OtherPasskey") {
|
|
59
70
|
* // ^^ narrowing the result using the _tag
|
|
60
|
-
* console.log(result.message);
|
|
71
|
+
* console.log(result.error.message);
|
|
61
72
|
* } else {
|
|
62
73
|
* ...
|
|
63
74
|
* }
|
|
@@ -66,7 +77,7 @@ import type { DeleteCredentialOptions, DeletePasskeyOptions, DeleteSuccess, Prun
|
|
|
66
77
|
*/
|
|
67
78
|
export declare const registerPasskey: (options: RegistrationOptions,
|
|
68
79
|
/** @hidden */
|
|
69
|
-
logger?: typeof Logger.Service) => Promise<RegistrationSuccess
|
|
80
|
+
logger?: typeof Logger.Service) => Promise<PasslockClient<RegistrationSuccess, RegistrationError>>;
|
|
70
81
|
/**
|
|
71
82
|
* Asks the client to present a passkey, which is then verified against the server-side component in your vault.
|
|
72
83
|
* If successful, this function returns both a `code` and an `id_token` (JWT).
|
|
@@ -75,11 +86,10 @@ logger?: typeof Logger.Service) => Promise<RegistrationSuccess | RegistrationErr
|
|
|
75
86
|
*
|
|
76
87
|
* @param options
|
|
77
88
|
*
|
|
78
|
-
* @returns
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
* Alternatively test the result's `_tag` property, which acts as a union discriminator.
|
|
89
|
+
* @returns A {@link PasslockClient} whose success branch contains an
|
|
90
|
+
* {@link AuthenticationSuccess} and whose error branch contains an
|
|
91
|
+
* {@link AuthenticationError}. Existing {@link isAuthenticationSuccess}
|
|
92
|
+
* checks and `_tag` discrimination still work.
|
|
83
93
|
*
|
|
84
94
|
* @see {@link isAuthenticationSuccess}
|
|
85
95
|
* @see {@link isPasskeyUnsupportedError}
|
|
@@ -92,22 +102,22 @@ logger?: typeof Logger.Service) => Promise<RegistrationSuccess | RegistrationErr
|
|
|
92
102
|
*
|
|
93
103
|
* const result = await authenticatePasskey({ tenancyId });
|
|
94
104
|
*
|
|
95
|
-
* if (
|
|
105
|
+
* if (result.success) {
|
|
96
106
|
* // send this to your backend for verification
|
|
97
|
-
* console.log(result.code);
|
|
98
|
-
* } else if (isPasskeyUnsupportedError(result)) {
|
|
107
|
+
* console.log(result.value.code);
|
|
108
|
+
* } else if (result.failure && isPasskeyUnsupportedError(result.error)) {
|
|
99
109
|
* // ^^ using an error type guard
|
|
100
110
|
* console.log("Device does not support passkeys");
|
|
101
|
-
* } else if (result._tag === "@error/OtherPasskey") {
|
|
111
|
+
* } else if (result.failure && result.error._tag === "@error/OtherPasskey") {
|
|
102
112
|
* // ^^ narrowing the result using the _tag
|
|
103
|
-
* console.log(result.message);
|
|
113
|
+
* console.log(result.error.message);
|
|
104
114
|
* }
|
|
105
115
|
*
|
|
106
116
|
* @category Passkeys (core)
|
|
107
117
|
*/
|
|
108
118
|
export declare const authenticatePasskey: (options: AuthenticationOptions,
|
|
109
119
|
/** @hidden */
|
|
110
|
-
logger?: typeof Logger.Service) => Promise<AuthenticationSuccess
|
|
120
|
+
logger?: typeof Logger.Service) => Promise<PasslockClient<AuthenticationSuccess, AuthenticationError>>;
|
|
111
121
|
/**
|
|
112
122
|
* Attempt to update the username or display name for a passkey (client-side only).
|
|
113
123
|
*
|
|
@@ -118,11 +128,19 @@ logger?: typeof Logger.Service) => Promise<AuthenticationSuccess | Authenticatio
|
|
|
118
128
|
*
|
|
119
129
|
* By calling this function and supplying a new username/display name, their local
|
|
120
130
|
* password manager will align with their updated account identifier.
|
|
121
|
-
*
|
|
122
|
-
*
|
|
123
|
-
*
|
|
124
|
-
*
|
|
125
|
-
*
|
|
131
|
+
* Support and metadata lookup failures populate the error branch as
|
|
132
|
+
* {@link UpdateError}. Browser-side signalling failures are logged as warnings
|
|
133
|
+
* and do not populate the error branch.
|
|
134
|
+
*
|
|
135
|
+
* @param options You will typically supply a target `passkeyId` via
|
|
136
|
+
* {@link UpdatePasskeyOptions}. {@link UpdateCredentialOptions} is intended
|
|
137
|
+
* for credential-scoped updates, for example when replaying data returned by
|
|
138
|
+
* `@passlock/server`.
|
|
139
|
+
* @returns A {@link PasslockClient} whose success branch contains an
|
|
140
|
+
* {@link UpdateSuccess} after the local update workflow has been started, and
|
|
141
|
+
* whose error branch contains an {@link UpdateError}.
|
|
142
|
+
* Existing {@link isUpdateSuccess}, {@link isUpdateError}, and `_tag` checks
|
|
143
|
+
* still work.
|
|
126
144
|
*
|
|
127
145
|
* @see {@link isUpdateSuccess}
|
|
128
146
|
* @see {@link isUpdateError}
|
|
@@ -136,12 +154,11 @@ logger?: typeof Logger.Service) => Promise<AuthenticationSuccess | Authenticatio
|
|
|
136
154
|
*
|
|
137
155
|
* const result = await updatePasskey({ tenancyId, passkeyId, username, displayName });
|
|
138
156
|
*
|
|
139
|
-
* if (result.
|
|
140
|
-
*
|
|
141
|
-
*
|
|
142
|
-
* } else if (isUpdateError(result)) {
|
|
157
|
+
* if (result.success) {
|
|
158
|
+
* console.log("passkey update requested");
|
|
159
|
+
* } else if (result.failure && isUpdateError(result.error)) {
|
|
143
160
|
* // narrowed to an UpdateError type
|
|
144
|
-
* console.log(result.code);
|
|
161
|
+
* console.log(result.error.code);
|
|
145
162
|
* } else {
|
|
146
163
|
* console.log("unable to update passkey");
|
|
147
164
|
* }
|
|
@@ -150,9 +167,101 @@ logger?: typeof Logger.Service) => Promise<AuthenticationSuccess | Authenticatio
|
|
|
150
167
|
*/
|
|
151
168
|
export declare const updatePasskey: (options: UpdatePasskeyOptions | UpdateCredentialOptions,
|
|
152
169
|
/** @hidden */
|
|
153
|
-
logger?: typeof Logger.Service) => Promise<UpdateSuccess
|
|
170
|
+
logger?: typeof Logger.Service) => Promise<PasslockClient<UpdateSuccess, UpdateError>>;
|
|
171
|
+
/**
|
|
172
|
+
* Attempt to update the username and/or display name for multiple passkeys (client-side only).
|
|
173
|
+
*
|
|
174
|
+
* Useful if the user has changed their account identifier. For example, they register
|
|
175
|
+
* using jdoe@gmail.com but later change their account username to jdoe@yahoo.com.
|
|
176
|
+
* Even after you update their account details in your backend, their local password
|
|
177
|
+
* manager will continue to display jdoe@gmail.com.
|
|
178
|
+
*
|
|
179
|
+
* By calling this function and supplying a new username/display name, their local
|
|
180
|
+
* password manager will align with their updated account identifier.
|
|
181
|
+
* Support failures populate the error branch as {@link UpdateError}.
|
|
182
|
+
* Browser-side signalling failures are logged as warnings and do not populate
|
|
183
|
+
* the error branch.
|
|
184
|
+
*
|
|
185
|
+
* @param options The `credentials` array returned by
|
|
186
|
+
* `@passlock/server/safe`'s `updatePasskeyUsernames` success branch.
|
|
187
|
+
* @returns A {@link PasslockClient} whose success branch contains an
|
|
188
|
+
* {@link UpdateSuccess} after the local update workflows have been started,
|
|
189
|
+
* and whose error branch contains an {@link UpdateError}.
|
|
190
|
+
* Existing {@link isUpdateSuccess}, {@link isUpdateError}, and `_tag` checks
|
|
191
|
+
* still work.
|
|
192
|
+
*
|
|
193
|
+
* @see {@link isUpdateSuccess}
|
|
194
|
+
* @see {@link isUpdateError}
|
|
195
|
+
*
|
|
196
|
+
* @example
|
|
197
|
+
* // server code
|
|
198
|
+
* import { updatePasskeyUsernames as updatePasskeyUsernamesOnServer } from "@passlock/server/safe";
|
|
199
|
+
*
|
|
200
|
+
* const backendResult = await updatePasskeyUsernamesOnServer({
|
|
201
|
+
* tenancyId,
|
|
202
|
+
* userId,
|
|
203
|
+
* username,
|
|
204
|
+
* displayName,
|
|
205
|
+
* });
|
|
206
|
+
* // send backendResult.value.credentials to your frontend when backendResult.success
|
|
207
|
+
*
|
|
208
|
+
* // client code
|
|
209
|
+
* import { updatePasskeyUsernames } from "@passlock/client/safe";
|
|
210
|
+
*
|
|
211
|
+
* const credentialsFromBackend = backendResult.value.credentials;
|
|
212
|
+
* const result = await updatePasskeyUsernames(credentialsFromBackend);
|
|
213
|
+
* console.log(result);
|
|
214
|
+
*
|
|
215
|
+
* @category Passkeys (core)
|
|
216
|
+
*/
|
|
217
|
+
export declare const updatePasskeyUsernames: (options: ReadonlyArray<UpdateCredentialOptions>,
|
|
218
|
+
/** @hidden */
|
|
219
|
+
logger?: typeof Logger.Service) => Promise<PasslockClient<UpdateSuccess, UpdateError>>;
|
|
220
|
+
/**
|
|
221
|
+
* Attempt to signal removal of multiple passkeys from a local device.
|
|
222
|
+
*
|
|
223
|
+
* Use this after deleting the server-side passkeys. The `deleted` array returned
|
|
224
|
+
* by `@passlock/server/safe` already has the right shape, so you can pass it
|
|
225
|
+
* straight into this function.
|
|
226
|
+
* Support failures populate the error branch as {@link DeleteError}.
|
|
227
|
+
* Browser-side signalling failures are logged as warnings and do not populate
|
|
228
|
+
* the error branch.
|
|
229
|
+
*
|
|
230
|
+
* @param options Credentials derived from deleted backend passkeys.
|
|
231
|
+
* @returns A {@link PasslockClient} whose success branch contains a
|
|
232
|
+
* {@link DeleteSuccess} once the local removal workflows have been started,
|
|
233
|
+
* and whose error branch contains a {@link DeleteError}. Existing
|
|
234
|
+
* {@link isDeleteSuccess}, {@link isDeleteError}, and `_tag` checks still work.
|
|
235
|
+
* @see {@link isDeleteSuccess}
|
|
236
|
+
* @see {@link isDeleteError}
|
|
237
|
+
*
|
|
238
|
+
* @example
|
|
239
|
+
* // server code
|
|
240
|
+
* import { deleteUserPasskeys as deleteUserPasskeysOnServer } from "@passlock/server/safe";
|
|
241
|
+
*
|
|
242
|
+
* const backendResult = await deleteUserPasskeysOnServer({
|
|
243
|
+
* tenancyId,
|
|
244
|
+
* userId,
|
|
245
|
+
* apiKey,
|
|
246
|
+
* });
|
|
247
|
+
*
|
|
248
|
+
* // send backendResult.value.deleted to your frontend when backendResult.success
|
|
249
|
+
*
|
|
250
|
+
* // client code
|
|
251
|
+
* import { deleteUserPasskeys } from "@passlock/client/safe";
|
|
252
|
+
*
|
|
253
|
+
* const deletedCredentials = backendResult.value.deleted;
|
|
254
|
+
* const result = await deleteUserPasskeys(deletedCredentials);
|
|
255
|
+
* console.log(result);
|
|
256
|
+
*
|
|
257
|
+
* @category Passkeys (core)
|
|
258
|
+
*/
|
|
259
|
+
export declare const deleteUserPasskeys: (options: ReadonlyArray<Credential>,
|
|
260
|
+
/** @hidden */
|
|
261
|
+
logger?: typeof Logger.Service) => Promise<PasslockClient<DeleteSuccess, DeleteError>>;
|
|
154
262
|
/**
|
|
155
|
-
* Attempts to
|
|
263
|
+
* Attempts to signal removal of a passkey from a local device. There are two
|
|
264
|
+
* scenarios in which this function is useful:
|
|
156
265
|
*
|
|
157
266
|
* 1. **Deleting a passkey** - Use the `@passlock/server` package or make vanilla REST calls from your
|
|
158
267
|
* backend to delete the server-side component, then use this function to delete the client-side component.
|
|
@@ -162,10 +271,17 @@ logger?: typeof Logger.Service) => Promise<UpdateSuccess | UpdateError>;
|
|
|
162
271
|
*
|
|
163
272
|
* See [deleting passkeys](https://passlock.dev/passkeys/passkey-removal/) and
|
|
164
273
|
* [handling missing passkeys](https://passlock.dev/handling-missing-passkeys/) in the documentation.
|
|
165
|
-
*
|
|
166
|
-
*
|
|
167
|
-
*
|
|
168
|
-
*
|
|
274
|
+
* Support and metadata lookup failures populate the error branch as
|
|
275
|
+
* {@link DeleteError}. Browser-side signalling failures are logged as warnings
|
|
276
|
+
* and do not populate the error branch.
|
|
277
|
+
*
|
|
278
|
+
* @param options You will typically pass {@link DeletePasskeyOptions}. Use
|
|
279
|
+
* {@link DeleteCredentialOptions} or {@link OrphanedPasskeyError} when you
|
|
280
|
+
* already have the credential metadata.
|
|
281
|
+
* @returns A {@link PasslockClient} whose success branch contains a
|
|
282
|
+
* {@link DeleteSuccess} once the local removal workflow has been started, and
|
|
283
|
+
* whose error branch contains a {@link DeleteError}. Existing
|
|
284
|
+
* {@link isDeleteSuccess}, {@link isDeleteError}, and `_tag` checks still work.
|
|
169
285
|
* @see {@link isDeleteSuccess}
|
|
170
286
|
* @see {@link isDeleteError}
|
|
171
287
|
*
|
|
@@ -176,12 +292,11 @@ logger?: typeof Logger.Service) => Promise<UpdateSuccess | UpdateError>;
|
|
|
176
292
|
*
|
|
177
293
|
* const result = await deletePasskey({ tenancyId, passkeyId });
|
|
178
294
|
*
|
|
179
|
-
* if (result.
|
|
180
|
-
*
|
|
181
|
-
*
|
|
182
|
-
* } else if (isDeleteError(result)) {
|
|
295
|
+
* if (result.success) {
|
|
296
|
+
* console.log("passkey removal requested");
|
|
297
|
+
* } else if (result.failure && isDeleteError(result.error)) {
|
|
183
298
|
* // narrowed to a DeleteError type
|
|
184
|
-
* console.log(result.code);
|
|
299
|
+
* console.log(result.error.code);
|
|
185
300
|
* } else {
|
|
186
301
|
* console.log("unable to delete passkey");
|
|
187
302
|
* }
|
|
@@ -190,16 +305,22 @@ logger?: typeof Logger.Service) => Promise<UpdateSuccess | UpdateError>;
|
|
|
190
305
|
*/
|
|
191
306
|
export declare const deletePasskey: (options: DeletePasskeyOptions | DeleteCredentialOptions | OrphanedPasskeyError,
|
|
192
307
|
/** @hidden */
|
|
193
|
-
logger?: typeof Logger.Service) => Promise<DeleteSuccess
|
|
308
|
+
logger?: typeof Logger.Service) => Promise<PasslockClient<DeleteSuccess, DeleteError>>;
|
|
194
309
|
/**
|
|
195
310
|
* Attempt to prune local passkeys by keeping only the passkey IDs you trust.
|
|
196
311
|
*
|
|
197
312
|
* This is useful when your backend is the source of truth for which passkeys
|
|
198
313
|
* should still exist for a given account on this device.
|
|
314
|
+
* Support and metadata lookup failures populate the error branch as
|
|
315
|
+
* {@link PruningError}. Browser-side signalling failures are logged as
|
|
316
|
+
* warnings and do not populate the error branch.
|
|
199
317
|
*
|
|
200
318
|
* @param options Pass the passkeys you **want to retain**.
|
|
201
|
-
* @returns
|
|
202
|
-
*
|
|
319
|
+
* @returns A {@link PasslockClient} whose success branch contains a
|
|
320
|
+
* {@link PruningSuccess} once the accepted-credentials signalling attempt has
|
|
321
|
+
* completed, and whose error branch contains a
|
|
322
|
+
* {@link PruningError}. Existing {@link isPruningSuccess},
|
|
323
|
+
* {@link isPruningError}, and `_tag` checks still work.
|
|
203
324
|
*
|
|
204
325
|
* @see {@link isPruningSuccess}
|
|
205
326
|
* @see {@link isPruningError}
|
|
@@ -211,12 +332,11 @@ logger?: typeof Logger.Service) => Promise<DeleteSuccess | DeleteError>;
|
|
|
211
332
|
*
|
|
212
333
|
* const result = await prunePasskeys({ tenancyId, allowablePasskeyIds });
|
|
213
334
|
*
|
|
214
|
-
* if (result.
|
|
215
|
-
*
|
|
216
|
-
*
|
|
217
|
-
* } else if (isPruningError(result)) {
|
|
335
|
+
* if (result.success) {
|
|
336
|
+
* console.log("accepted credentials sync requested");
|
|
337
|
+
* } else if (result.failure && isPruningError(result.error)) {
|
|
218
338
|
* // narrowed to a PruningError type
|
|
219
|
-
* console.log(result.code);
|
|
339
|
+
* console.log(result.error.code);
|
|
220
340
|
* } else {
|
|
221
341
|
* console.log("unable to prune passkeys");
|
|
222
342
|
* }
|
|
@@ -225,9 +345,9 @@ logger?: typeof Logger.Service) => Promise<DeleteSuccess | DeleteError>;
|
|
|
225
345
|
*/
|
|
226
346
|
export declare const prunePasskeys: (options: PrunePasskeyOptions,
|
|
227
347
|
/** @hidden */
|
|
228
|
-
logger?: typeof Logger.Service) => Promise<PruningSuccess
|
|
348
|
+
logger?: typeof Logger.Service) => Promise<PasslockClient<PruningSuccess, PruningError>>;
|
|
229
349
|
/**
|
|
230
|
-
* Does the local device support programmatic passkey deletion
|
|
350
|
+
* Does the local device support programmatic passkey deletion?
|
|
231
351
|
*
|
|
232
352
|
* @returns `true` if local passkey deletion is supported.
|
|
233
353
|
*
|
|
@@ -235,7 +355,7 @@ logger?: typeof Logger.Service) => Promise<PruningSuccess | PruningError>;
|
|
|
235
355
|
*/
|
|
236
356
|
export declare const isPasskeyDeleteSupport: () => boolean;
|
|
237
357
|
/**
|
|
238
|
-
* Does the local device support programmatic passkey pruning
|
|
358
|
+
* Does the local device support programmatic passkey pruning?
|
|
239
359
|
*
|
|
240
360
|
* @returns `true` if local passkey pruning is supported.
|
|
241
361
|
*
|
|
@@ -243,7 +363,7 @@ export declare const isPasskeyDeleteSupport: () => boolean;
|
|
|
243
363
|
*/
|
|
244
364
|
export declare const isPasskeyPruningSupport: () => boolean;
|
|
245
365
|
/**
|
|
246
|
-
* Does the local device support programmatic passkey updates
|
|
366
|
+
* Does the local device support programmatic passkey updates?
|
|
247
367
|
*
|
|
248
368
|
* @returns `true` if local passkey updates are supported.
|
|
249
369
|
*
|
|
@@ -251,6 +371,7 @@ export declare const isPasskeyPruningSupport: () => boolean;
|
|
|
251
371
|
*/
|
|
252
372
|
export declare const isPasskeyUpdateSupport: () => boolean;
|
|
253
373
|
export { isNetworkError, NetworkError } from "./internal/network.js";
|
|
374
|
+
export type { Err, Ok, Result } from "./internal/result.js";
|
|
254
375
|
export { LogEvent, Logger, LogLevel, } from "./logger.js";
|
|
255
376
|
export type { PasslockOptions } from "./options.js";
|
|
256
377
|
export type { AuthenticationError, AuthenticationEvent, AuthenticationEvents, AuthenticationOptions, AuthenticationSuccess, OnAuthenticationEvent, } from "./passkey/authentication/authentication.js";
|
|
@@ -260,7 +381,7 @@ export { DeleteError, DuplicatePasskeyError, isDeleteError, isDuplicatePasskeyEr
|
|
|
260
381
|
export type { OnRegistrationEvent, RegistrationError, RegistrationEvent, RegistrationOptions, RegistrationSuccess, } from "./passkey/registration/registration.js";
|
|
261
382
|
export { isRegistrationSuccess, RegistrationHelper, } from "./passkey/registration/registration.js";
|
|
262
383
|
export type { UserVerification } from "./passkey/shared.js";
|
|
263
|
-
export type {
|
|
384
|
+
export type { Credential, DeleteCredentialOptions, DeletePasskeyOptions, DeleteSuccess, PrunePasskeyOptions, PruningSuccess, UpdateCredentialOptions, UpdatePasskeyOptions, UpdateSuccess, } from "./passkey/signals/signals.js";
|
|
264
385
|
export { isDeleteSuccess, isPruningSuccess, isUpdateSuccess, } from "./passkey/signals/signals.js";
|
|
265
386
|
export { isAutofillSupport, isPasskeySupport, } from "./passkey/support.js";
|
|
266
387
|
export type { Principal } from "./principal.js";
|
package/dist/safe.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"safe.d.ts","sourceRoot":"","sources":["../src/safe.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"safe.d.ts","sourceRoot":"","sources":["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