@teamhanko/hanko-frontend-sdk 0.0.5-alpha → 0.0.6-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/dist/lib/client/WebauthnClient.d.ts +1 -0
- package/dist/sdk.cjs +1 -1
- package/dist/sdk.cjs.map +1 -1
- package/dist/sdk.modern.js +1 -1
- package/dist/sdk.modern.js.map +1 -1
- package/dist/sdk.module.js +1 -1
- package/dist/sdk.module.js.map +1 -1
- package/dist/sdk.umd.js +1 -1
- package/dist/sdk.umd.js.map +1 -1
- package/dist/src/Hanko.d.ts +20 -0
- package/dist/src/index.d.ts +14 -0
- package/dist/src/lib/Dto.d.ts +97 -0
- package/dist/src/lib/Errors.d.ts +139 -0
- package/dist/src/lib/WebauthnSupport.d.ts +36 -0
- package/dist/src/lib/client/Client.d.ts +15 -0
- package/dist/src/lib/client/ConfigClient.d.ts +20 -0
- package/dist/src/lib/client/HttpClient.d.ts +87 -0
- package/dist/src/lib/client/PasscodeClient.d.ts +54 -0
- package/dist/src/lib/client/PasswordClient.d.ts +46 -0
- package/dist/src/lib/client/UserClient.d.ts +48 -0
- package/dist/src/lib/client/WebauthnClient.d.ts +58 -0
- package/dist/src/lib/state/PasscodeState.d.ts +91 -0
- package/dist/src/lib/state/PasswordState.d.ts +50 -0
- package/dist/src/lib/state/State.d.ts +53 -0
- package/dist/src/lib/state/UserState.d.ts +51 -0
- package/dist/src/lib/state/WebauthnState.d.ts +60 -0
- package/dist/tests/lib/WebauthnSupport.spec.d.ts +1 -0
- package/dist/tests/lib/client/ConfigClient.spec.d.ts +1 -0
- package/dist/tests/lib/client/HttpClient.spec.d.ts +1 -0
- package/dist/tests/lib/client/PasscodeClient.spec.d.ts +1 -0
- package/dist/tests/lib/client/PasswordClient.spec.d.ts +1 -0
- package/dist/tests/lib/client/UserClient.spec.d.ts +1 -0
- package/dist/tests/lib/client/WebauthnClient.spec.d.ts +1 -0
- package/dist/tests/lib/state/PasscodeState.spec.d.ts +1 -0
- package/dist/tests/lib/state/PasswordState.spec.d.ts +1 -0
- package/dist/tests/lib/state/State.spec.d.ts +1 -0
- package/dist/tests/lib/state/UserState.spec.d.ts +1 -0
- package/dist/tests/lib/state/WebauthnState.spec.d.ts +1 -0
- package/dist/tests/setup.d.ts +10 -0
- package/package.json +1 -1
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { LocalStorageUsers } from "./UserState";
|
|
2
|
+
/**
|
|
3
|
+
* @interface
|
|
4
|
+
* @category SDK
|
|
5
|
+
* @subcategory Internal
|
|
6
|
+
* @property {LocalStorageUsers=} users - The user states.
|
|
7
|
+
*/
|
|
8
|
+
interface LocalStorage {
|
|
9
|
+
users?: LocalStorageUsers;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* A class to read and write local storage contents.
|
|
13
|
+
*
|
|
14
|
+
* @abstract
|
|
15
|
+
* @param {string} key - The local storage key.
|
|
16
|
+
* @category SDK
|
|
17
|
+
* @subcategory Internal
|
|
18
|
+
*/
|
|
19
|
+
declare abstract class State {
|
|
20
|
+
private readonly key;
|
|
21
|
+
ls: LocalStorage;
|
|
22
|
+
constructor(key?: string);
|
|
23
|
+
/**
|
|
24
|
+
* Reads and decodes the locally stored data.
|
|
25
|
+
*
|
|
26
|
+
* @return {State}
|
|
27
|
+
*/
|
|
28
|
+
read(): State;
|
|
29
|
+
/**
|
|
30
|
+
* Encodes and writes the data to the local storage.
|
|
31
|
+
*
|
|
32
|
+
* @return {State}
|
|
33
|
+
*/
|
|
34
|
+
write(): State;
|
|
35
|
+
/**
|
|
36
|
+
* Converts a timestamp into remaining seconds that you can count down.
|
|
37
|
+
*
|
|
38
|
+
* @static
|
|
39
|
+
* @param {number} time - Timestamp in seconds (since January 1, 1970 00:00:00 UTC).
|
|
40
|
+
* @return {number}
|
|
41
|
+
*/
|
|
42
|
+
static timeToRemainingSeconds(time?: number): number;
|
|
43
|
+
/**
|
|
44
|
+
* Converts a number of seconds into a timestamp.
|
|
45
|
+
*
|
|
46
|
+
* @static
|
|
47
|
+
* @param {number} seconds - Remaining seconds to be converted into a timestamp.
|
|
48
|
+
* @return {number}
|
|
49
|
+
*/
|
|
50
|
+
static remainingSecondsToTime(seconds?: number): number;
|
|
51
|
+
}
|
|
52
|
+
export { State };
|
|
53
|
+
export type { LocalStorage };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @interface
|
|
3
|
+
* @category SDK
|
|
4
|
+
* @subcategory Internal
|
|
5
|
+
* @property {Object.<string, LocalStorageUser>} - A dictionary for mapping users to their states.
|
|
6
|
+
*/
|
|
7
|
+
import { State } from "./State";
|
|
8
|
+
import { LocalStorageWebauthn } from "./WebauthnState";
|
|
9
|
+
import { LocalStoragePasscode } from "./PasscodeState";
|
|
10
|
+
import { LocalStoragePassword } from "./PasswordState";
|
|
11
|
+
/**
|
|
12
|
+
* @interface
|
|
13
|
+
* @category SDK
|
|
14
|
+
* @subcategory Internal
|
|
15
|
+
* @property {LocalStorageWebauthn=} webauthn - Information about WebAuthn credentials.
|
|
16
|
+
* @property {LocalStoragePasscode=} passcode - Information about the active passcode.
|
|
17
|
+
* @property {LocalStoragePassword=} password - Information about the password login attempts.
|
|
18
|
+
*/
|
|
19
|
+
interface LocalStorageUser {
|
|
20
|
+
webauthn?: LocalStorageWebauthn;
|
|
21
|
+
passcode?: LocalStoragePasscode;
|
|
22
|
+
password?: LocalStoragePassword;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* @interface
|
|
26
|
+
* @category SDK
|
|
27
|
+
* @subcategory Internal
|
|
28
|
+
* @property {Object.<string, LocalStorageUser>} - A dictionary for mapping users to their states.
|
|
29
|
+
*/
|
|
30
|
+
export interface LocalStorageUsers {
|
|
31
|
+
[userID: string]: LocalStorageUser;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* A class to read and write local storage contents.
|
|
35
|
+
*
|
|
36
|
+
* @abstract
|
|
37
|
+
* @extends State
|
|
38
|
+
* @param {string} key - The local storage key.
|
|
39
|
+
* @category SDK
|
|
40
|
+
* @subcategory Internal
|
|
41
|
+
*/
|
|
42
|
+
declare abstract class UserState extends State {
|
|
43
|
+
/**
|
|
44
|
+
* Gets the state of the specified user.
|
|
45
|
+
*
|
|
46
|
+
* @param {string} userID - The UUID of the user.
|
|
47
|
+
* @return {LocalStorageUser}
|
|
48
|
+
*/
|
|
49
|
+
getUserState(userID: string): LocalStorageUser;
|
|
50
|
+
}
|
|
51
|
+
export { UserState };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { UserState } from "./UserState";
|
|
2
|
+
import { Credential } from "../Dto";
|
|
3
|
+
/**
|
|
4
|
+
* @interface
|
|
5
|
+
* @category SDK
|
|
6
|
+
* @subcategory Internal
|
|
7
|
+
* @property {string[]?} credentials - A list of known credential IDs on the current browser.
|
|
8
|
+
*/
|
|
9
|
+
export interface LocalStorageWebauthn {
|
|
10
|
+
credentials?: string[];
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* A class that manages WebAuthn credentials via local storage.
|
|
14
|
+
*
|
|
15
|
+
* @extends UserState
|
|
16
|
+
* @category SDK
|
|
17
|
+
* @subcategory Internal
|
|
18
|
+
*/
|
|
19
|
+
declare class WebauthnState extends UserState {
|
|
20
|
+
/**
|
|
21
|
+
* Gets the WebAuthn state.
|
|
22
|
+
*
|
|
23
|
+
* @private
|
|
24
|
+
* @param {string} userID - The UUID of the user.
|
|
25
|
+
* @return {LocalStorageWebauthn}
|
|
26
|
+
*/
|
|
27
|
+
private getState;
|
|
28
|
+
/**
|
|
29
|
+
* Reads the current state.
|
|
30
|
+
*
|
|
31
|
+
* @public
|
|
32
|
+
* @return {WebauthnState}
|
|
33
|
+
*/
|
|
34
|
+
read(): WebauthnState;
|
|
35
|
+
/**
|
|
36
|
+
* Gets the list of known credentials on the current browser.
|
|
37
|
+
*
|
|
38
|
+
* @param {string} userID - The UUID of the user.
|
|
39
|
+
* @return {string[]}
|
|
40
|
+
*/
|
|
41
|
+
getCredentials(userID: string): string[];
|
|
42
|
+
/**
|
|
43
|
+
* Adds the credential to the list of known credentials.
|
|
44
|
+
*
|
|
45
|
+
* @param {string} userID - The UUID of the user.
|
|
46
|
+
* @param {string} credentialID - The WebAuthn credential ID.
|
|
47
|
+
* @return {WebauthnState}
|
|
48
|
+
*/
|
|
49
|
+
addCredential(userID: string, credentialID: string): WebauthnState;
|
|
50
|
+
/**
|
|
51
|
+
* Returns the intersection between the specified list of credentials and the known credentials stored in
|
|
52
|
+
* the local storage.
|
|
53
|
+
*
|
|
54
|
+
* @param {string} userID - The UUID of the user.
|
|
55
|
+
* @param {Credential[]} match - A list of credential IDs to be matched against the local storage.
|
|
56
|
+
* @return {Credential[]}
|
|
57
|
+
*/
|
|
58
|
+
matchCredentials(userID: string, match: Credential[]): Credential[];
|
|
59
|
+
}
|
|
60
|
+
export { WebauthnState };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="jest" />
|
|
2
|
+
import { LocalStorage } from "../src/lib/state/State";
|
|
3
|
+
export declare const encodedLSContent: () => string;
|
|
4
|
+
export declare const decodedLSContent: () => LocalStorage;
|
|
5
|
+
export declare const fakePublicKeyCredential: {
|
|
6
|
+
isUserVerifyingPlatformAuthenticatorAvailable: jest.Mock<any, any>;
|
|
7
|
+
isExternalCTAP2SecurityKeySupported: jest.Mock<any, any>;
|
|
8
|
+
isConditionalMediationAvailable: jest.Mock<any, any>;
|
|
9
|
+
};
|
|
10
|
+
export declare const fakeXMLHttpRequest: jest.Mock<any, any>;
|