@fogo/sessions-sdk 0.0.12 → 0.0.13

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/cjs/index.d.ts CHANGED
@@ -1,15 +1,16 @@
1
- import type { TransactionError, Connection } from "@solana/web3.js";
1
+ import type { Connection, TransactionError } from "@solana/web3.js";
2
2
  import { PublicKey } from "@solana/web3.js";
3
3
  import BN from "bn.js";
4
4
  import { z } from "zod";
5
5
  import type { SessionAdapter, TransactionResult } from "./adapter.js";
6
- export { type SessionAdapter, type TransactionResult, TransactionResultType, createSolanaWalletAdapter, } from "./adapter.js";
6
+ export { createSolanaWalletAdapter, TransactionResultType, type SessionAdapter, type TransactionResult, } from "./adapter.js";
7
7
  type EstablishSessionOptions = {
8
8
  adapter: SessionAdapter;
9
9
  walletPublicKey: PublicKey;
10
10
  signMessage: (message: Uint8Array) => Promise<Uint8Array>;
11
11
  expires: Date;
12
12
  extra?: string | undefined;
13
+ createUnsafeExtractableSessionKey?: boolean | undefined;
13
14
  } & ({
14
15
  limits?: Map<PublicKey, bigint>;
15
16
  unlimited?: false;
@@ -29,6 +30,10 @@ export declare const replaceSession: (options: {
29
30
  } | {
30
31
  unlimited: true;
31
32
  })) => Promise<EstablishSessionResult>;
33
+ export declare const revokeSession: (options: {
34
+ adapter: SessionAdapter;
35
+ session: Session;
36
+ }) => Promise<TransactionResult | undefined>;
32
37
  export declare const reestablishSession: (adapter: SessionAdapter, walletPublicKey: PublicKey, sessionKey: CryptoKeyPair) => Promise<Session | undefined>;
33
38
  export declare const getSessionAccount: (connection: Connection, sessionPublicKey: PublicKey) => Promise<{
34
39
  authorizedPrograms: {
@@ -44,176 +49,682 @@ export declare const getSessionAccount: (connection: Connection, sessionPublicKe
44
49
  expiration: Date;
45
50
  extra: unknown;
46
51
  major: number;
47
- minor: number;
52
+ minor: 1 | 2;
48
53
  user: PublicKey;
54
+ sponsor: PublicKey;
49
55
  } | undefined>;
50
56
  declare const sessionInfoSchema: z.ZodEffects<z.ZodObject<{
51
- session_info: z.ZodObject<{
52
- authorized_programs: z.ZodUnion<[z.ZodObject<{
53
- Specific: z.ZodObject<{
54
- 0: z.ZodArray<z.ZodObject<{
55
- program_id: z.ZodType<PublicKey, z.ZodTypeDef, PublicKey>;
56
- signer_pda: z.ZodType<PublicKey, z.ZodTypeDef, PublicKey>;
57
+ session_info: z.ZodUnion<[z.ZodObject<{
58
+ V1: z.ZodObject<{
59
+ "0": z.ZodObject<{
60
+ authorized_programs: z.ZodUnion<[z.ZodObject<{
61
+ Specific: z.ZodObject<{
62
+ 0: z.ZodArray<z.ZodObject<{
63
+ program_id: z.ZodType<PublicKey, z.ZodTypeDef, PublicKey>;
64
+ signer_pda: z.ZodType<PublicKey, z.ZodTypeDef, PublicKey>;
65
+ }, "strip", z.ZodTypeAny, {
66
+ program_id: PublicKey;
67
+ signer_pda: PublicKey;
68
+ }, {
69
+ program_id: PublicKey;
70
+ signer_pda: PublicKey;
71
+ }>, "many">;
72
+ }, "strip", z.ZodTypeAny, {
73
+ 0: {
74
+ program_id: PublicKey;
75
+ signer_pda: PublicKey;
76
+ }[];
77
+ }, {
78
+ 0: {
79
+ program_id: PublicKey;
80
+ signer_pda: PublicKey;
81
+ }[];
82
+ }>;
83
+ }, "strip", z.ZodTypeAny, {
84
+ Specific: {
85
+ 0: {
86
+ program_id: PublicKey;
87
+ signer_pda: PublicKey;
88
+ }[];
89
+ };
90
+ }, {
91
+ Specific: {
92
+ 0: {
93
+ program_id: PublicKey;
94
+ signer_pda: PublicKey;
95
+ }[];
96
+ };
97
+ }>, z.ZodObject<{
98
+ All: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
99
+ }, "strip", z.ZodTypeAny, {
100
+ All: {};
101
+ }, {
102
+ All: {};
103
+ }>]>;
104
+ authorized_tokens: z.ZodUnion<[z.ZodObject<{
105
+ Specific: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
106
+ }, "strip", z.ZodTypeAny, {
107
+ Specific: {};
108
+ }, {
109
+ Specific: {};
110
+ }>, z.ZodObject<{
111
+ All: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
57
112
  }, "strip", z.ZodTypeAny, {
58
- program_id: PublicKey;
59
- signer_pda: PublicKey;
113
+ All: {};
60
114
  }, {
61
- program_id: PublicKey;
62
- signer_pda: PublicKey;
63
- }>, "many">;
115
+ All: {};
116
+ }>]>;
117
+ expiration: z.ZodType<BN, z.ZodTypeDef, BN>;
118
+ extra: z.ZodObject<{
119
+ 0: z.ZodUnknown;
120
+ }, "strip", z.ZodTypeAny, {
121
+ 0?: unknown;
122
+ }, {
123
+ 0?: unknown;
124
+ }>;
125
+ user: z.ZodType<PublicKey, z.ZodTypeDef, PublicKey>;
64
126
  }, "strip", z.ZodTypeAny, {
65
- 0: {
66
- program_id: PublicKey;
67
- signer_pda: PublicKey;
68
- }[];
127
+ authorized_programs: {
128
+ Specific: {
129
+ 0: {
130
+ program_id: PublicKey;
131
+ signer_pda: PublicKey;
132
+ }[];
133
+ };
134
+ } | {
135
+ All: {};
136
+ };
137
+ authorized_tokens: {
138
+ Specific: {};
139
+ } | {
140
+ All: {};
141
+ };
142
+ expiration: BN;
143
+ extra: {
144
+ 0?: unknown;
145
+ };
146
+ user: PublicKey;
69
147
  }, {
70
- 0: {
71
- program_id: PublicKey;
72
- signer_pda: PublicKey;
73
- }[];
148
+ authorized_programs: {
149
+ Specific: {
150
+ 0: {
151
+ program_id: PublicKey;
152
+ signer_pda: PublicKey;
153
+ }[];
154
+ };
155
+ } | {
156
+ All: {};
157
+ };
158
+ authorized_tokens: {
159
+ Specific: {};
160
+ } | {
161
+ All: {};
162
+ };
163
+ expiration: BN;
164
+ extra: {
165
+ 0?: unknown;
166
+ };
167
+ user: PublicKey;
74
168
  }>;
75
169
  }, "strip", z.ZodTypeAny, {
76
- Specific: {
77
- 0: {
78
- program_id: PublicKey;
79
- signer_pda: PublicKey;
80
- }[];
170
+ "0": {
171
+ authorized_programs: {
172
+ Specific: {
173
+ 0: {
174
+ program_id: PublicKey;
175
+ signer_pda: PublicKey;
176
+ }[];
177
+ };
178
+ } | {
179
+ All: {};
180
+ };
181
+ authorized_tokens: {
182
+ Specific: {};
183
+ } | {
184
+ All: {};
185
+ };
186
+ expiration: BN;
187
+ extra: {
188
+ 0?: unknown;
189
+ };
190
+ user: PublicKey;
81
191
  };
82
192
  }, {
83
- Specific: {
84
- 0: {
85
- program_id: PublicKey;
86
- signer_pda: PublicKey;
87
- }[];
193
+ "0": {
194
+ authorized_programs: {
195
+ Specific: {
196
+ 0: {
197
+ program_id: PublicKey;
198
+ signer_pda: PublicKey;
199
+ }[];
200
+ };
201
+ } | {
202
+ All: {};
203
+ };
204
+ authorized_tokens: {
205
+ Specific: {};
206
+ } | {
207
+ All: {};
208
+ };
209
+ expiration: BN;
210
+ extra: {
211
+ 0?: unknown;
212
+ };
213
+ user: PublicKey;
88
214
  };
89
- }>, z.ZodObject<{
90
- All: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
91
- }, "strip", z.ZodTypeAny, {
92
- All: {};
93
- }, {
94
- All: {};
95
- }>]>;
96
- authorized_tokens: z.ZodUnion<[z.ZodObject<{
97
- Specific: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
98
- }, "strip", z.ZodTypeAny, {
99
- Specific: {};
100
- }, {
101
- Specific: {};
102
- }>, z.ZodObject<{
103
- All: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
104
- }, "strip", z.ZodTypeAny, {
105
- All: {};
106
- }, {
107
- All: {};
108
- }>]>;
109
- expiration: z.ZodType<BN, z.ZodTypeDef, BN>;
110
- extra: z.ZodObject<{
111
- 0: z.ZodUnknown;
112
- }, "strip", z.ZodTypeAny, {
113
- 0?: unknown;
114
- }, {
115
- 0?: unknown;
116
215
  }>;
117
- major: z.ZodNumber;
118
- minor: z.ZodNumber;
119
- user: z.ZodType<PublicKey, z.ZodTypeDef, PublicKey>;
120
216
  }, "strip", z.ZodTypeAny, {
121
- authorized_programs: {
122
- Specific: {
123
- 0: {
124
- program_id: PublicKey;
125
- signer_pda: PublicKey;
126
- }[];
217
+ V1: {
218
+ "0": {
219
+ authorized_programs: {
220
+ Specific: {
221
+ 0: {
222
+ program_id: PublicKey;
223
+ signer_pda: PublicKey;
224
+ }[];
225
+ };
226
+ } | {
227
+ All: {};
228
+ };
229
+ authorized_tokens: {
230
+ Specific: {};
231
+ } | {
232
+ All: {};
233
+ };
234
+ expiration: BN;
235
+ extra: {
236
+ 0?: unknown;
237
+ };
238
+ user: PublicKey;
127
239
  };
128
- } | {
129
- All: {};
130
- };
131
- authorized_tokens: {
132
- Specific: {};
133
- } | {
134
- All: {};
135
- };
136
- expiration: BN;
137
- extra: {
138
- 0?: unknown;
139
240
  };
140
- major: number;
141
- minor: number;
142
- user: PublicKey;
143
241
  }, {
144
- authorized_programs: {
145
- Specific: {
146
- 0: {
147
- program_id: PublicKey;
148
- signer_pda: PublicKey;
149
- }[];
242
+ V1: {
243
+ "0": {
244
+ authorized_programs: {
245
+ Specific: {
246
+ 0: {
247
+ program_id: PublicKey;
248
+ signer_pda: PublicKey;
249
+ }[];
250
+ };
251
+ } | {
252
+ All: {};
253
+ };
254
+ authorized_tokens: {
255
+ Specific: {};
256
+ } | {
257
+ All: {};
258
+ };
259
+ expiration: BN;
260
+ extra: {
261
+ 0?: unknown;
262
+ };
263
+ user: PublicKey;
150
264
  };
151
- } | {
152
- All: {};
153
265
  };
154
- authorized_tokens: {
155
- Specific: {};
156
- } | {
157
- All: {};
266
+ }>, z.ZodObject<{
267
+ V2: z.ZodObject<{
268
+ "0": z.ZodUnion<[z.ZodObject<{
269
+ Revoked: z.ZodType<BN, z.ZodTypeDef, BN>;
270
+ }, "strip", z.ZodTypeAny, {
271
+ Revoked: BN;
272
+ }, {
273
+ Revoked: BN;
274
+ }>, z.ZodObject<{
275
+ Active: z.ZodObject<{
276
+ "0": z.ZodObject<{
277
+ authorized_programs: z.ZodUnion<[z.ZodObject<{
278
+ Specific: z.ZodObject<{
279
+ 0: z.ZodArray<z.ZodObject<{
280
+ program_id: z.ZodType<PublicKey, z.ZodTypeDef, PublicKey>;
281
+ signer_pda: z.ZodType<PublicKey, z.ZodTypeDef, PublicKey>;
282
+ }, "strip", z.ZodTypeAny, {
283
+ program_id: PublicKey;
284
+ signer_pda: PublicKey;
285
+ }, {
286
+ program_id: PublicKey;
287
+ signer_pda: PublicKey;
288
+ }>, "many">;
289
+ }, "strip", z.ZodTypeAny, {
290
+ 0: {
291
+ program_id: PublicKey;
292
+ signer_pda: PublicKey;
293
+ }[];
294
+ }, {
295
+ 0: {
296
+ program_id: PublicKey;
297
+ signer_pda: PublicKey;
298
+ }[];
299
+ }>;
300
+ }, "strip", z.ZodTypeAny, {
301
+ Specific: {
302
+ 0: {
303
+ program_id: PublicKey;
304
+ signer_pda: PublicKey;
305
+ }[];
306
+ };
307
+ }, {
308
+ Specific: {
309
+ 0: {
310
+ program_id: PublicKey;
311
+ signer_pda: PublicKey;
312
+ }[];
313
+ };
314
+ }>, z.ZodObject<{
315
+ All: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
316
+ }, "strip", z.ZodTypeAny, {
317
+ All: {};
318
+ }, {
319
+ All: {};
320
+ }>]>;
321
+ authorized_tokens: z.ZodUnion<[z.ZodObject<{
322
+ Specific: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
323
+ }, "strip", z.ZodTypeAny, {
324
+ Specific: {};
325
+ }, {
326
+ Specific: {};
327
+ }>, z.ZodObject<{
328
+ All: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
329
+ }, "strip", z.ZodTypeAny, {
330
+ All: {};
331
+ }, {
332
+ All: {};
333
+ }>]>;
334
+ expiration: z.ZodType<BN, z.ZodTypeDef, BN>;
335
+ extra: z.ZodObject<{
336
+ 0: z.ZodUnknown;
337
+ }, "strip", z.ZodTypeAny, {
338
+ 0?: unknown;
339
+ }, {
340
+ 0?: unknown;
341
+ }>;
342
+ user: z.ZodType<PublicKey, z.ZodTypeDef, PublicKey>;
343
+ }, "strip", z.ZodTypeAny, {
344
+ authorized_programs: {
345
+ Specific: {
346
+ 0: {
347
+ program_id: PublicKey;
348
+ signer_pda: PublicKey;
349
+ }[];
350
+ };
351
+ } | {
352
+ All: {};
353
+ };
354
+ authorized_tokens: {
355
+ Specific: {};
356
+ } | {
357
+ All: {};
358
+ };
359
+ expiration: BN;
360
+ extra: {
361
+ 0?: unknown;
362
+ };
363
+ user: PublicKey;
364
+ }, {
365
+ authorized_programs: {
366
+ Specific: {
367
+ 0: {
368
+ program_id: PublicKey;
369
+ signer_pda: PublicKey;
370
+ }[];
371
+ };
372
+ } | {
373
+ All: {};
374
+ };
375
+ authorized_tokens: {
376
+ Specific: {};
377
+ } | {
378
+ All: {};
379
+ };
380
+ expiration: BN;
381
+ extra: {
382
+ 0?: unknown;
383
+ };
384
+ user: PublicKey;
385
+ }>;
386
+ }, "strip", z.ZodTypeAny, {
387
+ "0": {
388
+ authorized_programs: {
389
+ Specific: {
390
+ 0: {
391
+ program_id: PublicKey;
392
+ signer_pda: PublicKey;
393
+ }[];
394
+ };
395
+ } | {
396
+ All: {};
397
+ };
398
+ authorized_tokens: {
399
+ Specific: {};
400
+ } | {
401
+ All: {};
402
+ };
403
+ expiration: BN;
404
+ extra: {
405
+ 0?: unknown;
406
+ };
407
+ user: PublicKey;
408
+ };
409
+ }, {
410
+ "0": {
411
+ authorized_programs: {
412
+ Specific: {
413
+ 0: {
414
+ program_id: PublicKey;
415
+ signer_pda: PublicKey;
416
+ }[];
417
+ };
418
+ } | {
419
+ All: {};
420
+ };
421
+ authorized_tokens: {
422
+ Specific: {};
423
+ } | {
424
+ All: {};
425
+ };
426
+ expiration: BN;
427
+ extra: {
428
+ 0?: unknown;
429
+ };
430
+ user: PublicKey;
431
+ };
432
+ }>;
433
+ }, "strip", z.ZodTypeAny, {
434
+ Active: {
435
+ "0": {
436
+ authorized_programs: {
437
+ Specific: {
438
+ 0: {
439
+ program_id: PublicKey;
440
+ signer_pda: PublicKey;
441
+ }[];
442
+ };
443
+ } | {
444
+ All: {};
445
+ };
446
+ authorized_tokens: {
447
+ Specific: {};
448
+ } | {
449
+ All: {};
450
+ };
451
+ expiration: BN;
452
+ extra: {
453
+ 0?: unknown;
454
+ };
455
+ user: PublicKey;
456
+ };
457
+ };
458
+ }, {
459
+ Active: {
460
+ "0": {
461
+ authorized_programs: {
462
+ Specific: {
463
+ 0: {
464
+ program_id: PublicKey;
465
+ signer_pda: PublicKey;
466
+ }[];
467
+ };
468
+ } | {
469
+ All: {};
470
+ };
471
+ authorized_tokens: {
472
+ Specific: {};
473
+ } | {
474
+ All: {};
475
+ };
476
+ expiration: BN;
477
+ extra: {
478
+ 0?: unknown;
479
+ };
480
+ user: PublicKey;
481
+ };
482
+ };
483
+ }>]>;
484
+ }, "strip", z.ZodTypeAny, {
485
+ "0": {
486
+ Revoked: BN;
487
+ } | {
488
+ Active: {
489
+ "0": {
490
+ authorized_programs: {
491
+ Specific: {
492
+ 0: {
493
+ program_id: PublicKey;
494
+ signer_pda: PublicKey;
495
+ }[];
496
+ };
497
+ } | {
498
+ All: {};
499
+ };
500
+ authorized_tokens: {
501
+ Specific: {};
502
+ } | {
503
+ All: {};
504
+ };
505
+ expiration: BN;
506
+ extra: {
507
+ 0?: unknown;
508
+ };
509
+ user: PublicKey;
510
+ };
511
+ };
512
+ };
513
+ }, {
514
+ "0": {
515
+ Revoked: BN;
516
+ } | {
517
+ Active: {
518
+ "0": {
519
+ authorized_programs: {
520
+ Specific: {
521
+ 0: {
522
+ program_id: PublicKey;
523
+ signer_pda: PublicKey;
524
+ }[];
525
+ };
526
+ } | {
527
+ All: {};
528
+ };
529
+ authorized_tokens: {
530
+ Specific: {};
531
+ } | {
532
+ All: {};
533
+ };
534
+ expiration: BN;
535
+ extra: {
536
+ 0?: unknown;
537
+ };
538
+ user: PublicKey;
539
+ };
540
+ };
541
+ };
542
+ }>;
543
+ }, "strip", z.ZodTypeAny, {
544
+ V2: {
545
+ "0": {
546
+ Revoked: BN;
547
+ } | {
548
+ Active: {
549
+ "0": {
550
+ authorized_programs: {
551
+ Specific: {
552
+ 0: {
553
+ program_id: PublicKey;
554
+ signer_pda: PublicKey;
555
+ }[];
556
+ };
557
+ } | {
558
+ All: {};
559
+ };
560
+ authorized_tokens: {
561
+ Specific: {};
562
+ } | {
563
+ All: {};
564
+ };
565
+ expiration: BN;
566
+ extra: {
567
+ 0?: unknown;
568
+ };
569
+ user: PublicKey;
570
+ };
571
+ };
572
+ };
158
573
  };
159
- expiration: BN;
160
- extra: {
161
- 0?: unknown;
574
+ }, {
575
+ V2: {
576
+ "0": {
577
+ Revoked: BN;
578
+ } | {
579
+ Active: {
580
+ "0": {
581
+ authorized_programs: {
582
+ Specific: {
583
+ 0: {
584
+ program_id: PublicKey;
585
+ signer_pda: PublicKey;
586
+ }[];
587
+ };
588
+ } | {
589
+ All: {};
590
+ };
591
+ authorized_tokens: {
592
+ Specific: {};
593
+ } | {
594
+ All: {};
595
+ };
596
+ expiration: BN;
597
+ extra: {
598
+ 0?: unknown;
599
+ };
600
+ user: PublicKey;
601
+ };
602
+ };
603
+ };
162
604
  };
163
- major: number;
164
- minor: number;
165
- user: PublicKey;
166
- }>;
605
+ }>]>;
606
+ major: z.ZodNumber;
607
+ sponsor: z.ZodType<PublicKey, z.ZodTypeDef, PublicKey>;
167
608
  }, "strip", z.ZodTypeAny, {
609
+ sponsor: PublicKey;
168
610
  session_info: {
169
- authorized_programs: {
170
- Specific: {
171
- 0: {
172
- program_id: PublicKey;
173
- signer_pda: PublicKey;
174
- }[];
611
+ V1: {
612
+ "0": {
613
+ authorized_programs: {
614
+ Specific: {
615
+ 0: {
616
+ program_id: PublicKey;
617
+ signer_pda: PublicKey;
618
+ }[];
619
+ };
620
+ } | {
621
+ All: {};
622
+ };
623
+ authorized_tokens: {
624
+ Specific: {};
625
+ } | {
626
+ All: {};
627
+ };
628
+ expiration: BN;
629
+ extra: {
630
+ 0?: unknown;
631
+ };
632
+ user: PublicKey;
175
633
  };
176
- } | {
177
- All: {};
178
- };
179
- authorized_tokens: {
180
- Specific: {};
181
- } | {
182
- All: {};
183
634
  };
184
- expiration: BN;
185
- extra: {
186
- 0?: unknown;
635
+ } | {
636
+ V2: {
637
+ "0": {
638
+ Revoked: BN;
639
+ } | {
640
+ Active: {
641
+ "0": {
642
+ authorized_programs: {
643
+ Specific: {
644
+ 0: {
645
+ program_id: PublicKey;
646
+ signer_pda: PublicKey;
647
+ }[];
648
+ };
649
+ } | {
650
+ All: {};
651
+ };
652
+ authorized_tokens: {
653
+ Specific: {};
654
+ } | {
655
+ All: {};
656
+ };
657
+ expiration: BN;
658
+ extra: {
659
+ 0?: unknown;
660
+ };
661
+ user: PublicKey;
662
+ };
663
+ };
664
+ };
187
665
  };
188
- major: number;
189
- minor: number;
190
- user: PublicKey;
191
666
  };
667
+ major: number;
192
668
  }, {
669
+ sponsor: PublicKey;
193
670
  session_info: {
194
- authorized_programs: {
195
- Specific: {
196
- 0: {
197
- program_id: PublicKey;
198
- signer_pda: PublicKey;
199
- }[];
671
+ V1: {
672
+ "0": {
673
+ authorized_programs: {
674
+ Specific: {
675
+ 0: {
676
+ program_id: PublicKey;
677
+ signer_pda: PublicKey;
678
+ }[];
679
+ };
680
+ } | {
681
+ All: {};
682
+ };
683
+ authorized_tokens: {
684
+ Specific: {};
685
+ } | {
686
+ All: {};
687
+ };
688
+ expiration: BN;
689
+ extra: {
690
+ 0?: unknown;
691
+ };
692
+ user: PublicKey;
200
693
  };
201
- } | {
202
- All: {};
203
- };
204
- authorized_tokens: {
205
- Specific: {};
206
- } | {
207
- All: {};
208
694
  };
209
- expiration: BN;
210
- extra: {
211
- 0?: unknown;
695
+ } | {
696
+ V2: {
697
+ "0": {
698
+ Revoked: BN;
699
+ } | {
700
+ Active: {
701
+ "0": {
702
+ authorized_programs: {
703
+ Specific: {
704
+ 0: {
705
+ program_id: PublicKey;
706
+ signer_pda: PublicKey;
707
+ }[];
708
+ };
709
+ } | {
710
+ All: {};
711
+ };
712
+ authorized_tokens: {
713
+ Specific: {};
714
+ } | {
715
+ All: {};
716
+ };
717
+ expiration: BN;
718
+ extra: {
719
+ 0?: unknown;
720
+ };
721
+ user: PublicKey;
722
+ };
723
+ };
724
+ };
212
725
  };
213
- major: number;
214
- minor: number;
215
- user: PublicKey;
216
726
  };
727
+ major: number;
217
728
  }>, {
218
729
  authorizedPrograms: {
219
730
  type: AuthorizedProgramsType.All;
@@ -228,33 +739,69 @@ declare const sessionInfoSchema: z.ZodEffects<z.ZodObject<{
228
739
  expiration: Date;
229
740
  extra: unknown;
230
741
  major: number;
231
- minor: number;
742
+ minor: 1 | 2;
232
743
  user: PublicKey;
233
- }, {
744
+ sponsor: PublicKey;
745
+ } | undefined, {
746
+ sponsor: PublicKey;
234
747
  session_info: {
235
- authorized_programs: {
236
- Specific: {
237
- 0: {
238
- program_id: PublicKey;
239
- signer_pda: PublicKey;
240
- }[];
748
+ V1: {
749
+ "0": {
750
+ authorized_programs: {
751
+ Specific: {
752
+ 0: {
753
+ program_id: PublicKey;
754
+ signer_pda: PublicKey;
755
+ }[];
756
+ };
757
+ } | {
758
+ All: {};
759
+ };
760
+ authorized_tokens: {
761
+ Specific: {};
762
+ } | {
763
+ All: {};
764
+ };
765
+ expiration: BN;
766
+ extra: {
767
+ 0?: unknown;
768
+ };
769
+ user: PublicKey;
241
770
  };
242
- } | {
243
- All: {};
244
771
  };
245
- authorized_tokens: {
246
- Specific: {};
247
- } | {
248
- All: {};
249
- };
250
- expiration: BN;
251
- extra: {
252
- 0?: unknown;
772
+ } | {
773
+ V2: {
774
+ "0": {
775
+ Revoked: BN;
776
+ } | {
777
+ Active: {
778
+ "0": {
779
+ authorized_programs: {
780
+ Specific: {
781
+ 0: {
782
+ program_id: PublicKey;
783
+ signer_pda: PublicKey;
784
+ }[];
785
+ };
786
+ } | {
787
+ All: {};
788
+ };
789
+ authorized_tokens: {
790
+ Specific: {};
791
+ } | {
792
+ All: {};
793
+ };
794
+ expiration: BN;
795
+ extra: {
796
+ 0?: unknown;
797
+ };
798
+ user: PublicKey;
799
+ };
800
+ };
801
+ };
253
802
  };
254
- major: number;
255
- minor: number;
256
- user: PublicKey;
257
803
  };
804
+ major: number;
258
805
  }>;
259
806
  export declare enum AuthorizedProgramsType {
260
807
  All = 0,
@@ -288,7 +835,7 @@ export type Session = {
288
835
  walletPublicKey: PublicKey;
289
836
  payer: PublicKey;
290
837
  sendTransaction: (instructions: Parameters<SessionAdapter["sendTransaction"]>[1]) => Promise<TransactionResult>;
291
- sessionInfo: z.infer<typeof sessionInfoSchema>;
838
+ sessionInfo: NonNullable<z.infer<typeof sessionInfoSchema>>;
292
839
  };
293
840
  type SendTransferOptions = {
294
841
  adapter: SessionAdapter;
@@ -299,3 +846,33 @@ type SendTransferOptions = {
299
846
  recipient: PublicKey;
300
847
  };
301
848
  export declare const sendTransfer: (options: SendTransferOptions) => Promise<TransactionResult>;
849
+ /**
850
+ * Create a login token signed with the session key
851
+ * @param session - The session to create a login token for
852
+ * @returns The login token
853
+ */
854
+ export declare const createLogInToken: (session: Session) => Promise<string>;
855
+ /**
856
+ * Verify a login token
857
+ * @param token - The login token to verify against the session public key
858
+ * @param connection - The connection to use to get the session account
859
+ * @returns The session account if the token is valid, otherwise undefined
860
+ */
861
+ export declare const verifyLogInToken: (token: string, connection: Connection) => Promise<{
862
+ authorizedPrograms: {
863
+ type: AuthorizedProgramsType.All;
864
+ } | {
865
+ type: AuthorizedProgramsType.Specific;
866
+ programs: {
867
+ programId: PublicKey;
868
+ signerPda: PublicKey;
869
+ }[];
870
+ };
871
+ authorizedTokens: AuthorizedTokens;
872
+ expiration: Date;
873
+ extra: unknown;
874
+ major: number;
875
+ minor: 1 | 2;
876
+ user: PublicKey;
877
+ sponsor: PublicKey;
878
+ } | undefined>;