@xfuel/verify 0.3.5 → 0.4.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.
Files changed (103) hide show
  1. package/LICENSE +201 -201
  2. package/README.md +82 -269
  3. package/cli.js +40 -0
  4. package/index.cjs +8 -0
  5. package/index.d.ts +5 -0
  6. package/index.js +7 -0
  7. package/package.json +61 -67
  8. package/dist/anchor-trust.d.ts +0 -129
  9. package/dist/anchor-trust.d.ts.map +0 -1
  10. package/dist/anchor-trust.js +0 -395
  11. package/dist/anchor-trust.js.map +0 -1
  12. package/dist/anchor-witness.d.ts +0 -265
  13. package/dist/anchor-witness.d.ts.map +0 -1
  14. package/dist/anchor-witness.js +0 -818
  15. package/dist/anchor-witness.js.map +0 -1
  16. package/dist/base-payer.d.ts +0 -65
  17. package/dist/base-payer.d.ts.map +0 -1
  18. package/dist/base-payer.js +0 -222
  19. package/dist/base-payer.js.map +0 -1
  20. package/dist/binding.d.ts +0 -52
  21. package/dist/binding.d.ts.map +0 -1
  22. package/dist/binding.js +0 -80
  23. package/dist/binding.js.map +0 -1
  24. package/dist/canonical-preimage.d.ts +0 -9
  25. package/dist/canonical-preimage.d.ts.map +0 -1
  26. package/dist/canonical-preimage.js +0 -25
  27. package/dist/canonical-preimage.js.map +0 -1
  28. package/dist/carry-forward.d.ts +0 -79
  29. package/dist/carry-forward.d.ts.map +0 -1
  30. package/dist/carry-forward.js +0 -184
  31. package/dist/carry-forward.js.map +0 -1
  32. package/dist/cli.d.ts +0 -19
  33. package/dist/cli.d.ts.map +0 -1
  34. package/dist/cli.js +0 -1534
  35. package/dist/cli.js.map +0 -1
  36. package/dist/epoch.d.ts +0 -143
  37. package/dist/epoch.d.ts.map +0 -1
  38. package/dist/epoch.js +0 -352
  39. package/dist/epoch.js.map +0 -1
  40. package/dist/head-binding.d.ts +0 -24
  41. package/dist/head-binding.d.ts.map +0 -1
  42. package/dist/head-binding.js +0 -61
  43. package/dist/head-binding.js.map +0 -1
  44. package/dist/index.d.ts +0 -574
  45. package/dist/index.d.ts.map +0 -1
  46. package/dist/index.js +0 -1627
  47. package/dist/index.js.map +0 -1
  48. package/dist/issuer-history.d.ts +0 -110
  49. package/dist/issuer-history.d.ts.map +0 -1
  50. package/dist/issuer-history.js +0 -348
  51. package/dist/issuer-history.js.map +0 -1
  52. package/dist/issuer-pin.d.ts +0 -126
  53. package/dist/issuer-pin.d.ts.map +0 -1
  54. package/dist/issuer-pin.js +0 -567
  55. package/dist/issuer-pin.js.map +0 -1
  56. package/dist/jcs.d.ts +0 -8
  57. package/dist/jcs.d.ts.map +0 -1
  58. package/dist/jcs.js +0 -64
  59. package/dist/jcs.js.map +0 -1
  60. package/dist/jws.d.ts +0 -46
  61. package/dist/jws.d.ts.map +0 -1
  62. package/dist/jws.js +0 -129
  63. package/dist/jws.js.map +0 -1
  64. package/dist/payer.d.ts +0 -65
  65. package/dist/payer.d.ts.map +0 -1
  66. package/dist/payer.js +0 -148
  67. package/dist/payer.js.map +0 -1
  68. package/dist/preimage.d.ts +0 -78
  69. package/dist/preimage.d.ts.map +0 -1
  70. package/dist/preimage.js +0 -363
  71. package/dist/preimage.js.map +0 -1
  72. package/dist/receipt-lane.d.ts +0 -235
  73. package/dist/receipt-lane.d.ts.map +0 -1
  74. package/dist/receipt-lane.js +0 -446
  75. package/dist/receipt-lane.js.map +0 -1
  76. package/dist/receipt-version.d.ts +0 -92
  77. package/dist/receipt-version.d.ts.map +0 -1
  78. package/dist/receipt-version.js +0 -323
  79. package/dist/receipt-version.js.map +0 -1
  80. package/dist/refusal.d.ts +0 -93
  81. package/dist/refusal.d.ts.map +0 -1
  82. package/dist/refusal.js +0 -249
  83. package/dist/refusal.js.map +0 -1
  84. package/dist/request-binding.d.ts +0 -7
  85. package/dist/request-binding.d.ts.map +0 -1
  86. package/dist/request-binding.js +0 -26
  87. package/dist/request-binding.js.map +0 -1
  88. package/dist/row-hash.d.ts +0 -22
  89. package/dist/row-hash.d.ts.map +0 -1
  90. package/dist/row-hash.js +0 -26
  91. package/dist/row-hash.js.map +0 -1
  92. package/dist/shell.d.ts +0 -65
  93. package/dist/shell.d.ts.map +0 -1
  94. package/dist/shell.js +0 -268
  95. package/dist/shell.js.map +0 -1
  96. package/dist/solana-payer.d.ts +0 -99
  97. package/dist/solana-payer.d.ts.map +0 -1
  98. package/dist/solana-payer.js +0 -258
  99. package/dist/solana-payer.js.map +0 -1
  100. package/dist/v11-receipt.d.ts +0 -23
  101. package/dist/v11-receipt.d.ts.map +0 -1
  102. package/dist/v11-receipt.js +0 -368
  103. package/dist/v11-receipt.js.map +0 -1
@@ -1,126 +0,0 @@
1
- import { type Es256Jwk } from './jws.js';
2
- export declare const ISSUER_REGISTRATION_CONTEXT = "chit402-issuer-registration-v1";
3
- export declare const ISSUER_ROTATION_CONTEXT = "chit402-issuer-rotation-v1";
4
- export declare const ISSUER_PIN_VERSION = 1;
5
- export declare const ISSUER_PIN_SCHEMA = "chit402.issuer_key_pin.v1";
6
- export declare const ISSUER_PIN_PATH = "docs/well-known/issuer-key.json";
7
- export declare const ISSUER_PIN_CHAIN_ID = "eip155:84532";
8
- export declare const CITIZEN_FREEZE_SCHEMA = "chit402.freeze.v1";
9
- export declare const CITIZEN_FREEZE_PURPOSE = "citizen_issuer_key";
10
- export declare const ISSUER_PIN_REPO = "XFuel-Lab/chit402";
11
- /**
12
- * Kid of the Sepolia specimen in docs/well-known/issuer-key.json.
13
- * A different kid is a rotation and needs the previous pin.
14
- */
15
- export declare const PUBLISHED_ISSUER_PIN_KID = "kATmVjz6J8QvSTS-bS1NUjWaLs35o-PXYurO2blMf-c";
16
- export declare const ISSUER_PIN_MISMATCH = "ISSUER_PIN_MISMATCH";
17
- export declare const ISSUER_PIN_HASH_MISMATCH = "ISSUER_PIN_HASH_MISMATCH";
18
- export declare const ISSUER_SELF_SIG_INVALID = "ISSUER_SELF_SIG_INVALID";
19
- export declare const ISSUER_PIN_DOWNGRADE = "ISSUER_PIN_DOWNGRADE";
20
- export declare const ISSUER_PIN_MUTABLE_REF = "ISSUER_PIN_MUTABLE_REF";
21
- export declare const ISSUER_ROTATION_UNCONTROLLED = "ISSUER_ROTATION_UNCONTROLLED";
22
- export declare const ISSUER_PIN_CHAIN_REFUSED = "ISSUER_PIN_CHAIN_REFUSED";
23
- export interface IssuerPinRef {
24
- commit: string;
25
- path: string;
26
- sha256: string;
27
- }
28
- export interface IssuerPinAssessment {
29
- checked: boolean;
30
- ok: boolean;
31
- code: string | null;
32
- }
33
- export interface IssuerKeyPin {
34
- schema: typeof ISSUER_PIN_SCHEMA;
35
- version: number;
36
- chain_id: string;
37
- created_at: string;
38
- jwk: Es256Jwk;
39
- self_signature: string | null;
40
- control: {
41
- jws: string;
42
- } | null;
43
- }
44
- export declare function issuerPinFileHash(bytes: string): string;
45
- export declare function canonicalPublicKey(jwk: Pick<Es256Jwk, 'crv' | 'kty' | 'x' | 'y'>): string;
46
- /**
47
- * Registration preimage. The context, version, kid, created_at, and key
48
- * are fixed fields, so a signature over another purpose or another key
49
- * does not verify.
50
- */
51
- export declare function registrationPreimage(input: {
52
- kid: string;
53
- createdAt: string;
54
- jwk: Es256Jwk;
55
- }): string;
56
- export declare function rotationStatement(input: {
57
- priorKid: string;
58
- nextKid: string;
59
- pinSha256: string;
60
- pinCommit: string;
61
- createdAt: string;
62
- }): string;
63
- export declare function serializeIssuerPin(doc: IssuerKeyPin): string;
64
- /**
65
- * URL of the pin blob at one commit. A branch, HEAD, or any non-40-hex
66
- * ref returns ISSUER_PIN_MUTABLE_REF and does not build a URL.
67
- */
68
- export declare function issuerPinContentUrl(commit: string, path?: string): {
69
- ok: true;
70
- url: string;
71
- } | {
72
- ok: false;
73
- code: typeof ISSUER_PIN_MUTABLE_REF;
74
- };
75
- export declare function loadIssuerPinBytes(ref: IssuerPinRef, fetchImpl: (url: string) => Promise<Uint8Array>): Promise<{
76
- ok: true;
77
- bytes: string;
78
- } | {
79
- ok: false;
80
- code: string;
81
- }>;
82
- export declare function readIssuerPinClaim(doc: unknown): {
83
- claimed: boolean;
84
- ref: IssuerPinRef | null;
85
- };
86
- export declare function verifyRegistrationSignature(pin: IssuerKeyPin): {
87
- ok: boolean;
88
- code: string | null;
89
- };
90
- export declare function verifyCitizenRotation(input: {
91
- prior: IssuerKeyPin;
92
- next: IssuerKeyPin;
93
- nextHash: string;
94
- nextCommit: string;
95
- controlJws: string | null;
96
- }): {
97
- ok: true;
98
- } | {
99
- ok: false;
100
- code: string;
101
- };
102
- export interface AssessIssuerPinInput {
103
- receipt?: unknown;
104
- head?: unknown;
105
- pinBytes?: string | null;
106
- sigBytes?: string | null;
107
- ref?: IssuerPinRef | null;
108
- witnesses?: unknown;
109
- priorPinBytes?: string | null;
110
- priorRef?: IssuerPinRef | null;
111
- controlJws?: string | null;
112
- required?: boolean;
113
- /**
114
- * Ignored. The specimen kid gate is not optional. A caller cannot
115
- * turn it off by passing a prior pin or by setting this to false.
116
- */
117
- anchorToPublished?: boolean;
118
- }
119
- /**
120
- * Compare a receipt's issuer key to the pinned file, and to issuer_root
121
- * and a /api/witnesses document when those sources are present.
122
- * A receipt or head that claims a pinned era and omits the pin fails closed.
123
- * No claim and no explicit pin leaves the caller on the previous path.
124
- */
125
- export declare function assessIssuerPin(input: AssessIssuerPinInput): IssuerPinAssessment;
126
- //# sourceMappingURL=issuer-pin.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"issuer-pin.d.ts","sourceRoot":"","sources":["../src/issuer-pin.ts"],"names":[],"mappings":"AAcA,OAAO,EAAmE,KAAK,QAAQ,EAAE,MAAM,UAAU,CAAC;AAE1G,eAAO,MAAM,2BAA2B,mCAAmC,CAAC;AAC5E,eAAO,MAAM,uBAAuB,+BAA+B,CAAC;AACpE,eAAO,MAAM,kBAAkB,IAAI,CAAC;AACpC,eAAO,MAAM,iBAAiB,8BAA8B,CAAC;AAC7D,eAAO,MAAM,eAAe,oCAAoC,CAAC;AACjE,eAAO,MAAM,mBAAmB,iBAAiB,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