@@ -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 ) ;
@@ -240,7 +240,7 @@ export class TurnkeyBrowserClient extends TurnkeyBaseClient {
240
240
sessionType : SessionType = SessionType . READ_WRITE ,
241
241
iframeClient : TurnkeyIframeClient ,
242
242
targetPublicKey ?: string , // TODO: eventually we want to automatically pull this from localStorage/iframe
243
- expirationSeconds : string = DEFAULT_SESSION_EXPIRATION_IN_SECONDS
243
+ expirationSeconds : string = DEFAULT_SESSION_EXPIRATION_IN_SECONDS ,
244
244
) : Promise < void > => {
245
245
// Create a read-only session
246
246
if ( sessionType === SessionType . READ_ONLY ) {
@@ -260,7 +260,7 @@ export class TurnkeyBrowserClient extends TurnkeyBaseClient {
260
260
if ( sessionType === SessionType . READ_WRITE ) {
261
261
if ( ! targetPublicKey ) {
262
262
throw new Error (
263
- "You must provide a targetPublicKey to create a read-write session."
263
+ "You must provide a targetPublicKey to create a read-write session." ,
264
264
) ;
265
265
}
266
266
@@ -279,7 +279,7 @@ export class TurnkeyBrowserClient extends TurnkeyBaseClient {
279
279
280
280
if ( ! iframeClient ) {
281
281
throw new Error (
282
- "You must provide an iframe client to log in with a passkey."
282
+ "You must provide an iframe client to log in with a passkey." ,
283
283
) ;
284
284
}
285
285
await iframeClient . injectCredentialBundle ( session . token ! ) ;
@@ -303,7 +303,7 @@ export class TurnkeyBrowserClient extends TurnkeyBaseClient {
303
303
loginWithReadWriteSession = async (
304
304
targetEmbeddedKey : string ,
305
305
expirationSeconds : string = DEFAULT_SESSION_EXPIRATION_IN_SECONDS ,
306
- userId ?: string
306
+ userId ?: string ,
307
307
) : Promise < SdkApiTypes . TCreateReadWriteSessionResponse > => {
308
308
const readWriteSessionResult = await this . createReadWriteSession ( {
309
309
targetPublicKey : targetEmbeddedKey ,
@@ -333,7 +333,7 @@ export class TurnkeyBrowserClient extends TurnkeyBaseClient {
333
333
*/
334
334
loginWithAuthBundle = async (
335
335
credentialBundle : string ,
336
- expirationSeconds : string = DEFAULT_SESSION_EXPIRATION_IN_SECONDS
336
+ expirationSeconds : string = DEFAULT_SESSION_EXPIRATION_IN_SECONDS ,
337
337
) : Promise < any > => {
338
338
try {
339
339
const whoAmIResult = await this . getWhoami ( ) ;
@@ -387,20 +387,20 @@ export class TurnkeyBrowserClient extends TurnkeyBaseClient {
387
387
388
388
if ( phoneNumber ) {
389
389
promises . push (
390
- this . updateUser ( { userId, userPhoneNumber : "" , userTagIds : [ ] } )
390
+ this . updateUser ( { userId, userPhoneNumber : "" , userTagIds : [ ] } ) ,
391
391
) ;
392
392
}
393
393
if ( email ) {
394
394
promises . push (
395
- this . updateUser ( { userId, userEmail : "" , userTagIds : [ ] } )
395
+ this . updateUser ( { userId, userEmail : "" , userTagIds : [ ] } ) ,
396
396
) ;
397
397
}
398
398
if ( authenticatorIds && authenticatorIds . length > 0 ) {
399
399
promises . push ( this . deleteAuthenticators ( { userId, authenticatorIds } ) ) ;
400
400
}
401
401
if ( oauthProviderIds && oauthProviderIds . length > 0 ) {
402
402
promises . push (
403
- this . deleteOauthProviders ( { userId, providerIds : oauthProviderIds } )
403
+ this . deleteOauthProviders ( { userId, providerIds : oauthProviderIds } ) ,
404
404
) ;
405
405
}
406
406
if ( apiKeyIds && apiKeyIds . length > 0 ) {
@@ -455,12 +455,12 @@ export class TurnkeyBrowserClient extends TurnkeyBaseClient {
455
455
userId,
456
456
userPhoneNumber : phoneNumber ,
457
457
userTagIds : [ ] ,
458
- } )
458
+ } ) ,
459
459
) ;
460
460
}
461
461
if ( email ) {
462
462
promises . push (
463
- this . updateUser ( { userId, userEmail : email , userTagIds : [ ] } )
463
+ this . updateUser ( { userId, userEmail : email , userTagIds : [ ] } ) ,
464
464
) ;
465
465
}
466
466
if ( authenticators && authenticators . length > 0 ) {
@@ -525,7 +525,7 @@ export class TurnkeyBrowserClient extends TurnkeyBaseClient {
525
525
}
526
526
if ( Object . keys ( userUpdates ) . length > 0 ) {
527
527
promises . push (
528
- this . updateUser ( { userId, ...userUpdates , userTagIds : [ ] } )
528
+ this . updateUser ( { userId, ...userUpdates , userTagIds : [ ] } ) ,
529
529
) ;
530
530
}
531
531
@@ -536,15 +536,15 @@ export class TurnkeyBrowserClient extends TurnkeyBaseClient {
536
536
this . createAuthenticators ( {
537
537
userId,
538
538
authenticators : authenticators . add ,
539
- } )
539
+ } ) ,
540
540
) ;
541
541
}
542
542
if ( authenticators . deleteIds ?. length ) {
543
543
promises . push (
544
544
this . deleteAuthenticators ( {
545
545
userId,
546
546
authenticatorIds : authenticators . deleteIds ,
547
- } )
547
+ } ) ,
548
548
) ;
549
549
}
550
550
}
@@ -556,15 +556,15 @@ export class TurnkeyBrowserClient extends TurnkeyBaseClient {
556
556
this . createOauthProviders ( {
557
557
userId,
558
558
oauthProviders : oauthProviders . add ,
559
- } )
559
+ } ) ,
560
560
) ;
561
561
}
562
562
if ( oauthProviders . deleteIds ?. length ) {
563
563
promises . push (
564
564
this . deleteOauthProviders ( {
565
565
userId,
566
566
providerIds : oauthProviders . deleteIds ,
567
- } )
567
+ } ) ,
568
568
) ;
569
569
}
570
570
}
@@ -576,15 +576,15 @@ export class TurnkeyBrowserClient extends TurnkeyBaseClient {
576
576
this . createApiKeys ( {
577
577
userId,
578
578
apiKeys : apiKeys . add ,
579
- } )
579
+ } ) ,
580
580
) ;
581
581
}
582
582
if ( apiKeys . deleteIds ?. length ) {
583
583
promises . push (
584
584
this . deleteApiKeys ( {
585
585
userId,
586
586
apiKeyIds : apiKeys . deleteIds ,
587
- } )
587
+ } ) ,
588
588
) ;
589
589
}
590
590
}
@@ -613,7 +613,7 @@ export class TurnkeyPasskeyClient extends TurnkeyBrowserClient {
613
613
* @returns {Promise<Passkey> }
614
614
*/
615
615
createUserPasskey = async (
616
- config : Record < any , any > = { }
616
+ config : Record < any , any > = { } ,
617
617
) : Promise < Passkey > => {
618
618
const challenge = generateRandomBuffer ( ) ;
619
619
const encodedChallenge = base64UrlEncode ( challenge ) ;
@@ -693,15 +693,15 @@ export class TurnkeyPasskeyClient extends TurnkeyBrowserClient {
693
693
userId : string ,
694
694
targetEmbeddedKey : string ,
695
695
expirationSeconds : string = DEFAULT_SESSION_EXPIRATION_IN_SECONDS ,
696
- organizationId ?: string
696
+ organizationId ?: string ,
697
697
) : Promise < ReadWriteSession > => {
698
698
const user = await getStorageValue ( StorageKeys . UserSession ) ;
699
699
organizationId = organizationId ?? user ?. organization . organizationId ;
700
700
userId = userId ?? user ?. userId ;
701
701
702
702
if ( ! organizationId ) {
703
703
throw new Error (
704
- "Error creating passkey session: Organization ID is required"
704
+ "Error creating passkey session: Organization ID is required" ,
705
705
) ;
706
706
}
707
707
@@ -737,7 +737,7 @@ export class TurnkeyPasskeyClient extends TurnkeyBrowserClient {
737
737
credentialBundle,
738
738
sessionExpiry : expiry ,
739
739
} ,
740
- this . authClient
740
+ this . authClient ,
741
741
) ;
742
742
743
743
return {
@@ -762,44 +762,44 @@ export class TurnkeyIframeClient extends TurnkeyBrowserClient {
762
762
}
763
763
764
764
injectCredentialBundle = async (
765
- credentialBundle : string
765
+ credentialBundle : string ,
766
766
) : Promise < boolean > => {
767
767
return await ( this . stamper as IframeStamper ) . injectCredentialBundle (
768
- credentialBundle
768
+ credentialBundle ,
769
769
) ;
770
770
} ;
771
771
772
772
injectWalletExportBundle = async (
773
773
credentialBundle : string ,
774
- organizationId : string
774
+ organizationId : string ,
775
775
) : Promise < boolean > => {
776
776
return await ( this . stamper as IframeStamper ) . injectWalletExportBundle (
777
777
credentialBundle ,
778
- organizationId
778
+ organizationId ,
779
779
) ;
780
780
} ;
781
781
782
782
injectKeyExportBundle = async (
783
783
credentialBundle : string ,
784
784
organizationId : string ,
785
- keyFormat ?: KeyFormat | undefined
785
+ keyFormat ?: KeyFormat | undefined ,
786
786
) : Promise < boolean > => {
787
787
return await ( this . stamper as IframeStamper ) . injectKeyExportBundle (
788
788
credentialBundle ,
789
789
organizationId ,
790
- keyFormat
790
+ keyFormat ,
791
791
) ;
792
792
} ;
793
793
794
794
injectImportBundle = async (
795
795
bundle : string ,
796
796
organizationId : string ,
797
- userId : string
797
+ userId : string ,
798
798
) : Promise < boolean > => {
799
799
return await ( this . stamper as IframeStamper ) . injectImportBundle (
800
800
bundle ,
801
801
organizationId ,
802
- userId
802
+ userId ,
803
803
) ;
804
804
} ;
805
805
0 commit comments