@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.mjs
CHANGED
|
@@ -1,35 +1,33 @@
|
|
|
1
|
-
import { WebauthnStamper } from '@turnkey/webauthn-stamper';
|
|
2
|
-
import { IframeStamper } from '@turnkey/iframe-stamper';
|
|
3
|
-
import { getWebAuthnAttestation } from '@turnkey/http';
|
|
4
1
|
import { WalletStamper } from '@turnkey/wallet-stamper';
|
|
5
|
-
import {
|
|
2
|
+
import { IframeStamper } from '@turnkey/iframe-stamper';
|
|
3
|
+
import { WebauthnStamper } from '@turnkey/webauthn-stamper';
|
|
6
4
|
import WindowWrapper from './__polyfills__/window.mjs';
|
|
7
|
-
import { TurnkeyRequestError,
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
5
|
+
import { TurnkeyRequestError, SessionType } from './__types__/base.mjs';
|
|
6
|
+
import { getStorageValue, StorageKeys, removeStorageValue } from './storage.mjs';
|
|
7
|
+
import { TurnkeyPasskeyClient, TurnkeyIframeClient, TurnkeyWalletClient, TurnkeyBrowserClient } from './__clients__/browser-clients.mjs';
|
|
8
|
+
import { VERSION } from './__generated__/version.mjs';
|
|
11
9
|
|
|
12
|
-
const DEFAULT_SESSION_EXPIRATION = "900"; // default to 15 minutes
|
|
13
10
|
class TurnkeyBrowserSDK {
|
|
14
11
|
constructor(config) {
|
|
15
12
|
/**
|
|
16
|
-
* Creates a passkey client. The parameters
|
|
17
|
-
* @param
|
|
18
|
-
* @param timeout optional timeout (defaults to 5mins)
|
|
19
|
-
* @param userVerification optional UV flag (defaults to "preferred")
|
|
20
|
-
* @param allowCredentials optional allowCredentials array (defaults to empty array)
|
|
13
|
+
* Creates a passkey client. The parameters override the default values passed to the underlying Turnkey `WebauthnStamper`
|
|
14
|
+
* @param PasskeyClientParams
|
|
21
15
|
* @returns new TurnkeyPasskeyClient
|
|
22
16
|
*/
|
|
23
|
-
this.passkeyClient = (
|
|
24
|
-
const targetRpId = rpId ?? this.config.rpId ?? WindowWrapper.location.hostname;
|
|
17
|
+
this.passkeyClient = (params) => {
|
|
18
|
+
const targetRpId = params?.rpId ?? this.config.rpId ?? WindowWrapper.location.hostname;
|
|
25
19
|
if (!targetRpId) {
|
|
26
20
|
throw new Error("Tried to initialize a passkey client with no rpId defined");
|
|
27
21
|
}
|
|
28
22
|
this.stamper = new WebauthnStamper({
|
|
29
23
|
rpId: targetRpId,
|
|
30
|
-
...(timeout !== undefined && { timeout }),
|
|
31
|
-
...(userVerification !== undefined && {
|
|
32
|
-
|
|
24
|
+
...(params?.timeout !== undefined && { timeout: params?.timeout }),
|
|
25
|
+
...(params?.userVerification !== undefined && {
|
|
26
|
+
userVerification: params?.userVerification,
|
|
27
|
+
}),
|
|
28
|
+
...(params?.allowCredentials !== undefined && {
|
|
29
|
+
allowCredentials: params?.allowCredentials,
|
|
30
|
+
}),
|
|
33
31
|
});
|
|
34
32
|
return new TurnkeyPasskeyClient({
|
|
35
33
|
stamper: this.stamper,
|
|
@@ -47,7 +45,7 @@ class TurnkeyBrowserSDK {
|
|
|
47
45
|
iframeUrl: params.iframeUrl,
|
|
48
46
|
iframeElementId: TurnkeyIframeElementId,
|
|
49
47
|
});
|
|
50
|
-
await this.stamper.init();
|
|
48
|
+
await this.stamper.init(params.dangerouslyOverrideIframeKeyTtl ?? undefined);
|
|
51
49
|
return new TurnkeyIframeClient({
|
|
52
50
|
stamper: this.stamper,
|
|
53
51
|
apiBaseUrl: this.config.apiBaseUrl,
|
|
@@ -112,13 +110,13 @@ class TurnkeyBrowserSDK {
|
|
|
112
110
|
});
|
|
113
111
|
}
|
|
114
112
|
else {
|
|
115
|
-
this.
|
|
113
|
+
await this.logout();
|
|
116
114
|
}
|
|
117
115
|
return;
|
|
118
116
|
};
|
|
119
117
|
/**
|
|
120
118
|
* 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.
|
|
121
|
-
*
|
|
119
|
+
* @deprecated use `getSession` instead
|
|
122
120
|
* @returns {Promise<ReadWriteSession | undefined>}
|
|
123
121
|
*/
|
|
124
122
|
this.getReadWriteSession = async () => {
|
|
@@ -134,14 +132,21 @@ class TurnkeyBrowserSDK {
|
|
|
134
132
|
return;
|
|
135
133
|
};
|
|
136
134
|
/**
|
|
137
|
-
*
|
|
138
|
-
* It has been replaced by the `getReadWriteSession` method.
|
|
139
|
-
* Fetches an auth bundle stored in local storage.
|
|
135
|
+
* If there is a valid, active READ_WRITE session, this will return it
|
|
140
136
|
*
|
|
141
|
-
* @returns {Promise<
|
|
137
|
+
* @returns {Promise<Session | undefined>}
|
|
142
138
|
*/
|
|
143
|
-
this.
|
|
144
|
-
|
|
139
|
+
this.getSession = async () => {
|
|
140
|
+
const currentSession = await getStorageValue(StorageKeys.Session);
|
|
141
|
+
if (currentSession?.sessionType === SessionType.READ_WRITE) {
|
|
142
|
+
if (currentSession?.expiry > Date.now()) {
|
|
143
|
+
return currentSession;
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
await removeStorageValue(StorageKeys.Session);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
return;
|
|
145
150
|
};
|
|
146
151
|
/**
|
|
147
152
|
* Fetches the current user's organization details.
|
|
@@ -158,231 +163,56 @@ class TurnkeyBrowserSDK {
|
|
|
158
163
|
* @returns {Promise<User | undefined>}
|
|
159
164
|
*/
|
|
160
165
|
this.getCurrentUser = async () => {
|
|
161
|
-
|
|
166
|
+
try {
|
|
167
|
+
const session = await getStorageValue(StorageKeys.Session);
|
|
168
|
+
if (session?.userId && session?.organizationId) {
|
|
169
|
+
return {
|
|
170
|
+
userId: session.userId,
|
|
171
|
+
organization: {
|
|
172
|
+
organizationId: session.organizationId,
|
|
173
|
+
organizationName: "",
|
|
174
|
+
},
|
|
175
|
+
session: {
|
|
176
|
+
...(session.sessionType === SessionType.READ_ONLY && {
|
|
177
|
+
read: {
|
|
178
|
+
token: session.token,
|
|
179
|
+
expiry: session.expiry,
|
|
180
|
+
},
|
|
181
|
+
}),
|
|
182
|
+
...(session.sessionType === SessionType.READ_WRITE && {
|
|
183
|
+
write: {
|
|
184
|
+
credentialBundle: session.token,
|
|
185
|
+
expiry: session.expiry,
|
|
186
|
+
},
|
|
187
|
+
}),
|
|
188
|
+
},
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
else {
|
|
192
|
+
return undefined;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
catch (error) {
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
162
198
|
};
|
|
163
199
|
/**
|
|
164
|
-
* Clears out all data pertaining to
|
|
200
|
+
* Clears out all data pertaining to an end user session.
|
|
165
201
|
*
|
|
166
202
|
* @returns {Promise<boolean>}
|
|
167
203
|
*/
|
|
168
|
-
this.
|
|
204
|
+
this.logout = async () => {
|
|
169
205
|
await removeStorageValue(StorageKeys.AuthBundle); // DEPRECATED
|
|
170
206
|
await removeStorageValue(StorageKeys.CurrentUser);
|
|
171
207
|
await removeStorageValue(StorageKeys.UserSession);
|
|
172
208
|
await removeStorageValue(StorageKeys.ReadWriteSession);
|
|
209
|
+
await removeStorageValue(StorageKeys.Client);
|
|
210
|
+
await removeStorageValue(StorageKeys.Session);
|
|
173
211
|
return true;
|
|
174
212
|
};
|
|
175
213
|
this.config = config;
|
|
176
214
|
}
|
|
177
215
|
}
|
|
178
|
-
class TurnkeyBrowserClient extends TurnkeySDKClientBase {
|
|
179
|
-
constructor(config, authClient) {
|
|
180
|
-
super(config);
|
|
181
|
-
this.login = async (config) => {
|
|
182
|
-
const readOnlySessionResult = await this.createReadOnlySession(config || {});
|
|
183
|
-
await saveSession(readOnlySessionResult, this.authClient);
|
|
184
|
-
return readOnlySessionResult;
|
|
185
|
-
};
|
|
186
|
-
/**
|
|
187
|
-
* Creates a read-write session. This method infers the current user's organization ID and target userId.
|
|
188
|
-
* To be used in conjunction with an `iframeStamper`: the resulting session's credential bundle can be
|
|
189
|
-
* injected into an iframeStamper to create a session that enables both read and write requests.
|
|
190
|
-
*
|
|
191
|
-
* @param targetEmbeddedKey
|
|
192
|
-
* @param expirationSeconds
|
|
193
|
-
* @param userId
|
|
194
|
-
* @returns {Promise<SdkApiTypes.TCreateReadWriteSessionResponse>}
|
|
195
|
-
*/
|
|
196
|
-
this.loginWithReadWriteSession = async (targetEmbeddedKey, expirationSeconds = DEFAULT_SESSION_EXPIRATION, userId) => {
|
|
197
|
-
const readWriteSessionResult = await this.createReadWriteSession({
|
|
198
|
-
targetPublicKey: targetEmbeddedKey,
|
|
199
|
-
expirationSeconds,
|
|
200
|
-
userId: userId,
|
|
201
|
-
});
|
|
202
|
-
// Ensure session and sessionExpiry are included in the object
|
|
203
|
-
const readWriteSessionResultWithSession = {
|
|
204
|
-
...readWriteSessionResult,
|
|
205
|
-
credentialBundle: readWriteSessionResult.credentialBundle,
|
|
206
|
-
sessionExpiry: Date.now() + Number(expirationSeconds) * 1000,
|
|
207
|
-
};
|
|
208
|
-
// store auth bundle in local storage
|
|
209
|
-
await saveSession(readWriteSessionResultWithSession, this.authClient);
|
|
210
|
-
return readWriteSessionResultWithSession;
|
|
211
|
-
};
|
|
212
|
-
/**
|
|
213
|
-
* Logs in with an existing auth bundle. this bundle enables both read and write requests.
|
|
214
|
-
*
|
|
215
|
-
* @param credentialBundle
|
|
216
|
-
* @param expirationSeconds
|
|
217
|
-
* @returns {Promise<boolean>}
|
|
218
|
-
*/
|
|
219
|
-
this.loginWithAuthBundle = async (credentialBundle, expirationSeconds = DEFAULT_SESSION_EXPIRATION) => {
|
|
220
|
-
try {
|
|
221
|
-
const whoAmIResult = await this.getWhoami();
|
|
222
|
-
const readWriteSessionResultWithSession = {
|
|
223
|
-
...whoAmIResult,
|
|
224
|
-
credentialBundle: credentialBundle,
|
|
225
|
-
sessionExpiry: Date.now() + Number(expirationSeconds) * 1000,
|
|
226
|
-
};
|
|
227
|
-
await saveSession(readWriteSessionResultWithSession, this.authClient);
|
|
228
|
-
return true;
|
|
229
|
-
}
|
|
230
|
-
catch {
|
|
231
|
-
return false;
|
|
232
|
-
}
|
|
233
|
-
};
|
|
234
|
-
this.authClient = authClient;
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
class TurnkeyPasskeyClient extends TurnkeyBrowserClient {
|
|
238
|
-
constructor(config) {
|
|
239
|
-
super(config, AuthClient.Passkey);
|
|
240
|
-
/**
|
|
241
|
-
* Create a passkey for an end-user, taking care of various lower-level details.
|
|
242
|
-
*
|
|
243
|
-
* @returns {Promise<Passkey>}
|
|
244
|
-
*/
|
|
245
|
-
this.createUserPasskey = async (config = {}) => {
|
|
246
|
-
const challenge = generateRandomBuffer();
|
|
247
|
-
const encodedChallenge = base64UrlEncode(challenge);
|
|
248
|
-
const authenticatorUserId = generateRandomBuffer();
|
|
249
|
-
// WebAuthn credential options options can be found here:
|
|
250
|
-
// https://www.w3.org/TR/webauthn-2/#sctn-sample-registration
|
|
251
|
-
//
|
|
252
|
-
// All pubkey algorithms can be found here: https://www.iana.org/assignments/cose/cose.xhtml#algorithms
|
|
253
|
-
// Turnkey only supports ES256 (-7) and RS256 (-257)
|
|
254
|
-
//
|
|
255
|
-
// The pubkey type only supports one value, "public-key"
|
|
256
|
-
// See https://www.w3.org/TR/webauthn-2/#enumdef-publickeycredentialtype for more details
|
|
257
|
-
// TODO: consider un-nesting these config params
|
|
258
|
-
const webauthnConfig = {
|
|
259
|
-
publicKey: {
|
|
260
|
-
rp: {
|
|
261
|
-
id: config.publicKey?.rp?.id ?? this.rpId,
|
|
262
|
-
name: config.publicKey?.rp?.name ?? "",
|
|
263
|
-
},
|
|
264
|
-
challenge: config.publicKey?.challenge ?? challenge,
|
|
265
|
-
pubKeyCredParams: config.publicKey?.pubKeyCredParams ?? [
|
|
266
|
-
{
|
|
267
|
-
type: "public-key",
|
|
268
|
-
alg: -7,
|
|
269
|
-
},
|
|
270
|
-
{
|
|
271
|
-
type: "public-key",
|
|
272
|
-
alg: -257,
|
|
273
|
-
},
|
|
274
|
-
],
|
|
275
|
-
user: {
|
|
276
|
-
id: config.publicKey?.user?.id ?? authenticatorUserId,
|
|
277
|
-
name: config.publicKey?.user?.name ?? "Default User",
|
|
278
|
-
displayName: config.publicKey?.user?.displayName ?? "Default User",
|
|
279
|
-
},
|
|
280
|
-
authenticatorSelection: {
|
|
281
|
-
authenticatorAttachment: config.publicKey?.authenticatorSelection?.authenticatorAttachment ??
|
|
282
|
-
undefined,
|
|
283
|
-
requireResidentKey: config.publicKey?.authenticatorSelection?.requireResidentKey ??
|
|
284
|
-
true,
|
|
285
|
-
residentKey: config.publicKey?.authenticatorSelection?.residentKey ?? "required",
|
|
286
|
-
userVerification: config.publicKey?.authenticatorSelection?.userVerification ??
|
|
287
|
-
"preferred",
|
|
288
|
-
},
|
|
289
|
-
},
|
|
290
|
-
};
|
|
291
|
-
const attestation = await getWebAuthnAttestation(webauthnConfig);
|
|
292
|
-
return {
|
|
293
|
-
encodedChallenge: config.publicKey?.challenge
|
|
294
|
-
? base64UrlEncode(config.publicKey?.challenge)
|
|
295
|
-
: encodedChallenge,
|
|
296
|
-
attestation,
|
|
297
|
-
};
|
|
298
|
-
};
|
|
299
|
-
/**
|
|
300
|
-
* Uses passkey authentication to create a read-write session, via an embedded API key,
|
|
301
|
-
* and stores + returns the resulting auth bundle that contains the encrypted API key.
|
|
302
|
-
* This auth bundle (also referred to as a credential bundle) can be injected into an `iframeStamper`,
|
|
303
|
-
* resulting in a touch-free authenticator. Unlike `loginWithReadWriteSession`, this method
|
|
304
|
-
* assumes the end-user's organization ID (i.e. the sub-organization ID) is already known.
|
|
305
|
-
*
|
|
306
|
-
* @param userId
|
|
307
|
-
* @param targetEmbeddedKey
|
|
308
|
-
* @param expirationSeconds
|
|
309
|
-
* @param curveType
|
|
310
|
-
* @returns {Promise<ReadWriteSession>}
|
|
311
|
-
*/
|
|
312
|
-
this.createPasskeySession = async (userId, targetEmbeddedKey, expirationSeconds = DEFAULT_SESSION_EXPIRATION, organizationId) => {
|
|
313
|
-
const user = await getStorageValue(StorageKeys.UserSession);
|
|
314
|
-
organizationId = organizationId ?? user?.organization.organizationId;
|
|
315
|
-
if (!organizationId) {
|
|
316
|
-
throw new Error("Error creating passkey session: Organization ID is required");
|
|
317
|
-
}
|
|
318
|
-
userId = userId ?? user?.userId;
|
|
319
|
-
const { authBundle: credentialBundle, publicKey } = await createEmbeddedAPIKey(targetEmbeddedKey);
|
|
320
|
-
// add API key to Turnkey User
|
|
321
|
-
await this.createApiKeys({
|
|
322
|
-
organizationId,
|
|
323
|
-
userId,
|
|
324
|
-
apiKeys: [
|
|
325
|
-
{
|
|
326
|
-
apiKeyName: `Session Key ${String(Date.now())}`,
|
|
327
|
-
publicKey,
|
|
328
|
-
expirationSeconds,
|
|
329
|
-
curveType: "API_KEY_CURVE_P256",
|
|
330
|
-
},
|
|
331
|
-
],
|
|
332
|
-
});
|
|
333
|
-
const expiry = Date.now() + Number(expirationSeconds) * 1000;
|
|
334
|
-
await saveSession({
|
|
335
|
-
organizationId,
|
|
336
|
-
organizationName: user?.organization.organizationName ?? "",
|
|
337
|
-
userId,
|
|
338
|
-
username: user?.username ?? "",
|
|
339
|
-
credentialBundle,
|
|
340
|
-
sessionExpiry: expiry,
|
|
341
|
-
}, this.authClient);
|
|
342
|
-
return {
|
|
343
|
-
credentialBundle,
|
|
344
|
-
expiry,
|
|
345
|
-
};
|
|
346
|
-
};
|
|
347
|
-
this.rpId = this.stamper.rpId;
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
class TurnkeyIframeClient extends TurnkeyBrowserClient {
|
|
351
|
-
constructor(config) {
|
|
352
|
-
super(config, AuthClient.Iframe);
|
|
353
|
-
this.injectCredentialBundle = async (credentialBundle) => {
|
|
354
|
-
return await this.stamper.injectCredentialBundle(credentialBundle);
|
|
355
|
-
};
|
|
356
|
-
this.injectWalletExportBundle = async (credentialBundle, organizationId) => {
|
|
357
|
-
return await this.stamper.injectWalletExportBundle(credentialBundle, organizationId);
|
|
358
|
-
};
|
|
359
|
-
this.injectKeyExportBundle = async (credentialBundle, organizationId, keyFormat) => {
|
|
360
|
-
return await this.stamper.injectKeyExportBundle(credentialBundle, organizationId, keyFormat);
|
|
361
|
-
};
|
|
362
|
-
this.injectImportBundle = async (bundle, organizationId, userId) => {
|
|
363
|
-
return await this.stamper.injectImportBundle(bundle, organizationId, userId);
|
|
364
|
-
};
|
|
365
|
-
this.extractWalletEncryptedBundle = async () => {
|
|
366
|
-
return await this.stamper.extractWalletEncryptedBundle();
|
|
367
|
-
};
|
|
368
|
-
this.extractKeyEncryptedBundle = async () => {
|
|
369
|
-
return await this.stamper.extractKeyEncryptedBundle();
|
|
370
|
-
};
|
|
371
|
-
this.iframePublicKey = this.stamper.iframePublicKey;
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
class TurnkeyWalletClient extends TurnkeyBrowserClient {
|
|
375
|
-
constructor(config) {
|
|
376
|
-
super(config, AuthClient.Wallet);
|
|
377
|
-
this.wallet = config.wallet;
|
|
378
|
-
}
|
|
379
|
-
async getPublicKey() {
|
|
380
|
-
return this.wallet.getPublicKey();
|
|
381
|
-
}
|
|
382
|
-
getWalletInterface() {
|
|
383
|
-
return this.wallet;
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
216
|
|
|
387
217
|
export { TurnkeyBrowserClient, TurnkeyBrowserSDK, TurnkeyIframeClient, TurnkeyPasskeyClient, TurnkeyWalletClient };
|
|
388
218
|
//# sourceMappingURL=sdk-client.mjs.map
|
package/dist/sdk-client.mjs.map
CHANGED
|
@@ -1 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
@@ -1,20 +1,40 @@
|
|
|
1
|
-
import type { User, ReadWriteSession } from "
|
|
2
|
-
import type { AuthClient, TSessionResponse } from "
|
|
1
|
+
import type { User, ReadWriteSession } from "@models";
|
|
2
|
+
import type { AuthClient, SessionType, TSessionResponse } from "@types";
|
|
3
3
|
export declare enum StorageKeys {
|
|
4
4
|
AuthBundle = "@turnkey/auth_bundle",
|
|
5
5
|
CurrentUser = "@turnkey/current_user",
|
|
6
6
|
UserSession = "@turnkey/session/v1",
|
|
7
|
-
ReadWriteSession = "@turnkey/read_write_session"
|
|
7
|
+
ReadWriteSession = "@turnkey/read_write_session",
|
|
8
|
+
Session = "@turnkey/session/v2",
|
|
9
|
+
Client = "@turnkey/client"
|
|
8
10
|
}
|
|
11
|
+
export type Session = {
|
|
12
|
+
sessionType: SessionType;
|
|
13
|
+
userId: string;
|
|
14
|
+
organizationId: string;
|
|
15
|
+
expiry: number;
|
|
16
|
+
token: string;
|
|
17
|
+
};
|
|
9
18
|
interface StorageValue {
|
|
10
19
|
[StorageKeys.AuthBundle]: string;
|
|
11
20
|
[StorageKeys.CurrentUser]: User;
|
|
12
21
|
[StorageKeys.UserSession]: User;
|
|
13
22
|
[StorageKeys.ReadWriteSession]: ReadWriteSession;
|
|
23
|
+
[StorageKeys.Session]: Session;
|
|
24
|
+
[StorageKeys.Client]: AuthClient;
|
|
14
25
|
}
|
|
15
26
|
export declare const getStorageValue: <K extends StorageKeys>(storageKey: K) => Promise<StorageValue[K] | undefined>;
|
|
16
27
|
export declare const setStorageValue: <K extends StorageKeys>(storageKey: K, storageValue: StorageValue[K]) => Promise<any>;
|
|
17
28
|
export declare const removeStorageValue: <K extends StorageKeys>(storageKey: K) => Promise<void>;
|
|
29
|
+
/**
|
|
30
|
+
* Saves a session and client to storage.
|
|
31
|
+
*
|
|
32
|
+
* @param {Session} session - The session response containing session details.
|
|
33
|
+
* @param {AuthClient} authClient - The authentication client used for the session.
|
|
34
|
+
* @throws Will throw an error if the authentication client is not set.
|
|
35
|
+
* @returns {Promise<void>} A promise that resolves when the session is saved.
|
|
36
|
+
*/
|
|
37
|
+
export declare const storeSession: (session: Session, client: AuthClient) => Promise<void>;
|
|
18
38
|
/**
|
|
19
39
|
* Saves a user session to storage.
|
|
20
40
|
*
|
package/dist/storage.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../src/storage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../src/storage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEtD,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAExE,oBAAY,WAAW;IACrB,UAAU,yBAAyB;IACnC,WAAW,0BAA0B;IACrC,WAAW,wBAAwB;IACnC,gBAAgB,gCAAgC;IAChD,OAAO,wBAAwB;IAC/B,MAAM,oBAAoB;CAC3B;AAED,MAAM,MAAM,OAAO,GAAG;IACpB,WAAW,EAAE,WAAW,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,UAAU,YAAY;IACpB,CAAC,WAAW,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IACjC,CAAC,WAAW,CAAC,WAAW,CAAC,EAAE,IAAI,CAAC;IAChC,CAAC,WAAW,CAAC,WAAW,CAAC,EAAE,IAAI,CAAC;IAChC,CAAC,WAAW,CAAC,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACjD,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAC/B,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,UAAU,CAAC;CAClC;AAuBD,eAAO,MAAM,eAAe,gFAO3B,CAAC;AAEF,eAAO,MAAM,eAAe,2EAGzB,QAAQ,GAAG,CAIb,CAAC;AAEF,eAAO,MAAM,kBAAkB,4CAE5B,QAAQ,IAAI,CAId,CAAC;AAEF;;;;;;;GAOG;AAEH,eAAO,MAAM,YAAY,YAAmB,OAAO,UAAU,UAAU,kBAGtE,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW,gHASnB,gBAAgB,eACN,UAAU,KACtB,QAAQ,IAAI,CAkCd,CAAC"}
|
package/dist/storage.js
CHANGED
|
@@ -8,6 +8,8 @@ exports.StorageKeys = void 0;
|
|
|
8
8
|
StorageKeys["CurrentUser"] = "@turnkey/current_user";
|
|
9
9
|
StorageKeys["UserSession"] = "@turnkey/session/v1";
|
|
10
10
|
StorageKeys["ReadWriteSession"] = "@turnkey/read_write_session";
|
|
11
|
+
StorageKeys["Session"] = "@turnkey/session/v2";
|
|
12
|
+
StorageKeys["Client"] = "@turnkey/client";
|
|
11
13
|
})(exports.StorageKeys || (exports.StorageKeys = {}));
|
|
12
14
|
var StorageLocation;
|
|
13
15
|
(function (StorageLocation) {
|
|
@@ -20,6 +22,8 @@ const STORAGE_VALUE_LOCATIONS = {
|
|
|
20
22
|
[exports.StorageKeys.CurrentUser]: StorageLocation.Local,
|
|
21
23
|
[exports.StorageKeys.ReadWriteSession]: StorageLocation.Secure,
|
|
22
24
|
[exports.StorageKeys.UserSession]: StorageLocation.Session,
|
|
25
|
+
[exports.StorageKeys.Session]: StorageLocation.Session,
|
|
26
|
+
[exports.StorageKeys.Client]: StorageLocation.Session,
|
|
23
27
|
};
|
|
24
28
|
const STORAGE_LOCATIONS = {
|
|
25
29
|
[StorageLocation.Local]: window.localStorage,
|
|
@@ -42,6 +46,18 @@ const removeStorageValue = async (storageKey) => {
|
|
|
42
46
|
const browserStorageLocation = STORAGE_LOCATIONS[storageLocation];
|
|
43
47
|
browserStorageLocation.removeItem(storageKey);
|
|
44
48
|
};
|
|
49
|
+
/**
|
|
50
|
+
* Saves a session and client to storage.
|
|
51
|
+
*
|
|
52
|
+
* @param {Session} session - The session response containing session details.
|
|
53
|
+
* @param {AuthClient} authClient - The authentication client used for the session.
|
|
54
|
+
* @throws Will throw an error if the authentication client is not set.
|
|
55
|
+
* @returns {Promise<void>} A promise that resolves when the session is saved.
|
|
56
|
+
*/
|
|
57
|
+
const storeSession = async (session, client) => {
|
|
58
|
+
await setStorageValue(exports.StorageKeys.Session, session);
|
|
59
|
+
await setStorageValue(exports.StorageKeys.Client, client);
|
|
60
|
+
};
|
|
45
61
|
/**
|
|
46
62
|
* Saves a user session to storage.
|
|
47
63
|
*
|
|
@@ -87,4 +103,5 @@ exports.getStorageValue = getStorageValue;
|
|
|
87
103
|
exports.removeStorageValue = removeStorageValue;
|
|
88
104
|
exports.saveSession = saveSession;
|
|
89
105
|
exports.setStorageValue = setStorageValue;
|
|
106
|
+
exports.storeSession = storeSession;
|
|
90
107
|
//# sourceMappingURL=storage.js.map
|
package/dist/storage.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage.js","sources":["../src/storage.ts"],"sourcesContent":[null],"names":["StorageKeys","WindowWrapper"],"mappings":";;;;AAIYA,
|
|
1
|
+
{"version":3,"file":"storage.js","sources":["../src/storage.ts"],"sourcesContent":[null],"names":["StorageKeys","WindowWrapper"],"mappings":";;;;AAIYA,6BAOX;AAPD,CAAA,UAAY,WAAW,EAAA;AACrB,IAAA,WAAA,CAAA,YAAA,CAAA,GAAA,sBAAmC,CAAA;AACnC,IAAA,WAAA,CAAA,aAAA,CAAA,GAAA,uBAAqC,CAAA;AACrC,IAAA,WAAA,CAAA,aAAA,CAAA,GAAA,qBAAmC,CAAA;AACnC,IAAA,WAAA,CAAA,kBAAA,CAAA,GAAA,6BAAgD,CAAA;AAChD,IAAA,WAAA,CAAA,SAAA,CAAA,GAAA,qBAA+B,CA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AC;IACrC,MAAM,OAAO,GAAG,gBAAgB;AAC9B,UAAE;AACE,YAAA,KAAK,EAAE;gBACL,gBAAgB;gBAChB,MAAM;AACP,aAAA;AACF,SAAA;AACH,UAAE;AACE,YAAA,IAAI,EAAE;gBACJ,KAAK,EAAE,eAAe,CAAC,OAAQ;gBAC/B,MAAM;AACP,aAAA;SACF,CAAC;AAEN,IAAA,MAAM,WAAW,GAAS;QACxB,MAAM;QACN,QAAQ;AACR,QAAA,YAAY,EAAE;YACZ,cAAc;YACd,gBAAgB;AACjB,SAAA;AACD,QAAA,OAAO,EAAE;YACP,UAAU;AACV,YAAA,GAAG,OAAO;AACX,SAAA;KACF,CAAC;IAEF,MAAM,eAAe,CAACA,mBAAW,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;AAC9D;;;;;;;;"}
|
package/dist/storage.mjs
CHANGED
|
@@ -6,6 +6,8 @@ var StorageKeys;
|
|
|
6
6
|
StorageKeys["CurrentUser"] = "@turnkey/current_user";
|
|
7
7
|
StorageKeys["UserSession"] = "@turnkey/session/v1";
|
|
8
8
|
StorageKeys["ReadWriteSession"] = "@turnkey/read_write_session";
|
|
9
|
+
StorageKeys["Session"] = "@turnkey/session/v2";
|
|
10
|
+
StorageKeys["Client"] = "@turnkey/client";
|
|
9
11
|
})(StorageKeys || (StorageKeys = {}));
|
|
10
12
|
var StorageLocation;
|
|
11
13
|
(function (StorageLocation) {
|
|
@@ -18,6 +20,8 @@ const STORAGE_VALUE_LOCATIONS = {
|
|
|
18
20
|
[StorageKeys.CurrentUser]: StorageLocation.Local,
|
|
19
21
|
[StorageKeys.ReadWriteSession]: StorageLocation.Secure,
|
|
20
22
|
[StorageKeys.UserSession]: StorageLocation.Session,
|
|
23
|
+
[StorageKeys.Session]: StorageLocation.Session,
|
|
24
|
+
[StorageKeys.Client]: StorageLocation.Session,
|
|
21
25
|
};
|
|
22
26
|
const STORAGE_LOCATIONS = {
|
|
23
27
|
[StorageLocation.Local]: WindowWrapper.localStorage,
|
|
@@ -40,6 +44,18 @@ const removeStorageValue = async (storageKey) => {
|
|
|
40
44
|
const browserStorageLocation = STORAGE_LOCATIONS[storageLocation];
|
|
41
45
|
browserStorageLocation.removeItem(storageKey);
|
|
42
46
|
};
|
|
47
|
+
/**
|
|
48
|
+
* Saves a session and client to storage.
|
|
49
|
+
*
|
|
50
|
+
* @param {Session} session - The session response containing session details.
|
|
51
|
+
* @param {AuthClient} authClient - The authentication client used for the session.
|
|
52
|
+
* @throws Will throw an error if the authentication client is not set.
|
|
53
|
+
* @returns {Promise<void>} A promise that resolves when the session is saved.
|
|
54
|
+
*/
|
|
55
|
+
const storeSession = async (session, client) => {
|
|
56
|
+
await setStorageValue(StorageKeys.Session, session);
|
|
57
|
+
await setStorageValue(StorageKeys.Client, client);
|
|
58
|
+
};
|
|
43
59
|
/**
|
|
44
60
|
* Saves a user session to storage.
|
|
45
61
|
*
|
|
@@ -81,5 +97,5 @@ const saveSession = async ({ organizationId, organizationName, sessionExpiry, cr
|
|
|
81
97
|
await setStorageValue(StorageKeys.UserSession, userSession);
|
|
82
98
|
};
|
|
83
99
|
|
|
84
|
-
export { StorageKeys, getStorageValue, removeStorageValue, saveSession, setStorageValue };
|
|
100
|
+
export { StorageKeys, getStorageValue, removeStorageValue, saveSession, setStorageValue, storeSession };
|
|
85
101
|
//# sourceMappingURL=storage.mjs.map
|
package/dist/storage.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage.mjs","sources":["../src/storage.ts"],"sourcesContent":[null],"names":[],"mappings":";;IAIY,
|
|
1
|
+
{"version":3,"file":"storage.mjs","sources":["../src/storage.ts"],"sourcesContent":[null],"names":[],"mappings":";;IAIY,YAOX;AAPD,CAAA,UAAY,WAAW,EAAA;AACrB,IAAA,WAAA,CAAA,YAAA,CAAA,GAAA,sBAAmC,CAAA;AACnC,IAAA,WAAA,CAAA,aAAA,CAAA,GAAA,uBAAqC,CAAA;AACrC,IAAA,WAAA,CAAA,a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AACf,QAAA,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAC;AAC1E,KAAA;AAED,IAAA,MAAM,MAAM,GAAG,MAAM,CAAC,aAAa,CAAC,CAAC;IACrC,MAAM,OAAO,GAAG,gBAAgB;AAC9B,UAAE;AACE,YAAA,KAAK,EAAE;gBACL,gBAAgB;gBAChB,MAAM;AACP,aAAA;AACF,SAAA;AACH,UAAE;AACE,YAAA,IAAI,EAAE;gBACJ,KAAK,EAAE,eAAe,CAAC,OAAQ;gBAC/B,MAAM;AACP,aAAA;SACF,CAAC;AAEN,IAAA,MAAM,WAAW,GAAS;QACxB,MAAM;QACN,QAAQ;AACR,QAAA,YAAY,EAAE;YACZ,cAAc;YACd,gBAAgB;AACjB,SAAA;AACD,QAAA,OAAO,EAAE;YACP,UAAU;AACV,YAAA,GAAG,OAAO;AACX,SAAA;KACF,CAAC;IAEF,MAAM,eAAe,CAAC,WAAW,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;AAC9D;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@turnkey/sdk-browser",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"module": "./dist/index.mjs",
|
|
6
6
|
"exports": {
|
|
@@ -42,16 +42,17 @@
|
|
|
42
42
|
"buffer": "^6.0.3",
|
|
43
43
|
"cross-fetch": "^3.1.5",
|
|
44
44
|
"hpke-js": "^1.2.7",
|
|
45
|
-
"@turnkey/encoding": "0.4.0",
|
|
46
45
|
"@turnkey/api-key-stamper": "0.4.4",
|
|
47
|
-
"@turnkey/
|
|
46
|
+
"@turnkey/encoding": "0.4.0",
|
|
48
47
|
"@turnkey/http": "2.21.0",
|
|
49
|
-
"@turnkey/
|
|
50
|
-
"@turnkey/
|
|
51
|
-
"@turnkey/wallet-stamper": "1.0.3"
|
|
48
|
+
"@turnkey/crypto": "2.3.1",
|
|
49
|
+
"@turnkey/iframe-stamper": "2.3.0",
|
|
50
|
+
"@turnkey/wallet-stamper": "1.0.3",
|
|
51
|
+
"@turnkey/webauthn-stamper": "0.5.0"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"glob": "^8.0.3"
|
|
54
|
+
"glob": "^8.0.3",
|
|
55
|
+
"typescript": "^5.1.5"
|
|
55
56
|
},
|
|
56
57
|
"engines": {
|
|
57
58
|
"node": ">=18.0.0"
|