@0xsequence/guard 2.3.37 → 2.3.39

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.
@@ -18,19 +18,14 @@ function _extends() {
18
18
  }
19
19
 
20
20
  /* eslint-disable */
21
- // sequence-guard v0.4.0 776b307c2145ac7a994eec63240acae042c96067
21
+ // sequence-guard v0.5.0 910e01c32ffb24b42386d4ca6be119b0acc55c5f
22
22
  // --
23
23
  // Code generated by webrpc-gen@v0.25.3 with typescript generator. DO NOT EDIT.
24
24
  //
25
25
  // webrpc-gen -schema=guard.ridl -target=typescript -client -out=./clients/guard.gen.ts
26
26
 
27
27
  const WebrpcHeader = 'Webrpc';
28
- const WebrpcHeaderValue = 'webrpc@v0.25.3;gen-typescript@v0.17.0;sequence-guard@v0.4.0';
29
-
30
- //
31
- // Types
32
- //
33
-
28
+ const WebrpcHeaderValue = 'webrpc@v0.25.3;gen-typescript@v0.17.0;sequence-guard@v0.5.0';
34
29
  //
35
30
  // Client
36
31
  //
@@ -458,6 +453,18 @@ class NotFoundError extends WebrpcError {
458
453
  Object.setPrototypeOf(this, NotFoundError.prototype);
459
454
  }
460
455
  }
456
+ class RequiresTOTPError extends WebrpcError {
457
+ constructor(name = 'RequiresTOTP', code = 6600, message = `TOTP is required`, status = 0, cause) {
458
+ super(name, code, message, status, cause);
459
+ Object.setPrototypeOf(this, RequiresTOTPError.prototype);
460
+ }
461
+ }
462
+ class RequiresPINError extends WebrpcError {
463
+ constructor(name = 'RequiresPIN', code = 6601, message = `PIN is required`, status = 0, cause) {
464
+ super(name, code, message, status, cause);
465
+ Object.setPrototypeOf(this, RequiresPINError.prototype);
466
+ }
467
+ }
461
468
  const webrpcErrorByCode = {
462
469
  [0]: WebrpcEndpointError,
463
470
  [-1]: WebrpcRequestFailedError,
@@ -482,7 +489,9 @@ const webrpcErrorByCode = {
482
489
  [2002]: UnavailableError,
483
490
  [2003]: QueryFailedError,
484
491
  [2004]: ValidationFailedError,
485
- [3000]: NotFoundError
492
+ [3000]: NotFoundError,
493
+ [6600]: RequiresTOTPError,
494
+ [6601]: RequiresPINError
486
495
  };
487
496
 
488
497
  class GuardSigner {
@@ -557,7 +566,8 @@ class GuardSigner {
557
566
  wallet: signedProof.walletAddress,
558
567
  timestamp: signedProof.timestamp.getTime(),
559
568
  signer: signedProof.signerAddress,
560
- signature: signedProof.signature
569
+ signature: signedProof.signature,
570
+ chainId: 1
561
571
  }
562
572
  });
563
573
  }
@@ -570,7 +580,8 @@ class GuardSigner {
570
580
  if (pin === undefined) {
571
581
  await this.guard.resetPIN({
572
582
  timestamp: signedProof.timestamp.getTime(),
573
- signature: signedProof.signature
583
+ signature: signedProof.signature,
584
+ chainId: 1
574
585
  }, {
575
586
  Authorization: `BEARER ${proof.jwt}`
576
587
  });
@@ -578,7 +589,8 @@ class GuardSigner {
578
589
  await this.guard.setPIN({
579
590
  pin,
580
591
  timestamp: signedProof.timestamp.getTime(),
581
- signature: signedProof.signature
592
+ signature: signedProof.signature,
593
+ chainId: 1
582
594
  }, {
583
595
  Authorization: `BEARER ${proof.jwt}`
584
596
  });
@@ -593,7 +605,8 @@ class GuardSigner {
593
605
  uri
594
606
  } = await this.guard.createTOTP({
595
607
  timestamp: signedProof.timestamp.getTime(),
596
- signature: signedProof.signature
608
+ signature: signedProof.signature,
609
+ chainId: 1
597
610
  }, {
598
611
  Authorization: `BEARER ${proof.jwt}`
599
612
  });
@@ -613,7 +626,8 @@ class GuardSigner {
613
626
  const signedProof = await signAuthUpdateProof(proof);
614
627
  await this.guard.resetTOTP({
615
628
  timestamp: signedProof.timestamp.getTime(),
616
- signature: signedProof.signature
629
+ signature: signedProof.signature,
630
+ chainId: 1
617
631
  }, {
618
632
  Authorization: `BEARER ${proof.jwt}`
619
633
  });
@@ -633,7 +647,8 @@ class GuardSigner {
633
647
  wallet: signedProof.walletAddress,
634
648
  timestamp: signedProof.timestamp.getTime(),
635
649
  signer: signedProof.signerAddress,
636
- signature: signedProof.signature
650
+ signature: signedProof.signature,
651
+ chainId: 1
637
652
  }
638
653
  });
639
654
  }
@@ -644,7 +659,8 @@ class GuardSigner {
644
659
  codes
645
660
  } = await this.guard.recoveryCodes({
646
661
  timestamp: signedProof.timestamp.getTime(),
647
- signature: signedProof.signature
662
+ signature: signedProof.signature,
663
+ chainId: 1
648
664
  }, {
649
665
  Authorization: `BEARER ${proof.jwt}`
650
666
  });
@@ -656,7 +672,8 @@ class GuardSigner {
656
672
  codes
657
673
  } = await this.guard.resetRecoveryCodes({
658
674
  timestamp: signedProof.timestamp.getTime(),
659
- signature: signedProof.signature
675
+ signature: signedProof.signature,
676
+ chainId: 1
660
677
  }, {
661
678
  Authorization: `BEARER ${proof.jwt}`
662
679
  });
@@ -18,19 +18,14 @@ function _extends() {
18
18
  }
19
19
 
20
20
  /* eslint-disable */
21
- // sequence-guard v0.4.0 776b307c2145ac7a994eec63240acae042c96067
21
+ // sequence-guard v0.5.0 910e01c32ffb24b42386d4ca6be119b0acc55c5f
22
22
  // --
23
23
  // Code generated by webrpc-gen@v0.25.3 with typescript generator. DO NOT EDIT.
24
24
  //
25
25
  // webrpc-gen -schema=guard.ridl -target=typescript -client -out=./clients/guard.gen.ts
26
26
 
27
27
  const WebrpcHeader = 'Webrpc';
28
- const WebrpcHeaderValue = 'webrpc@v0.25.3;gen-typescript@v0.17.0;sequence-guard@v0.4.0';
29
-
30
- //
31
- // Types
32
- //
33
-
28
+ const WebrpcHeaderValue = 'webrpc@v0.25.3;gen-typescript@v0.17.0;sequence-guard@v0.5.0';
34
29
  //
35
30
  // Client
36
31
  //
@@ -458,6 +453,18 @@ class NotFoundError extends WebrpcError {
458
453
  Object.setPrototypeOf(this, NotFoundError.prototype);
459
454
  }
460
455
  }
456
+ class RequiresTOTPError extends WebrpcError {
457
+ constructor(name = 'RequiresTOTP', code = 6600, message = `TOTP is required`, status = 0, cause) {
458
+ super(name, code, message, status, cause);
459
+ Object.setPrototypeOf(this, RequiresTOTPError.prototype);
460
+ }
461
+ }
462
+ class RequiresPINError extends WebrpcError {
463
+ constructor(name = 'RequiresPIN', code = 6601, message = `PIN is required`, status = 0, cause) {
464
+ super(name, code, message, status, cause);
465
+ Object.setPrototypeOf(this, RequiresPINError.prototype);
466
+ }
467
+ }
461
468
  const webrpcErrorByCode = {
462
469
  [0]: WebrpcEndpointError,
463
470
  [-1]: WebrpcRequestFailedError,
@@ -482,7 +489,9 @@ const webrpcErrorByCode = {
482
489
  [2002]: UnavailableError,
483
490
  [2003]: QueryFailedError,
484
491
  [2004]: ValidationFailedError,
485
- [3000]: NotFoundError
492
+ [3000]: NotFoundError,
493
+ [6600]: RequiresTOTPError,
494
+ [6601]: RequiresPINError
486
495
  };
487
496
 
488
497
  class GuardSigner {
@@ -557,7 +566,8 @@ class GuardSigner {
557
566
  wallet: signedProof.walletAddress,
558
567
  timestamp: signedProof.timestamp.getTime(),
559
568
  signer: signedProof.signerAddress,
560
- signature: signedProof.signature
569
+ signature: signedProof.signature,
570
+ chainId: 1
561
571
  }
562
572
  });
563
573
  }
@@ -570,7 +580,8 @@ class GuardSigner {
570
580
  if (pin === undefined) {
571
581
  await this.guard.resetPIN({
572
582
  timestamp: signedProof.timestamp.getTime(),
573
- signature: signedProof.signature
583
+ signature: signedProof.signature,
584
+ chainId: 1
574
585
  }, {
575
586
  Authorization: `BEARER ${proof.jwt}`
576
587
  });
@@ -578,7 +589,8 @@ class GuardSigner {
578
589
  await this.guard.setPIN({
579
590
  pin,
580
591
  timestamp: signedProof.timestamp.getTime(),
581
- signature: signedProof.signature
592
+ signature: signedProof.signature,
593
+ chainId: 1
582
594
  }, {
583
595
  Authorization: `BEARER ${proof.jwt}`
584
596
  });
@@ -593,7 +605,8 @@ class GuardSigner {
593
605
  uri
594
606
  } = await this.guard.createTOTP({
595
607
  timestamp: signedProof.timestamp.getTime(),
596
- signature: signedProof.signature
608
+ signature: signedProof.signature,
609
+ chainId: 1
597
610
  }, {
598
611
  Authorization: `BEARER ${proof.jwt}`
599
612
  });
@@ -613,7 +626,8 @@ class GuardSigner {
613
626
  const signedProof = await signAuthUpdateProof(proof);
614
627
  await this.guard.resetTOTP({
615
628
  timestamp: signedProof.timestamp.getTime(),
616
- signature: signedProof.signature
629
+ signature: signedProof.signature,
630
+ chainId: 1
617
631
  }, {
618
632
  Authorization: `BEARER ${proof.jwt}`
619
633
  });
@@ -633,7 +647,8 @@ class GuardSigner {
633
647
  wallet: signedProof.walletAddress,
634
648
  timestamp: signedProof.timestamp.getTime(),
635
649
  signer: signedProof.signerAddress,
636
- signature: signedProof.signature
650
+ signature: signedProof.signature,
651
+ chainId: 1
637
652
  }
638
653
  });
639
654
  }
@@ -644,7 +659,8 @@ class GuardSigner {
644
659
  codes
645
660
  } = await this.guard.recoveryCodes({
646
661
  timestamp: signedProof.timestamp.getTime(),
647
- signature: signedProof.signature
662
+ signature: signedProof.signature,
663
+ chainId: 1
648
664
  }, {
649
665
  Authorization: `BEARER ${proof.jwt}`
650
666
  });
@@ -656,7 +672,8 @@ class GuardSigner {
656
672
  codes
657
673
  } = await this.guard.resetRecoveryCodes({
658
674
  timestamp: signedProof.timestamp.getTime(),
659
- signature: signedProof.signature
675
+ signature: signedProof.signature,
676
+ chainId: 1
660
677
  }, {
661
678
  Authorization: `BEARER ${proof.jwt}`
662
679
  });
@@ -14,19 +14,14 @@ function _extends() {
14
14
  }
15
15
 
16
16
  /* eslint-disable */
17
- // sequence-guard v0.4.0 776b307c2145ac7a994eec63240acae042c96067
17
+ // sequence-guard v0.5.0 910e01c32ffb24b42386d4ca6be119b0acc55c5f
18
18
  // --
19
19
  // Code generated by webrpc-gen@v0.25.3 with typescript generator. DO NOT EDIT.
20
20
  //
21
21
  // webrpc-gen -schema=guard.ridl -target=typescript -client -out=./clients/guard.gen.ts
22
22
 
23
23
  const WebrpcHeader = 'Webrpc';
24
- const WebrpcHeaderValue = 'webrpc@v0.25.3;gen-typescript@v0.17.0;sequence-guard@v0.4.0';
25
-
26
- //
27
- // Types
28
- //
29
-
24
+ const WebrpcHeaderValue = 'webrpc@v0.25.3;gen-typescript@v0.17.0;sequence-guard@v0.5.0';
30
25
  //
31
26
  // Client
32
27
  //
@@ -454,6 +449,18 @@ class NotFoundError extends WebrpcError {
454
449
  Object.setPrototypeOf(this, NotFoundError.prototype);
455
450
  }
456
451
  }
452
+ class RequiresTOTPError extends WebrpcError {
453
+ constructor(name = 'RequiresTOTP', code = 6600, message = `TOTP is required`, status = 0, cause) {
454
+ super(name, code, message, status, cause);
455
+ Object.setPrototypeOf(this, RequiresTOTPError.prototype);
456
+ }
457
+ }
458
+ class RequiresPINError extends WebrpcError {
459
+ constructor(name = 'RequiresPIN', code = 6601, message = `PIN is required`, status = 0, cause) {
460
+ super(name, code, message, status, cause);
461
+ Object.setPrototypeOf(this, RequiresPINError.prototype);
462
+ }
463
+ }
457
464
  const webrpcErrorByCode = {
458
465
  [0]: WebrpcEndpointError,
459
466
  [-1]: WebrpcRequestFailedError,
@@ -478,7 +485,9 @@ const webrpcErrorByCode = {
478
485
  [2002]: UnavailableError,
479
486
  [2003]: QueryFailedError,
480
487
  [2004]: ValidationFailedError,
481
- [3000]: NotFoundError
488
+ [3000]: NotFoundError,
489
+ [6600]: RequiresTOTPError,
490
+ [6601]: RequiresPINError
482
491
  };
483
492
 
484
493
  class GuardSigner {
@@ -553,7 +562,8 @@ class GuardSigner {
553
562
  wallet: signedProof.walletAddress,
554
563
  timestamp: signedProof.timestamp.getTime(),
555
564
  signer: signedProof.signerAddress,
556
- signature: signedProof.signature
565
+ signature: signedProof.signature,
566
+ chainId: 1
557
567
  }
558
568
  });
559
569
  }
@@ -566,7 +576,8 @@ class GuardSigner {
566
576
  if (pin === undefined) {
567
577
  await this.guard.resetPIN({
568
578
  timestamp: signedProof.timestamp.getTime(),
569
- signature: signedProof.signature
579
+ signature: signedProof.signature,
580
+ chainId: 1
570
581
  }, {
571
582
  Authorization: `BEARER ${proof.jwt}`
572
583
  });
@@ -574,7 +585,8 @@ class GuardSigner {
574
585
  await this.guard.setPIN({
575
586
  pin,
576
587
  timestamp: signedProof.timestamp.getTime(),
577
- signature: signedProof.signature
588
+ signature: signedProof.signature,
589
+ chainId: 1
578
590
  }, {
579
591
  Authorization: `BEARER ${proof.jwt}`
580
592
  });
@@ -589,7 +601,8 @@ class GuardSigner {
589
601
  uri
590
602
  } = await this.guard.createTOTP({
591
603
  timestamp: signedProof.timestamp.getTime(),
592
- signature: signedProof.signature
604
+ signature: signedProof.signature,
605
+ chainId: 1
593
606
  }, {
594
607
  Authorization: `BEARER ${proof.jwt}`
595
608
  });
@@ -609,7 +622,8 @@ class GuardSigner {
609
622
  const signedProof = await signAuthUpdateProof(proof);
610
623
  await this.guard.resetTOTP({
611
624
  timestamp: signedProof.timestamp.getTime(),
612
- signature: signedProof.signature
625
+ signature: signedProof.signature,
626
+ chainId: 1
613
627
  }, {
614
628
  Authorization: `BEARER ${proof.jwt}`
615
629
  });
@@ -629,7 +643,8 @@ class GuardSigner {
629
643
  wallet: signedProof.walletAddress,
630
644
  timestamp: signedProof.timestamp.getTime(),
631
645
  signer: signedProof.signerAddress,
632
- signature: signedProof.signature
646
+ signature: signedProof.signature,
647
+ chainId: 1
633
648
  }
634
649
  });
635
650
  }
@@ -640,7 +655,8 @@ class GuardSigner {
640
655
  codes
641
656
  } = await this.guard.recoveryCodes({
642
657
  timestamp: signedProof.timestamp.getTime(),
643
- signature: signedProof.signature
658
+ signature: signedProof.signature,
659
+ chainId: 1
644
660
  }, {
645
661
  Authorization: `BEARER ${proof.jwt}`
646
662
  });
@@ -652,7 +668,8 @@ class GuardSigner {
652
668
  codes
653
669
  } = await this.guard.resetRecoveryCodes({
654
670
  timestamp: signedProof.timestamp.getTime(),
655
- signature: signedProof.signature
671
+ signature: signedProof.signature,
672
+ chainId: 1
656
673
  }, {
657
674
  Authorization: `BEARER ${proof.jwt}`
658
675
  });
@@ -1,8 +1,8 @@
1
1
  export declare const WebrpcHeader = "Webrpc";
2
- export declare const WebrpcHeaderValue = "webrpc@v0.25.3;gen-typescript@v0.17.0;sequence-guard@v0.4.0";
2
+ export declare const WebrpcHeaderValue = "webrpc@v0.25.3;gen-typescript@v0.17.0;sequence-guard@v0.5.0";
3
3
  export declare const WebRPCVersion = "v1";
4
- export declare const WebRPCSchemaVersion = "v0.4.0";
5
- export declare const WebRPCSchemaHash = "776b307c2145ac7a994eec63240acae042c96067";
4
+ export declare const WebRPCSchemaVersion = "v0.5.0";
5
+ export declare const WebRPCSchemaHash = "910e01c32ffb24b42386d4ca6be119b0acc55c5f";
6
6
  type WebrpcGenVersions = {
7
7
  webrpcGenVersion: string;
8
8
  codeGenName: string;
@@ -11,6 +11,18 @@ type WebrpcGenVersions = {
11
11
  schemaVersion: string;
12
12
  };
13
13
  export declare function VersionFromHeader(headers: Headers): WebrpcGenVersions;
14
+ export declare enum PayloadType {
15
+ Calls = "Calls",
16
+ Message = "Message",
17
+ ConfigUpdate = "ConfigUpdate",
18
+ SessionImplicitAuthorize = "SessionImplicitAuthorize"
19
+ }
20
+ export declare enum SignatureType {
21
+ Hash = "Hash",
22
+ Sapient = "Sapient",
23
+ EthSign = "EthSign",
24
+ Erc1271 = "Erc1271"
25
+ }
14
26
  export interface Version {
15
27
  webrpcVersion: string;
16
28
  schemaVersion: string;
@@ -36,22 +48,34 @@ export interface WalletSigner {
36
48
  export interface SignRequest {
37
49
  chainId: number;
38
50
  msg: string;
39
- auxData: string;
51
+ auxData?: string;
52
+ wallet?: string;
53
+ payloadType?: PayloadType;
54
+ payloadData?: string;
55
+ signatures?: Array<Signature>;
40
56
  }
41
57
  export interface OwnershipProof {
42
58
  wallet: string;
43
59
  timestamp: number;
44
60
  signer: string;
45
61
  signature: string;
62
+ chainId: number;
46
63
  }
47
64
  export interface AuthToken {
48
65
  id: string;
49
66
  token: string;
67
+ resetAuth?: boolean;
50
68
  }
51
69
  export interface RecoveryCode {
52
70
  code: string;
53
71
  used: boolean;
54
72
  }
73
+ export interface Signature {
74
+ address: string;
75
+ type: SignatureType;
76
+ imageHash?: string;
77
+ data: string;
78
+ }
55
79
  export interface Guard {
56
80
  ping(headers?: object, signal?: AbortSignal): Promise<PingReturn>;
57
81
  version(headers?: object, signal?: AbortSignal): Promise<VersionReturn>;
@@ -169,18 +193,21 @@ export interface SetPINArgs {
169
193
  pin: string;
170
194
  timestamp: number;
171
195
  signature: string;
196
+ chainId: number;
172
197
  }
173
198
  export interface SetPINReturn {
174
199
  }
175
200
  export interface ResetPINArgs {
176
201
  timestamp: number;
177
202
  signature: string;
203
+ chainId: number;
178
204
  }
179
205
  export interface ResetPINReturn {
180
206
  }
181
207
  export interface CreateTOTPArgs {
182
208
  timestamp: number;
183
209
  signature: string;
210
+ chainId: number;
184
211
  }
185
212
  export interface CreateTOTPReturn {
186
213
  uri: string;
@@ -194,6 +221,7 @@ export interface CommitTOTPReturn {
194
221
  export interface ResetTOTPArgs {
195
222
  timestamp: number;
196
223
  signature: string;
224
+ chainId: number;
197
225
  }
198
226
  export interface ResetTOTPReturn {
199
227
  }
@@ -206,6 +234,7 @@ export interface Reset2FAReturn {
206
234
  export interface RecoveryCodesArgs {
207
235
  timestamp: number;
208
236
  signature: string;
237
+ chainId: number;
209
238
  }
210
239
  export interface RecoveryCodesReturn {
211
240
  codes: Array<RecoveryCode>;
@@ -213,6 +242,7 @@ export interface RecoveryCodesReturn {
213
242
  export interface ResetRecoveryCodesArgs {
214
243
  timestamp: number;
215
244
  signature: string;
245
+ chainId: number;
216
246
  }
217
247
  export interface ResetRecoveryCodesReturn {
218
248
  codes: Array<RecoveryCode>;
@@ -323,6 +353,12 @@ export declare class ValidationFailedError extends WebrpcError {
323
353
  export declare class NotFoundError extends WebrpcError {
324
354
  constructor(name?: string, code?: number, message?: string, status?: number, cause?: string);
325
355
  }
356
+ export declare class RequiresTOTPError extends WebrpcError {
357
+ constructor(name?: string, code?: number, message?: string, status?: number, cause?: string);
358
+ }
359
+ export declare class RequiresPINError extends WebrpcError {
360
+ constructor(name?: string, code?: number, message?: string, status?: number, cause?: string);
361
+ }
326
362
  export declare enum errors {
327
363
  WebrpcEndpoint = "WebrpcEndpoint",
328
364
  WebrpcRequestFailed = "WebrpcRequestFailed",
@@ -347,7 +383,9 @@ export declare enum errors {
347
383
  Unavailable = "Unavailable",
348
384
  QueryFailed = "QueryFailed",
349
385
  ValidationFailed = "ValidationFailed",
350
- NotFound = "NotFound"
386
+ NotFound = "NotFound",
387
+ RequiresTOTP = "RequiresTOTP",
388
+ RequiresPIN = "RequiresPIN"
351
389
  }
352
390
  export declare enum WebrpcErrorCodes {
353
391
  WebrpcEndpoint = 0,
@@ -373,7 +411,9 @@ export declare enum WebrpcErrorCodes {
373
411
  Unavailable = 2002,
374
412
  QueryFailed = 2003,
375
413
  ValidationFailed = 2004,
376
- NotFound = 3000
414
+ NotFound = 3000,
415
+ RequiresTOTP = 6600,
416
+ RequiresPIN = 6601
377
417
  }
378
418
  export declare const webrpcErrorByCode: {
379
419
  [code: number]: any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0xsequence/guard",
3
- "version": "2.3.37",
3
+ "version": "2.3.39",
4
4
  "description": "guard sub-package for Sequence",
5
5
  "repository": "https://github.com/0xsequence/sequence.js/tree/master/packages/guard",
6
6
  "source": "src/index.ts",
@@ -12,10 +12,10 @@
12
12
  "ethers": ">=6"
13
13
  },
14
14
  "dependencies": {
15
- "@0xsequence/core": "2.3.37",
16
- "@0xsequence/utils": "2.3.37",
17
- "@0xsequence/account": "2.3.37",
18
- "@0xsequence/signhub": "2.3.37"
15
+ "@0xsequence/core": "2.3.39",
16
+ "@0xsequence/signhub": "2.3.39",
17
+ "@0xsequence/account": "2.3.39",
18
+ "@0xsequence/utils": "2.3.39"
19
19
  },
20
20
  "devDependencies": {
21
21
  "ethers": "6.13.4"
package/src/guard.gen.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable */
2
- // sequence-guard v0.4.0 776b307c2145ac7a994eec63240acae042c96067
2
+ // sequence-guard v0.5.0 910e01c32ffb24b42386d4ca6be119b0acc55c5f
3
3
  // --
4
4
  // Code generated by webrpc-gen@v0.25.3 with typescript generator. DO NOT EDIT.
5
5
  //
@@ -7,16 +7,16 @@
7
7
 
8
8
  export const WebrpcHeader = 'Webrpc'
9
9
 
10
- export const WebrpcHeaderValue = 'webrpc@v0.25.3;gen-typescript@v0.17.0;sequence-guard@v0.4.0'
10
+ export const WebrpcHeaderValue = 'webrpc@v0.25.3;gen-typescript@v0.17.0;sequence-guard@v0.5.0'
11
11
 
12
12
  // WebRPC description and code-gen version
13
13
  export const WebRPCVersion = 'v1'
14
14
 
15
15
  // Schema version of your RIDL schema
16
- export const WebRPCSchemaVersion = 'v0.4.0'
16
+ export const WebRPCSchemaVersion = 'v0.5.0'
17
17
 
18
18
  // Schema hash generated from your RIDL schema
19
- export const WebRPCSchemaHash = '776b307c2145ac7a994eec63240acae042c96067'
19
+ export const WebRPCSchemaHash = '910e01c32ffb24b42386d4ca6be119b0acc55c5f'
20
20
 
21
21
  type WebrpcGenVersions = {
22
22
  webrpcGenVersion: string
@@ -70,6 +70,20 @@ function parseWebrpcGenVersions(header: string): WebrpcGenVersions {
70
70
  // Types
71
71
  //
72
72
 
73
+ export enum PayloadType {
74
+ Calls = 'Calls',
75
+ Message = 'Message',
76
+ ConfigUpdate = 'ConfigUpdate',
77
+ SessionImplicitAuthorize = 'SessionImplicitAuthorize'
78
+ }
79
+
80
+ export enum SignatureType {
81
+ Hash = 'Hash',
82
+ Sapient = 'Sapient',
83
+ EthSign = 'EthSign',
84
+ Erc1271 = 'Erc1271'
85
+ }
86
+
73
87
  export interface Version {
74
88
  webrpcVersion: string
75
89
  schemaVersion: string
@@ -99,7 +113,11 @@ export interface WalletSigner {
99
113
  export interface SignRequest {
100
114
  chainId: number
101
115
  msg: string
102
- auxData: string
116
+ auxData?: string
117
+ wallet?: string
118
+ payloadType?: PayloadType
119
+ payloadData?: string
120
+ signatures?: Array<Signature>
103
121
  }
104
122
 
105
123
  export interface OwnershipProof {
@@ -107,11 +125,13 @@ export interface OwnershipProof {
107
125
  timestamp: number
108
126
  signer: string
109
127
  signature: string
128
+ chainId: number
110
129
  }
111
130
 
112
131
  export interface AuthToken {
113
132
  id: string
114
133
  token: string
134
+ resetAuth?: boolean
115
135
  }
116
136
 
117
137
  export interface RecoveryCode {
@@ -119,6 +139,13 @@ export interface RecoveryCode {
119
139
  used: boolean
120
140
  }
121
141
 
142
+ export interface Signature {
143
+ address: string
144
+ type: SignatureType
145
+ imageHash?: string
146
+ data: string
147
+ }
148
+
122
149
  export interface Guard {
123
150
  ping(headers?: object, signal?: AbortSignal): Promise<PingReturn>
124
151
  version(headers?: object, signal?: AbortSignal): Promise<VersionReturn>
@@ -242,18 +269,21 @@ export interface SetPINArgs {
242
269
  pin: string
243
270
  timestamp: number
244
271
  signature: string
272
+ chainId: number
245
273
  }
246
274
 
247
275
  export interface SetPINReturn {}
248
276
  export interface ResetPINArgs {
249
277
  timestamp: number
250
278
  signature: string
279
+ chainId: number
251
280
  }
252
281
 
253
282
  export interface ResetPINReturn {}
254
283
  export interface CreateTOTPArgs {
255
284
  timestamp: number
256
285
  signature: string
286
+ chainId: number
257
287
  }
258
288
 
259
289
  export interface CreateTOTPReturn {
@@ -269,6 +299,7 @@ export interface CommitTOTPReturn {
269
299
  export interface ResetTOTPArgs {
270
300
  timestamp: number
271
301
  signature: string
302
+ chainId: number
272
303
  }
273
304
 
274
305
  export interface ResetTOTPReturn {}
@@ -281,6 +312,7 @@ export interface Reset2FAReturn {}
281
312
  export interface RecoveryCodesArgs {
282
313
  timestamp: number
283
314
  signature: string
315
+ chainId: number
284
316
  }
285
317
 
286
318
  export interface RecoveryCodesReturn {
@@ -289,6 +321,7 @@ export interface RecoveryCodesReturn {
289
321
  export interface ResetRecoveryCodesArgs {
290
322
  timestamp: number
291
323
  signature: string
324
+ chainId: number
292
325
  }
293
326
 
294
327
  export interface ResetRecoveryCodesReturn {
@@ -931,6 +964,32 @@ export class NotFoundError extends WebrpcError {
931
964
  }
932
965
  }
933
966
 
967
+ export class RequiresTOTPError extends WebrpcError {
968
+ constructor(
969
+ name: string = 'RequiresTOTP',
970
+ code: number = 6600,
971
+ message: string = `TOTP is required`,
972
+ status: number = 0,
973
+ cause?: string
974
+ ) {
975
+ super(name, code, message, status, cause)
976
+ Object.setPrototypeOf(this, RequiresTOTPError.prototype)
977
+ }
978
+ }
979
+
980
+ export class RequiresPINError extends WebrpcError {
981
+ constructor(
982
+ name: string = 'RequiresPIN',
983
+ code: number = 6601,
984
+ message: string = `PIN is required`,
985
+ status: number = 0,
986
+ cause?: string
987
+ ) {
988
+ super(name, code, message, status, cause)
989
+ Object.setPrototypeOf(this, RequiresPINError.prototype)
990
+ }
991
+ }
992
+
934
993
  export enum errors {
935
994
  WebrpcEndpoint = 'WebrpcEndpoint',
936
995
  WebrpcRequestFailed = 'WebrpcRequestFailed',
@@ -955,7 +1014,9 @@ export enum errors {
955
1014
  Unavailable = 'Unavailable',
956
1015
  QueryFailed = 'QueryFailed',
957
1016
  ValidationFailed = 'ValidationFailed',
958
- NotFound = 'NotFound'
1017
+ NotFound = 'NotFound',
1018
+ RequiresTOTP = 'RequiresTOTP',
1019
+ RequiresPIN = 'RequiresPIN'
959
1020
  }
960
1021
 
961
1022
  export enum WebrpcErrorCodes {
@@ -982,7 +1043,9 @@ export enum WebrpcErrorCodes {
982
1043
  Unavailable = 2002,
983
1044
  QueryFailed = 2003,
984
1045
  ValidationFailed = 2004,
985
- NotFound = 3000
1046
+ NotFound = 3000,
1047
+ RequiresTOTP = 6600,
1048
+ RequiresPIN = 6601
986
1049
  }
987
1050
 
988
1051
  export const webrpcErrorByCode: { [code: number]: any } = {
@@ -1009,7 +1072,9 @@ export const webrpcErrorByCode: { [code: number]: any } = {
1009
1072
  [2002]: UnavailableError,
1010
1073
  [2003]: QueryFailedError,
1011
1074
  [2004]: ValidationFailedError,
1012
- [3000]: NotFoundError
1075
+ [3000]: NotFoundError,
1076
+ [6600]: RequiresTOTPError,
1077
+ [6601]: RequiresPINError
1013
1078
  }
1014
1079
 
1015
1080
  export type Fetch = (input: RequestInfo, init?: RequestInit) => Promise<Response>
package/src/signer.ts CHANGED
@@ -91,7 +91,8 @@ export class GuardSigner implements signers.SapientSigner {
91
91
  wallet: signedProof.walletAddress,
92
92
  timestamp: signedProof.timestamp.getTime(),
93
93
  signer: signedProof.signerAddress,
94
- signature: signedProof.signature
94
+ signature: signedProof.signature,
95
+ chainId: 1
95
96
  }
96
97
  })
97
98
  }
@@ -104,12 +105,12 @@ export class GuardSigner implements signers.SapientSigner {
104
105
 
105
106
  if (pin === undefined) {
106
107
  await this.guard.resetPIN(
107
- { timestamp: signedProof.timestamp.getTime(), signature: signedProof.signature },
108
+ { timestamp: signedProof.timestamp.getTime(), signature: signedProof.signature, chainId: 1 },
108
109
  { Authorization: `BEARER ${proof.jwt}` }
109
110
  )
110
111
  } else {
111
112
  await this.guard.setPIN(
112
- { pin, timestamp: signedProof.timestamp.getTime(), signature: signedProof.signature },
113
+ { pin, timestamp: signedProof.timestamp.getTime(), signature: signedProof.signature, chainId: 1 },
113
114
  { Authorization: `BEARER ${proof.jwt}` }
114
115
  )
115
116
  }
@@ -123,7 +124,7 @@ export class GuardSigner implements signers.SapientSigner {
123
124
  const signedProof = await signAuthUpdateProof(proof)
124
125
 
125
126
  const { uri } = await this.guard.createTOTP(
126
- { timestamp: signedProof.timestamp.getTime(), signature: signedProof.signature },
127
+ { timestamp: signedProof.timestamp.getTime(), signature: signedProof.signature, chainId: 1 },
127
128
  { Authorization: `BEARER ${proof.jwt}` }
128
129
  )
129
130
 
@@ -139,7 +140,7 @@ export class GuardSigner implements signers.SapientSigner {
139
140
  const signedProof = await signAuthUpdateProof(proof)
140
141
 
141
142
  await this.guard.resetTOTP(
142
- { timestamp: signedProof.timestamp.getTime(), signature: signedProof.signature },
143
+ { timestamp: signedProof.timestamp.getTime(), signature: signedProof.signature, chainId: 1 },
143
144
  { Authorization: `BEARER ${proof.jwt}` }
144
145
  )
145
146
  }
@@ -156,7 +157,8 @@ export class GuardSigner implements signers.SapientSigner {
156
157
  wallet: signedProof.walletAddress,
157
158
  timestamp: signedProof.timestamp.getTime(),
158
159
  signer: signedProof.signerAddress,
159
- signature: signedProof.signature
160
+ signature: signedProof.signature,
161
+ chainId: 1
160
162
  }
161
163
  })
162
164
  }
@@ -166,7 +168,7 @@ export class GuardSigner implements signers.SapientSigner {
166
168
  const signedProof = await signAuthUpdateProof(proof)
167
169
 
168
170
  const { codes } = await this.guard.recoveryCodes(
169
- { timestamp: signedProof.timestamp.getTime(), signature: signedProof.signature },
171
+ { timestamp: signedProof.timestamp.getTime(), signature: signedProof.signature, chainId: 1 },
170
172
  { Authorization: `BEARER ${proof.jwt}` }
171
173
  )
172
174
 
@@ -177,7 +179,7 @@ export class GuardSigner implements signers.SapientSigner {
177
179
  const signedProof = await signAuthUpdateProof(proof)
178
180
 
179
181
  const { codes } = await this.guard.resetRecoveryCodes(
180
- { timestamp: signedProof.timestamp.getTime(), signature: signedProof.signature },
182
+ { timestamp: signedProof.timestamp.getTime(), signature: signedProof.signature, chainId: 1 },
181
183
  { Authorization: `BEARER ${proof.jwt}` }
182
184
  )
183
185