@@ -108,7 +108,7 @@ export class TurnkeyBrowserClient extends TurnkeyBaseClient {
108
108
organizationId ?: string ;
109
109
} ) : Promise < SdkApiTypes . TCreateReadOnlySessionResponse > => {
110
110
const readOnlySessionResult = await this . createReadOnlySession (
111
- config || { }
111
+ config || { } ,
112
112
) ;
113
113
await saveSession ( readOnlySessionResult , this . authClient ) ;
114
114
@@ -128,12 +128,12 @@ export class TurnkeyBrowserClient extends TurnkeyBaseClient {
128
128
refereshSession = async (
129
129
sessionType : SessionType = SessionType . READ_WRITE ,
130
130
targetPublicKey ?: string , // TODO: eventually we want to automatically pull this from localStorage/iframe
131
- expirationSeconds : string = DEFAULT_SESSION_EXPIRATION_IN_SECONDS
131
+ expirationSeconds : string = DEFAULT_SESSION_EXPIRATION_IN_SECONDS ,
132
132
) : Promise < void > => {
133
133
if ( sessionType === SessionType . READ_ONLY ) {
134
134
if ( this ! instanceof TurnkeyPasskeyClient ) {
135
135
throw new Error (
136
- "You must use a passkey client to refresh a read session"
136
+ "You must use a passkey client to refresh a read session" ,
137
137
) ; // TODO: support wallet clients perhaps?
138
138
}
139
139
const readOnlySessionResult = await this . createReadOnlySession ( { } ) ;
@@ -150,7 +150,7 @@ export class TurnkeyBrowserClient extends TurnkeyBaseClient {
150
150
if ( sessionType === SessionType . READ_WRITE ) {
151
151
if ( ! targetPublicKey ) {
152
152
throw new Error (
153
- "You must provide a targetPublicKey to refresh a read-write session."
153
+ "You must provide a targetPublicKey to refresh a read-write session." ,
154
154
) ;
155
155
}
156
156
const readWriteSessionResult = await this . createReadWriteSession ( {
@@ -170,7 +170,7 @@ export class TurnkeyBrowserClient extends TurnkeyBaseClient {
170
170
} else {
171
171
// Throw an error if the client is not an iframe client
172
172
throw new Error (
173
- "You must use an iframe client to refresh a read-write session"
173
+ "You must use an iframe client to refresh a read-write session" ,
174
174
) ; //should we default to a "localStorage" client?
175
175
}
176
176
await storeSession ( session , AuthClient . Iframe ) ;
@@ -187,14 +187,14 @@ export class TurnkeyBrowserClient extends TurnkeyBaseClient {
187
187
*/
188
188
loginWithBundle = async (
189
189
bundle : string , // we need a way to get the expiry of this token. Either it lives in the token itself or is returned from the server action and passed again here
190
- expirationSeconds : string // we need a way to get the expiry of this token. Either it lives in the token itself or is returned from the server action and passed again here
190
+ expirationSeconds : string , // we need a way to get the expiry of this token. Either it lives in the token itself or is returned from the server action and passed again here
191
191
) : Promise < void > => {
192
192
if ( this ! instanceof TurnkeyIframeClient ) {
193
193
await this . injectCredentialBundle ( bundle ) ;
194
194
} else {
195
195
// Throw an error if the client is not an iframe client
196
196
throw new Error (
197
- "You must use an iframe client to log in with a session."
197
+ "You must use an iframe client to log in with a session." ,
198
198
) ; //should we default to a "localStorage" client?
199
199
}
200
200
const whoAmI = await this . getWhoami ( ) ;
@@ -223,7 +223,7 @@ export class TurnkeyBrowserClient extends TurnkeyBaseClient {
223
223
} else {
224
224
// Throw an error if the client is not an iframe client
225
225
throw new Error (
226
- "You must use an iframe client to log in with a session."
226
+ "You must use an iframe client to log in with a session." ,
227
227
) ; //should we default to a "localStorage" client?
228
228
}
229
229
await storeSession ( session , AuthClient . Iframe ) ;
@@ -241,7 +241,7 @@ export class TurnkeyBrowserClient extends TurnkeyBaseClient {
241
241
iframeClient : TurnkeyIframeClient ,
242
242
targetPublicKey ?: string , // TODO: eventually we want to automatically pull this from localStorage/iframe
243
243
244
- expirationSeconds : string = DEFAULT_SESSION_EXPIRATION_IN_SECONDS
244
+ expirationSeconds : string = DEFAULT_SESSION_EXPIRATION_IN_SECONDS ,
245
245
) : Promise < void > => {
246
246
// Create a read-only session
247
247
if ( sessionType === SessionType . READ_ONLY ) {
@@ -261,7 +261,7 @@ export class TurnkeyBrowserClient extends TurnkeyBaseClient {
261
261
if ( sessionType === SessionType . READ_WRITE ) {
262
262
if ( ! targetPublicKey ) {
263
263
throw new Error (
264
- "You must provide a targetPublicKey to create a read-write session."
264
+ "You must provide a targetPublicKey to create a read-write session." ,
265
265
) ;
266
266
}
267
267
@@ -280,7 +280,7 @@ export class TurnkeyBrowserClient extends TurnkeyBaseClient {
280
280
281
281
if ( ! iframeClient ) {
282
282
throw new Error (
283
- "You must provide an iframe client to log in with a passkey."
283
+ "You must provide an iframe client to log in with a passkey." ,
284
284
) ;
285
285
}
286
286
await iframeClient . injectCredentialBundle ( session . token ! ) ;
@@ -304,7 +304,7 @@ export class TurnkeyBrowserClient extends TurnkeyBaseClient {
304
304
loginWithReadWriteSession = async (
305
305
targetEmbeddedKey : string ,
306
306
expirationSeconds : string = DEFAULT_SESSION_EXPIRATION_IN_SECONDS ,
307
- userId ?: string
307
+ userId ?: string ,
308
308
) : Promise < SdkApiTypes . TCreateReadWriteSessionResponse > => {
309
309
const readWriteSessionResult = await this . createReadWriteSession ( {
310
310
targetPublicKey : targetEmbeddedKey ,
@@ -334,7 +334,7 @@ export class TurnkeyBrowserClient extends TurnkeyBaseClient {
334
334
*/
335
335
loginWithAuthBundle = async (
336
336
credentialBundle : string ,
337
- expirationSeconds : string = DEFAULT_SESSION_EXPIRATION_IN_SECONDS
337
+ expirationSeconds : string = DEFAULT_SESSION_EXPIRATION_IN_SECONDS ,
338
338
) : Promise < any > => {
339
339
try {
340
340
const whoAmIResult = await this . getWhoami ( ) ;
@@ -388,20 +388,20 @@ export class TurnkeyBrowserClient extends TurnkeyBaseClient {
388
388
389
389
if ( phoneNumber ) {
390
390
promises . push (
391
- this . updateUser ( { userId, userPhoneNumber : "" , userTagIds : [ ] } )
391
+ this . updateUser ( { userId, userPhoneNumber : "" , userTagIds : [ ] } ) ,
392
392
) ;
393
393
}
394
394
if ( email ) {
395
395
promises . push (
396
- this . updateUser ( { userId, userEmail : "" , userTagIds : [ ] } )
396
+ this . updateUser ( { userId, userEmail : "" , userTagIds : [ ] } ) ,
397
397
) ;
398
398
}
399
399
if ( authenticatorIds && authenticatorIds . length > 0 ) {
400
400
promises . push ( this . deleteAuthenticators ( { userId, authenticatorIds } ) ) ;
401
401
}
402
402
if ( oauthProviderIds && oauthProviderIds . length > 0 ) {
403
403
promises . push (
404
- this . deleteOauthProviders ( { userId, providerIds : oauthProviderIds } )
404
+ this . deleteOauthProviders ( { userId, providerIds : oauthProviderIds } ) ,
405
405
) ;
406
406
}
407
407
if ( apiKeyIds && apiKeyIds . length > 0 ) {
@@ -456,12 +456,12 @@ export class TurnkeyBrowserClient extends TurnkeyBaseClient {
456
456
userId,
457
457
userPhoneNumber : phoneNumber ,
458
458
userTagIds : [ ] ,
459
- } )
459
+ } ) ,
460
460
) ;
461
461
}
462
462
if ( email ) {
463
463
promises . push (
464
- this . updateUser ( { userId, userEmail : email , userTagIds : [ ] } )
464
+ this . updateUser ( { userId, userEmail : email , userTagIds : [ ] } ) ,
465
465
) ;
466
466
}
467
467
if ( authenticators && authenticators . length > 0 ) {
@@ -526,7 +526,7 @@ export class TurnkeyBrowserClient extends TurnkeyBaseClient {
526
526
}
527
527
if ( Object . keys ( userUpdates ) . length > 0 ) {
528
528
promises . push (
529
- this . updateUser ( { userId, ...userUpdates , userTagIds : [ ] } )
529
+ this . updateUser ( { userId, ...userUpdates , userTagIds : [ ] } ) ,
530
530
) ;
531
531
}
532
532
@@ -537,15 +537,15 @@ export class TurnkeyBrowserClient extends TurnkeyBaseClient {
537
537
this . createAuthenticators ( {
538
538
userId,
539
539
authenticators : authenticators . add ,
540
- } )
540
+ } ) ,
541
541
) ;
542
542
}
543
543
if ( authenticators . deleteIds ?. length ) {
544
544
promises . push (
545
545
this . deleteAuthenticators ( {
546
546
userId,
547
547
authenticatorIds : authenticators . deleteIds ,
548
- } )
548
+ } ) ,
549
549
) ;
550
550
}
551
551
}
@@ -557,15 +557,15 @@ export class TurnkeyBrowserClient extends TurnkeyBaseClient {
557
557
this . createOauthProviders ( {
558
558
userId,
559
559
oauthProviders : oauthProviders . add ,
560
- } )
560
+ } ) ,
561
561
) ;
562
562
}
563
563
if ( oauthProviders . deleteIds ?. length ) {
564
564
promises . push (
565
565
this . deleteOauthProviders ( {
566
566
userId,
567
567
providerIds : oauthProviders . deleteIds ,
568
- } )
568
+ } ) ,
569
569
) ;
570
570
}
571
571
}
@@ -577,15 +577,15 @@ export class TurnkeyBrowserClient extends TurnkeyBaseClient {
577
577
this . createApiKeys ( {
578
578
userId,
579
579
apiKeys : apiKeys . add ,
580
- } )
580
+ } ) ,
581
581
) ;
582
582
}
583
583
if ( apiKeys . deleteIds ?. length ) {
584
584
promises . push (
585
585
this . deleteApiKeys ( {
586
586
userId,
587
587
apiKeyIds : apiKeys . deleteIds ,
588
- } )
588
+ } ) ,
589
589
) ;
590
590
}
591
591
}
@@ -614,7 +614,7 @@ export class TurnkeyPasskeyClient extends TurnkeyBrowserClient {
614
614
* @returns {Promise<Passkey> }
615
615
*/
616
616
createUserPasskey = async (
617
- config : Record < any , any > = { }
617
+ config : Record < any , any > = { } ,
618
618
) : Promise < Passkey > => {
619
619
const challenge = generateRandomBuffer ( ) ;
620
620
const encodedChallenge = base64UrlEncode ( challenge ) ;
@@ -694,15 +694,15 @@ export class TurnkeyPasskeyClient extends TurnkeyBrowserClient {
694
694
userId : string ,
695
695
targetEmbeddedKey : string ,
696
696
expirationSeconds : string = DEFAULT_SESSION_EXPIRATION_IN_SECONDS ,
697
- organizationId ?: string
697
+ organizationId ?: string ,
698
698
) : Promise < ReadWriteSession > => {
699
699
const user = await getStorageValue ( StorageKeys . UserSession ) ;
700
700
organizationId = organizationId ?? user ?. organization . organizationId ;
701
701
userId = userId ?? user ?. userId ;
702
702
703
703
if ( ! organizationId ) {
704
704
throw new Error (
705
- "Error creating passkey session: Organization ID is required"
705
+ "Error creating passkey session: Organization ID is required" ,
706
706
) ;
707
707
}
708
708
@@ -738,7 +738,7 @@ export class TurnkeyPasskeyClient extends TurnkeyBrowserClient {
738
738
credentialBundle,
739
739
sessionExpiry : expiry ,
740
740
} ,
741
- this . authClient
741
+ this . authClient ,
742
742
) ;
743
743
744
744
return {
@@ -763,44 +763,44 @@ export class TurnkeyIframeClient extends TurnkeyBrowserClient {
763
763
}
764
764
765
765
injectCredentialBundle = async (
766
- credentialBundle : string
766
+ credentialBundle : string ,
767
767
) : Promise < boolean > => {
768
768
return await ( this . stamper as IframeStamper ) . injectCredentialBundle (
769
- credentialBundle
769
+ credentialBundle ,
770
770
) ;
771
771
} ;
772
772
773
773
injectWalletExportBundle = async (
774
774
credentialBundle : string ,
775
- organizationId : string
775
+ organizationId : string ,
776
776
) : Promise < boolean > => {
777
777
return await ( this . stamper as IframeStamper ) . injectWalletExportBundle (
778
778
credentialBundle ,
779
- organizationId
779
+ organizationId ,
780
780
) ;
781
781
} ;
782
782
783
783
injectKeyExportBundle = async (
784
784
credentialBundle : string ,
785
785
organizationId : string ,
786
- keyFormat ?: KeyFormat | undefined
786
+ keyFormat ?: KeyFormat | undefined ,
787
787
) : Promise < boolean > => {
788
788
return await ( this . stamper as IframeStamper ) . injectKeyExportBundle (
789
789
credentialBundle ,
790
790
organizationId ,
791
- keyFormat
791
+ keyFormat ,
792
792
) ;
793
793
} ;
794
794
795
795
injectImportBundle = async (
796
796
bundle : string ,
797
797
organizationId : string ,
798
- userId : string
798
+ userId : string ,
799
799
) : Promise < boolean > => {
800
800
return await ( this . stamper as IframeStamper ) . injectImportBundle (
801
801
bundle ,
802
802
organizationId ,
803
- userId
803
+ userId ,
804
804
) ;
805
805
} ;
806
806
0 commit comments