@turnkey/sdk-browser 1.15.0 → 2.0.0
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/CHANGELOG.md +63 -0
- package/dist/__clients__/base-client.d.ts +7 -0
- package/dist/__clients__/base-client.d.ts.map +1 -0
- package/dist/__clients__/base-client.js +13 -0
- package/dist/__clients__/base-client.js.map +1 -0
- package/dist/__clients__/base-client.mjs +11 -0
- package/dist/__clients__/base-client.mjs.map +1 -0
- package/dist/__clients__/browser-clients.d.ts +243 -0
- package/dist/__clients__/browser-clients.d.ts.map +1 -0
- package/dist/__clients__/browser-clients.js +633 -0
- package/dist/__clients__/browser-clients.js.map +1 -0
- package/dist/__clients__/browser-clients.mjs +628 -0
- package/dist/__clients__/browser-clients.mjs.map +1 -0
- package/dist/__generated__/sdk-client-base.d.ts.map +1 -1
- package/dist/__generated__/sdk-client-base.js +106 -110
- package/dist/__generated__/sdk-client-base.js.map +1 -1
- package/dist/__generated__/sdk-client-base.mjs +106 -110
- package/dist/__generated__/sdk-client-base.mjs.map +1 -1
- package/dist/__generated__/version.d.ts +1 -1
- package/dist/__generated__/version.d.ts.map +1 -1
- package/dist/__generated__/version.js +1 -1
- package/dist/__generated__/version.mjs +1 -1
- package/dist/__types__/base.d.ts +12 -0
- package/dist/__types__/base.d.ts.map +1 -1
- package/dist/__types__/base.js +5 -0
- package/dist/__types__/base.js.map +1 -1
- package/dist/__types__/base.mjs +6 -1
- package/dist/__types__/base.mjs.map +1 -1
- package/dist/constants.d.ts +2 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +6 -0
- package/dist/constants.js.map +1 -0
- package/dist/constants.mjs +4 -0
- package/dist/constants.mjs.map +1 -0
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -2
- package/dist/index.mjs.map +1 -1
- package/dist/models.d.ts +1 -1
- package/dist/models.d.ts.map +1 -1
- package/dist/sdk-client.d.ts +34 -85
- package/dist/sdk-client.d.ts.map +1 -1
- package/dist/sdk-client.js +75 -245
- package/dist/sdk-client.js.map +1 -1
- package/dist/sdk-client.mjs +69 -239
- package/dist/sdk-client.mjs.map +1 -1
- package/dist/storage.d.ts +23 -3
- package/dist/storage.d.ts.map +1 -1
- package/dist/storage.js +17 -0
- package/dist/storage.js.map +1 -1
- package/dist/storage.mjs +17 -1
- package/dist/storage.mjs.map +1 -1
- package/package.json +8 -7
package/dist/sdk-client.d.ts
CHANGED
|
@@ -1,22 +1,38 @@
|
|
|
1
|
-
import { KeyFormat } from "@turnkey/iframe-stamper";
|
|
2
1
|
import { type WalletInterface } from "@turnkey/wallet-stamper";
|
|
3
|
-
import { type
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import
|
|
2
|
+
import { type TurnkeySDKBrowserConfig, Stamper, IframeClientParams, PasskeyClientParams } from "./__types__/base";
|
|
3
|
+
import type { User, SubOrganization, ReadWriteSession } from "@models";
|
|
4
|
+
import { Session } from "@storage";
|
|
5
|
+
import { TurnkeyBrowserClient, TurnkeyIframeClient, TurnkeyPasskeyClient, TurnkeyWalletClient } from "./__clients__/browser-clients";
|
|
6
|
+
export interface OauthProvider {
|
|
7
|
+
providerName: string;
|
|
8
|
+
oidcToken: string;
|
|
9
|
+
}
|
|
10
|
+
export interface ApiKey {
|
|
11
|
+
apiKeyName: string;
|
|
12
|
+
publicKey: string;
|
|
13
|
+
curveType: "API_KEY_CURVE_P256" | "API_KEY_CURVE_SECP256K1" | "API_KEY_CURVE_ED25519";
|
|
14
|
+
expirationSeconds?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface Authenticator {
|
|
17
|
+
authenticatorName: string;
|
|
18
|
+
challenge: string;
|
|
19
|
+
attestation: {
|
|
20
|
+
credentialId: string;
|
|
21
|
+
clientDataJson: string;
|
|
22
|
+
attestationObject: string;
|
|
23
|
+
transports: ("AUTHENTICATOR_TRANSPORT_BLE" | "AUTHENTICATOR_TRANSPORT_INTERNAL" | "AUTHENTICATOR_TRANSPORT_NFC" | "AUTHENTICATOR_TRANSPORT_USB" | "AUTHENTICATOR_TRANSPORT_HYBRID")[];
|
|
24
|
+
};
|
|
25
|
+
}
|
|
7
26
|
export declare class TurnkeyBrowserSDK {
|
|
8
27
|
config: TurnkeySDKBrowserConfig;
|
|
9
28
|
protected stamper: Stamper | undefined;
|
|
10
29
|
constructor(config: TurnkeySDKBrowserConfig);
|
|
11
30
|
/**
|
|
12
|
-
* Creates a passkey client. The parameters
|
|
13
|
-
* @param
|
|
14
|
-
* @param timeout optional timeout (defaults to 5mins)
|
|
15
|
-
* @param userVerification optional UV flag (defaults to "preferred")
|
|
16
|
-
* @param allowCredentials optional allowCredentials array (defaults to empty array)
|
|
31
|
+
* Creates a passkey client. The parameters override the default values passed to the underlying Turnkey `WebauthnStamper`
|
|
32
|
+
* @param PasskeyClientParams
|
|
17
33
|
* @returns new TurnkeyPasskeyClient
|
|
18
34
|
*/
|
|
19
|
-
passkeyClient: (
|
|
35
|
+
passkeyClient: (params?: PasskeyClientParams) => TurnkeyPasskeyClient;
|
|
20
36
|
iframeClient: (params: IframeClientParams) => Promise<TurnkeyIframeClient>;
|
|
21
37
|
walletClient: (wallet: WalletInterface) => TurnkeyWalletClient;
|
|
22
38
|
serverSign: <TResponseType>(methodName: string, params: any[], serverSignUrl?: string) => Promise<TResponseType>;
|
|
@@ -28,18 +44,16 @@ export declare class TurnkeyBrowserSDK {
|
|
|
28
44
|
currentUserSession: () => Promise<TurnkeyBrowserClient | undefined>;
|
|
29
45
|
/**
|
|
30
46
|
* If there is a valid, current read-session, this will return an auth bundle and its expiration. This auth bundle can be used in conjunction with an iframeStamper to create a read + write session.
|
|
31
|
-
*
|
|
47
|
+
* @deprecated use `getSession` instead
|
|
32
48
|
* @returns {Promise<ReadWriteSession | undefined>}
|
|
33
49
|
*/
|
|
34
50
|
getReadWriteSession: () => Promise<ReadWriteSession | undefined>;
|
|
35
51
|
/**
|
|
36
|
-
*
|
|
37
|
-
* It has been replaced by the `getReadWriteSession` method.
|
|
38
|
-
* Fetches an auth bundle stored in local storage.
|
|
52
|
+
* If there is a valid, active READ_WRITE session, this will return it
|
|
39
53
|
*
|
|
40
|
-
* @returns {Promise<
|
|
54
|
+
* @returns {Promise<Session | undefined>}
|
|
41
55
|
*/
|
|
42
|
-
|
|
56
|
+
getSession: () => Promise<Session | undefined>;
|
|
43
57
|
/**
|
|
44
58
|
* Fetches the current user's organization details.
|
|
45
59
|
*
|
|
@@ -53,76 +67,11 @@ export declare class TurnkeyBrowserSDK {
|
|
|
53
67
|
*/
|
|
54
68
|
getCurrentUser: () => Promise<User | undefined>;
|
|
55
69
|
/**
|
|
56
|
-
* Clears out all data pertaining to
|
|
70
|
+
* Clears out all data pertaining to an end user session.
|
|
57
71
|
*
|
|
58
72
|
* @returns {Promise<boolean>}
|
|
59
73
|
*/
|
|
60
|
-
|
|
61
|
-
}
|
|
62
|
-
export declare class TurnkeyBrowserClient extends TurnkeySDKClientBase {
|
|
63
|
-
authClient?: AuthClient | undefined;
|
|
64
|
-
constructor(config: TurnkeySDKClientConfig, authClient?: AuthClient);
|
|
65
|
-
login: (config?: {
|
|
66
|
-
organizationId?: string;
|
|
67
|
-
}) => Promise<SdkApiTypes.TCreateReadOnlySessionResponse>;
|
|
68
|
-
/**
|
|
69
|
-
* Creates a read-write session. This method infers the current user's organization ID and target userId.
|
|
70
|
-
* To be used in conjunction with an `iframeStamper`: the resulting session's credential bundle can be
|
|
71
|
-
* injected into an iframeStamper to create a session that enables both read and write requests.
|
|
72
|
-
*
|
|
73
|
-
* @param targetEmbeddedKey
|
|
74
|
-
* @param expirationSeconds
|
|
75
|
-
* @param userId
|
|
76
|
-
* @returns {Promise<SdkApiTypes.TCreateReadWriteSessionResponse>}
|
|
77
|
-
*/
|
|
78
|
-
loginWithReadWriteSession: (targetEmbeddedKey: string, expirationSeconds?: string, userId?: string) => Promise<SdkApiTypes.TCreateReadWriteSessionResponse>;
|
|
79
|
-
/**
|
|
80
|
-
* Logs in with an existing auth bundle. this bundle enables both read and write requests.
|
|
81
|
-
*
|
|
82
|
-
* @param credentialBundle
|
|
83
|
-
* @param expirationSeconds
|
|
84
|
-
* @returns {Promise<boolean>}
|
|
85
|
-
*/
|
|
86
|
-
loginWithAuthBundle: (credentialBundle: string, expirationSeconds?: string) => Promise<any>;
|
|
87
|
-
}
|
|
88
|
-
export declare class TurnkeyPasskeyClient extends TurnkeyBrowserClient {
|
|
89
|
-
rpId: string;
|
|
90
|
-
constructor(config: TurnkeySDKClientConfig);
|
|
91
|
-
/**
|
|
92
|
-
* Create a passkey for an end-user, taking care of various lower-level details.
|
|
93
|
-
*
|
|
94
|
-
* @returns {Promise<Passkey>}
|
|
95
|
-
*/
|
|
96
|
-
createUserPasskey: (config?: Record<any, any>) => Promise<Passkey>;
|
|
97
|
-
/**
|
|
98
|
-
* Uses passkey authentication to create a read-write session, via an embedded API key,
|
|
99
|
-
* and stores + returns the resulting auth bundle that contains the encrypted API key.
|
|
100
|
-
* This auth bundle (also referred to as a credential bundle) can be injected into an `iframeStamper`,
|
|
101
|
-
* resulting in a touch-free authenticator. Unlike `loginWithReadWriteSession`, this method
|
|
102
|
-
* assumes the end-user's organization ID (i.e. the sub-organization ID) is already known.
|
|
103
|
-
*
|
|
104
|
-
* @param userId
|
|
105
|
-
* @param targetEmbeddedKey
|
|
106
|
-
* @param expirationSeconds
|
|
107
|
-
* @param curveType
|
|
108
|
-
* @returns {Promise<ReadWriteSession>}
|
|
109
|
-
*/
|
|
110
|
-
createPasskeySession: (userId: string, targetEmbeddedKey: string, expirationSeconds?: string, organizationId?: string) => Promise<ReadWriteSession>;
|
|
111
|
-
}
|
|
112
|
-
export declare class TurnkeyIframeClient extends TurnkeyBrowserClient {
|
|
113
|
-
iframePublicKey: string | null;
|
|
114
|
-
constructor(config: TurnkeySDKClientConfig);
|
|
115
|
-
injectCredentialBundle: (credentialBundle: string) => Promise<boolean>;
|
|
116
|
-
injectWalletExportBundle: (credentialBundle: string, organizationId: string) => Promise<boolean>;
|
|
117
|
-
injectKeyExportBundle: (credentialBundle: string, organizationId: string, keyFormat?: KeyFormat | undefined) => Promise<boolean>;
|
|
118
|
-
injectImportBundle: (bundle: string, organizationId: string, userId: string) => Promise<boolean>;
|
|
119
|
-
extractWalletEncryptedBundle: () => Promise<string>;
|
|
120
|
-
extractKeyEncryptedBundle: () => Promise<string>;
|
|
121
|
-
}
|
|
122
|
-
export declare class TurnkeyWalletClient extends TurnkeyBrowserClient {
|
|
123
|
-
private wallet;
|
|
124
|
-
constructor(config: TurnkeyWalletClientConfig);
|
|
125
|
-
getPublicKey(): Promise<string>;
|
|
126
|
-
getWalletInterface(): WalletInterface;
|
|
74
|
+
logout: () => Promise<boolean>;
|
|
127
75
|
}
|
|
76
|
+
export { TurnkeyBrowserClient, TurnkeyIframeClient, TurnkeyPasskeyClient, TurnkeyWalletClient, };
|
|
128
77
|
//# sourceMappingURL=sdk-client.d.ts.map
|
package/dist/sdk-client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk-client.d.ts","sourceRoot":"","sources":["../src/sdk-client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sdk-client.d.ts","sourceRoot":"","sources":["../src/sdk-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAM9E,OAAO,EAEL,KAAK,uBAAuB,EAE5B,OAAO,EACP,kBAAkB,EAClB,mBAAmB,EAEpB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,KAAK,EAAE,IAAI,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEvE,OAAO,EACL,OAAO,EAIR,MAAM,UAAU,CAAC;AAElB,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACpB,MAAM,+BAA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yBAAyB,QAAa,QACpC,eAAe,GAAG,SAAS,CAC5B,CAGC;IAEF;;;;OAIG;IACH,cAAc,QAAa,QAAQ,IAAI,GAAG,SAAS,CAAC,CA+BlD;IAEF;;;;OAIG;IACH,MAAM,QAAa,QAAQ,OAAO,CAAC,CAQjC;CACH;AAED,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,GACpB,CAAC"}
|
package/dist/sdk-client.js
CHANGED
|
@@ -1,39 +1,37 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var webauthnStamper = require('@turnkey/webauthn-stamper');
|
|
4
|
-
var iframeStamper = require('@turnkey/iframe-stamper');
|
|
5
|
-
var http = require('@turnkey/http');
|
|
6
3
|
var walletStamper = require('@turnkey/wallet-stamper');
|
|
7
|
-
var
|
|
4
|
+
var iframeStamper = require('@turnkey/iframe-stamper');
|
|
5
|
+
var webauthnStamper = require('@turnkey/webauthn-stamper');
|
|
8
6
|
var window = require('./__polyfills__/window.js');
|
|
9
7
|
var base = require('./__types__/base.js');
|
|
10
|
-
var sdkClientBase = require('./__generated__/sdk-client-base.js');
|
|
11
8
|
var storage = require('./storage.js');
|
|
12
|
-
var
|
|
9
|
+
var browserClients = require('./__clients__/browser-clients.js');
|
|
10
|
+
var version = require('./__generated__/version.js');
|
|
13
11
|
|
|
14
|
-
const DEFAULT_SESSION_EXPIRATION = "900"; // default to 15 minutes
|
|
15
12
|
class TurnkeyBrowserSDK {
|
|
16
13
|
constructor(config) {
|
|
17
14
|
/**
|
|
18
|
-
* Creates a passkey client. The parameters
|
|
19
|
-
* @param
|
|
20
|
-
* @param timeout optional timeout (defaults to 5mins)
|
|
21
|
-
* @param userVerification optional UV flag (defaults to "preferred")
|
|
22
|
-
* @param allowCredentials optional allowCredentials array (defaults to empty array)
|
|
15
|
+
* Creates a passkey client. The parameters override the default values passed to the underlying Turnkey `WebauthnStamper`
|
|
16
|
+
* @param PasskeyClientParams
|
|
23
17
|
* @returns new TurnkeyPasskeyClient
|
|
24
18
|
*/
|
|
25
|
-
this.passkeyClient = (
|
|
26
|
-
const targetRpId = rpId ?? this.config.rpId ?? window.location.hostname;
|
|
19
|
+
this.passkeyClient = (params) => {
|
|
20
|
+
const targetRpId = params?.rpId ?? this.config.rpId ?? window.location.hostname;
|
|
27
21
|
if (!targetRpId) {
|
|
28
22
|
throw new Error("Tried to initialize a passkey client with no rpId defined");
|
|
29
23
|
}
|
|
30
24
|
this.stamper = new webauthnStamper.WebauthnStamper({
|
|
31
25
|
rpId: targetRpId,
|
|
32
|
-
...(timeout !== undefined && { timeout }),
|
|
33
|
-
...(userVerification !== undefined && {
|
|
34
|
-
|
|
26
|
+
...(params?.timeout !== undefined && { timeout: params?.timeout }),
|
|
27
|
+
...(params?.userVerification !== undefined && {
|
|
28
|
+
userVerification: params?.userVerification,
|
|
29
|
+
}),
|
|
30
|
+
...(params?.allowCredentials !== undefined && {
|
|
31
|
+
allowCredentials: params?.allowCredentials,
|
|
32
|
+
}),
|
|
35
33
|
});
|
|
36
|
-
return new TurnkeyPasskeyClient({
|
|
34
|
+
return new browserClients.TurnkeyPasskeyClient({
|
|
37
35
|
stamper: this.stamper,
|
|
38
36
|
apiBaseUrl: this.config.apiBaseUrl,
|
|
39
37
|
organizationId: this.config.defaultOrganizationId,
|
|
@@ -49,15 +47,15 @@ class TurnkeyBrowserSDK {
|
|
|
49
47
|
iframeUrl: params.iframeUrl,
|
|
50
48
|
iframeElementId: TurnkeyIframeElementId,
|
|
51
49
|
});
|
|
52
|
-
await this.stamper.init();
|
|
53
|
-
return new TurnkeyIframeClient({
|
|
50
|
+
await this.stamper.init(params.dangerouslyOverrideIframeKeyTtl ?? undefined);
|
|
51
|
+
return new browserClients.TurnkeyIframeClient({
|
|
54
52
|
stamper: this.stamper,
|
|
55
53
|
apiBaseUrl: this.config.apiBaseUrl,
|
|
56
54
|
organizationId: this.config.defaultOrganizationId,
|
|
57
55
|
});
|
|
58
56
|
};
|
|
59
57
|
this.walletClient = (wallet) => {
|
|
60
|
-
return new TurnkeyWalletClient({
|
|
58
|
+
return new browserClients.TurnkeyWalletClient({
|
|
61
59
|
stamper: new walletStamper.WalletStamper(wallet),
|
|
62
60
|
wallet,
|
|
63
61
|
apiBaseUrl: this.config.apiBaseUrl,
|
|
@@ -106,7 +104,7 @@ class TurnkeyBrowserSDK {
|
|
|
106
104
|
return;
|
|
107
105
|
}
|
|
108
106
|
if (currentUser?.session?.read?.expiry > Date.now()) {
|
|
109
|
-
return new TurnkeyBrowserClient({
|
|
107
|
+
return new browserClients.TurnkeyBrowserClient({
|
|
110
108
|
readOnlySession: currentUser?.session?.read?.token,
|
|
111
109
|
apiBaseUrl: this.config.apiBaseUrl,
|
|
112
110
|
organizationId: currentUser?.organization?.organizationId ??
|
|
@@ -114,13 +112,13 @@ class TurnkeyBrowserSDK {
|
|
|
114
112
|
});
|
|
115
113
|
}
|
|
116
114
|
else {
|
|
117
|
-
this.
|
|
115
|
+
await this.logout();
|
|
118
116
|
}
|
|
119
117
|
return;
|
|
120
118
|
};
|
|
121
119
|
/**
|
|
122
120
|
* If there is a valid, current read-session, this will return an auth bundle and its expiration. This auth bundle can be used in conjunction with an iframeStamper to create a read + write session.
|
|
123
|
-
*
|
|
121
|
+
* @deprecated use `getSession` instead
|
|
124
122
|
* @returns {Promise<ReadWriteSession | undefined>}
|
|
125
123
|
*/
|
|
126
124
|
this.getReadWriteSession = async () => {
|
|
@@ -136,14 +134,21 @@ class TurnkeyBrowserSDK {
|
|
|
136
134
|
return;
|
|
137
135
|
};
|
|
138
136
|
/**
|
|
139
|
-
*
|
|
140
|
-
* It has been replaced by the `getReadWriteSession` method.
|
|
141
|
-
* Fetches an auth bundle stored in local storage.
|
|
137
|
+
* If there is a valid, active READ_WRITE session, this will return it
|
|
142
138
|
*
|
|
143
|
-
* @returns {Promise<
|
|
139
|
+
* @returns {Promise<Session | undefined>}
|
|
144
140
|
*/
|
|
145
|
-
this.
|
|
146
|
-
|
|
141
|
+
this.getSession = async () => {
|
|
142
|
+
const currentSession = await storage.getStorageValue(storage.StorageKeys.Session);
|
|
143
|
+
if (currentSession?.sessionType === base.SessionType.READ_WRITE) {
|
|
144
|
+
if (currentSession?.expiry > Date.now()) {
|
|
145
|
+
return currentSession;
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
await storage.removeStorageValue(storage.StorageKeys.Session);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
return;
|
|
147
152
|
};
|
|
148
153
|
/**
|
|
149
154
|
* Fetches the current user's organization details.
|
|
@@ -160,235 +165,60 @@ class TurnkeyBrowserSDK {
|
|
|
160
165
|
* @returns {Promise<User | undefined>}
|
|
161
166
|
*/
|
|
162
167
|
this.getCurrentUser = async () => {
|
|
163
|
-
|
|
168
|
+
try {
|
|
169
|
+
const session = await storage.getStorageValue(storage.StorageKeys.Session);
|
|
170
|
+
if (session?.userId && session?.organizationId) {
|
|
171
|
+
return {
|
|
172
|
+
userId: session.userId,
|
|
173
|
+
organization: {
|
|
174
|
+
organizationId: session.organizationId,
|
|
175
|
+
organizationName: "",
|
|
176
|
+
},
|
|
177
|
+
session: {
|
|
178
|
+
...(session.sessionType === base.SessionType.READ_ONLY && {
|
|
179
|
+
read: {
|
|
180
|
+
token: session.token,
|
|
181
|
+
expiry: session.expiry,
|
|
182
|
+
},
|
|
183
|
+
}),
|
|
184
|
+
...(session.sessionType === base.SessionType.READ_WRITE && {
|
|
185
|
+
write: {
|
|
186
|
+
credentialBundle: session.token,
|
|
187
|
+
expiry: session.expiry,
|
|
188
|
+
},
|
|
189
|
+
}),
|
|
190
|
+
},
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
else {
|
|
194
|
+
return undefined;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
catch (error) {
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
164
200
|
};
|
|
165
201
|
/**
|
|
166
|
-
* Clears out all data pertaining to
|
|
202
|
+
* Clears out all data pertaining to an end user session.
|
|
167
203
|
*
|
|
168
204
|
* @returns {Promise<boolean>}
|
|
169
205
|
*/
|
|
170
|
-
this.
|
|
206
|
+
this.logout = async () => {
|
|
171
207
|
await storage.removeStorageValue(storage.StorageKeys.AuthBundle); // DEPRECATED
|
|
172
208
|
await storage.removeStorageValue(storage.StorageKeys.CurrentUser);
|
|
173
209
|
await storage.removeStorageValue(storage.StorageKeys.UserSession);
|
|
174
210
|
await storage.removeStorageValue(storage.StorageKeys.ReadWriteSession);
|
|
211
|
+
await storage.removeStorageValue(storage.StorageKeys.Client);
|
|
212
|
+
await storage.removeStorageValue(storage.StorageKeys.Session);
|
|
175
213
|
return true;
|
|
176
214
|
};
|
|
177
215
|
this.config = config;
|
|
178
216
|
}
|
|
179
217
|
}
|
|
180
|
-
class TurnkeyBrowserClient extends sdkClientBase.TurnkeySDKClientBase {
|
|
181
|
-
constructor(config, authClient) {
|
|
182
|
-
super(config);
|
|
183
|
-
this.login = async (config) => {
|
|
184
|
-
const readOnlySessionResult = await this.createReadOnlySession(config || {});
|
|
185
|
-
await storage.saveSession(readOnlySessionResult, this.authClient);
|
|
186
|
-
return readOnlySessionResult;
|
|
187
|
-
};
|
|
188
|
-
/**
|
|
189
|
-
* Creates a read-write session. This method infers the current user's organization ID and target userId.
|
|
190
|
-
* To be used in conjunction with an `iframeStamper`: the resulting session's credential bundle can be
|
|
191
|
-
* injected into an iframeStamper to create a session that enables both read and write requests.
|
|
192
|
-
*
|
|
193
|
-
* @param targetEmbeddedKey
|
|
194
|
-
* @param expirationSeconds
|
|
195
|
-
* @param userId
|
|
196
|
-
* @returns {Promise<SdkApiTypes.TCreateReadWriteSessionResponse>}
|
|
197
|
-
*/
|
|
198
|
-
this.loginWithReadWriteSession = async (targetEmbeddedKey, expirationSeconds = DEFAULT_SESSION_EXPIRATION, userId) => {
|
|
199
|
-
const readWriteSessionResult = await this.createReadWriteSession({
|
|
200
|
-
targetPublicKey: targetEmbeddedKey,
|
|
201
|
-
expirationSeconds,
|
|
202
|
-
userId: userId,
|
|
203
|
-
});
|
|
204
|
-
// Ensure session and sessionExpiry are included in the object
|
|
205
|
-
const readWriteSessionResultWithSession = {
|
|
206
|
-
...readWriteSessionResult,
|
|
207
|
-
credentialBundle: readWriteSessionResult.credentialBundle,
|
|
208
|
-
sessionExpiry: Date.now() + Number(expirationSeconds) * 1000,
|
|
209
|
-
};
|
|
210
|
-
// store auth bundle in local storage
|
|
211
|
-
await storage.saveSession(readWriteSessionResultWithSession, this.authClient);
|
|
212
|
-
return readWriteSessionResultWithSession;
|
|
213
|
-
};
|
|
214
|
-
/**
|
|
215
|
-
* Logs in with an existing auth bundle. this bundle enables both read and write requests.
|
|
216
|
-
*
|
|
217
|
-
* @param credentialBundle
|
|
218
|
-
* @param expirationSeconds
|
|
219
|
-
* @returns {Promise<boolean>}
|
|
220
|
-
*/
|
|
221
|
-
this.loginWithAuthBundle = async (credentialBundle, expirationSeconds = DEFAULT_SESSION_EXPIRATION) => {
|
|
222
|
-
try {
|
|
223
|
-
const whoAmIResult = await this.getWhoami();
|
|
224
|
-
const readWriteSessionResultWithSession = {
|
|
225
|
-
...whoAmIResult,
|
|
226
|
-
credentialBundle: credentialBundle,
|
|
227
|
-
sessionExpiry: Date.now() + Number(expirationSeconds) * 1000,
|
|
228
|
-
};
|
|
229
|
-
await storage.saveSession(readWriteSessionResultWithSession, this.authClient);
|
|
230
|
-
return true;
|
|
231
|
-
}
|
|
232
|
-
catch {
|
|
233
|
-
return false;
|
|
234
|
-
}
|
|
235
|
-
};
|
|
236
|
-
this.authClient = authClient;
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
class TurnkeyPasskeyClient extends TurnkeyBrowserClient {
|
|
240
|
-
constructor(config) {
|
|
241
|
-
super(config, base.AuthClient.Passkey);
|
|
242
|
-
/**
|
|
243
|
-
* Create a passkey for an end-user, taking care of various lower-level details.
|
|
244
|
-
*
|
|
245
|
-
* @returns {Promise<Passkey>}
|
|
246
|
-
*/
|
|
247
|
-
this.createUserPasskey = async (config = {}) => {
|
|
248
|
-
const challenge = utils.generateRandomBuffer();
|
|
249
|
-
const encodedChallenge = utils.base64UrlEncode(challenge);
|
|
250
|
-
const authenticatorUserId = utils.generateRandomBuffer();
|
|
251
|
-
// WebAuthn credential options options can be found here:
|
|
252
|
-
// https://www.w3.org/TR/webauthn-2/#sctn-sample-registration
|
|
253
|
-
//
|
|
254
|
-
// All pubkey algorithms can be found here: https://www.iana.org/assignments/cose/cose.xhtml#algorithms
|
|
255
|
-
// Turnkey only supports ES256 (-7) and RS256 (-257)
|
|
256
|
-
//
|
|
257
|
-
// The pubkey type only supports one value, "public-key"
|
|
258
|
-
// See https://www.w3.org/TR/webauthn-2/#enumdef-publickeycredentialtype for more details
|
|
259
|
-
// TODO: consider un-nesting these config params
|
|
260
|
-
const webauthnConfig = {
|
|
261
|
-
publicKey: {
|
|
262
|
-
rp: {
|
|
263
|
-
id: config.publicKey?.rp?.id ?? this.rpId,
|
|
264
|
-
name: config.publicKey?.rp?.name ?? "",
|
|
265
|
-
},
|
|
266
|
-
challenge: config.publicKey?.challenge ?? challenge,
|
|
267
|
-
pubKeyCredParams: config.publicKey?.pubKeyCredParams ?? [
|
|
268
|
-
{
|
|
269
|
-
type: "public-key",
|
|
270
|
-
alg: -7,
|
|
271
|
-
},
|
|
272
|
-
{
|
|
273
|
-
type: "public-key",
|
|
274
|
-
alg: -257,
|
|
275
|
-
},
|
|
276
|
-
],
|
|
277
|
-
user: {
|
|
278
|
-
id: config.publicKey?.user?.id ?? authenticatorUserId,
|
|
279
|
-
name: config.publicKey?.user?.name ?? "Default User",
|
|
280
|
-
displayName: config.publicKey?.user?.displayName ?? "Default User",
|
|
281
|
-
},
|
|
282
|
-
authenticatorSelection: {
|
|
283
|
-
authenticatorAttachment: config.publicKey?.authenticatorSelection?.authenticatorAttachment ??
|
|
284
|
-
undefined,
|
|
285
|
-
requireResidentKey: config.publicKey?.authenticatorSelection?.requireResidentKey ??
|
|
286
|
-
true,
|
|
287
|
-
residentKey: config.publicKey?.authenticatorSelection?.residentKey ?? "required",
|
|
288
|
-
userVerification: config.publicKey?.authenticatorSelection?.userVerification ??
|
|
289
|
-
"preferred",
|
|
290
|
-
},
|
|
291
|
-
},
|
|
292
|
-
};
|
|
293
|
-
const attestation = await http.getWebAuthnAttestation(webauthnConfig);
|
|
294
|
-
return {
|
|
295
|
-
encodedChallenge: config.publicKey?.challenge
|
|
296
|
-
? utils.base64UrlEncode(config.publicKey?.challenge)
|
|
297
|
-
: encodedChallenge,
|
|
298
|
-
attestation,
|
|
299
|
-
};
|
|
300
|
-
};
|
|
301
|
-
/**
|
|
302
|
-
* Uses passkey authentication to create a read-write session, via an embedded API key,
|
|
303
|
-
* and stores + returns the resulting auth bundle that contains the encrypted API key.
|
|
304
|
-
* This auth bundle (also referred to as a credential bundle) can be injected into an `iframeStamper`,
|
|
305
|
-
* resulting in a touch-free authenticator. Unlike `loginWithReadWriteSession`, this method
|
|
306
|
-
* assumes the end-user's organization ID (i.e. the sub-organization ID) is already known.
|
|
307
|
-
*
|
|
308
|
-
* @param userId
|
|
309
|
-
* @param targetEmbeddedKey
|
|
310
|
-
* @param expirationSeconds
|
|
311
|
-
* @param curveType
|
|
312
|
-
* @returns {Promise<ReadWriteSession>}
|
|
313
|
-
*/
|
|
314
|
-
this.createPasskeySession = async (userId, targetEmbeddedKey, expirationSeconds = DEFAULT_SESSION_EXPIRATION, organizationId) => {
|
|
315
|
-
const user = await storage.getStorageValue(storage.StorageKeys.UserSession);
|
|
316
|
-
organizationId = organizationId ?? user?.organization.organizationId;
|
|
317
|
-
if (!organizationId) {
|
|
318
|
-
throw new Error("Error creating passkey session: Organization ID is required");
|
|
319
|
-
}
|
|
320
|
-
userId = userId ?? user?.userId;
|
|
321
|
-
const { authBundle: credentialBundle, publicKey } = await utils.createEmbeddedAPIKey(targetEmbeddedKey);
|
|
322
|
-
// add API key to Turnkey User
|
|
323
|
-
await this.createApiKeys({
|
|
324
|
-
organizationId,
|
|
325
|
-
userId,
|
|
326
|
-
apiKeys: [
|
|
327
|
-
{
|
|
328
|
-
apiKeyName: `Session Key ${String(Date.now())}`,
|
|
329
|
-
publicKey,
|
|
330
|
-
expirationSeconds,
|
|
331
|
-
curveType: "API_KEY_CURVE_P256",
|
|
332
|
-
},
|
|
333
|
-
],
|
|
334
|
-
});
|
|
335
|
-
const expiry = Date.now() + Number(expirationSeconds) * 1000;
|
|
336
|
-
await storage.saveSession({
|
|
337
|
-
organizationId,
|
|
338
|
-
organizationName: user?.organization.organizationName ?? "",
|
|
339
|
-
userId,
|
|
340
|
-
username: user?.username ?? "",
|
|
341
|
-
credentialBundle,
|
|
342
|
-
sessionExpiry: expiry,
|
|
343
|
-
}, this.authClient);
|
|
344
|
-
return {
|
|
345
|
-
credentialBundle,
|
|
346
|
-
expiry,
|
|
347
|
-
};
|
|
348
|
-
};
|
|
349
|
-
this.rpId = this.stamper.rpId;
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
class TurnkeyIframeClient extends TurnkeyBrowserClient {
|
|
353
|
-
constructor(config) {
|
|
354
|
-
super(config, base.AuthClient.Iframe);
|
|
355
|
-
this.injectCredentialBundle = async (credentialBundle) => {
|
|
356
|
-
return await this.stamper.injectCredentialBundle(credentialBundle);
|
|
357
|
-
};
|
|
358
|
-
this.injectWalletExportBundle = async (credentialBundle, organizationId) => {
|
|
359
|
-
return await this.stamper.injectWalletExportBundle(credentialBundle, organizationId);
|
|
360
|
-
};
|
|
361
|
-
this.injectKeyExportBundle = async (credentialBundle, organizationId, keyFormat) => {
|
|
362
|
-
return await this.stamper.injectKeyExportBundle(credentialBundle, organizationId, keyFormat);
|
|
363
|
-
};
|
|
364
|
-
this.injectImportBundle = async (bundle, organizationId, userId) => {
|
|
365
|
-
return await this.stamper.injectImportBundle(bundle, organizationId, userId);
|
|
366
|
-
};
|
|
367
|
-
this.extractWalletEncryptedBundle = async () => {
|
|
368
|
-
return await this.stamper.extractWalletEncryptedBundle();
|
|
369
|
-
};
|
|
370
|
-
this.extractKeyEncryptedBundle = async () => {
|
|
371
|
-
return await this.stamper.extractKeyEncryptedBundle();
|
|
372
|
-
};
|
|
373
|
-
this.iframePublicKey = this.stamper.iframePublicKey;
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
class TurnkeyWalletClient extends TurnkeyBrowserClient {
|
|
377
|
-
constructor(config) {
|
|
378
|
-
super(config, base.AuthClient.Wallet);
|
|
379
|
-
this.wallet = config.wallet;
|
|
380
|
-
}
|
|
381
|
-
async getPublicKey() {
|
|
382
|
-
return this.wallet.getPublicKey();
|
|
383
|
-
}
|
|
384
|
-
getWalletInterface() {
|
|
385
|
-
return this.wallet;
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
218
|
|
|
389
|
-
exports.TurnkeyBrowserClient = TurnkeyBrowserClient;
|
|
219
|
+
exports.TurnkeyBrowserClient = browserClients.TurnkeyBrowserClient;
|
|
220
|
+
exports.TurnkeyIframeClient = browserClients.TurnkeyIframeClient;
|
|
221
|
+
exports.TurnkeyPasskeyClient = browserClients.TurnkeyPasskeyClient;
|
|
222
|
+
exports.TurnkeyWalletClient = browserClients.TurnkeyWalletClient;
|
|
390
223
|
exports.TurnkeyBrowserSDK = TurnkeyBrowserSDK;
|
|
391
|
-
exports.TurnkeyIframeClient = TurnkeyIframeClient;
|
|
392
|
-
exports.TurnkeyPasskeyClient = TurnkeyPasskeyClient;
|
|
393
|
-
exports.TurnkeyWalletClient = TurnkeyWalletClient;
|
|
394
224
|
//# sourceMappingURL=sdk-client.js.map
|
package/dist/sdk-client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk-client.js","sources":["../src/sdk-client.ts"],"sourcesContent":[null],"names":["WindowWrapper","WebauthnStamper","IframeStamper","WalletStamper","VERSION","TurnkeyRequestError","getStorageValue","StorageKeys","removeStorageValue","TurnkeySDKClientBase","saveSession","AuthClient","generateRandomBuffer","base64UrlEncode","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C;QAEF,IAA4B,CAAA,4BAAA,GAAG,YAA4B;AACzD,YAAA,OAAO,MAAO,IAAI,CAAC,OAAyB,CAAC,4BAA4B,EAAE,CAAC;AAC9E,SAAC,CAAC;QAEF,IAAyB,CAAA,yBAAA,GAAG,YAA4B;AACtD,YAAA,OAAO,MAAO,IAAI,CAAC,OAAyB,CAAC,yBAAyB,EAAE,CAAC;AAC3E,SAAC,CAAC;QAnDA,IAAI,CAAC,eAAe,GAAI,IAAI,CAAC,OAAyB,CAAC,eAAe,CAAC;KACxE;AAmDF,CAAA;AAEK,MAAO,mBAAoB,SAAQ,oBAAoB,CAAA;AAG3D,IAAA,WAAA,CAAY,MAAiC,EAAA;AAC3C,QAAA,KAAK,CAAC,MAAM,EAAEA,eAAU,CAAC,MAAM,CAAC,CAAC;AACjC,QAAA,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;KAC7B;AAED,IAAA,MAAM,YAAY,GAAA;AAChB,QAAA,OAAO,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC;KACnC;IAED,kBAAkB,GAAA;QAChB,OAAO,IAAI,CAAC,MAAM,CAAC;KACpB;AACF;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"sdk-client.js","sources":["../src/sdk-client.ts"],"sourcesContent":[null],"names":["WindowWrapper","WebauthnStamper","TurnkeyPasskeyClient","IframeStamper","TurnkeyIframeClient","TurnkeyWalletClient","WalletStamper","VERSION","TurnkeyRequestError","TurnkeyBrowserClient","getStorageValue","StorageKeys","removeStorageValue","SessionType"],"mappings":";;;;;;;;;;;MAiEa,iBAAiB,CAAA;AAK5B,IAAA,WAAA,CAAY,MAA+B,EAAA;AAI3C;;;;AAIG;AACH,QAAA,IAAA,CAAA,aAAa,GAAG,CAAC,MAA4B,KAA0B;AACrE,YAAA,MAAM,UAAU,GACd,MAAM,EAAE,IAAI,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,IAAIA,MAAa,CAAC,QAAQ,CAAC,QAA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