@teamhanko/hanko-frontend-sdk 0.0.6-alpha → 0.0.8-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.
Files changed (46) hide show
  1. package/dist/lib/client/Client.d.ts +1 -1
  2. package/dist/lib/client/HttpClient.d.ts +7 -1
  3. package/dist/lib/client/PasscodeClient.d.ts +3 -2
  4. package/dist/lib/client/PasswordClient.d.ts +3 -2
  5. package/dist/lib/client/WebauthnClient.d.ts +7 -3
  6. package/dist/lib/state/State.d.ts +5 -7
  7. package/dist/lib/state/UserState.d.ts +1 -2
  8. package/dist/sdk.cjs +1 -1
  9. package/dist/sdk.cjs.map +1 -1
  10. package/dist/sdk.modern.js +1 -1
  11. package/dist/sdk.modern.js.map +1 -1
  12. package/dist/sdk.module.js +1 -1
  13. package/dist/sdk.module.js.map +1 -1
  14. package/dist/sdk.umd.js +1 -1
  15. package/dist/sdk.umd.js.map +1 -1
  16. package/package.json +15 -11
  17. package/dist/src/Hanko.d.ts +0 -20
  18. package/dist/src/index.d.ts +0 -14
  19. package/dist/src/lib/Dto.d.ts +0 -97
  20. package/dist/src/lib/Errors.d.ts +0 -139
  21. package/dist/src/lib/WebauthnSupport.d.ts +0 -36
  22. package/dist/src/lib/client/Client.d.ts +0 -15
  23. package/dist/src/lib/client/ConfigClient.d.ts +0 -20
  24. package/dist/src/lib/client/HttpClient.d.ts +0 -87
  25. package/dist/src/lib/client/PasscodeClient.d.ts +0 -54
  26. package/dist/src/lib/client/PasswordClient.d.ts +0 -46
  27. package/dist/src/lib/client/UserClient.d.ts +0 -48
  28. package/dist/src/lib/client/WebauthnClient.d.ts +0 -58
  29. package/dist/src/lib/state/PasscodeState.d.ts +0 -91
  30. package/dist/src/lib/state/PasswordState.d.ts +0 -50
  31. package/dist/src/lib/state/State.d.ts +0 -53
  32. package/dist/src/lib/state/UserState.d.ts +0 -51
  33. package/dist/src/lib/state/WebauthnState.d.ts +0 -60
  34. package/dist/tests/lib/WebauthnSupport.spec.d.ts +0 -1
  35. package/dist/tests/lib/client/ConfigClient.spec.d.ts +0 -1
  36. package/dist/tests/lib/client/HttpClient.spec.d.ts +0 -1
  37. package/dist/tests/lib/client/PasscodeClient.spec.d.ts +0 -1
  38. package/dist/tests/lib/client/PasswordClient.spec.d.ts +0 -1
  39. package/dist/tests/lib/client/UserClient.spec.d.ts +0 -1
  40. package/dist/tests/lib/client/WebauthnClient.spec.d.ts +0 -1
  41. package/dist/tests/lib/state/PasscodeState.spec.d.ts +0 -1
  42. package/dist/tests/lib/state/PasswordState.spec.d.ts +0 -1
  43. package/dist/tests/lib/state/State.spec.d.ts +0 -1
  44. package/dist/tests/lib/state/UserState.spec.d.ts +0 -1
  45. package/dist/tests/lib/state/WebauthnState.spec.d.ts +0 -1
  46. package/dist/tests/setup.d.ts +0 -10
@@ -1,139 +0,0 @@
1
- /**
2
- * Every error thrown in the SDK is an instance of 'HankoError'. The value of the 'code' property is eligible to
3
- * translate the error into an error message.
4
- *
5
- * @extends {Error}
6
- * @category SDK
7
- * @subcategory Errors
8
- * @param code {string} - An error code that refers to the error instance.
9
- * @param cause {Error=} - The original error
10
- */
11
- declare abstract class HankoError extends Error {
12
- code: string;
13
- cause?: Error;
14
- protected constructor(message: string, code: string, cause?: Error);
15
- }
16
- /**
17
- * Every error that doesn't need to be handled in a special way is a 'TechnicalError'. Whenever you catch one, there is
18
- * usually nothing you can do but present an error to the user, e.g. "Something went wrong".
19
- *
20
- * @category SDK
21
- * @subcategory Errors
22
- * @extends {HankoError}
23
- */
24
- declare class TechnicalError extends HankoError {
25
- constructor(cause?: Error);
26
- }
27
- /**
28
- * Attempting to create a resource that already exists results in a 'ConflictError'.
29
- *
30
- * @category SDK
31
- * @subcategory Errors
32
- * @extends {HankoError}
33
- */
34
- declare class ConflictError extends HankoError {
35
- constructor(userID?: string, cause?: Error);
36
- }
37
- /**
38
- * A 'RequestTimeoutError' occurs when the specified timeout has been reached.
39
- *
40
- * @category SDK
41
- * @subcategory Errors
42
- * @extends {HankoError}
43
- */
44
- declare class RequestTimeoutError extends HankoError {
45
- constructor(cause?: Error);
46
- }
47
- /**
48
- * A 'WebauthnRequestCancelledError' occurs during WebAuthn authentication or registration, when the WebAuthn API throws
49
- * an error. In most cases, this happens when the user cancels the browser's WebAuthn dialog.
50
- *
51
- * @category SDK
52
- * @subcategory Errors
53
- * @extends {HankoError}
54
- */
55
- declare class WebauthnRequestCancelledError extends HankoError {
56
- constructor(cause?: Error);
57
- }
58
- /**
59
- * An 'InvalidPasswordError' occurs when invalid credentials are provided when logging in with a password.
60
- *
61
- * @category SDK
62
- * @subcategory Errors
63
- * @extends {HankoError}
64
- */
65
- declare class InvalidPasswordError extends HankoError {
66
- constructor(cause?: Error);
67
- }
68
- /**
69
- * An 'InvalidPasswordError' occurs when an incorrect code is entered when logging in with a passcode.
70
- *
71
- * @category SDK
72
- * @subcategory Errors
73
- * @extends {HankoError}
74
- */
75
- declare class InvalidPasscodeError extends HankoError {
76
- constructor(cause?: Error);
77
- }
78
- /**
79
- * An 'InvalidWebauthnCredentialError' occurs if invalid credentials were used when logging in with WebAuthn.
80
- *
81
- * @category SDK
82
- * @subcategory Errors
83
- * @extends {HankoError}
84
- */
85
- declare class InvalidWebauthnCredentialError extends HankoError {
86
- constructor(cause?: Error);
87
- }
88
- /**
89
- * A 'PasscodeExpiredError' occurs when the passcode has expired.
90
- *
91
- * @category SDK
92
- * @subcategory Errors
93
- * @extends {HankoError}
94
- */
95
- declare class PasscodeExpiredError extends HankoError {
96
- constructor(cause?: Error);
97
- }
98
- /**
99
- * A 'MaxNumOfPasscodeAttemptsReachedError' occurs when an incorrect passcode is provided too many times.
100
- *
101
- * @category SDK
102
- * @subcategory Errors
103
- * @extends {HankoError}
104
- */
105
- declare class MaxNumOfPasscodeAttemptsReachedError extends HankoError {
106
- constructor(cause?: Error);
107
- }
108
- /**
109
- * A 'NotFoundError' occurs when the requested resource was not found.
110
- *
111
- * @category SDK
112
- * @subcategory Errors
113
- * @extends {HankoError}
114
- */
115
- declare class NotFoundError extends HankoError {
116
- constructor(cause?: Error);
117
- }
118
- /**
119
- * A 'TooManyRequestsError' occurs due to rate limiting when too many requests are made.
120
- *
121
- * @category SDK
122
- * @subcategory Errors
123
- * @extends {HankoError}
124
- */
125
- declare class TooManyRequestsError extends HankoError {
126
- retryAfter?: number;
127
- constructor(retryAfter?: number, cause?: Error);
128
- }
129
- /**
130
- * An 'UnauthorizedError' occurs when the user is not authorized to access the resource.
131
- *
132
- * @category SDK
133
- * @subcategory Errors
134
- * @extends {HankoError}
135
- */
136
- declare class UnauthorizedError extends HankoError {
137
- constructor(cause?: Error);
138
- }
139
- export { HankoError, TechnicalError, ConflictError, RequestTimeoutError, WebauthnRequestCancelledError, InvalidPasswordError, InvalidPasscodeError, InvalidWebauthnCredentialError, PasscodeExpiredError, MaxNumOfPasscodeAttemptsReachedError, NotFoundError, TooManyRequestsError, UnauthorizedError, };
@@ -1,36 +0,0 @@
1
- /**
2
- * A class to check the browser's WebAuthn support.
3
- *
4
- * @hideconstructor
5
- * @category SDK
6
- * @subcategory Utilities
7
- */
8
- declare class WebauthnSupport {
9
- /**
10
- * Does a simple check to test for the credential management API functions we need, and an indication of
11
- * public key credential authentication support.
12
- *
13
- * @see https://developers.google.com/web/updates/2018/03/webauthn-credential-management
14
- * @return boolean
15
- */
16
- static supported(): boolean;
17
- /**
18
- * Checks whether a user-verifying platform authenticator is available.
19
- *
20
- * @return Promise<boolean>
21
- */
22
- static isPlatformAuthenticatorAvailable(): Promise<boolean>;
23
- /**
24
- * Checks whether external CTAP2 security keys are supported.
25
- *
26
- * @return Promise<boolean>
27
- */
28
- static isSecurityKeySupported(): Promise<boolean>;
29
- /**
30
- * Checks whether autofill assisted requests are supported.
31
- *
32
- * @return Promise<boolean>
33
- */
34
- static isConditionalMediationAvailable(): Promise<boolean>;
35
- }
36
- export { WebauthnSupport };
@@ -1,15 +0,0 @@
1
- import { HttpClient } from "./HttpClient";
2
- /**
3
- * A class to be extended by the other client classes.
4
- *
5
- * @abstract
6
- * @category SDK
7
- * @subcategory Internal
8
- * @param {string} api - The URL of your Hanko API instance
9
- * @param {number=} timeout - The request timeout in milliseconds
10
- */
11
- declare abstract class Client {
12
- client: HttpClient;
13
- constructor(api: string, timeout?: number);
14
- }
15
- export { Client };
@@ -1,20 +0,0 @@
1
- import { Config } from "../Dto";
2
- import { Client } from "./Client";
3
- /**
4
- * A class for retrieving configurations from the API.
5
- *
6
- * @category SDK
7
- * @subcategory Clients
8
- * @extends {Client}
9
- */
10
- declare class ConfigClient extends Client {
11
- /**
12
- * Retrieves the frontend configuration.
13
- * @return {Promise<Config>}
14
- * @throws {RequestTimeoutError}
15
- * @throws {TechnicalError}
16
- * @see https://docs.hanko.io/api/public#tag/.well-known/operation/getConfig
17
- */
18
- get(): Promise<Config>;
19
- }
20
- export { ConfigClient };
@@ -1,87 +0,0 @@
1
- /**
2
- * This class wraps an XMLHttpRequest to maintain compatibility with the fetch API.
3
- *
4
- * @category SDK
5
- * @subcategory Internal
6
- * @param {XMLHttpRequest} xhr - The request to be wrapped.
7
- * @see HttpClient
8
- */
9
- declare class Headers {
10
- _xhr: XMLHttpRequest;
11
- constructor(xhr: XMLHttpRequest);
12
- get(name: string): string;
13
- }
14
- /**
15
- * This class wraps an XMLHttpRequest to maintain compatibility with the fetch API.
16
- *
17
- * @category SDK
18
- * @subcategory Internal
19
- * @param {XMLHttpRequest} xhr - The request to be wrapped.
20
- * @see HttpClient
21
- */
22
- declare class Response321 {
23
- headers: Headers;
24
- ok: boolean;
25
- status: number;
26
- statusText: string;
27
- url: string;
28
- _decodedJSON: any;
29
- constructor(xhr: XMLHttpRequest);
30
- /**
31
- * Returns the JSON decoded response.
32
- *
33
- * @return {any}
34
- */
35
- json(): any;
36
- }
37
- /**
38
- * Internally used for communication with the Hanko API. It also handles authorization tokens to enable authorized
39
- * requests.
40
- *
41
- * Currently, there is an issue with Safari and on iOS 15 devices where decoding a JSON response via the fetch API
42
- * breaks the user gesture and the user is not able to use the authenticator. Therefore, this class uses XMLHttpRequests
43
- * instead of the fetch API, but maintains compatibility by wrapping the XMLHttpRequests. So, if the issues are fixed,
44
- * we can easily return to the fetch API.
45
- *
46
- * @category SDK
47
- * @subcategory Internal
48
- * @param {string} api - The URL of your Hanko API instance
49
- * @param {number=} timeout - The request timeout in milliseconds
50
- */
51
- declare class HttpClient {
52
- timeout: number;
53
- api: string;
54
- xhr: XMLHttpRequest;
55
- constructor(api: string, timeout?: number);
56
- _fetch(path: string, options: RequestInit, xhr?: XMLHttpRequest): Promise<Response321>;
57
- /**
58
- * Performs a GET request.
59
- *
60
- * @param {string} path - The path to the requested resource.
61
- * @return {Promise<Response321>}
62
- * @throws {RequestTimeoutError}
63
- * @throws {TechnicalError}
64
- */
65
- get(path: string): Promise<Response321>;
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<Response321>}
72
- * @throws {RequestTimeoutError}
73
- * @throws {TechnicalError}
74
- */
75
- post(path: string, body?: any): Promise<Response321>;
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<Response321>}
82
- * @throws {RequestTimeoutError}
83
- * @throws {TechnicalError}
84
- */
85
- put(path: string, body?: any): Promise<Response321>;
86
- }
87
- export { Headers, Response321, HttpClient };
@@ -1,54 +0,0 @@
1
- import { PasscodeState } from "../state/PasscodeState";
2
- import { Passcode } from "../Dto";
3
- import { Client } from "./Client";
4
- /**
5
- * A class to handle passcodes.
6
- *
7
- * @constructor
8
- * @category SDK
9
- * @subcategory Clients
10
- * @extends {Client}
11
- */
12
- declare class PasscodeClient extends Client {
13
- state: PasscodeState;
14
- constructor(api: string, timeout?: number);
15
- /**
16
- * Causes the API to send a new passcode to the user's email address.
17
- *
18
- * @param {string} userID - The UUID of the user.
19
- * @return {Promise<Passcode>}
20
- * @throws {TooManyRequestsError}
21
- * @throws {RequestTimeoutError}
22
- * @throws {TechnicalError}
23
- * @see https://docs.hanko.io/api/public#tag/Passcode/operation/passcodeInit
24
- */
25
- initialize(userID: string): Promise<Passcode>;
26
- /**
27
- * Validates the passcode obtained from the email.
28
- *
29
- * @param {string} userID - The UUID of the user.
30
- * @param {string} code - The passcode digests.
31
- * @return {Promise<void>}
32
- * @throws {InvalidPasscodeError}
33
- * @throws {MaxNumOfPasscodeAttemptsReachedError}
34
- * @throws {RequestTimeoutError}
35
- * @throws {TechnicalError}
36
- * @see https://docs.hanko.io/api/public#tag/Passcode/operation/passcodeFinal
37
- */
38
- finalize(userID: string, code: string): Promise<void>;
39
- /**
40
- * Returns the number of seconds the current passcode is active for.
41
- *
42
- * @param {string} userID - The UUID of the user.
43
- * @return {number}
44
- */
45
- getTTL(userID: string): number;
46
- /**
47
- * Returns the number of seconds the rate limiting is active for.
48
- *
49
- * @param {string} userID - The UUID of the user.
50
- * @return {number}
51
- */
52
- getResendAfter(userID: string): number;
53
- }
54
- export { PasscodeClient };
@@ -1,46 +0,0 @@
1
- import { PasswordState } from "../state/PasswordState";
2
- import { Client } from "./Client";
3
- /**
4
- * A class to handle passwords.
5
- *
6
- * @constructor
7
- * @category SDK
8
- * @subcategory Clients
9
- * @extends {Client}
10
- */
11
- declare class PasswordClient extends Client {
12
- state: PasswordState;
13
- constructor(api: string, timeout?: number);
14
- /**
15
- * Logs in a user with a password.
16
- *
17
- * @param {string} userID - The UUID of the user.
18
- * @param {string} password - The password.
19
- * @return {Promise<void>}
20
- * @throws {TooManyRequestsError}
21
- * @throws {RequestTimeoutError}
22
- * @throws {TechnicalError}
23
- * @see https://docs.hanko.io/api/public#tag/Password/operation/passwordLogin
24
- */
25
- login(userID: string, password: string): Promise<void>;
26
- /**
27
- * Updates a password.
28
- *
29
- * @param {string} userID - The UUID of the user.
30
- * @param {string} password - The new password.
31
- * @return {Promise<void>}
32
- * @throws {RequestTimeoutError}
33
- * @throws {UnauthorizedError}
34
- * @throws {TechnicalError}
35
- * @see https://docs.hanko.io/api/public#tag/Password/operation/password
36
- */
37
- update(userID: string, password: string): Promise<void>;
38
- /**
39
- * Returns the number of seconds the rate limiting is active for.
40
- *
41
- * @param {string} userID - The UUID of the user.
42
- * @return {number}
43
- */
44
- getRetryAfter(userID: string): number;
45
- }
46
- export { PasswordClient };
@@ -1,48 +0,0 @@
1
- import { User, UserInfo } from "../Dto";
2
- import { Client } from "./Client";
3
- /**
4
- * A class to manage user information.
5
- *
6
- * @category SDK
7
- * @subcategory Clients
8
- * @extends {Client}
9
- */
10
- declare class UserClient extends Client {
11
- /**
12
- * Fetches basic information about the user identified by the given email address. Can be used while the user is logged out
13
- * and is helpful in deciding which type of login to choose. For example, if the user's email is not verified, you may
14
- * want to log in with a passcode, or if no WebAuthn credentials are registered, you may not want to use WebAuthn.
15
- *
16
- * @param {string} email - The user's email address.
17
- * @return {Promise<UserInfo>}
18
- * @throws {NotFoundError}
19
- * @throws {RequestTimeoutError}
20
- * @throws {TechnicalError}
21
- * @see https://docs.hanko.io/api/public#tag/User-Management/operation/getUserId
22
- */
23
- getInfo(email: string): Promise<UserInfo>;
24
- /**
25
- * Creates a new user. Afterwards, verify the email address via passcode. If a 'ConflictError'
26
- * occurred, you may want to prompt the user to log in.
27
- *
28
- * @param {string} email - The email address of the user to be created.
29
- * @return {Promise<User>}
30
- * @throws {ConflictError}
31
- * @throws {RequestTimeoutError}
32
- * @throws {TechnicalError}
33
- * @see https://docs.hanko.io/api/public#tag/User-Management/operation/createUser
34
- */
35
- create(email: string): Promise<User>;
36
- /**
37
- * Fetches the current user.
38
- *
39
- * @return {Promise<User>}
40
- * @throws {UnauthorizedError}
41
- * @throws {RequestTimeoutError}
42
- * @throws {TechnicalError}
43
- * @see https://docs.hanko.io/api/public#tag/User-Management/operation/IsUserAuthorized
44
- * @see https://docs.hanko.io/api/public#tag/User-Management/operation/listUser
45
- */
46
- getCurrent(): Promise<User>;
47
- }
48
- export { UserClient };
@@ -1,58 +0,0 @@
1
- import { WebauthnState } from "../state/WebauthnState";
2
- import { create as createWebauthnCredential, get as getWebauthnCredential } from "@github/webauthn-json";
3
- import { User } from "../Dto";
4
- import { Client } from "./Client";
5
- /**
6
- * A class that handles WebAuthn authentication and registration.
7
- *
8
- * @constructor
9
- * @category SDK
10
- * @subcategory Clients
11
- * @extends {Client}
12
- */
13
- declare class WebauthnClient extends Client {
14
- state: WebauthnState;
15
- _getCredential: typeof getWebauthnCredential;
16
- _createCredential: typeof createWebauthnCredential;
17
- constructor(api: string, timeout?: number);
18
- /**
19
- * Performs a WebAuthn authentication ceremony. When 'userID' is specified, the API provides a list of
20
- * allowed credentials and the browser is able to present a list of suitable credentials to the user.
21
- *
22
- * @param {string=} userID - The user's UUID.
23
- * @param {boolean=} useConditionalMediation - Enables autofill assisted login.
24
- * @return {Promise<void>}
25
- * @throws {WebauthnRequestCancelledError}
26
- * @throws {InvalidWebauthnCredentialError}
27
- * @throws {RequestTimeoutError}
28
- * @throws {TechnicalError}
29
- * @see https://docs.hanko.io/api/public#tag/WebAuthn/operation/webauthnLoginInit
30
- * @see https://docs.hanko.io/api/public#tag/WebAuthn/operation/webauthnLoginFinal
31
- * @see https://www.w3.org/TR/webauthn-2/#authentication-ceremony
32
- */
33
- login(userID?: string, useConditionalMediation?: boolean): Promise<void>;
34
- /**
35
- * Performs a WebAuthn registration ceremony.
36
- *
37
- * @return {Promise<void>}
38
- * @throws {WebauthnRequestCancelledError}
39
- * @throws {RequestTimeoutError}
40
- * @throws {UnauthorizedError}
41
- * @throws {TechnicalError}
42
- * @see https://docs.hanko.io/api/public#tag/WebAuthn/operation/webauthnRegInit
43
- * @see https://docs.hanko.io/api/public#tag/WebAuthn/operation/webauthnRegFinal
44
- * @see https://www.w3.org/TR/webauthn-2/#sctn-registering-a-new-credential
45
- */
46
- register(): Promise<void>;
47
- /**
48
- * Determines whether a credential registration ceremony should be performed. Returns 'true' when a platform
49
- * authenticator is available and the user's credentials do not intersect with the credentials already known on the
50
- * current browser/device.
51
- *
52
- * @param {User} user - The user object.
53
- * @return {Promise<boolean>}
54
- * @throws {TechnicalError}
55
- */
56
- shouldRegister(user: User): Promise<boolean>;
57
- }
58
- export { WebauthnClient };
@@ -1,91 +0,0 @@
1
- import { UserState } from "./UserState";
2
- /**
3
- * @interface
4
- * @category SDK
5
- * @subcategory Internal
6
- * @property {string=} id - The UUID of the active passcode.
7
- * @property {number=} ttl - Timestamp until when the passcode is valid in seconds (since January 1, 1970 00:00:00 UTC).
8
- * @property {number=} resendAfter - Seconds until a passcode can be resent.
9
- */
10
- export interface LocalStoragePasscode {
11
- id?: string;
12
- ttl?: number;
13
- resendAfter?: number;
14
- }
15
- /**
16
- * A class that manages passcodes via local storage.
17
- *
18
- * @extends UserState
19
- * @category SDK
20
- * @subcategory Internal
21
- */
22
- declare class PasscodeState extends UserState {
23
- /**
24
- * Get the passcode state.
25
- *
26
- * @private
27
- * @param {string} userID - The UUID of the user.
28
- * @return {LocalStoragePasscode}
29
- */
30
- private getState;
31
- /**
32
- * Reads the current state.
33
- *
34
- * @public
35
- * @return {PasscodeState}
36
- */
37
- read(): PasscodeState;
38
- /**
39
- * Gets the UUID of the active passcode.
40
- *
41
- * @param {string} userID - The UUID of the user.
42
- * @return {string}
43
- */
44
- getActiveID(userID: string): string;
45
- /**
46
- * Sets the UUID of the active passcode.
47
- *
48
- * @param {string} userID - The UUID of the user.
49
- * @param {string} passcodeID - The UUID of the passcode to be set as active.
50
- * @return {PasscodeState}
51
- */
52
- setActiveID(userID: string, passcodeID: string): PasscodeState;
53
- /**
54
- * Removes the active passcode.
55
- *
56
- * @param {string} userID - The UUID of the user.
57
- * @return {PasscodeState}
58
- */
59
- reset(userID: string): PasscodeState;
60
- /**
61
- * Gets the TTL in seconds. When the seconds expire, the code is invalid.
62
- *
63
- * @param {string} userID - The UUID of the user.
64
- * @return {number}
65
- */
66
- getTTL(userID: string): number;
67
- /**
68
- * Sets the passcode's TTL and stores it to the local storage.
69
- *
70
- * @param {string} userID - The UUID of the user.
71
- * @param {string} seconds - Number of seconds the passcode is valid for.
72
- * @return {PasscodeState}
73
- */
74
- setTTL(userID: string, seconds: number): PasscodeState;
75
- /**
76
- * Gets the number of seconds until when the next passcode can be sent.
77
- *
78
- * @param {string} userID - The UUID of the user.
79
- * @return {number}
80
- */
81
- getResendAfter(userID: string): number;
82
- /**
83
- * Sets the number of seconds until a new passcode can be sent.
84
- *
85
- * @param {string} userID - The UUID of the user.
86
- * @param {string} seconds - Number of seconds the passcode is valid for.
87
- * @return {PasscodeState}
88
- */
89
- setResendAfter(userID: string, seconds: number): PasscodeState;
90
- }
91
- export { PasscodeState };
@@ -1,50 +0,0 @@
1
- import { UserState } from "./UserState";
2
- /**
3
- * @interface
4
- * @category SDK
5
- * @subcategory Internal
6
- * @property {number=} retryAfter - Timestamp (in seconds since January 1, 1970 00:00:00 UTC) indicating when the next password login can be attempted.
7
- */
8
- export interface LocalStoragePassword {
9
- retryAfter?: number;
10
- }
11
- /**
12
- * A class that manages the password login state.
13
- *
14
- * @extends UserState
15
- * @category SDK
16
- * @subcategory Internal
17
- */
18
- declare class PasswordState extends UserState {
19
- /**
20
- * Get the password state.
21
- *
22
- * @private
23
- * @param {string} userID - The UUID of the user.
24
- * @return {LocalStoragePassword}
25
- */
26
- private getState;
27
- /**
28
- * Reads the current state.
29
- *
30
- * @public
31
- * @return {PasswordState}
32
- */
33
- read(): PasswordState;
34
- /**
35
- * Gets the number of seconds until when a new password login can be attempted.
36
- *
37
- * @param {string} userID - The UUID of the user.
38
- * @return {number}
39
- */
40
- getRetryAfter(userID: string): number;
41
- /**
42
- * Sets the number of seconds until a new password login can be attempted.
43
- *
44
- * @param {string} userID - The UUID of the user.
45
- * @param {string} seconds - Number of seconds the passcode is valid for.
46
- * @return {PasswordState}
47
- */
48
- setRetryAfter(userID: string, seconds: number): PasswordState;
49
- }
50
- export { PasswordState };