@passlock/client 2.0.1 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/README.template.md +2 -2
- package/dist/errors.d.ts +4 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +14 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +236 -31
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +236 -34
- package/dist/index.js.map +1 -1
- package/dist/internal/index.d.ts +4 -0
- package/dist/internal/index.d.ts.map +1 -0
- package/dist/internal/index.js +4 -0
- package/dist/internal/index.js.map +1 -0
- package/dist/{shared → internal}/network.d.ts +19 -16
- package/dist/internal/network.d.ts.map +1 -0
- package/dist/{shared → internal}/network.js +40 -25
- package/dist/internal/network.js.map +1 -0
- package/dist/{shared → internal}/promise.d.ts +2 -2
- package/dist/internal/promise.d.ts.map +1 -0
- package/dist/{shared → internal}/promise.js +2 -2
- package/dist/internal/promise.js.map +1 -0
- package/dist/internal/tenancy.d.ts.map +1 -0
- package/dist/internal/tenancy.js.map +1 -0
- package/dist/{logger/index.d.ts → logger.d.ts} +19 -4
- package/dist/logger.d.ts.map +1 -0
- package/dist/{logger/index.js → logger.js} +19 -4
- package/dist/logger.js.map +1 -0
- package/dist/{shared/options.d.ts → options.d.ts} +4 -0
- package/dist/options.d.ts.map +1 -0
- package/dist/{shared/options.js.map → options.js.map} +1 -1
- package/dist/passkey/authentication/authentication.d.ts +134 -0
- package/dist/passkey/authentication/authentication.d.ts.map +1 -0
- package/dist/passkey/{authentication.js → authentication/authentication.js} +68 -50
- package/dist/passkey/authentication/authentication.js.map +1 -0
- package/dist/passkey/errors.d.ts +158 -16
- package/dist/passkey/errors.d.ts.map +1 -1
- package/dist/passkey/errors.js +214 -6
- package/dist/passkey/errors.js.map +1 -1
- package/dist/passkey/registration/registration.d.ts +145 -0
- package/dist/passkey/registration/registration.d.ts.map +1 -0
- package/dist/passkey/{registration.js → registration/registration.js} +43 -36
- package/dist/passkey/registration/registration.js.map +1 -0
- package/dist/passkey/shared.d.ts +8 -2
- package/dist/passkey/shared.d.ts.map +1 -1
- package/dist/passkey/signals/signals.d.ts +103 -0
- package/dist/passkey/signals/signals.d.ts.map +1 -0
- package/dist/passkey/{signals.js → signals/signals.js} +69 -71
- package/dist/passkey/signals/signals.js.map +1 -0
- package/dist/passkey/support.d.ts +15 -0
- package/dist/passkey/support.d.ts.map +1 -1
- package/dist/passkey/support.js +16 -1
- package/dist/passkey/support.js.map +1 -1
- package/dist/principal.d.ts +16 -0
- package/dist/principal.d.ts.map +1 -0
- package/dist/principal.js +2 -0
- package/dist/principal.js.map +1 -0
- package/dist/safe.d.ts +247 -0
- package/dist/safe.d.ts.map +1 -0
- package/dist/safe.js +254 -0
- package/dist/safe.js.map +1 -0
- package/package.json +21 -19
- package/dist/logger/index.d.ts.map +0 -1
- package/dist/logger/index.js.map +0 -1
- package/dist/passkey/authentication.d.ts +0 -118
- package/dist/passkey/authentication.d.ts.map +0 -1
- package/dist/passkey/authentication.js.map +0 -1
- package/dist/passkey/authentication.test.d.ts +0 -2
- package/dist/passkey/authentication.test.d.ts.map +0 -1
- package/dist/passkey/authentication.test.js +0 -157
- package/dist/passkey/authentication.test.js.map +0 -1
- package/dist/passkey/registration.d.ts +0 -136
- package/dist/passkey/registration.d.ts.map +0 -1
- package/dist/passkey/registration.js.map +0 -1
- package/dist/passkey/registration.test.d.ts +0 -2
- package/dist/passkey/registration.test.d.ts.map +0 -1
- package/dist/passkey/registration.test.js +0 -161
- package/dist/passkey/registration.test.js.map +0 -1
- package/dist/passkey/signals.d.ts +0 -113
- package/dist/passkey/signals.d.ts.map +0 -1
- package/dist/passkey/signals.js.map +0 -1
- package/dist/shared/network.d.ts.map +0 -1
- package/dist/shared/network.js.map +0 -1
- package/dist/shared/options.d.ts.map +0 -1
- package/dist/shared/promise.d.ts.map +0 -1
- package/dist/shared/promise.js.map +0 -1
- package/dist/shared/tenancy.d.ts.map +0 -1
- package/dist/shared/tenancy.js.map +0 -1
- package/dist/surface.test.d.ts +0 -2
- package/dist/surface.test.d.ts.map +0 -1
- package/dist/surface.test.js +0 -38
- package/dist/surface.test.js.map +0 -1
- package/dist/unsafe.d.ts +0 -41
- package/dist/unsafe.d.ts.map +0 -1
- package/dist/unsafe.js +0 -52
- package/dist/unsafe.js.map +0 -1
- /package/dist/{shared → internal}/tenancy.d.ts +0 -0
- /package/dist/{shared → internal}/tenancy.js +0 -0
- /package/dist/{shared/options.js → options.js} +0 -0
package/dist/passkey/errors.js
CHANGED
|
@@ -1,10 +1,218 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
/**
|
|
2
|
+
* The local device does not support Passkeys.
|
|
3
|
+
* See the message property (string) for more details
|
|
4
|
+
*
|
|
5
|
+
* @category Passkeys (errors)
|
|
6
|
+
*/
|
|
7
|
+
export const isPasskeyUnsupportedError = (payload) => {
|
|
8
|
+
if (typeof payload !== "object")
|
|
9
|
+
return false;
|
|
10
|
+
if (payload === null)
|
|
11
|
+
return false;
|
|
12
|
+
return payload instanceof PasskeyUnsupportedError;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* The local device does not support Passkeys.
|
|
16
|
+
* See the message property (string) for more details
|
|
17
|
+
*
|
|
18
|
+
* @category Passkeys (errors)
|
|
19
|
+
*/
|
|
20
|
+
export class PasskeyUnsupportedError extends Error {
|
|
21
|
+
_tag = "PasskeyUnsupported";
|
|
22
|
+
message;
|
|
23
|
+
constructor({ message }) {
|
|
24
|
+
super();
|
|
25
|
+
this.message = message;
|
|
26
|
+
}
|
|
27
|
+
static isPasskeyUnsupportedError = isPasskeyUnsupportedError;
|
|
5
28
|
}
|
|
6
|
-
|
|
7
|
-
|
|
29
|
+
/**
|
|
30
|
+
* Client tried to authenticate with a passkey that was not found in the vault.
|
|
31
|
+
* Note: this error can be passed to the {@link deletePasskey} function. This is
|
|
32
|
+
* useful when the user has an orphaned passkey on their device with no server-side
|
|
33
|
+
* component. Just pass this error into deletePasskey and the library will attempt
|
|
34
|
+
* to remove the orphaned passkey from the local device.
|
|
35
|
+
*
|
|
36
|
+
* @category Passkeys (errors)
|
|
37
|
+
*/
|
|
38
|
+
export const isPasskeyNotFoundError = (payload) => {
|
|
39
|
+
if (typeof payload !== "object")
|
|
40
|
+
return false;
|
|
41
|
+
if (payload === null)
|
|
42
|
+
return false;
|
|
43
|
+
return payload instanceof PasskeyNotFoundError;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Client tried to authenticate with a passkey that was not found in the vault.
|
|
47
|
+
* Note: this error can be passed to the {@link deletePasskey} function. This is
|
|
48
|
+
* useful when the user has an orphaned passkey on their device with no server-side
|
|
49
|
+
* component. Just pass this error into deletePasskey and the library will attempt
|
|
50
|
+
* to remove the orphaned passkey from the local device.
|
|
51
|
+
*
|
|
52
|
+
* @category Passkeys (errors)
|
|
53
|
+
*/
|
|
54
|
+
export class PasskeyNotFoundError extends Error {
|
|
55
|
+
_tag = "PasskeyNotFoundError";
|
|
56
|
+
message;
|
|
57
|
+
credentialId;
|
|
58
|
+
rpId;
|
|
59
|
+
constructor({ message, credentialId, rpId, }) {
|
|
60
|
+
super();
|
|
61
|
+
this.message = message;
|
|
62
|
+
this.credentialId = credentialId;
|
|
63
|
+
this.rpId = rpId;
|
|
64
|
+
}
|
|
65
|
+
static isPasskeyNotFoundError = isPasskeyNotFoundError;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* An unexpected passkey specific error occurred.
|
|
69
|
+
* Check the code and message for more information.
|
|
70
|
+
*
|
|
71
|
+
* @category Passkeys (errors)
|
|
72
|
+
*/
|
|
73
|
+
export const isOtherPasskeyError = (payload) => {
|
|
74
|
+
if (typeof payload !== "object")
|
|
75
|
+
return false;
|
|
76
|
+
if (payload === null)
|
|
77
|
+
return false;
|
|
78
|
+
return payload instanceof OtherPasskeyError;
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* An unexpected passkey specific error occurred.
|
|
82
|
+
* Check the code and message for more information.
|
|
83
|
+
*
|
|
84
|
+
* @category Passkeys (errors)
|
|
85
|
+
*/
|
|
86
|
+
export class OtherPasskeyError extends Error {
|
|
87
|
+
_tag = "OtherPasskey";
|
|
88
|
+
error;
|
|
89
|
+
message;
|
|
90
|
+
code;
|
|
91
|
+
cause;
|
|
92
|
+
constructor({ error, message, code, cause, }) {
|
|
93
|
+
super();
|
|
94
|
+
this.error = error;
|
|
95
|
+
this.message = message;
|
|
96
|
+
if (code)
|
|
97
|
+
this.code = code;
|
|
98
|
+
if (cause)
|
|
99
|
+
this.cause = cause;
|
|
100
|
+
}
|
|
8
101
|
static isOtherPasskeyError = isOtherPasskeyError;
|
|
9
102
|
}
|
|
103
|
+
/**
|
|
104
|
+
* Raised if excludeCredentials was provided and the device
|
|
105
|
+
* recognises one of the excluded passkeys i.e. the user currently
|
|
106
|
+
* has a passkey registered for a given userId.
|
|
107
|
+
*
|
|
108
|
+
* @category Passkeys (errors)
|
|
109
|
+
*/
|
|
110
|
+
export const isDuplicatePasskeyError = (payload) => {
|
|
111
|
+
if (typeof payload !== "object")
|
|
112
|
+
return false;
|
|
113
|
+
if (payload === null)
|
|
114
|
+
return false;
|
|
115
|
+
return payload instanceof DuplicatePasskeyError;
|
|
116
|
+
};
|
|
117
|
+
/**
|
|
118
|
+
* Raised if excludeCredentials was provided and the device
|
|
119
|
+
* recognises one of the excluded passkeys i.e. the user currently
|
|
120
|
+
* has a passkey registered for a given userId.
|
|
121
|
+
*
|
|
122
|
+
* @category Passkeys (errors)
|
|
123
|
+
*/
|
|
124
|
+
export class DuplicatePasskeyError extends Error {
|
|
125
|
+
_tag = "DuplicatePasskeyError";
|
|
126
|
+
message;
|
|
127
|
+
constructor({ message }) {
|
|
128
|
+
super();
|
|
129
|
+
this.message = message;
|
|
130
|
+
}
|
|
131
|
+
static isDuplicatePasskeyError = isDuplicatePasskeyError;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* The browser/device was unable to delete the passkey
|
|
135
|
+
*
|
|
136
|
+
* @category Passkeys (errors)
|
|
137
|
+
*/
|
|
138
|
+
export const isDeleteError = (payload) => {
|
|
139
|
+
if (typeof payload !== "object")
|
|
140
|
+
return false;
|
|
141
|
+
if (payload === null)
|
|
142
|
+
return false;
|
|
143
|
+
return payload instanceof DeleteError;
|
|
144
|
+
};
|
|
145
|
+
/**
|
|
146
|
+
* The browser/device was unable to delete the passkey
|
|
147
|
+
*
|
|
148
|
+
* @category Passkeys (errors)
|
|
149
|
+
*/
|
|
150
|
+
export class DeleteError extends Error {
|
|
151
|
+
_tag = "DeleteError";
|
|
152
|
+
message;
|
|
153
|
+
code;
|
|
154
|
+
constructor({ message, code, }) {
|
|
155
|
+
super();
|
|
156
|
+
this.message = message;
|
|
157
|
+
this.code = code;
|
|
158
|
+
}
|
|
159
|
+
static isDeleteError = isDeleteError;
|
|
160
|
+
}
|
|
161
|
+
/* Pruning error */
|
|
162
|
+
/**
|
|
163
|
+
* The browser/device was unable to prune the passkeys
|
|
164
|
+
*
|
|
165
|
+
* @category Passkeys (errors)
|
|
166
|
+
*/
|
|
167
|
+
export const isPruningError = (payload) => {
|
|
168
|
+
if (typeof payload !== "object")
|
|
169
|
+
return false;
|
|
170
|
+
if (payload === null)
|
|
171
|
+
return false;
|
|
172
|
+
return payload instanceof PruningError;
|
|
173
|
+
};
|
|
174
|
+
/**
|
|
175
|
+
* The browser/device was unable to prune the passkeys
|
|
176
|
+
*
|
|
177
|
+
* @category Passkeys (errors)
|
|
178
|
+
*/
|
|
179
|
+
export class PruningError extends Error {
|
|
180
|
+
_tag = "PruningError";
|
|
181
|
+
message;
|
|
182
|
+
code;
|
|
183
|
+
constructor({ message, code, }) {
|
|
184
|
+
super();
|
|
185
|
+
this.message = message;
|
|
186
|
+
this.code = code;
|
|
187
|
+
}
|
|
188
|
+
static isPruningError = isPruningError;
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* The browser/device was unable to update the local passkey
|
|
192
|
+
*
|
|
193
|
+
* @category Passkeys (errors)
|
|
194
|
+
*/
|
|
195
|
+
export const isUpdateError = (payload) => {
|
|
196
|
+
if (typeof payload !== "object")
|
|
197
|
+
return false;
|
|
198
|
+
if (payload === null)
|
|
199
|
+
return false;
|
|
200
|
+
return payload instanceof UpdateError;
|
|
201
|
+
};
|
|
202
|
+
/**
|
|
203
|
+
* The browser/device was unable to update the local passkey
|
|
204
|
+
*
|
|
205
|
+
* @category Passkeys (errors)
|
|
206
|
+
*/
|
|
207
|
+
export class UpdateError extends Error {
|
|
208
|
+
_tag = "UpdateError";
|
|
209
|
+
message;
|
|
210
|
+
code;
|
|
211
|
+
constructor({ message, code, }) {
|
|
212
|
+
super();
|
|
213
|
+
this.message = message;
|
|
214
|
+
this.code = code;
|
|
215
|
+
}
|
|
216
|
+
static isUpdateError = isUpdateError;
|
|
217
|
+
}
|
|
10
218
|
//# sourceMappingURL=errors.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/passkey/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/passkey/errors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CACvC,OAAgB,EACoB,EAAE;IACtC,IAAI,OAAO,OAAO,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAA;IAC7C,IAAI,OAAO,KAAK,IAAI;QAAE,OAAO,KAAK,CAAA;IAClC,OAAO,OAAO,YAAY,uBAAuB,CAAA;AACnD,CAAC,CAAA;AAED;;;;;GAKG;AACH,MAAM,OAAO,uBAAwB,SAAQ,KAAK;IACvC,IAAI,GAAG,oBAA6B,CAAA;IACpC,OAAO,CAAQ;IAExB,YAAY,EAAE,OAAO,EAAuB;Q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AAO,CAAA;QACtB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;IAClB,CAAC;IAED,MAAM,CAAC,aAAa,GAAG,aAAa,CAAA"}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import * as Helper from "@simplewebauthn/browser";
|
|
2
|
+
import { type PublicKeyCredentialCreationOptionsJSON, type RegistrationResponseJSON } from "@simplewebauthn/browser";
|
|
3
|
+
import { Micro } from "effect";
|
|
4
|
+
import type { Principal } from "src/principal";
|
|
5
|
+
import { Endpoint, TenancyId } from "../../internal";
|
|
6
|
+
import type { NetworkError } from "../../internal/network";
|
|
7
|
+
import { Logger } from "../../logger";
|
|
8
|
+
import type { PasslockOptions } from "../../options";
|
|
9
|
+
import { DuplicatePasskeyError, OtherPasskeyError, PasskeyUnsupportedError } from "../errors";
|
|
10
|
+
import type { Millis, UserVerification } from "../shared";
|
|
11
|
+
/**
|
|
12
|
+
* Passkey registration options
|
|
13
|
+
*
|
|
14
|
+
* @category Passkeys (core)
|
|
15
|
+
*/
|
|
16
|
+
export interface RegistrationOptions extends PasslockOptions {
|
|
17
|
+
/**
|
|
18
|
+
* Username associated with passkey. Will be shown by the device during
|
|
19
|
+
* registration and subsequent authentication. The value used should be
|
|
20
|
+
* meaningful to the user e.g. jdoe or jdoe@gmail.com vs 5487546.
|
|
21
|
+
*
|
|
22
|
+
* You won't directly associate the username with an account in your
|
|
23
|
+
* backend. Instead, you'll associate the passkey ID with an account.
|
|
24
|
+
*
|
|
25
|
+
* @see {@link https://passlock.dev/passkeys/registration}
|
|
26
|
+
*/
|
|
27
|
+
username: string;
|
|
28
|
+
/**
|
|
29
|
+
* May be shown by devices in place of the username e.g. given a username
|
|
30
|
+
* of jdoe or jdoe@gmail.com a suitable display name might be "John Doe"
|
|
31
|
+
* or "John Doe (personal)". Note: no guarantee browsers/devices will
|
|
32
|
+
* choose to display this property.
|
|
33
|
+
*/
|
|
34
|
+
userDisplayName?: string | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* Prevents the user registering a passkey if they already have one
|
|
37
|
+
* (associated with the same user account) registered on the current device.
|
|
38
|
+
*
|
|
39
|
+
* @see {@link https://passlock.dev/passkeys/exclude-credentials}
|
|
40
|
+
*/
|
|
41
|
+
excludeCredentials?: Array<string> | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* Whether the device should re-authenticate the user locally before registering the passkey.
|
|
44
|
+
*
|
|
45
|
+
* @see {@link https://passlock.dev/passkeys/user-verification}
|
|
46
|
+
*/
|
|
47
|
+
userVerification?: UserVerification | undefined;
|
|
48
|
+
/**
|
|
49
|
+
* Receive notifications about key stages in the registration process.
|
|
50
|
+
* For example, you might use event notifications to toggle loading icons or
|
|
51
|
+
* to disable certain form fields.
|
|
52
|
+
*
|
|
53
|
+
* @param event
|
|
54
|
+
* @returns Nothing.
|
|
55
|
+
*/
|
|
56
|
+
onEvent?: OnRegistrationEvent;
|
|
57
|
+
/**
|
|
58
|
+
* Abort the operation after N milliseconds
|
|
59
|
+
*/
|
|
60
|
+
timeout?: Millis | undefined;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Represents the outcome of a successful passkey registration.
|
|
64
|
+
* Submit the code and/or id_token to your backend, then either
|
|
65
|
+
* exchange the code with the passlock REST API or decode and
|
|
66
|
+
* verify the id_token (JWT).
|
|
67
|
+
*
|
|
68
|
+
* Note: The @passlock/node library includes utilities to do this
|
|
69
|
+
* for you.
|
|
70
|
+
*
|
|
71
|
+
* @category Passkeys (core)
|
|
72
|
+
*/
|
|
73
|
+
export type RegistrationSuccess = {
|
|
74
|
+
/**
|
|
75
|
+
* Discriminator for use in a discriminated union.
|
|
76
|
+
*/
|
|
77
|
+
_tag: "RegistrationSuccess";
|
|
78
|
+
principal: Principal;
|
|
79
|
+
/**
|
|
80
|
+
* A signed JWT representing the newly registered passkey.
|
|
81
|
+
* Decode and verify this in your backend or use one of the @passlock/node
|
|
82
|
+
* helper utilities.
|
|
83
|
+
*
|
|
84
|
+
* @see {@link https://passlock.dev/principal/idtoken-verification/|id_token}
|
|
85
|
+
*/
|
|
86
|
+
id_token: string;
|
|
87
|
+
/**
|
|
88
|
+
* Call the Passlock API to exchange this code for details about the newly
|
|
89
|
+
* registered passkey.
|
|
90
|
+
*
|
|
91
|
+
* @see {@link https://passlock.dev/principal/code-exchange/|code exchange}
|
|
92
|
+
*/
|
|
93
|
+
code: string;
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* Type guard to test for a {@link RegistrationSuccess}. Typically used to test the
|
|
97
|
+
* object returned from {@link registerPasskey}
|
|
98
|
+
*
|
|
99
|
+
* @param payload
|
|
100
|
+
* @returns `true` if the payload is a {@link RegistrationSuccess}.
|
|
101
|
+
*
|
|
102
|
+
* @category Passkeys (other)
|
|
103
|
+
*/
|
|
104
|
+
export declare const isRegistrationSuccess: (payload: unknown) => payload is RegistrationSuccess;
|
|
105
|
+
export type OptionsResponse = {
|
|
106
|
+
sessionToken: string;
|
|
107
|
+
optionsJSON: PublicKeyCredentialCreationOptionsJSON;
|
|
108
|
+
};
|
|
109
|
+
export declare const isOptionsResponse: (payload: unknown) => payload is OptionsResponse;
|
|
110
|
+
export declare const fetchOptions: (options: Omit<RegistrationOptions, keyof PasslockOptions>) => Micro.Micro<OptionsResponse, NetworkError, Endpoint | TenancyId | Logger>;
|
|
111
|
+
export declare const startRegistration: (optionsJSON: PublicKeyCredentialCreationOptionsJSON, { onEvent }: {
|
|
112
|
+
onEvent?: OnRegistrationEvent | undefined;
|
|
113
|
+
}) => Micro.Micro<Helper.RegistrationResponseJSON, PasskeyUnsupportedError | OtherPasskeyError | DuplicatePasskeyError, Logger | RegistrationHelper>;
|
|
114
|
+
export declare const verifyCredential: (sessionToken: string, response: RegistrationResponseJSON, { onEvent }: {
|
|
115
|
+
onEvent?: OnRegistrationEvent | undefined;
|
|
116
|
+
}) => Micro.Micro<RegistrationSuccess, NetworkError, Endpoint | TenancyId | Logger>;
|
|
117
|
+
/**
|
|
118
|
+
* Potential errors associated with Passkey registration
|
|
119
|
+
*
|
|
120
|
+
* @category Passkeys (errors)
|
|
121
|
+
*/
|
|
122
|
+
export type RegistrationError = PasskeyUnsupportedError | DuplicatePasskeyError | OtherPasskeyError | NetworkError;
|
|
123
|
+
/**
|
|
124
|
+
* Trigger local passkey registration then save the passkey in your Passlock vault.
|
|
125
|
+
* Returns a code and id_token that can be exchanged/decoded in your backend.
|
|
126
|
+
*
|
|
127
|
+
* @param options
|
|
128
|
+
* @returns A Micro effect that resolves with {@link RegistrationSuccess} or
|
|
129
|
+
* fails with {@link RegistrationError}.
|
|
130
|
+
*/
|
|
131
|
+
export declare const registerPasskey: (options: RegistrationOptions) => Micro.Micro<RegistrationSuccess, RegistrationError, Logger | RegistrationHelper>;
|
|
132
|
+
export declare const RegistrationEvent: readonly ["optionsRequest", "createCredential", "saveCredential"];
|
|
133
|
+
/**
|
|
134
|
+
* Type of the registration event
|
|
135
|
+
*
|
|
136
|
+
* @category Passkeys (other)
|
|
137
|
+
*/
|
|
138
|
+
export type RegistrationEvent = (typeof RegistrationEvent)[number];
|
|
139
|
+
/**
|
|
140
|
+
* Callback to receive registration lifecycle events.
|
|
141
|
+
*
|
|
142
|
+
* @category Passkeys (other)
|
|
143
|
+
*/
|
|
144
|
+
export type OnRegistrationEvent = (event: RegistrationEvent) => void;
|
|
145
|
+
//# sourceMappingURL=registration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registration.d.ts","sourceRoot":"","sources":["../../../src/passkey/registration/registration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,yBAAyB,CAAA;AACjD,OAAO,EACL,KAAK,sCAAsC,EAC3C,KAAK,wBAAwB,EAE9B,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAW,KAAK,EAAQ,MAAM,QAAQ,CAAA;AAC7C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAE,QAAQ,EAA6B,SAAS,E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AM,iBAAiB,GAC5B,SAAS,OAAO,KACf,OAAO,IAAI,eAYb,CAAA;AAED,eAAO,MAAM,YAAY,GACvB,SAAS,IAAI,CAAC,mBAAmB,EAAE,MAAM,eAAe,CAAC,8EAmCvD,CAAA;AAEJ,eAAO,MAAM,iBAAiB,GAC5B,aAAa,sCAAsC,EACnD,aAAa;IAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,SAAS,CAAA;CAAE,mJAoCxD,CAAA;AAEJ,eAAO,MAAM,gBAAgB,GAC3B,cAAc,MAAM,EACpB,UAAU,wBAAwB,EAClC,aAAa;IAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,SAAS,CAAA;CAAE,kFAgCxD,CAAA;AAEJ;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GACzB,uBAAuB,GACvB,qBAAqB,GACrB,iBAAiB,GACjB,YAAY,CAAA;AAEhB;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,GAC1B,SAAS,mBAAmB,KAC3B,KAAK,CAAC,KAAK,CACZ,mBAAmB,EACnB,iBAAiB,EACjB,MAAM,GAAG,kBAAkB,CAmB5B,CAAA;AAED,eAAO,MAAM,iBAAiB,mEAIpB,CAAA;AAEV;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAA;AAElE;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,KAAK,EAAE,iBAAiB,KAAK,IAAI,CAAA"}
|
|
@@ -1,26 +1,42 @@
|
|
|
1
1
|
import * as Helper from "@simplewebauthn/browser";
|
|
2
2
|
import { WebAuthnError, } from "@simplewebauthn/browser";
|
|
3
3
|
import { Context, Micro, pipe } from "effect";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
4
|
+
import { Endpoint, makeEndpoint, makeRequest, TenancyId } from "../../internal";
|
|
5
|
+
import { Logger } from "../../logger";
|
|
6
|
+
import { DuplicatePasskeyError, OtherPasskeyError, PasskeyUnsupportedError, } from "../errors";
|
|
7
|
+
/**
|
|
8
|
+
* @internal
|
|
9
|
+
* @hidden
|
|
10
|
+
*/
|
|
8
11
|
export class RegistrationHelper extends Context.Tag("RegistrationHelper")() {
|
|
9
12
|
static Default = {
|
|
10
13
|
browserSupportsWebAuthn: Helper.browserSupportsWebAuthn,
|
|
11
14
|
startRegistration: Helper.startRegistration,
|
|
12
15
|
};
|
|
13
16
|
}
|
|
14
|
-
export const isDuplicatePasskey = (err) => err instanceof DuplicatePasskeyError;
|
|
15
17
|
/**
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
18
|
+
* Type guard to test for a {@link RegistrationSuccess}. Typically used to test the
|
|
19
|
+
* object returned from {@link registerPasskey}
|
|
20
|
+
*
|
|
21
|
+
* @param payload
|
|
22
|
+
* @returns `true` if the payload is a {@link RegistrationSuccess}.
|
|
23
|
+
*
|
|
24
|
+
* @category Passkeys (other)
|
|
19
25
|
*/
|
|
20
|
-
export
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
26
|
+
export const isRegistrationSuccess = (payload) => {
|
|
27
|
+
if (typeof payload !== "object")
|
|
28
|
+
return false;
|
|
29
|
+
if (payload === null)
|
|
30
|
+
return false;
|
|
31
|
+
if (!("_tag" in payload))
|
|
32
|
+
return false;
|
|
33
|
+
if (typeof payload._tag !== "string")
|
|
34
|
+
return false;
|
|
35
|
+
if (payload._tag !== "RegistrationSuccess")
|
|
36
|
+
return false;
|
|
37
|
+
return true;
|
|
38
|
+
};
|
|
39
|
+
export const isOptionsResponse = (payload) => {
|
|
24
40
|
if (typeof payload !== "object")
|
|
25
41
|
return false;
|
|
26
42
|
if (payload === null)
|
|
@@ -37,12 +53,11 @@ const isOptionsResponse = (payload) => {
|
|
|
37
53
|
return false;
|
|
38
54
|
return true;
|
|
39
55
|
};
|
|
40
|
-
export const registrationEvent = ["optionsRequest", "createCredential", "saveCredential"];
|
|
41
56
|
export const fetchOptions = (options) => Micro.gen(function* () {
|
|
42
57
|
const logger = yield* Micro.service(Logger);
|
|
43
58
|
const { endpoint } = yield* Micro.service(Endpoint);
|
|
44
59
|
const { tenancyId } = yield* Micro.service(TenancyId);
|
|
45
|
-
const { username, userDisplayName,
|
|
60
|
+
const { username, userDisplayName, excludeCredentials, userVerification, timeout, onEvent, } = options;
|
|
46
61
|
const url = new URL(`${tenancyId}/passkey/registration/options`, endpoint);
|
|
47
62
|
onEvent?.("optionsRequest");
|
|
48
63
|
yield* logger.logInfo("Fetching passkey registration options from Passlock");
|
|
@@ -50,7 +65,6 @@ export const fetchOptions = (options) => Micro.gen(function* () {
|
|
|
50
65
|
excludeCredentials,
|
|
51
66
|
timeout,
|
|
52
67
|
userDisplayName,
|
|
53
|
-
userId,
|
|
54
68
|
username,
|
|
55
69
|
userVerification,
|
|
56
70
|
};
|
|
@@ -61,20 +75,6 @@ export const fetchOptions = (options) => Micro.gen(function* () {
|
|
|
61
75
|
url,
|
|
62
76
|
});
|
|
63
77
|
});
|
|
64
|
-
const RegistrationSuccessTag = "RegistrationSuccess";
|
|
65
|
-
export const isRegistrationSuccess = (payload) => {
|
|
66
|
-
if (typeof payload !== "object")
|
|
67
|
-
return false;
|
|
68
|
-
if (payload === null)
|
|
69
|
-
return false;
|
|
70
|
-
if (!("_tag" in payload))
|
|
71
|
-
return false;
|
|
72
|
-
if (typeof payload._tag !== "string")
|
|
73
|
-
return false;
|
|
74
|
-
if (payload._tag !== RegistrationSuccessTag)
|
|
75
|
-
return false;
|
|
76
|
-
return true;
|
|
77
|
-
};
|
|
78
78
|
export const startRegistration = (optionsJSON, { onEvent }) => Micro.gen(function* () {
|
|
79
79
|
onEvent?.("createCredential");
|
|
80
80
|
const logger = yield* Micro.service(Logger);
|
|
@@ -82,10 +82,11 @@ export const startRegistration = (optionsJSON, { onEvent }) => Micro.gen(functio
|
|
|
82
82
|
const helper = yield* Micro.service(RegistrationHelper);
|
|
83
83
|
const isSupport = helper.browserSupportsWebAuthn();
|
|
84
84
|
if (!isSupport)
|
|
85
|
-
yield* new PasskeyUnsupportedError({
|
|
85
|
+
yield* Micro.fail(new PasskeyUnsupportedError({
|
|
86
86
|
message: "Device does not support passkeys",
|
|
87
|
-
});
|
|
87
|
+
}));
|
|
88
88
|
return yield* Micro.tryPromise({
|
|
89
|
+
try: () => helper.startRegistration({ optionsJSON }),
|
|
89
90
|
catch: (error) => {
|
|
90
91
|
if (error instanceof WebAuthnError &&
|
|
91
92
|
error.code === "ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED") {
|
|
@@ -102,7 +103,6 @@ export const startRegistration = (optionsJSON, { onEvent }) => Micro.gen(functio
|
|
|
102
103
|
return new OtherPasskeyError({ error, message: "Unexpected error" });
|
|
103
104
|
}
|
|
104
105
|
},
|
|
105
|
-
try: () => helper.startRegistration({ optionsJSON }),
|
|
106
106
|
});
|
|
107
107
|
});
|
|
108
108
|
export const verifyCredential = (sessionToken, response, { onEvent }) => Micro.gen(function* () {
|
|
@@ -126,13 +126,15 @@ export const verifyCredential = (sessionToken, response, { onEvent }) => Micro.g
|
|
|
126
126
|
return registrationResponse;
|
|
127
127
|
});
|
|
128
128
|
/**
|
|
129
|
-
*
|
|
130
|
-
*
|
|
129
|
+
* Trigger local passkey registration then save the passkey in your Passlock vault.
|
|
130
|
+
* Returns a code and id_token that can be exchanged/decoded in your backend.
|
|
131
|
+
*
|
|
131
132
|
* @param options
|
|
132
|
-
* @returns
|
|
133
|
+
* @returns A Micro effect that resolves with {@link RegistrationSuccess} or
|
|
134
|
+
* fails with {@link RegistrationError}.
|
|
133
135
|
*/
|
|
134
136
|
export const registerPasskey = (options) => {
|
|
135
|
-
const endpoint =
|
|
137
|
+
const endpoint = makeEndpoint(options);
|
|
136
138
|
const effect = Micro.gen(function* () {
|
|
137
139
|
const { sessionToken, optionsJSON } = yield* fetchOptions(options);
|
|
138
140
|
const response = yield* startRegistration(optionsJSON, {
|
|
@@ -144,4 +146,9 @@ export const registerPasskey = (options) => {
|
|
|
144
146
|
});
|
|
145
147
|
return pipe(effect, Micro.provideService(TenancyId, options), Micro.provideService(Endpoint, endpoint));
|
|
146
148
|
};
|
|
149
|
+
export const RegistrationEvent = [
|
|
150
|
+
"optionsRequest",
|
|
151
|
+
"createCredential",
|
|
152
|
+
"saveCredential",
|
|
153
|
+
];
|
|
147
154
|
//# sourceMappingURL=registration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registration.js","sourceRoot":"","sources":["../../../src/passkey/registration/registration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,yBAAyB,CAAA;AACjD,OAAO,EAGL,aAAa,GACd,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAE7C,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAE/E,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAErC,OAAO,EACL,qBAAqB,EACrB,iBAAiB,EACjB,uBAAuB,GACxB,MAAM,WAAW,CAAA;AA4DlB;;;GAGG;AACH,MAAM,OAAO,kBAAmB,SAAQ,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,EAMtE;IACD,MAAM,CAAC,OAAO,GAAG;QACf,uBAAuB,EAAE,MAAM,CAAC,uBAAuB;QACvD,iBAAiB,EAAE,MAAM,CAAC,iBAAiB;KACA,CAAA;;AAuC/C;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CACnC,OAAgB,EACgB,EAAE;IAClC,IAAI,OAAO,OAAO,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAA;IAC7C,IAAI,OAAO,KAAK,IAAI;QAAE,OAAO,KAAK,CAAA;IAElC,IAAI,CAAC,CAAC,MAAM,IAAI,OAAO,CAAC;QAAE,OAAO,KAAK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,CAAA"}
|
package/dist/passkey/shared.d.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* https://w3c.github.io/webauthn/#user-verification
|
|
3
|
+
*
|
|
4
|
+
* @category Passkeys (core)
|
|
5
|
+
*/
|
|
1
6
|
export type UserVerification = "discouraged" | "preferred" | "required";
|
|
2
7
|
/**
|
|
3
8
|
* https://w3c.github.io/webauthn/#enumdef-publickeycredentialhint
|
|
@@ -10,7 +15,7 @@ export type AttestationFormat = "fido-u2f" | "packed" | "android-safetynet" | "a
|
|
|
10
15
|
/**
|
|
11
16
|
* https://w3c.github.io/webauthn/#dictdef-publickeycredentialcreationoptionsjson
|
|
12
17
|
*/
|
|
13
|
-
export
|
|
18
|
+
export type PublicKeyCredentialCreationOptionsJSON = {
|
|
14
19
|
rp: PublicKeyCredentialRpEntity;
|
|
15
20
|
user: PublicKeyCredentialUserEntityJSON;
|
|
16
21
|
challenge: Base64URLString;
|
|
@@ -22,5 +27,6 @@ export interface PublicKeyCredentialCreationOptionsJSON {
|
|
|
22
27
|
attestation?: AttestationConveyancePreference;
|
|
23
28
|
attestationFormats?: Array<AttestationFormat>;
|
|
24
29
|
extensions?: AuthenticationExtensionsClientInputs;
|
|
25
|
-
}
|
|
30
|
+
};
|
|
31
|
+
export type Millis = number;
|
|
26
32
|
//# sourceMappingURL=shared.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/passkey/shared.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,gBAAgB,GAAG,aAAa,GAAG,WAAW,GAAG,UAAU,CAAA;AAEvE;;GAEG;AACH,MAAM,MAAM,uBAAuB,
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/passkey/shared.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GAAG,aAAa,GAAG,WAAW,GAAG,UAAU,CAAA;AAEvE;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAC/B,QAAQ,GACR,cAAc,GACd,eAAe,CAAA;AAEnB;;GAEG;AACH,MAAM,MAAM,iBAAiB,GACzB,UAAU,GACV,QAAQ,GACR,mBAAmB,GACnB,aAAa,GACb,KAAK,GACL,OAAO,GACP,MAAM,CAAA;AAEV;;GAEG;AACH,MAAM,MAAM,sCAAsC,GAAG;IACnD,EAAE,EAAE,2BAA2B,CAAA;IAC/B,IAAI,EAAE,iCAAiC,CAAA;IACvC,SAAS,EAAE,eAAe,CAAA;IAC1B,gBAAgB,EAAE,KAAK,CAAC,6BAA6B,CAAC,CAAA;IACtD,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,kBAAkB,CAAC,EAAE,KAAK,CAAC,iCAAiC,CAAC,CAAA;IAC7D,sBAAsB,CAAC,EAAE,8BAA8B,CAAA;IACvD,KAAK,CAAC,EAAE,KAAK,CAAC,uBAAuB,CAAC,CAAA;IACtC,WAAW,CAAC,EAAE,+BAA+B,CAAA;IAC7C,kBAAkB,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,CAAA;IAC7C,UAAU,CAAC,EAAE,oCAAoC,CAAA;CAClD,CAAA;AAED,MAAM,MAAM,MAAM,GAAG,MAAM,CAAA"}
|