@passlock/client 2.0.2 → 2.0.4
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 +38 -39
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +34 -35
- package/dist/index.js.map +1 -1
- package/dist/internal/network.d.ts +1 -1
- package/dist/internal/network.d.ts.map +1 -1
- package/dist/internal/network.js +6 -4
- package/dist/internal/network.js.map +1 -1
- package/dist/logger.js +4 -4
- package/dist/logger.js.map +1 -1
- package/dist/passkey/authentication/authentication.d.ts +28 -17
- package/dist/passkey/authentication/authentication.d.ts.map +1 -1
- package/dist/passkey/authentication/authentication.js +7 -7
- package/dist/passkey/authentication/authentication.js.map +1 -1
- package/dist/passkey/errors.d.ts +9 -16
- package/dist/passkey/errors.d.ts.map +1 -1
- package/dist/passkey/errors.js +10 -17
- package/dist/passkey/errors.js.map +1 -1
- package/dist/passkey/registration/registration.d.ts +19 -15
- package/dist/passkey/registration/registration.d.ts.map +1 -1
- package/dist/passkey/registration/registration.js +7 -4
- package/dist/passkey/registration/registration.js.map +1 -1
- package/dist/passkey/shared.d.ts +2 -0
- package/dist/passkey/shared.d.ts.map +1 -1
- package/dist/passkey/signals/signals.d.ts +76 -19
- package/dist/passkey/signals/signals.d.ts.map +1 -1
- package/dist/passkey/signals/signals.js +67 -26
- package/dist/passkey/signals/signals.js.map +1 -1
- package/dist/principal.d.ts +3 -0
- package/dist/principal.d.ts.map +1 -1
- package/dist/safe.d.ts +75 -55
- package/dist/safe.d.ts.map +1 -1
- package/dist/safe.js +71 -50
- package/dist/safe.js.map +1 -1
- package/package.json +6 -9
- package/dist/errors.d.ts +0 -4
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js +0 -14
- package/dist/errors.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
* type guards to narrow the thrown error down to a specific type.
|
|
4
4
|
*
|
|
5
5
|
* @categoryDescription Passkeys (core)
|
|
6
|
-
* Creating,
|
|
6
|
+
* Creating, authenticating, updating and deleting passkeys. {@link registerPasskey}
|
|
7
|
+
* and {@link authenticatePasskey} are the key functions.
|
|
7
8
|
*
|
|
8
9
|
* @categoryDescription Passkeys (other)
|
|
9
10
|
* Testing for browser capabilities related to passkeys, type guards and other utilities.
|
|
@@ -12,15 +13,15 @@
|
|
|
12
13
|
* @module unsafe
|
|
13
14
|
*/
|
|
14
15
|
import { Logger } from "./logger";
|
|
15
|
-
import type { PasslockOptions } from "./options";
|
|
16
16
|
import type { AuthenticationOptions, AuthenticationSuccess } from "./passkey/authentication/authentication";
|
|
17
17
|
import type { RegistrationOptions, RegistrationSuccess } from "./passkey/registration/registration";
|
|
18
|
-
import type {
|
|
18
|
+
import type { DeleteCredentialOptions, DeletePasskeyOptions, DeleteSuccess, PrunePasskeyOptions, PruningSuccess, UpdateCredentialOptions, UpdatePasskeyOptions, UpdateSuccess } from "./passkey/signals/signals";
|
|
19
|
+
import type { OrphanedPasskeyError } from "./safe";
|
|
19
20
|
/**
|
|
20
21
|
* Registers a passkey on the user's device, then saves the server-side component in your vault.
|
|
21
|
-
* If successful, this function returns a `code`
|
|
22
|
-
*
|
|
23
|
-
* [register a passkey](https://passlock.dev/passkeys/registration/) in the documentation.
|
|
22
|
+
* If successful, this function returns both a `code` and an `id_token` (JWT).
|
|
23
|
+
* Send either value to your backend for verification.
|
|
24
|
+
* See [register a passkey](https://passlock.dev/passkeys/registration/) in the documentation.
|
|
24
25
|
*
|
|
25
26
|
* @param options
|
|
26
27
|
*
|
|
@@ -33,7 +34,7 @@ import type { CredentialMapping, UpdatePasskeyOptions } from "./passkey/signals/
|
|
|
33
34
|
*
|
|
34
35
|
* @throws {@link RegistrationError} (alias to a union of potential errors)
|
|
35
36
|
* @throws {@link PasskeyUnsupportedError} if the device does not support passkeys
|
|
36
|
-
* @throws {@link DuplicatePasskeyError} if `
|
|
37
|
+
* @throws {@link DuplicatePasskeyError} if `excludeCredentials` includes a passkey that already exists on the device
|
|
37
38
|
* @throws {@link OtherPasskeyError} typically a low level failure
|
|
38
39
|
* @throws {@link NetworkError}
|
|
39
40
|
*
|
|
@@ -50,7 +51,7 @@ import type { CredentialMapping, UpdatePasskeyOptions } from "./passkey/signals/
|
|
|
50
51
|
* if (isPasskeyUnsupportedError(error)) {
|
|
51
52
|
* alert("passkeys not supported on this device");
|
|
52
53
|
* } else {
|
|
53
|
-
* console.
|
|
54
|
+
* console.log(error);
|
|
54
55
|
* }
|
|
55
56
|
* }
|
|
56
57
|
*
|
|
@@ -61,8 +62,8 @@ export declare const registerPasskey: (options: RegistrationOptions,
|
|
|
61
62
|
logger?: typeof Logger.Service) => Promise<RegistrationSuccess>;
|
|
62
63
|
/**
|
|
63
64
|
* Asks the client to present a passkey, which is then verified against the server-side component in your vault.
|
|
64
|
-
* If successful, this function returns a `code`
|
|
65
|
-
*
|
|
65
|
+
* If successful, this function returns both a `code` and an `id_token` (JWT). Send either value to your backend for verification.
|
|
66
|
+
* See
|
|
66
67
|
* [authenticate a passkey](https://passlock.dev/passkeys/authentication/) in the documentation.
|
|
67
68
|
*
|
|
68
69
|
* @param options
|
|
@@ -71,12 +72,12 @@ logger?: typeof Logger.Service) => Promise<RegistrationSuccess>;
|
|
|
71
72
|
*
|
|
72
73
|
* @see {@link isAuthenticationSuccess}
|
|
73
74
|
* @see {@link isPasskeyUnsupportedError}
|
|
74
|
-
* @see {@link
|
|
75
|
+
* @see {@link isOrphanedPasskeyError}
|
|
75
76
|
* @see {@link isOtherPasskeyError}
|
|
76
77
|
*
|
|
77
78
|
* @throws {@link AuthenticationError} (alias to a union of potential errors)
|
|
78
79
|
* @throws {@link PasskeyUnsupportedError} if the device does not support passkeys
|
|
79
|
-
* @throws {@link
|
|
80
|
+
* @throws {@link OrphanedPasskeyError} if the passkey is orphaned i.e. deleted from the vault but still present on the local device
|
|
80
81
|
* @throws {@link OtherPasskeyError} typically a low level failure
|
|
81
82
|
* @throws {@link NetworkError}
|
|
82
83
|
*
|
|
@@ -92,7 +93,7 @@ logger?: typeof Logger.Service) => Promise<RegistrationSuccess>;
|
|
|
92
93
|
* if (isPasskeyUnsupportedError(error)) {
|
|
93
94
|
* alert("passkeys not supported on this device");
|
|
94
95
|
* } else {
|
|
95
|
-
* console.
|
|
96
|
+
* console.log(error);
|
|
96
97
|
* }
|
|
97
98
|
* }
|
|
98
99
|
*
|
|
@@ -112,7 +113,7 @@ logger?: typeof Logger.Service) => Promise<AuthenticationSuccess>;
|
|
|
112
113
|
* By calling this function and supplying a new username/display name, their local
|
|
113
114
|
* password manager will align with their updated account identifier.
|
|
114
115
|
*
|
|
115
|
-
* @param options
|
|
116
|
+
* @param options You will typically supply a target `passkeyId` via {@link UpdatePasskeyOptions}. {@link UpdateCredentialOptions} is for advanced use cases.
|
|
116
117
|
* @returns Update status
|
|
117
118
|
* @see {@link isUpdateError}
|
|
118
119
|
* @throws {@link UpdateError} if the passkey cannot be updated
|
|
@@ -128,18 +129,18 @@ logger?: typeof Logger.Service) => Promise<AuthenticationSuccess>;
|
|
|
128
129
|
* const result = await updatePasskey({ tenancyId, passkeyId, username, displayName });
|
|
129
130
|
* console.log("passkey updated");
|
|
130
131
|
* } catch (error) {
|
|
131
|
-
* console.
|
|
132
|
+
* console.log(error);
|
|
132
133
|
* }
|
|
133
134
|
*
|
|
134
135
|
* @category Passkeys (core)
|
|
135
136
|
*/
|
|
136
|
-
export declare const updatePasskey: (options: UpdatePasskeyOptions,
|
|
137
|
+
export declare const updatePasskey: (options: UpdatePasskeyOptions | UpdateCredentialOptions,
|
|
137
138
|
/** @hidden */
|
|
138
|
-
logger?: typeof Logger.Service) => Promise<
|
|
139
|
+
logger?: typeof Logger.Service) => Promise<UpdateSuccess>;
|
|
139
140
|
/**
|
|
140
141
|
* Attempts to delete a passkey from a local device. There are two scenarios in which this function proves useful:
|
|
141
142
|
*
|
|
142
|
-
* 1. **Deleting a passkey**. Use the `@passlock/node` package or make
|
|
143
|
+
* 1. **Deleting a passkey**. Use the `@passlock/node` package or make vanilla REST calls from your
|
|
143
144
|
* backend to delete the server-side component, then use this function to delete the client-side component.
|
|
144
145
|
*
|
|
145
146
|
* 2. **Missing passkey**. The user tried to present a passkey, but the server-side component could not be found.
|
|
@@ -148,9 +149,8 @@ logger?: typeof Logger.Service) => Promise<boolean>;
|
|
|
148
149
|
* See [deleting passkeys](https://passlock.dev/passkeys/passkey-removal/) and
|
|
149
150
|
* [handling missing passkeys](https://passlock.dev/handling-missing-passkeys/) in the documentation.
|
|
150
151
|
*
|
|
151
|
-
* @param
|
|
152
|
-
* @
|
|
153
|
-
* @returns Delete status
|
|
152
|
+
* @param options You typically pass a {@link DeletePasskeyOptions}, the other types are for advanced edge-cases.
|
|
153
|
+
* @returns A {@link DeleteSuccess} payload if the passkey is deleted.
|
|
154
154
|
* @see {@link isDeleteError}
|
|
155
155
|
* @throws {@link DeleteError} if the passkey cannot be deleted
|
|
156
156
|
*
|
|
@@ -160,26 +160,25 @@ logger?: typeof Logger.Service) => Promise<boolean>;
|
|
|
160
160
|
* const passkeyId = "myPasskeyId";
|
|
161
161
|
*
|
|
162
162
|
* try {
|
|
163
|
-
* const result = await deletePasskey(
|
|
163
|
+
* const result = await deletePasskey({ tenancyId, passkeyId });
|
|
164
164
|
* console.log("passkey deleted");
|
|
165
165
|
* } catch (error) {
|
|
166
|
-
* console.
|
|
166
|
+
* console.log(error);
|
|
167
167
|
* }
|
|
168
168
|
*
|
|
169
169
|
* @category Passkeys (core)
|
|
170
170
|
*/
|
|
171
|
-
export declare const deletePasskey: (
|
|
171
|
+
export declare const deletePasskey: (options: DeletePasskeyOptions | DeleteCredentialOptions | OrphanedPasskeyError,
|
|
172
172
|
/** @hidden */
|
|
173
|
-
logger?: typeof Logger.Service) => Promise<
|
|
173
|
+
logger?: typeof Logger.Service) => Promise<DeleteSuccess>;
|
|
174
174
|
/**
|
|
175
175
|
* Attempt to prune local passkeys by keeping only the passkey IDs you trust.
|
|
176
176
|
*
|
|
177
177
|
* This is useful when your backend is the source of truth for which passkeys
|
|
178
178
|
* should still exist for a given account on this device.
|
|
179
179
|
*
|
|
180
|
-
* @param
|
|
181
|
-
* @
|
|
182
|
-
* @returns `true` if local passkeys were pruned.
|
|
180
|
+
* @param options Pass the passkeys you want to retain.
|
|
181
|
+
* @returns A {@link PruningSuccess} payload if local passkeys were pruned.
|
|
183
182
|
* @see {@link isPruningError}
|
|
184
183
|
*
|
|
185
184
|
* @throws {@link PruningError}
|
|
@@ -187,24 +186,24 @@ logger?: typeof Logger.Service) => Promise<boolean>;
|
|
|
187
186
|
* @example
|
|
188
187
|
* // from your Passlock console settings
|
|
189
188
|
* const tenancyId = "myTenancyId";
|
|
190
|
-
* const
|
|
189
|
+
* const allowablePasskeyIds = ["passkey-1", "passkey-2"];
|
|
191
190
|
*
|
|
192
191
|
* try {
|
|
193
|
-
* const result = await prunePasskeys(
|
|
192
|
+
* const result = await prunePasskeys({ tenancyId, allowablePasskeyIds });
|
|
194
193
|
* console.log("local passkeys pruned", result);
|
|
195
194
|
* } catch (error) {
|
|
196
195
|
* if (isPruningError(error)) {
|
|
197
|
-
* console.
|
|
196
|
+
* console.log(error.code);
|
|
198
197
|
* } else {
|
|
199
|
-
* console.
|
|
198
|
+
* console.log(error);
|
|
200
199
|
* }
|
|
201
200
|
* }
|
|
202
201
|
*
|
|
203
202
|
* @category Passkeys (core)
|
|
204
203
|
*/
|
|
205
|
-
export declare const prunePasskeys: (
|
|
204
|
+
export declare const prunePasskeys: (options: PrunePasskeyOptions,
|
|
206
205
|
/** @hidden */
|
|
207
|
-
logger?: typeof Logger.Service) => Promise<
|
|
206
|
+
logger?: typeof Logger.Service) => Promise<PruningSuccess>;
|
|
208
207
|
/**
|
|
209
208
|
* Does the local device support programmatic passkey deletion
|
|
210
209
|
*
|
|
@@ -229,18 +228,18 @@ export declare const isPasskeyPruningSupport: () => boolean;
|
|
|
229
228
|
* @category Passkeys (other)
|
|
230
229
|
*/
|
|
231
230
|
export declare const isPasskeyUpdateSupport: () => boolean;
|
|
232
|
-
export
|
|
233
|
-
export { isNetworkError } from "./internal/network";
|
|
231
|
+
export { isNetworkError, NetworkError } from "./internal/network";
|
|
234
232
|
export { LogEvent, Logger, LogLevel, } from "./logger";
|
|
235
233
|
export type { PasslockOptions } from "./options";
|
|
236
|
-
export type { AuthenticationError, AuthenticationEvent, AuthenticationOptions, AuthenticationSuccess, OnAuthenticationEvent, } from "./passkey/authentication/authentication";
|
|
234
|
+
export type { AuthenticationError, AuthenticationEvent, AuthenticationEvents, AuthenticationOptions, AuthenticationSuccess, OnAuthenticationEvent, } from "./passkey/authentication/authentication";
|
|
237
235
|
export { AuthenticationHelper, isAuthenticationSuccess, } from "./passkey/authentication/authentication";
|
|
238
236
|
export type { ErrorCode } from "./passkey/errors";
|
|
239
|
-
export { DeleteError, DuplicatePasskeyError, isDeleteError, isDuplicatePasskeyError,
|
|
237
|
+
export { DeleteError, DuplicatePasskeyError, isDeleteError, isDuplicatePasskeyError, isOrphanedPasskeyError, isOtherPasskeyError, isPasskeyUnsupportedError, isPruningError, isUpdateError, OrphanedPasskeyError, OtherPasskeyError, PasskeyUnsupportedError, PruningError, UpdateError, } from "./passkey/errors";
|
|
240
238
|
export type { OnRegistrationEvent, RegistrationError, RegistrationEvent, RegistrationOptions, RegistrationSuccess, } from "./passkey/registration/registration";
|
|
241
239
|
export { isRegistrationSuccess, RegistrationHelper, } from "./passkey/registration/registration";
|
|
242
240
|
export type { UserVerification } from "./passkey/shared";
|
|
243
|
-
export type { CredentialMapping, UpdatePasskeyOptions, } from "./passkey/signals/signals";
|
|
241
|
+
export type { CredentialMapping, DeleteCredentialOptions, DeletePasskeyOptions, DeleteSuccess, PrunePasskeyOptions, PruningSuccess, UpdateCredentialOptions, UpdatePasskeyOptions, UpdateSuccess, } from "./passkey/signals/signals";
|
|
242
|
+
export { isDeleteSuccess, isPruningSuccess, isUpdateSuccess, } from "./passkey/signals/signals";
|
|
244
243
|
export { isAutofillSupport, isPasskeySupport, } from "./passkey/support";
|
|
245
244
|
export type { Principal } from "./principal";
|
|
246
245
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAIH,OAAO,EAAe,MAAM,EAAE,MAAM,UAAU,CAAA;AAC9C,OAAO,KAAK,EACV,qBAAqB,EACrB,qBAAqB,EACtB,MAAM,yCAAyC,CAAA;AAKhD,OAAO,KAAK,EACV,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,qCAAqC,CAAA;AAK5C,OAAO,KAAK,EACV,uBAAuB,EACvB,oBAAoB,EACpB,aAAa,EACb,mBAAmB,EACnB,cAAc,EACd,uBAAuB,EACvB,oBAAoB,EACpB,aAAa,EACd,MAAM,2BAA2B,CAAA;AASlC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,QAAQ,CAAA;AAIlD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,eAAO,MAAM,eAAe,GAC1B,SAAS,mBAAmB;AAC5B,cAAc;AACd,SAAQ,OAAO,MAAM,CAAC,OAAqB,KAC1C,OAAO,CAAC,mBAAmB,CAM3B,CAAA;AAIH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,eAAO,MAAM,mBAAmB,GAC9B,SAAS,qBAAqB;AAC9B,cAAc;AACd,SAAQ,OAAO,MAAM,CAAC,OAAqB,KAC1C,OAAO,CAAC,qBAAqB,CAM7B,CAAA;AAIH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,eAAO,MAAM,aAAa,GACxB,SAAS,oBAAoB,GAAG,uBAAuB;AACvD,cAAc;AACd,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W,GACZ,MAAM,kBAAkB,CAAA;AACzB,YAAY,EACV,mBAAmB,EACnB,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,qCAAqC,CAAA;AAC5C,OAAO,EACL,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,qCAAqC,CAAA;AAC5C,YAAY,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AACxD,YAAY,EACV,iBAAiB,EACjB,uBAAuB,EACvB,oBAAoB,EACpB,aAAa,EACb,mBAAmB,EACnB,cAAc,EACd,uBAAuB,EACvB,oBAAoB,EACpB,aAAa,GACd,MAAM,2BAA2B,CAAA;AAClC,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,eAAe,GAChB,MAAM,2BAA2B,CAAA;AAClC,OAAO,EACL,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,mBAAmB,CAAA;AAC1B,YAAY,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
* type guards to narrow the thrown error down to a specific type.
|
|
4
4
|
*
|
|
5
5
|
* @categoryDescription Passkeys (core)
|
|
6
|
-
* Creating,
|
|
6
|
+
* Creating, authenticating, updating and deleting passkeys. {@link registerPasskey}
|
|
7
|
+
* and {@link authenticatePasskey} are the key functions.
|
|
7
8
|
*
|
|
8
9
|
* @categoryDescription Passkeys (other)
|
|
9
10
|
* Testing for browser capabilities related to passkeys, type guards and other utilities.
|
|
@@ -16,13 +17,13 @@ import { runToPromiseUnsafe } from "./internal";
|
|
|
16
17
|
import { eventLogger, Logger } from "./logger";
|
|
17
18
|
import { AuthenticationHelper, authenticatePasskey as authenticatePasskeyM, } from "./passkey/authentication/authentication";
|
|
18
19
|
import { RegistrationHelper, registerPasskey as registerPasskeyM, } from "./passkey/registration/registration";
|
|
19
|
-
import { deletePasskey as deletePasskeyM, isPasskeyDeleteSupport as isPasskeyDeleteSupportM, isPasskeyPruningSupport as isPasskeyPruningSupportM, isPasskeyUpdateSupport as isPasskeyUpdateSupportM, prunePasskeys as prunePasskeysM,
|
|
20
|
+
import { deletePasskey as deletePasskeyM, isPasskeyDeleteSupport as isPasskeyDeleteSupportM, isPasskeyPruningSupport as isPasskeyPruningSupportM, isPasskeyUpdateSupport as isPasskeyUpdateSupportM, prunePasskeys as prunePasskeysM, updatePasskey as updatePasskeyM, } from "./passkey/signals/signals";
|
|
20
21
|
/* Registration */
|
|
21
22
|
/**
|
|
22
23
|
* Registers a passkey on the user's device, then saves the server-side component in your vault.
|
|
23
|
-
* If successful, this function returns a `code`
|
|
24
|
-
*
|
|
25
|
-
* [register a passkey](https://passlock.dev/passkeys/registration/) in the documentation.
|
|
24
|
+
* If successful, this function returns both a `code` and an `id_token` (JWT).
|
|
25
|
+
* Send either value to your backend for verification.
|
|
26
|
+
* See [register a passkey](https://passlock.dev/passkeys/registration/) in the documentation.
|
|
26
27
|
*
|
|
27
28
|
* @param options
|
|
28
29
|
*
|
|
@@ -35,7 +36,7 @@ import { deletePasskey as deletePasskeyM, isPasskeyDeleteSupport as isPasskeyDel
|
|
|
35
36
|
*
|
|
36
37
|
* @throws {@link RegistrationError} (alias to a union of potential errors)
|
|
37
38
|
* @throws {@link PasskeyUnsupportedError} if the device does not support passkeys
|
|
38
|
-
* @throws {@link DuplicatePasskeyError} if `
|
|
39
|
+
* @throws {@link DuplicatePasskeyError} if `excludeCredentials` includes a passkey that already exists on the device
|
|
39
40
|
* @throws {@link OtherPasskeyError} typically a low level failure
|
|
40
41
|
* @throws {@link NetworkError}
|
|
41
42
|
*
|
|
@@ -52,7 +53,7 @@ import { deletePasskey as deletePasskeyM, isPasskeyDeleteSupport as isPasskeyDel
|
|
|
52
53
|
* if (isPasskeyUnsupportedError(error)) {
|
|
53
54
|
* alert("passkeys not supported on this device");
|
|
54
55
|
* } else {
|
|
55
|
-
* console.
|
|
56
|
+
* console.log(error);
|
|
56
57
|
* }
|
|
57
58
|
* }
|
|
58
59
|
*
|
|
@@ -64,8 +65,8 @@ logger = eventLogger) => pipe(registerPasskeyM(options), Micro.provideService(Re
|
|
|
64
65
|
/* Authentication */
|
|
65
66
|
/**
|
|
66
67
|
* Asks the client to present a passkey, which is then verified against the server-side component in your vault.
|
|
67
|
-
* If successful, this function returns a `code`
|
|
68
|
-
*
|
|
68
|
+
* If successful, this function returns both a `code` and an `id_token` (JWT). Send either value to your backend for verification.
|
|
69
|
+
* See
|
|
69
70
|
* [authenticate a passkey](https://passlock.dev/passkeys/authentication/) in the documentation.
|
|
70
71
|
*
|
|
71
72
|
* @param options
|
|
@@ -74,12 +75,12 @@ logger = eventLogger) => pipe(registerPasskeyM(options), Micro.provideService(Re
|
|
|
74
75
|
*
|
|
75
76
|
* @see {@link isAuthenticationSuccess}
|
|
76
77
|
* @see {@link isPasskeyUnsupportedError}
|
|
77
|
-
* @see {@link
|
|
78
|
+
* @see {@link isOrphanedPasskeyError}
|
|
78
79
|
* @see {@link isOtherPasskeyError}
|
|
79
80
|
*
|
|
80
81
|
* @throws {@link AuthenticationError} (alias to a union of potential errors)
|
|
81
82
|
* @throws {@link PasskeyUnsupportedError} if the device does not support passkeys
|
|
82
|
-
* @throws {@link
|
|
83
|
+
* @throws {@link OrphanedPasskeyError} if the passkey is orphaned i.e. deleted from the vault but still present on the local device
|
|
83
84
|
* @throws {@link OtherPasskeyError} typically a low level failure
|
|
84
85
|
* @throws {@link NetworkError}
|
|
85
86
|
*
|
|
@@ -95,7 +96,7 @@ logger = eventLogger) => pipe(registerPasskeyM(options), Micro.provideService(Re
|
|
|
95
96
|
* if (isPasskeyUnsupportedError(error)) {
|
|
96
97
|
* alert("passkeys not supported on this device");
|
|
97
98
|
* } else {
|
|
98
|
-
* console.
|
|
99
|
+
* console.log(error);
|
|
99
100
|
* }
|
|
100
101
|
* }
|
|
101
102
|
*
|
|
@@ -116,7 +117,7 @@ logger = eventLogger) => pipe(authenticatePasskeyM(options), Micro.provideServic
|
|
|
116
117
|
* By calling this function and supplying a new username/display name, their local
|
|
117
118
|
* password manager will align with their updated account identifier.
|
|
118
119
|
*
|
|
119
|
-
* @param options
|
|
120
|
+
* @param options You will typically supply a target `passkeyId` via {@link UpdatePasskeyOptions}. {@link UpdateCredentialOptions} is for advanced use cases.
|
|
120
121
|
* @returns Update status
|
|
121
122
|
* @see {@link isUpdateError}
|
|
122
123
|
* @throws {@link UpdateError} if the passkey cannot be updated
|
|
@@ -132,7 +133,7 @@ logger = eventLogger) => pipe(authenticatePasskeyM(options), Micro.provideServic
|
|
|
132
133
|
* const result = await updatePasskey({ tenancyId, passkeyId, username, displayName });
|
|
133
134
|
* console.log("passkey updated");
|
|
134
135
|
* } catch (error) {
|
|
135
|
-
* console.
|
|
136
|
+
* console.log(error);
|
|
136
137
|
* }
|
|
137
138
|
*
|
|
138
139
|
* @category Passkeys (core)
|
|
@@ -146,7 +147,7 @@ logger = eventLogger) => {
|
|
|
146
147
|
/**
|
|
147
148
|
* Attempts to delete a passkey from a local device. There are two scenarios in which this function proves useful:
|
|
148
149
|
*
|
|
149
|
-
* 1. **Deleting a passkey**. Use the `@passlock/node` package or make
|
|
150
|
+
* 1. **Deleting a passkey**. Use the `@passlock/node` package or make vanilla REST calls from your
|
|
150
151
|
* backend to delete the server-side component, then use this function to delete the client-side component.
|
|
151
152
|
*
|
|
152
153
|
* 2. **Missing passkey**. The user tried to present a passkey, but the server-side component could not be found.
|
|
@@ -155,9 +156,8 @@ logger = eventLogger) => {
|
|
|
155
156
|
* See [deleting passkeys](https://passlock.dev/passkeys/passkey-removal/) and
|
|
156
157
|
* [handling missing passkeys](https://passlock.dev/handling-missing-passkeys/) in the documentation.
|
|
157
158
|
*
|
|
158
|
-
* @param
|
|
159
|
-
* @
|
|
160
|
-
* @returns Delete status
|
|
159
|
+
* @param options You typically pass a {@link DeletePasskeyOptions}, the other types are for advanced edge-cases.
|
|
160
|
+
* @returns A {@link DeleteSuccess} payload if the passkey is deleted.
|
|
161
161
|
* @see {@link isDeleteError}
|
|
162
162
|
* @throws {@link DeleteError} if the passkey cannot be deleted
|
|
163
163
|
*
|
|
@@ -167,20 +167,18 @@ logger = eventLogger) => {
|
|
|
167
167
|
* const passkeyId = "myPasskeyId";
|
|
168
168
|
*
|
|
169
169
|
* try {
|
|
170
|
-
* const result = await deletePasskey(
|
|
170
|
+
* const result = await deletePasskey({ tenancyId, passkeyId });
|
|
171
171
|
* console.log("passkey deleted");
|
|
172
172
|
* } catch (error) {
|
|
173
|
-
* console.
|
|
173
|
+
* console.log(error);
|
|
174
174
|
* }
|
|
175
175
|
*
|
|
176
176
|
* @category Passkeys (core)
|
|
177
177
|
*/
|
|
178
|
-
export const deletePasskey = (
|
|
178
|
+
export const deletePasskey = (options,
|
|
179
179
|
/** @hidden */
|
|
180
180
|
logger = eventLogger) => {
|
|
181
|
-
const micro =
|
|
182
|
-
? deletePasskeyM(identifiers, options)
|
|
183
|
-
: signalCredentialRemoval(identifiers);
|
|
181
|
+
const micro = deletePasskeyM(options);
|
|
184
182
|
return pipe(micro, Micro.provideService(Logger, logger), runToPromiseUnsafe);
|
|
185
183
|
};
|
|
186
184
|
/**
|
|
@@ -189,9 +187,8 @@ logger = eventLogger) => {
|
|
|
189
187
|
* This is useful when your backend is the source of truth for which passkeys
|
|
190
188
|
* should still exist for a given account on this device.
|
|
191
189
|
*
|
|
192
|
-
* @param
|
|
193
|
-
* @
|
|
194
|
-
* @returns `true` if local passkeys were pruned.
|
|
190
|
+
* @param options Pass the passkeys you want to retain.
|
|
191
|
+
* @returns A {@link PruningSuccess} payload if local passkeys were pruned.
|
|
195
192
|
* @see {@link isPruningError}
|
|
196
193
|
*
|
|
197
194
|
* @throws {@link PruningError}
|
|
@@ -199,25 +196,25 @@ logger = eventLogger) => {
|
|
|
199
196
|
* @example
|
|
200
197
|
* // from your Passlock console settings
|
|
201
198
|
* const tenancyId = "myTenancyId";
|
|
202
|
-
* const
|
|
199
|
+
* const allowablePasskeyIds = ["passkey-1", "passkey-2"];
|
|
203
200
|
*
|
|
204
201
|
* try {
|
|
205
|
-
* const result = await prunePasskeys(
|
|
202
|
+
* const result = await prunePasskeys({ tenancyId, allowablePasskeyIds });
|
|
206
203
|
* console.log("local passkeys pruned", result);
|
|
207
204
|
* } catch (error) {
|
|
208
205
|
* if (isPruningError(error)) {
|
|
209
|
-
* console.
|
|
206
|
+
* console.log(error.code);
|
|
210
207
|
* } else {
|
|
211
|
-
* console.
|
|
208
|
+
* console.log(error);
|
|
212
209
|
* }
|
|
213
210
|
* }
|
|
214
211
|
*
|
|
215
212
|
* @category Passkeys (core)
|
|
216
213
|
*/
|
|
217
|
-
export const prunePasskeys = (
|
|
214
|
+
export const prunePasskeys = (options,
|
|
218
215
|
/** @hidden */
|
|
219
216
|
logger = eventLogger) => {
|
|
220
|
-
const micro = prunePasskeysM(
|
|
217
|
+
const micro = prunePasskeysM(options);
|
|
221
218
|
return pipe(micro, Micro.provideService(Logger, logger), runToPromiseUnsafe);
|
|
222
219
|
};
|
|
223
220
|
/* Support */
|
|
@@ -245,10 +242,12 @@ export const isPasskeyPruningSupport = () => pipe(isPasskeyPruningSupportM, Micr
|
|
|
245
242
|
* @category Passkeys (other)
|
|
246
243
|
*/
|
|
247
244
|
export const isPasskeyUpdateSupport = () => pipe(isPasskeyUpdateSupportM, Micro.runSync);
|
|
248
|
-
|
|
245
|
+
/* Re-exports */
|
|
246
|
+
export { isNetworkError, NetworkError } from "./internal/network";
|
|
249
247
|
export { LogEvent, Logger, LogLevel, } from "./logger";
|
|
250
248
|
export { AuthenticationHelper, isAuthenticationSuccess, } from "./passkey/authentication/authentication";
|
|
251
|
-
export { DeleteError, DuplicatePasskeyError, isDeleteError, isDuplicatePasskeyError,
|
|
249
|
+
export { DeleteError, DuplicatePasskeyError, isDeleteError, isDuplicatePasskeyError, isOrphanedPasskeyError, isOtherPasskeyError, isPasskeyUnsupportedError, isPruningError, isUpdateError, OrphanedPasskeyError, OtherPasskeyError, PasskeyUnsupportedError, PruningError, UpdateError, } from "./passkey/errors";
|
|
252
250
|
export { isRegistrationSuccess, RegistrationHelper, } from "./passkey/registration/registration";
|
|
251
|
+
export { isDeleteSuccess, isPruningSuccess, isUpdateSuccess, } from "./passkey/signals/signals";
|
|
253
252
|
export { isAutofillSupport, isPasskeySupport, } from "./passkey/support";
|
|
254
253
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AACpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAK9C,OAAO,EACL,oBAAoB,EACpB,mBAAmB,IAAI,oBAAoB,GAC5C,MAAM,yCAAyC,CAAA;AAKhD,OAAO,EACL,kBAAkB,EAClB,eAAe,IAAI,gBAAgB,GACpC,MAAM,qCAAqC,CAAA;AAW5C,OAAO,EACL,aAAa,IAAI,cAAc,EAC/B,sBAAsB,IAAI,uBAAuB,EACjD,uBAAuB,IAAI,wBAAwB,EACnD,sBAAsB,IAAI,uBAAuB,EACjD,aAAa,IAAI,cAAc,EAC/B,aAAa,IAAI,cAAc,GAChC,MAAM,2BAA2B,CAAA;AAGlC,kBAAkB;AAElB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,EAClC,OAA4B;AAC5B,cAAc;AACd,SAAgC,WAAW,EACb,EAAE,CAChC,IAAI,CACF,gBAAgB,CAAC,OAAO,CAAC,EACzB,KAAK,CAAC,cAAc,CAAC,kBAAkB,EAAE,kBAA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B,gBAAgB,GACjB,MAAM,mBAAmB,CAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Context, Micro } from "effect";
|
|
2
2
|
export declare const isNetworkError: (payload: unknown) => payload is NetworkError;
|
|
3
3
|
export declare class NetworkError extends Error {
|
|
4
|
-
readonly _tag: "
|
|
4
|
+
readonly _tag: "@error/Network";
|
|
5
5
|
readonly message: string;
|
|
6
6
|
readonly url: string;
|
|
7
7
|
constructor({ message, url }: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"network.d.ts","sourceRoot":"","sources":["../../src/internal/network.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAA;AAEvC,eAAO,MAAM,cAAc,GAAI,SAAS,OAAO,KAAG,OAAO,IAAI,YAI5D,CAAA;AAED,qBAAa,YAAa,SAAQ,KAAK;IACrC,QAAQ,CAAC,IAAI,EAAG,
|
|
1
|
+
{"version":3,"file":"network.d.ts","sourceRoot":"","sources":["../../src/internal/network.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAA;AAEvC,eAAO,MAAM,cAAc,GAAI,SAAS,OAAO,KAAG,OAAO,IAAI,YAI5D,CAAA;AAED,qBAAa,YAAa,SAAQ,KAAK;IACrC,QAAQ,CAAC,IAAI,EAAG,gBAAgB,CAAS;IACzC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;gBAER,EAAE,OAAO,EAAE,GAAG,EAAE,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE;IAM9D,MAAM,CAAC,cAAc,YAjBiB,OAAO,KAAG,OAAO,IAAI,YAAY,CAiBjC;CACvC;;uBAmBsB,MAAM;;AAL7B;;GAEG;AACH,qBAAa,QAAS,SAAQ,aAG3B;CAAG;AAEN,eAAO,MAAM,YAAY,GAAI,eAE1B;IACD,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,KAAG,QAAQ,CAAC,MAAM,CAA8B,CAAA;AAwBjD,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,GAAG,KAAK,IAAI;IACxD,GAAG,EAAE,GAAG,CAAA;IAER,sBAAsB;IACtB,OAAO,EAAE,MAAM,CAAA;IAEf,0BAA0B;IAC1B,iBAAiB,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,GAAG,IAAI,CAAC,CAAA;IAE7C,gCAAgC;IAChC,cAAc,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,KAAK,GAAG,IAAI,CAAC,CAAA;IAE3D,kCAAkC;IAClC,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,GAAI,CAAC,SAAS,MAAM,EAAE,CAAC,GAAG,KAAK,EAAE,6DAMtD,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,KAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,YAAY,CA0ErD,CAAA"}
|
package/dist/internal/network.js
CHANGED
|
@@ -7,7 +7,7 @@ export const isNetworkError = (payload) => {
|
|
|
7
7
|
return payload instanceof NetworkError;
|
|
8
8
|
};
|
|
9
9
|
export class NetworkError extends Error {
|
|
10
|
-
_tag = "
|
|
10
|
+
_tag = "@error/Network";
|
|
11
11
|
message;
|
|
12
12
|
url;
|
|
13
13
|
constructor({ message, url }) {
|
|
@@ -18,9 +18,11 @@ export class NetworkError extends Error {
|
|
|
18
18
|
static isNetworkError = isNetworkError;
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
|
-
* Make a request to the Passlock API endpoint.
|
|
22
|
-
*
|
|
23
|
-
*
|
|
21
|
+
* Make a request to the Passlock API endpoint.
|
|
22
|
+
* Successful responses are expected to be JSON.
|
|
23
|
+
* For non-2xx responses this function first attempts to parse JSON so typed
|
|
24
|
+
* API errors can be returned, and falls back to a generic network error when
|
|
25
|
+
* parsing fails.
|
|
24
26
|
*
|
|
25
27
|
* TODO Consider Effect RPC/HttpClient
|
|
26
28
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"network.js","sourceRoot":"","sources":["../../src/internal/network.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAA;AAEvC,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,OAAgB,EAA2B,EAAE;IAC1E,IAAI,OAAO,OAAO,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAA;IAC7C,IAAI,OAAO,KAAK,IAAI;QAAE,OAAO,KAAK,CAAA;IAClC,OAAO,OAAO,YAAY,YAAY,CAAA;AACxC,CAAC,CAAA;AAED,MAAM,OAAO,YAAa,SAAQ,KAAK;IAC5B,IAAI,GAAG,
|
|
1
|
+
{"version":3,"file":"network.js","sourceRoot":"","sources":["../../src/internal/network.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAA;AAEvC,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,OAAgB,EAA2B,EAAE;IAC1E,IAAI,OAAO,OAAO,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAA;IAC7C,IAAI,OAAO,KAAK,IAAI;QAAE,OAAO,KAAK,CAAA;IAClC,OAAO,OAAO,YAAY,YAAY,CAAA;AACxC,CAAC,CAAA;AAED,MAAM,OAAO,YAAa,SAAQ,KAAK;IAC5B,IAAI,GAAG,gBAAyB,CAAA;IAChC,OAAO,CAAQ;IACf,GAAG,CAAQ;IAEpB,YAAY,EAAE,OAAO,EAAE,GAAG,EAAoC;QAC5D,KAAK,EAAE,CAAA;QACP,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,GAAG,GAAG,GAAG,C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
CHANGED
|
@@ -10,16 +10,16 @@ export class Logger extends Context.Tag("ClientLogger")() {
|
|
|
10
10
|
*/
|
|
11
11
|
export const consoleLogger = {
|
|
12
12
|
logDebug: (message, ...optionalArgs) => Micro.sync(() => {
|
|
13
|
-
console.
|
|
13
|
+
console.log(message, optionalArgs);
|
|
14
14
|
}),
|
|
15
15
|
logError: (message, ...optionalArgs) => Micro.sync(() => {
|
|
16
|
-
console.
|
|
16
|
+
console.log(message, optionalArgs);
|
|
17
17
|
}),
|
|
18
18
|
logInfo: (message, ...optionalArgs) => Micro.sync(() => {
|
|
19
|
-
console.
|
|
19
|
+
console.log(message, optionalArgs);
|
|
20
20
|
}),
|
|
21
21
|
logWarn: (message, ...optionalArgs) => Micro.sync(() => {
|
|
22
|
-
console.
|
|
22
|
+
console.log(message, optionalArgs);
|
|
23
23
|
}),
|
|
24
24
|
};
|
|
25
25
|
export var LogLevel;
|
package/dist/logger.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAA;AAEvC;;;GAGG;AACH,MAAM,OAAO,MAAO,SAAQ,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,EAQpD;CAAG;AAEN;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAA0B;IAClD,QAAQ,EAAE,CAAC,OAAwB,EAAE,GAAG,YAA4B,EAAE,EAAE,CACtE,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE;QACd,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAA;AAEvC;;;GAGG;AACH,MAAM,OAAO,MAAO,SAAQ,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,EAQpD;C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