@teamhanko/hanko-frontend-sdk 0.0.1-alpha

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 Hanko GmbH
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,150 @@
1
+ # hanko-frontend-sdk
2
+
3
+ This package utilizes the [Hanko API](https://github.com/teamhanko/hanko/blob/main/backend/README.md) to provide
4
+ functionality that allows an easier UI integration. It is meant for use in browsers only.
5
+
6
+ ## Installation
7
+
8
+ ```shell
9
+ # npm
10
+ npm install @teamhanko/hanko-frontend-sdk
11
+
12
+ # yarn
13
+ yarn add @teamhanko/hanko-frontend-sdk
14
+
15
+ # pnpm
16
+ pnpm install @teamhanko/hanko-frontend-sdk
17
+ ```
18
+
19
+ ## Usage
20
+
21
+ Import as a module:
22
+
23
+ ```typescript
24
+ import { Hanko } from "@teamhanko/hanko-frontend-sdk"
25
+
26
+ const hanko = new Hanko("http://localhost:3000")
27
+ ```
28
+
29
+ With a script tag via CDN:
30
+
31
+ ```html
32
+ <script src="https://cdn.jsdelivr.net/npm/@teamhanko/hanko-frontend-sdk/dist/sdk.umd.js"></script>
33
+
34
+ <script>
35
+ const hanko = new hankoFrontendSdk.Hanko("http://localhost:3000")
36
+ ...
37
+ </script>
38
+ ```
39
+
40
+ ## Documentation
41
+
42
+ To see the latest documentation, please click [here](https://teamhanko.github.io/hanko/jsdoc/@teamhanko/hanko-frontend-sdk/0.0.1-alpha).
43
+
44
+ ## Exports
45
+
46
+ ### SDK
47
+
48
+ - `Hanko` - A class that bundles all functionalities.
49
+
50
+ ### Clients
51
+
52
+ - `ConfigClient` - A class to fetch configurations.
53
+ - `UserClient` - A class to manage users.
54
+ - `WebauthnClient` - A class to handle WebAuthn-related functionalities.
55
+ - `PasswordClient` - A class to manage passwords and password logins.
56
+ - `PasscodeClient` - A class to handle passcode logins.
57
+
58
+ ### Utilities
59
+
60
+ - `WebauthnSupport` - A class to check the browser's WebAuthn support.
61
+
62
+ ### DTOs
63
+
64
+ - `Config`
65
+ - `PasswordConfig`
66
+ - `WebauthnFinalized`
67
+ - `Credential`
68
+ - `UserInfo`
69
+ - `User`
70
+ - `Passcode`
71
+
72
+ ### Errors
73
+
74
+ - `HankoError`
75
+ - `TechnicalError`
76
+ - `ConflictError`
77
+ - `RequestTimeoutError`
78
+ - `WebauthnRequestCancelledError`
79
+ - `InvalidPasswordError`
80
+ - `InvalidPasscodeError`
81
+ - `InvalidWebauthnCredentialError`
82
+ - `PasscodeExpiredError`
83
+ - `MaxNumOfPasscodeAttemptsReachedError`
84
+ - `NotFoundError`
85
+ - `TooManyRequestsError`
86
+ - `UnauthorizedError`
87
+
88
+ ## Examples
89
+
90
+ ### Get the current user / Validate the JWT against the Hanko API
91
+
92
+ The Hanko API issues a JWT when a user logs in. For certain actions, like obtaining the user object, a valid JWT is
93
+ required. The following example shows how to get the user object of the current user, or to identify that the user is
94
+ not logged in:
95
+
96
+ ```typescript
97
+ import { Hanko, UnauthorizedError } from "@teamhanko/hanko-frontend-sdk"
98
+
99
+ const hanko = new Hanko("http://localhost:3000")
100
+
101
+ try {
102
+ const user = await hanko.user.getCurrent()
103
+
104
+ // A valid JWT is in place so that the user object was able to be fetched.
105
+ } catch (e) {
106
+ if (e instanceof UnauthorizedError) {
107
+ // Display an error or prompt the user to login again. After a successful call to `hanko.webauthn.login()`,
108
+ // `hanko.password.login()` or `hanko.passcode.finalize()` a JWT will be issued and `hanko.user.getCurrent()`
109
+ // would succeed.
110
+ }
111
+ }
112
+ ```
113
+
114
+ ### Register a WebAuthn credential
115
+
116
+ There are a number of situations where you may want the user to register a WebAuthn credential. For example, after user
117
+ creation, when a user logs in to a new browser/device, or to take advantage of the "caBLE" support and pair a smartphone
118
+ with a desktop computer:
119
+
120
+ ```typescript
121
+ import { Hanko, UnauthorizedError, WebauthnRequestCancelledError } from "@teamhanko/hanko-frontend-sdk"
122
+
123
+ const hanko = new Hanko("http://localhost:3000")
124
+
125
+ // By passing the user object (see example above) to `hanko.webauthn.shouldRegister(user)` you get an indication of
126
+ // whether a WebAuthn credential registration should be performed on the current browser. This is useful if the user has
127
+ // logged in using a method other than WebAuthn, and you then want to display a UI that allows the user to register a
128
+ // credential when possibly none exists.
129
+
130
+ try {
131
+ // Will cause the browser to present a dialog with various options depending on the WebAuthn implemention.
132
+ await hanko.webauthn.register()
133
+
134
+ // Credential has been registered.
135
+ } catch(e) {
136
+ if (e instanceof WebauthnRequestCancelledError) {
137
+ // The WebAuthn API failed. Usually in this case the user cancelled the WebAuthn dialog.
138
+ } else if (e instanceof UnauthorizedError) {
139
+ // The user needs to login to perform this action.
140
+ }
141
+ }
142
+ ```
143
+
144
+ ## Bugs
145
+
146
+ Found a bug? Please report on our [GitHub](https://github.com/teamhanko/hanko/issues) page.
147
+
148
+ ## License
149
+
150
+ The `hanko-frontend-sdk` project is licensed under the [MIT License](LICENSE).
@@ -0,0 +1,20 @@
1
+ import { ConfigClient } from "./lib/client/ConfigClient";
2
+ import { PasscodeClient } from "./lib/client/PasscodeClient";
3
+ import { PasswordClient } from "./lib/client/PasswordClient";
4
+ import { UserClient } from "./lib/client/UserClient";
5
+ import { WebauthnClient } from "./lib/client/WebauthnClient";
6
+ /**
7
+ * A class that bundles all available SDK functions.
8
+ *
9
+ * @param {string} api - The URL of your Hanko API instance
10
+ * @param {number=} timeout - The request timeout in milliseconds
11
+ */
12
+ declare class Hanko {
13
+ config: ConfigClient;
14
+ user: UserClient;
15
+ webauthn: WebauthnClient;
16
+ password: PasswordClient;
17
+ passcode: PasscodeClient;
18
+ constructor(api: string, timeout?: number);
19
+ }
20
+ export { Hanko };
@@ -0,0 +1,14 @@
1
+ import { Hanko } from "./Hanko";
2
+ export { Hanko };
3
+ import { ConfigClient } from "./lib/client/ConfigClient";
4
+ import { PasscodeClient } from "./lib/client/PasscodeClient";
5
+ import { PasswordClient } from "./lib/client/PasswordClient";
6
+ import { UserClient } from "./lib/client/UserClient";
7
+ import { WebauthnClient } from "./lib/client/WebauthnClient";
8
+ export { ConfigClient, UserClient, WebauthnClient, PasswordClient, PasscodeClient, };
9
+ import { WebauthnSupport } from "./lib/WebauthnSupport";
10
+ export { WebauthnSupport };
11
+ import { PasswordConfig, Config, WebauthnFinalized, Credential, UserInfo, User, Passcode } from "./lib/Dto";
12
+ export type { PasswordConfig, Config, WebauthnFinalized, Credential, UserInfo, User, Passcode, };
13
+ import { HankoError, TechnicalError, ConflictError, RequestTimeoutError, WebauthnRequestCancelledError, InvalidPasswordError, InvalidPasscodeError, InvalidWebauthnCredentialError, PasscodeExpiredError, MaxNumOfPasscodeAttemptsReachedError, NotFoundError, TooManyRequestsError, UnauthorizedError } from "./lib/Errors";
14
+ export { HankoError, TechnicalError, ConflictError, RequestTimeoutError, WebauthnRequestCancelledError, InvalidPasswordError, InvalidPasscodeError, InvalidWebauthnCredentialError, PasscodeExpiredError, MaxNumOfPasscodeAttemptsReachedError, NotFoundError, TooManyRequestsError, UnauthorizedError, };
@@ -0,0 +1,305 @@
1
+ import { Config, Passcode, User, UserInfo } from "./Dto";
2
+ /**
3
+ * This class wraps an XMLHttpRequest to maintain compatibility with the fetch API.
4
+ *
5
+ * @category SDK
6
+ * @subcategory Internal
7
+ * @param {XMLHttpRequest} xhr - The request to be wrapped.
8
+ * @see HttpClient
9
+ */
10
+ declare class Headers {
11
+ _xhr: XMLHttpRequest;
12
+ constructor(xhr: XMLHttpRequest);
13
+ get(name: string): string;
14
+ }
15
+ /**
16
+ * This class wraps an XMLHttpRequest to maintain compatibility with the fetch API.
17
+ *
18
+ * @category SDK
19
+ * @subcategory Internal
20
+ * @param {XMLHttpRequest} xhr - The request to be wrapped.
21
+ * @see HttpClient
22
+ */
23
+ declare class Response {
24
+ headers: Headers;
25
+ ok: boolean;
26
+ status: number;
27
+ statusText: string;
28
+ url: string;
29
+ _decodedJSON: any;
30
+ constructor(xhr: XMLHttpRequest);
31
+ /**
32
+ * Returns the JSON decoded response.
33
+ *
34
+ * @return {any}
35
+ */
36
+ json(): any;
37
+ }
38
+ /**
39
+ * Internally used for communication with the Hanko API. It also handles authorization tokens to enable authorized
40
+ * requests.
41
+ *
42
+ * Currently, there is an issue with Safari and on iOS 15 devices where decoding a JSON response via the fetch API
43
+ * breaks the user gesture and the user is not able to use the authenticator. Therefore, this class uses XMLHttpRequests
44
+ * instead of the fetch API, but maintains compatibility by wrapping the XMLHttpRequests. So, if the issues are fixed,
45
+ * we can easily return to the fetch API.
46
+ *
47
+ * @category SDK
48
+ * @subcategory Internal
49
+ * @param {string} api - The URL of your Hanko API instance
50
+ * @param {number=} timeout - The request timeout in milliseconds
51
+ */
52
+ declare class HttpClient {
53
+ timeout: number;
54
+ api: string;
55
+ constructor(api: string, timeout?: number);
56
+ _fetch(path: string, options: RequestInit): Promise<Response>;
57
+ /**
58
+ * Performs a GET request.
59
+ *
60
+ * @param {string} path - The path to the requested resource.
61
+ * @return {Promise<Response>}
62
+ * @throws {RequestTimeoutError}
63
+ * @throws {TechnicalError}
64
+ */
65
+ get(path: string): Promise<Response>;
66
+ /**
67
+ * Performs a POST request.
68
+ *
69
+ * @param {string} path - The path to the requested resource.
70
+ * @param {any=} body - The request body.
71
+ * @return {Promise<Response>}
72
+ * @throws {RequestTimeoutError}
73
+ * @throws {TechnicalError}
74
+ */
75
+ post(path: string, body?: any): Promise<Response>;
76
+ /**
77
+ * Performs a PUT request.
78
+ *
79
+ * @param {string} path - The path to the requested resource.
80
+ * @param {any=} body - The request body.
81
+ * @return {Promise<Response>}
82
+ * @throws {RequestTimeoutError}
83
+ * @throws {TechnicalError}
84
+ */
85
+ put(path: string, body?: any): Promise<Response>;
86
+ }
87
+ /**
88
+ * A class to be extended by the other client classes.
89
+ *
90
+ * @abstract
91
+ * @category SDK
92
+ * @subcategory Internal
93
+ * @param {string} api - The URL of your Hanko API instance
94
+ * @param {number=} timeout - The request timeout in milliseconds
95
+ */
96
+ declare abstract class Client {
97
+ protected client: HttpClient;
98
+ constructor(api: string, timeout?: number);
99
+ }
100
+ /**
101
+ * A class for retrieving configurations from the API.
102
+ *
103
+ * @category SDK
104
+ * @subcategory Clients
105
+ * @extends {Client}
106
+ */
107
+ declare class ConfigClient extends Client {
108
+ /**
109
+ * Retrieves the frontend configuration.
110
+ * @return {Promise<Config>}
111
+ * @throws {RequestTimeoutError}
112
+ * @throws {TechnicalError}
113
+ * @see https://teamhanko.github.io/hanko/#/.well-known/getConfig
114
+ */
115
+ get(): Promise<Config>;
116
+ }
117
+ /**
118
+ * A class to manage user information.
119
+ *
120
+ * @category SDK
121
+ * @subcategory Clients
122
+ * @extends {Client}
123
+ */
124
+ declare class UserClient extends Client {
125
+ /**
126
+ * Fetches basic information about the user by providing an email address. Can be used while the user is logged out
127
+ * and is helpful in deciding which type of login to choose. For example, if the user's email is not verified, you may
128
+ * want to log in with a passcode, or if no WebAuthN credentials are registered, you may not want to use WebAuthN.
129
+ *
130
+ * @param {string} email - The user's email address.
131
+ * @return {Promise<UserInfo>}
132
+ * @throws {NotFoundError}
133
+ * @throws {RequestTimeoutError}
134
+ * @throws {TechnicalError}
135
+ * @see https://teamhanko.github.io/hanko/#/authentication/getUserId
136
+ */
137
+ getInfo(email: string): Promise<UserInfo>;
138
+ /**
139
+ * Creates a new user. Afterwards, the step should be to verify the email address via passcode. If a 'ConflictError'
140
+ * occurred, you may want to prompt the user to log in.
141
+ *
142
+ * @param {string} email - The email address of the user to be created.
143
+ * @return {Promise<User>}
144
+ * @throws {ConflictError}
145
+ * @throws {RequestTimeoutError}
146
+ * @throws {TechnicalError}
147
+ * @see https://teamhanko.github.io/hanko/#/management/createUser
148
+ */
149
+ create(email: string): Promise<User>;
150
+ /**
151
+ * Fetches the current user.
152
+ *
153
+ * @return {Promise<User>}
154
+ * @throws {UnauthorizedError}
155
+ * @throws {RequestTimeoutError}
156
+ * @throws {TechnicalError}
157
+ * @see https://teamhanko.github.io/hanko/#/authentication/IsUserAuthorized
158
+ * @see https://teamhanko.github.io/hanko/#/management/listUser
159
+ */
160
+ getCurrent(): Promise<User>;
161
+ }
162
+ /**
163
+ * A class that handles WebAuthN authentication and registration.
164
+ *
165
+ * @constructor
166
+ * @category SDK
167
+ * @subcategory Clients
168
+ * @extends {Client}
169
+ */
170
+ declare class WebauthnClient extends Client {
171
+ private state;
172
+ constructor(api: string, timeout: number);
173
+ /**
174
+ * Performs a WebAuthN authentication ceremony. When 'userID' is specified, the API provides a list of
175
+ * allowed credentials and the browser is able to present a list of suitable credentials to the user.
176
+ *
177
+ * @param {string=} userID - The user's UUID.
178
+ * @return {Promise<void>}
179
+ * @throws {WebauthnRequestCancelledError}
180
+ * @throws {InvalidWebauthnCredentialError}
181
+ * @throws {RequestTimeoutError}
182
+ * @throws {TechnicalError}
183
+ * @see https://teamhanko.github.io/hanko/#/authentication/webauthnLoginInit
184
+ * @see https://teamhanko.github.io/hanko/#/authentication/webauthnLoginFinal
185
+ * @see https://www.w3.org/TR/webauthn-2/#authentication-ceremony
186
+ */
187
+ login(userID?: string): Promise<void>;
188
+ /**
189
+ * Performs a WebAuthN registration ceremony.
190
+ *
191
+ * @return {Promise<void>}
192
+ * @throws {WebauthnRequestCancelledError}
193
+ * @throws {RequestTimeoutError}
194
+ * @throws {UnauthorizedError}
195
+ * @throws {TechnicalError}
196
+ * @see https://teamhanko.github.io/hanko/#/authentication/webauthnRegInit
197
+ * @see https://teamhanko.github.io/hanko/#/authentication/webauthnRegFinal
198
+ * @see https://www.w3.org/TR/webauthn-2/#sctn-registering-a-new-credential
199
+ */
200
+ register(): Promise<void>;
201
+ /**
202
+ * Determines whether a credential registration ceremony should be performed. Returns 'true' when a platform
203
+ * authenticator is available and the user's credentials do not intersect with the credentials already known on the
204
+ * current browser/device.
205
+ *
206
+ * @param {User} user - The user object.
207
+ * @return {Promise<boolean>}
208
+ * @throws {TechnicalError}
209
+ */
210
+ shouldRegister(user: User): Promise<boolean>;
211
+ }
212
+ /**
213
+ * A class to handle passwords.
214
+ *
215
+ * @constructor
216
+ * @category SDK
217
+ * @subcategory Clients
218
+ * @extends {Client}
219
+ */
220
+ declare class PasswordClient extends Client {
221
+ private state;
222
+ constructor(api: string, timeout: number);
223
+ /**
224
+ * Logs in a user with a password.
225
+ *
226
+ * @param {string} userID - The UUID of the user.
227
+ * @param {string} password - The password.
228
+ * @return {Promise<void>}
229
+ * @throws {TooManyRequestsError}
230
+ * @throws {RequestTimeoutError}
231
+ * @throws {TechnicalError}
232
+ * @see https://teamhanko.github.io/hanko/#/authentication/passwordLogin
233
+ */
234
+ login(userID: string, password: string): Promise<void>;
235
+ /**
236
+ * Updates a password.
237
+ *
238
+ * @param {string} userID - The UUID of the user.
239
+ * @param {string} password - The new password.
240
+ * @return {Promise<void>}
241
+ * @throws {RequestTimeoutError}
242
+ * @throws {UnauthorizedError}
243
+ * @throws {TechnicalError}
244
+ * @see https://teamhanko.github.io/hanko/#/authentication/password
245
+ */
246
+ update(userID: string, password: string): Promise<void>;
247
+ /**
248
+ * Returns the seconds until the rate limiting is actives.
249
+ *
250
+ * @param {string} userID - The UUID of the user.
251
+ * @return {number}
252
+ */
253
+ getRetryAfter(userID: string): number;
254
+ }
255
+ /**
256
+ * A class to handle passcodes.
257
+ *
258
+ * @constructor
259
+ * @category SDK
260
+ * @subcategory Clients
261
+ * @extends {Client}
262
+ */
263
+ declare class PasscodeClient extends Client {
264
+ private state;
265
+ constructor(api: string, timeout: number);
266
+ /**
267
+ * Causes the API to send a new passcode to the user's email address.
268
+ *
269
+ * @param {string} userID - The UUID of the user.
270
+ * @return {Promise<Passcode>}
271
+ * @throws {TooManyRequestsError}
272
+ * @throws {RequestTimeoutError}
273
+ * @throws {TechnicalError}
274
+ * @see https://teamhanko.github.io/hanko/#/authentication/passcodeInit
275
+ */
276
+ initialize(userID: string): Promise<Passcode>;
277
+ /**
278
+ * Validates the passcode obtained from the email.
279
+ *
280
+ * @param {string} userID - The UUID of the user.
281
+ * @param {string} code - The passcode digests.
282
+ * @return {Promise<void>}
283
+ * @throws {InvalidPasscodeError}
284
+ * @throws {MaxNumOfPasscodeAttemptsReachedError}
285
+ * @throws {RequestTimeoutError}
286
+ * @throws {TechnicalError}
287
+ * @see https://teamhanko.github.io/hanko/#/authentication/passcodeFinal
288
+ */
289
+ finalize(userID: string, code: string): Promise<void>;
290
+ /**
291
+ * Returns the seconds until the current passcode is active.
292
+ *
293
+ * @param {string} userID - The UUID of the user.
294
+ * @return {number}
295
+ */
296
+ getTTL(userID: string): number;
297
+ /**
298
+ * Returns the seconds until the rate limiting is active.
299
+ *
300
+ * @param {string} userID - The UUID of the user.
301
+ * @return {number}
302
+ */
303
+ getResendAfter(userID: string): number;
304
+ }
305
+ export { HttpClient, ConfigClient, UserClient, WebauthnClient, PasswordClient, PasscodeClient, Headers, Response, };
@@ -0,0 +1,97 @@
1
+ import { PublicKeyCredentialWithAttestationJSON } from "@github/webauthn-json";
2
+ /**
3
+ * @interface
4
+ * @category SDK
5
+ * @subcategory DTO
6
+ * @property {boolean} enabled - Indicates passwords are enabled, so the API accepts login attempts using passwords.
7
+ */
8
+ interface PasswordConfig {
9
+ enabled: boolean;
10
+ }
11
+ /**
12
+ * @interface
13
+ * @category SDK
14
+ * @subcategory DTO
15
+ * @property {PasswordConfig} password - The password configuration.
16
+ */
17
+ interface Config {
18
+ password: PasswordConfig;
19
+ }
20
+ /**
21
+ * @interface
22
+ * @category SDK
23
+ * @subcategory DTO
24
+ * @property {string} credential_id - The ID of the credential that was used.
25
+ * @property {string} user_id - The ID of the user that was used.
26
+ */
27
+ interface WebauthnFinalized {
28
+ credential_id: string;
29
+ user_id: string;
30
+ }
31
+ /**
32
+ * @interface
33
+ * @category SDK
34
+ * @subcategory DTO
35
+ * @property {string} id - The UUID of the user.
36
+ * @property {boolean} verified - Indicates whether the user's email address is verified.
37
+ * @property {boolean} has_webauthn_credential - Indicates that the user has registered a WebAuthn credential in the past.
38
+ */
39
+ interface UserInfo {
40
+ id: string;
41
+ verified: boolean;
42
+ has_webauthn_credential: boolean;
43
+ }
44
+ /**
45
+ * @interface
46
+ * @category SDK
47
+ * @subcategory DTO
48
+ * @property {string} id - The UUID of the current user.
49
+ * @ignore
50
+ */
51
+ interface Me {
52
+ id: string;
53
+ }
54
+ /**
55
+ * @interface
56
+ * @category SDK
57
+ * @subcategory DTO
58
+ * @property {string} id - The WebAuthn credential ID.
59
+ */
60
+ interface Credential {
61
+ id: string;
62
+ }
63
+ /**
64
+ * @interface
65
+ * @category SDK
66
+ * @subcategory DTO
67
+ * @property {string} id - The user's UUID.
68
+ * @property {string} email - The user's email.
69
+ * @property {Credential[]} webauthn_credentials - A list of credentials that have been registered.
70
+ */
71
+ interface User {
72
+ id: string;
73
+ email: string;
74
+ webauthn_credentials: Credential[];
75
+ }
76
+ /**
77
+ * @interface
78
+ * @category SDK
79
+ * @subcategory DTO
80
+ * @property {string} id - The UUID of the passcode.
81
+ * @property {number} ttl - How long the code is active in seconds.
82
+ */
83
+ interface Passcode {
84
+ id: string;
85
+ ttl: number;
86
+ }
87
+ /**
88
+ * @interface
89
+ * @category SDK
90
+ * @subcategory DTO
91
+ * @property {string[]} transports - A list of WebAuthn AuthenticatorTransport, e.g.: "usb", "internal",...
92
+ * @ignore
93
+ */
94
+ interface Attestation extends PublicKeyCredentialWithAttestationJSON {
95
+ transports: string[];
96
+ }
97
+ export type { PasswordConfig, Config, WebauthnFinalized, Credential, UserInfo, Me, User, Passcode, Attestation, };