@xfuel/verify 0.3.1 → 0.3.4

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 (60) hide show
  1. package/README.md +16 -6
  2. package/dist/anchor-trust.d.ts +129 -0
  3. package/dist/anchor-trust.d.ts.map +1 -0
  4. package/dist/anchor-trust.js +395 -0
  5. package/dist/anchor-trust.js.map +1 -0
  6. package/dist/anchor-witness.d.ts +114 -4
  7. package/dist/anchor-witness.d.ts.map +1 -1
  8. package/dist/anchor-witness.js +419 -32
  9. package/dist/anchor-witness.js.map +1 -1
  10. package/dist/carry-forward.d.ts +79 -0
  11. package/dist/carry-forward.d.ts.map +1 -0
  12. package/dist/carry-forward.js +184 -0
  13. package/dist/carry-forward.js.map +1 -0
  14. package/dist/cli.js +691 -42
  15. package/dist/cli.js.map +1 -1
  16. package/dist/epoch.d.ts +41 -7
  17. package/dist/epoch.d.ts.map +1 -1
  18. package/dist/epoch.js +143 -0
  19. package/dist/epoch.js.map +1 -1
  20. package/dist/index.d.ts +65 -6
  21. package/dist/index.d.ts.map +1 -1
  22. package/dist/index.js +348 -96
  23. package/dist/index.js.map +1 -1
  24. package/dist/issuer-history.d.ts +19 -0
  25. package/dist/issuer-history.d.ts.map +1 -1
  26. package/dist/issuer-history.js +131 -75
  27. package/dist/issuer-history.js.map +1 -1
  28. package/dist/issuer-pin.d.ts +126 -0
  29. package/dist/issuer-pin.d.ts.map +1 -0
  30. package/dist/issuer-pin.js +567 -0
  31. package/dist/issuer-pin.js.map +1 -0
  32. package/dist/preimage.d.ts +29 -0
  33. package/dist/preimage.d.ts.map +1 -1
  34. package/dist/preimage.js +162 -2
  35. package/dist/preimage.js.map +1 -1
  36. package/dist/receipt-lane.d.ts +1 -0
  37. package/dist/receipt-lane.d.ts.map +1 -1
  38. package/dist/receipt-lane.js +5 -2
  39. package/dist/receipt-lane.js.map +1 -1
  40. package/dist/refusal.d.ts +5 -2
  41. package/dist/refusal.d.ts.map +1 -1
  42. package/dist/refusal.js +28 -6
  43. package/dist/refusal.js.map +1 -1
  44. package/dist/request-binding.d.ts +7 -0
  45. package/dist/request-binding.d.ts.map +1 -0
  46. package/dist/request-binding.js +26 -0
  47. package/dist/request-binding.js.map +1 -0
  48. package/dist/row-hash.d.ts +22 -0
  49. package/dist/row-hash.d.ts.map +1 -0
  50. package/dist/row-hash.js +26 -0
  51. package/dist/row-hash.js.map +1 -0
  52. package/dist/shell.d.ts +65 -0
  53. package/dist/shell.d.ts.map +1 -0
  54. package/dist/shell.js +268 -0
  55. package/dist/shell.js.map +1 -0
  56. package/dist/v11-receipt.d.ts +21 -0
  57. package/dist/v11-receipt.d.ts.map +1 -0
  58. package/dist/v11-receipt.js +351 -0
  59. package/dist/v11-receipt.js.map +1 -0
  60. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -13,7 +13,8 @@
13
13
  */
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.REFUSAL_SCHEMA = exports.verifyRefusal = exports.isRefusalDocument = exports.HEAD_BINDING_PAYLOAD_VERSION = exports.outerHeadDisagrees = exports.signedHeadBinding = exports.headBindingVerdict = exports.RECEIPT_LANE_BOUNDARY = exports.RECEIPT_LANE_ORDERING = exports.RECEIPT_LANE_RULE = exports.RECEIPT_LANE_SCHEMA = exports.anchorChangedSinceBinding = exports.deriveSettled = exports.deriveSettledBy = exports.receiptLaneDecision = exports.receiptLaneFromVerification = exports.buildReceiptLane = exports.jwksHostAllowed = exports.isPinnedTrustedJwk = exports.jwkThumbprint = exports.KEY_UNTRUSTED = exports.DEFAULT_TRUSTED_JWKS_HOSTS = exports.DEFAULT_TRUSTED_ISSUER_KIDS = exports.verifyIssuerJws = exports.resolvePinnedIssuerJwk = exports.canonicalSignedPayload = exports.BASE_SEPOLIA_RPC_URL = exports.ZK_VERIFIER_ADDRESS = exports.decodeJwsPayload = exports.receiptPayerClaimsFromEnvelope = exports.verifyPayerBinding = exports.SOLANA_USDC_MINT_DEVNET = exports.SOLANA_USDC_MINT_MAINNET = exports.SOLANA_RPC_URL = exports.fetchSolanaTransaction = exports.inferUsdcOutflowFromBalances = exports.extractUsdcTransfersFromTx = exports.isSolanaBase58Pubkey = exports.parseSolanaPaymentRef = exports.verifySolanaPayer = exports.BASE_RPC_URL = exports.ERC20_TRANSFER_TOPIC = exports.USDC_ADDRESSES = exports.fetchBaseTransactionReceipt = exports.sumUsdcTransfersFromPayer = exports.isEvmAddress = exports.parseBasePaymentRef = exports.verifyBasePayer = exports.computeInferenceBinding = exports.computePaymentCommitment = void 0;
16
- exports.issuerHistoryDocumentHash = exports.readIssuerHistoryPin = exports.CANONICAL_PAYLOAD_VERSION = exports.verifyCanonicalPreimageBytes = exports.BASE_MAINNET_CHAIN_ID = exports.SOLANA_GENESIS = exports.ANCHOR_DOES_NOT_PROVE = exports.ANCHOR_PROVES = exports.leafHash = exports.parseAnchorMemo = exports.extractMemos = exports.verifyMerkleInclusion = exports.verifyAnchoredRoot = exports.EPOCH2_OPENING_ROOT = exports.matchEpoch1Prefix = exports.epoch1PrefixRoot = exports.EPOCH1_SIZE2_ROOT = exports.EPOCH1_SIZE1_ROOT = exports.EPOCH1_GENESIS_DIGEST = exports.EPOCH1_FINAL_SIZE = exports.EPOCH1_FINAL_ROOT = exports.TREE_HEAD_SCHEMA_V2 = exports.TREE_HEAD_SCHEMA_V1 = exports.verifyEpochInclusion = exports.verifyEpochRecord = exports.verifyEpochLink = exports.acceptTreeHeadSchema = exports.REFUSAL_DOES_NOT_PROVE = exports.REFUSAL_PROVES = exports.REFUSAL_PAYLOAD_VERSION = void 0;
16
+ exports.ISSUER_ROTATION_CONTEXT = exports.ISSUER_REGISTRATION_CONTEXT = exports.canonicalPublicKey = exports.verifyRegistrationSignature = exports.verifyCitizenRotation = exports.serializeIssuerPin = exports.rotationStatement = exports.registrationPreimage = exports.readIssuerPinClaim = exports.loadIssuerPinBytes = exports.issuerPinFileHash = exports.issuerPinContentUrl = exports.assessIssuerPin = exports.BASE_MAINNET_CHAIN_ID = exports.SOLANA_GENESIS = exports.ANCHOR_DOES_NOT_PROVE = exports.ANCHOR_PROVES = exports.leafHash = exports.parseAnchorMemo = exports.extractMemos = exports.verifyMerkleInclusion = exports.verifyAnchoredRoot = exports.CARRY_FORWARD_STATUS = exports.PINNED_ANCHOR_EPOCHS = exports.verifyCarryForward = exports.EPOCH2_OPENING_ROOT = exports.matchEpoch1Prefix = exports.epoch1PrefixRoot = exports.EPOCH1_SIZE2_ROOT = exports.EPOCH1_SIZE1_ROOT = exports.EPOCH1_GENESIS_DIGEST = exports.EPOCH1_FINAL_SIZE = exports.EPOCH1_FINAL_ROOT = exports.TREE_HEAD_SCHEMA_V2 = exports.TREE_HEAD_SCHEMA_V1 = exports.canonicalUnloggedRows = exports.unloggedReasonForTask = exports.unloggedIdCommitment = exports.verifyUnloggedCommitment = exports.verifyUnloggedSection = exports.verifyEpochInclusion = exports.verifyEpochRecord = exports.verifyEpochLink = exports.acceptTreeHeadSchema = exports.requestDigestOfPreimage = exports.verifyRequestDigest = exports.REFUSAL_DOES_NOT_PROVE = exports.REFUSAL_PROVES = exports.REFUSAL_PAYLOAD_VERSION = exports.REFUSAL_SCHEMA_V2 = void 0;
17
+ exports.INCLUDED_SHELL_LINE = exports.SHELL_SCHEMA = exports.decodeShellJwsPayload = exports.openV11Commitment = exports.shellHolderVerdict = exports.holderDocumentFromOwnerView = exports.compareShellToJws = exports.shellFromHolder = exports.isReceiptShell = exports.issuerHistoryDocumentHash = exports.readIssuerHistoryPin = exports.CANONICAL_PAYLOAD_VERSION = exports.verifyCanonicalPreimageBytes = exports.compileAnchorWallets = exports.verifyAnchorWalletDocument = exports.verifyTreeHeadTrust = exports.headOmitsPinnedSigner = exports.HEAD_TRUST_MESSAGES = exports.LEGACY_HEAD_UNPINNED_SIGNER = exports.ANCHOR_WALLET_SOURCES_NOT_CONSULTED = exports.PINNED_SOLANA_ANCHOR_FEE_PAYER = exports.PINNED_BASE_ANCHOR_WALLET = exports.ISSUER_PIN_CHAIN_REFUSED = exports.ISSUER_ROTATION_UNCONTROLLED = exports.ISSUER_PIN_MUTABLE_REF = exports.ISSUER_PIN_DOWNGRADE = exports.ISSUER_SELF_SIG_INVALID = exports.ISSUER_PIN_HASH_MISMATCH = exports.ISSUER_PIN_MISMATCH = exports.CITIZEN_FREEZE_PURPOSE = exports.CITIZEN_FREEZE_SCHEMA = exports.PUBLISHED_ISSUER_PIN_KID = exports.ISSUER_PIN_CHAIN_ID = exports.ISSUER_PIN_PATH = exports.ISSUER_PIN_SCHEMA = exports.ISSUER_PIN_VERSION = void 0;
17
18
  exports.canonicalPayloadVersion = canonicalPayloadVersion;
18
19
  exports.canonicalIssuerPayload = canonicalIssuerPayload;
19
20
  exports.sumUsdcTransfersToPayee = sumUsdcTransfersToPayee;
@@ -25,12 +26,16 @@ exports.verifyNullifier = verifyNullifier;
25
26
  exports.hashCanonicalPayload = hashCanonicalPayload;
26
27
  exports.claimIdVerdict = claimIdVerdict;
27
28
  exports.diffOuterClaims = diffOuterClaims;
29
+ exports.unsignedOuterFields = unsignedOuterFields;
28
30
  exports.loadIssuerJwks = loadIssuerJwks;
29
31
  exports.fetchIssuerJwks = fetchIssuerJwks;
30
32
  exports.receiptPayerClaims = receiptPayerClaims;
33
+ exports.verifyReceiptUpToV10 = verifyReceiptUpToV10;
31
34
  exports.verifyReceipt = verifyReceipt;
32
35
  const ethers_1 = require("ethers");
33
36
  const anchor_witness_js_1 = require("./anchor-witness.js");
37
+ const row_hash_js_1 = require("./row-hash.js");
38
+ const carry_forward_js_1 = require("./carry-forward.js");
34
39
  const node_crypto_1 = require("node:crypto");
35
40
  const binding_js_1 = require("./binding.js");
36
41
  Object.defineProperty(exports, "computePaymentCommitment", { enumerable: true, get: function () { return binding_js_1.computePaymentCommitment; } });
@@ -58,6 +63,7 @@ const payer_js_1 = require("./payer.js");
58
63
  Object.defineProperty(exports, "verifyPayerBinding", { enumerable: true, get: function () { return payer_js_1.verifyPayerBinding; } });
59
64
  Object.defineProperty(exports, "receiptPayerClaimsFromEnvelope", { enumerable: true, get: function () { return payer_js_1.receiptPayerClaimsFromEnvelope; } });
60
65
  Object.defineProperty(exports, "decodeJwsPayload", { enumerable: true, get: function () { return payer_js_1.decodeJwsPayload; } });
66
+ const v11_receipt_js_1 = require("./v11-receipt.js");
61
67
  const jws_js_1 = require("./jws.js");
62
68
  const head_binding_js_1 = require("./head-binding.js");
63
69
  const receipt_lane_js_1 = require("./receipt-lane.js");
@@ -65,6 +71,7 @@ const refusal_js_1 = require("./refusal.js");
65
71
  const preimage_js_1 = require("./preimage.js");
66
72
  const issuer_history_js_1 = require("./issuer-history.js");
67
73
  const canonical_preimage_js_1 = require("./canonical-preimage.js");
74
+ const anchor_trust_js_1 = require("./anchor-trust.js");
68
75
  /** ZKVerifierSP1 contract on Base mainnet. */
69
76
  exports.ZK_VERIFIER_ADDRESS = '0x9373499645292715a2275A78eD65B14215C41c06';
70
77
  /** Base Sepolia testnet RPC. */
@@ -650,66 +657,118 @@ function asRecord(value) {
650
657
  return null;
651
658
  return value;
652
659
  }
653
- function normFact(value, address = false) {
654
- const text = claimString(value);
655
- if (text == null)
660
+ function isPlain(value) {
661
+ return !!value && typeof value === 'object' && !Array.isArray(value);
662
+ }
663
+ function formatClaim(value) {
664
+ if (value == null)
656
665
  return null;
657
- return address ? text.toLowerCase() : text;
666
+ if (typeof value === 'string')
667
+ return value;
668
+ if (typeof value === 'number' || typeof value === 'boolean')
669
+ return String(value);
670
+ return JSON.stringify(value);
671
+ }
672
+ /** 0x hex is compared case-insensitively. Checksum case is not a different claim. */
673
+ function sameLeaf(signed, outer) {
674
+ if (Array.isArray(signed) || Array.isArray(outer)) {
675
+ return JSON.stringify(signed) === JSON.stringify(outer);
676
+ }
677
+ if (typeof signed === 'string' && typeof outer === 'string') {
678
+ if (/^0x[0-9a-fA-F]+$/.test(signed) && /^0x[0-9a-fA-F]+$/.test(outer)) {
679
+ return signed.toLowerCase() === outer.toLowerCase();
680
+ }
681
+ return signed === outer;
682
+ }
683
+ if (signed == null || outer == null)
684
+ return signed == null && outer == null;
685
+ return Object.is(signed, outer);
658
686
  }
659
687
  /**
660
- * Fields a verifier may quote. Compared only when both the unsigned outer
661
- * copy and the JWS payload carry a value.
688
+ * The outer receipt `schema` (`xfuel.receipt.v3`) is the document type.
689
+ * The JWS `schema` (`chit402.foreign_payout.v1`) is the payload type.
690
+ * They share a name and are not copies of each other.
691
+ */
692
+ function schemaIsNotACopy(path) {
693
+ return path === 'schema';
694
+ }
695
+ function compareSignedNode(signed, outer, prefix, mismatches) {
696
+ if (!isPlain(signed))
697
+ return;
698
+ if (!isPlain(outer)) {
699
+ mismatches.push({
700
+ field: prefix || '$',
701
+ outer: formatClaim(outer),
702
+ signed: formatClaim(signed),
703
+ });
704
+ return;
705
+ }
706
+ for (const key of Object.keys(signed)) {
707
+ const path = prefix ? `${prefix}.${key}` : key;
708
+ if (schemaIsNotACopy(path))
709
+ continue;
710
+ if (!Object.prototype.hasOwnProperty.call(outer, key))
711
+ continue;
712
+ const sv = signed[key];
713
+ const ov = outer[key];
714
+ if (isPlain(sv) && isPlain(ov)) {
715
+ compareSignedNode(sv, ov, path, mismatches);
716
+ continue;
717
+ }
718
+ if (!sameLeaf(sv, ov)) {
719
+ mismatches.push({ field: path, outer: formatClaim(ov), signed: formatClaim(sv) });
720
+ }
721
+ }
722
+ }
723
+ /**
724
+ * Walk every signed claim. When the outer receipt has the same path, the
725
+ * values must match, including null against a filled-in outer copy. A path
726
+ * the outer receipt omits is not a copy, so it is not a mismatch.
662
727
  */
663
- const CLAIM_COMPARE = [
664
- { field: 'task_id', outer: (r) => r.task_id, signed: (c) => c.task_id },
665
- { field: 'payment.rail', outer: (r) => r.payment?.rail, signed: (c) => asRecord(c.payment)?.rail },
666
- { field: 'payment.ref', outer: (r) => r.payment?.ref, signed: (c) => asRecord(c.payment)?.ref },
667
- { field: 'payment.gross_amount', outer: (r) => r.payment?.gross_amount, signed: (c) => asRecord(c.payment)?.gross_amount },
668
- { field: 'payment.settled_amount', outer: (r) => r.payment?.settled_amount, signed: (c) => asRecord(c.payment)?.settled_amount },
669
- { field: 'payment.net_amount', outer: (r) => r.payment?.net_amount, signed: (c) => asRecord(c.payment)?.net_amount },
670
- { field: 'payment.asset', outer: (r) => r.payment?.asset, signed: (c) => asRecord(c.payment)?.asset, address: true },
671
- { field: 'payment.payee', outer: (r) => r.payment?.payee, signed: (c) => asRecord(c.payment)?.payee, address: true },
672
- { field: 'caller_binding.payer_wallet', outer: (r) => r.caller_binding?.payer_wallet, signed: (c) => asRecord(c.caller_binding)?.payer_wallet, address: true },
673
- { field: 'caller_binding.agent_pubkey', outer: (r) => r.caller_binding?.agent_pubkey, signed: (c) => asRecord(c.caller_binding)?.agent_pubkey },
674
- { field: 'caller_binding.api_key_hash', outer: (r) => r.caller_binding?.api_key_hash, signed: (c) => asRecord(c.caller_binding)?.api_key_hash },
675
- { field: 'claim_id', outer: (r) => r.claim_id, signed: (c) => c.claim_id },
676
- { field: 'route.model', outer: (r) => r.route?.model, signed: (c) => asRecord(c.route)?.model },
677
- { field: 'route.provider', outer: (r) => r.route?.provider, signed: (c) => asRecord(c.route)?.provider },
678
- { field: 'output.hash', outer: (r) => r.output?.hash, signed: (c) => asRecord(c.output)?.hash },
679
- { field: 'binding.expected_commitment', outer: (r) => r.binding?.expected_commitment, signed: (c) => asRecord(c.binding)?.expected_commitment },
680
- { field: 'provider_cogs.actual', outer: (r) => r.provider_cogs?.actual, signed: (c) => asRecord(c.provider_cogs)?.actual },
681
- ];
682
- /** Flag unsigned outer copies that disagree with the JWS payload. */
683
728
  function diffOuterClaims(receipt, claims) {
684
729
  if (!claims)
685
730
  return [];
686
731
  const mismatches = [];
687
- for (const spec of CLAIM_COMPARE) {
688
- const outer = normFact(spec.outer(receipt), spec.address);
689
- const signed = normFact(spec.signed(claims), spec.address);
690
- if (outer == null || signed == null || outer === signed)
691
- continue;
692
- mismatches.push({
693
- field: spec.field,
694
- outer: claimString(spec.outer(receipt)),
695
- signed: claimString(spec.signed(claims)),
696
- });
732
+ compareSignedNode(claims, receipt, '', mismatches);
733
+ return mismatches;
734
+ }
735
+ function pushUnsignedLeaves(value, path, paths) {
736
+ if (isPlain(value)) {
737
+ const keys = Object.keys(value).sort();
738
+ if (keys.length === 0) {
739
+ paths.push(path);
740
+ return;
741
+ }
742
+ for (const key of keys)
743
+ pushUnsignedLeaves(value[key], `${path}.${key}`, paths);
744
+ return;
697
745
  }
698
- // v9 head pair. Compared when the outer key is present, including a null
699
- // signed hash against a filled-in outer copy. v8 claims skip this.
700
- if ((0, head_binding_js_1.headBindingVerdict)(claims) === 'ok') {
701
- const disagree = (0, head_binding_js_1.outerHeadDisagrees)(receipt, claims);
702
- if (disagree) {
703
- const outerValue = disagree === 'tree_head_hash' ? receipt.tree_head_hash : receipt.tolerance;
704
- const signedValue = disagree === 'tree_head_hash' ? claims.tree_head_hash : claims.tolerance;
705
- mismatches.push({
706
- field: disagree,
707
- outer: outerValue == null ? null : JSON.stringify(outerValue),
708
- signed: signedValue == null ? null : JSON.stringify(signedValue),
709
- });
746
+ paths.push(path);
747
+ }
748
+ function collectUnsigned(outer, signed, prefix, paths) {
749
+ if (!isPlain(outer))
750
+ return;
751
+ const signedObj = isPlain(signed) ? signed : null;
752
+ for (const key of Object.keys(outer).sort()) {
753
+ const path = prefix ? `${prefix}.${key}` : key;
754
+ // The signature container is the credential that was checked, not an unsigned claim.
755
+ if (!prefix && key === 'issuer_signature')
756
+ continue;
757
+ const signedHas = !!signedObj && Object.prototype.hasOwnProperty.call(signedObj, key);
758
+ if (!signedHas || schemaIsNotACopy(path)) {
759
+ pushUnsignedLeaves(outer[key], path, paths);
760
+ continue;
710
761
  }
762
+ const sv = signedObj[key];
763
+ if (isPlain(outer[key]) && isPlain(sv))
764
+ collectUnsigned(outer[key], sv, path, paths);
711
765
  }
712
- return mismatches;
766
+ }
767
+ /** Outer paths the signed claims do not cover. Sorted. Not a failure by themselves. */
768
+ function unsignedOuterFields(receipt, claims) {
769
+ const paths = [];
770
+ collectUnsigned(receipt, claims, '', paths);
771
+ return paths;
713
772
  }
714
773
  function receiptViewFromClaims(receipt, claims) {
715
774
  const payment = asRecord(claims.payment);
@@ -888,9 +947,55 @@ function normalizeBoundRoot(root) {
888
947
  return /^[0-9a-f]{64}$/.test(hex) ? hex : null;
889
948
  }
890
949
  /**
891
- * True when the supplied head is the signed prefix, or a later head whose
892
- * inclusion proof contains this receipt's leaf.
950
+ * Row hash for an offline leaf. Null and `''` are missing: do not hash `task_id|`.
893
951
  */
952
+ function inclusionRow(receipt, inclusion) {
953
+ const bound = (0, row_hash_js_1.boundRowHash)(receipt, inclusion);
954
+ if (!bound.ok)
955
+ return bound;
956
+ if (bound.row == null || bound.row === '')
957
+ return { ok: false, reason: 'no_leaf' };
958
+ return { ok: true, row: bound.row };
959
+ }
960
+ /**
961
+ * Bind a supplied inclusion proof to its leaf index and tree size.
962
+ * The head's size, when present, has to be the inclusion's size.
963
+ */
964
+ function offlineInclusionBound(receipt, head, inclusion) {
965
+ const index = inclusion.leaf_index;
966
+ const size = inclusion.tree_size ?? head?.tree_size;
967
+ if (index == null || size == null || !Array.isArray(inclusion.proof)) {
968
+ return { ok: false, reason: 'inclusion_failed' };
969
+ }
970
+ if (head?.tree_size != null && inclusion.tree_size != null
971
+ && Number(head.tree_size) !== Number(inclusion.tree_size)) {
972
+ return { ok: false, reason: 'tree_size_mismatch' };
973
+ }
974
+ const root = normalizeBoundRoot(head?.root) || normalizeBoundRoot(inclusion.root);
975
+ if (!root)
976
+ return { ok: false, reason: 'bad_root' };
977
+ if (receipt.task_id == null)
978
+ return { ok: false, reason: 'missing_task_id' };
979
+ const bound = inclusionRow(receipt, inclusion);
980
+ if (!bound.ok)
981
+ return bound;
982
+ const leaf = (0, anchor_witness_js_1.leafHash)(Buffer.from(`${receipt.task_id}|${bound.row}`));
983
+ if (typeof inclusion.leaf === 'string' && /^[0-9a-fA-F]{64}$/.test(inclusion.leaf)
984
+ && inclusion.leaf.toLowerCase() !== leaf.toString('hex')) {
985
+ return { ok: false, reason: 'leaf_mismatch' };
986
+ }
987
+ const included = (0, anchor_witness_js_1.verifyMerkleInclusion)(leaf, Number(index), Number(size), root, inclusion.proof);
988
+ return included ? { ok: true } : { ok: false, reason: 'inclusion_failed' };
989
+ }
990
+ /**
991
+ * `{ root }` and `{ root, tree_size }` only compare a signed tree_head_hash.
992
+ * Any other supplied head is an offline tree-head witness and needs a signature.
993
+ */
994
+ function offlineHeadNeedsSignature(head) {
995
+ if (!head || typeof head !== 'object')
996
+ return false;
997
+ return Object.keys(head).some((key) => key !== 'root' && key !== 'tree_size');
998
+ }
894
999
  function suppliedHeadCovers(receipt, signedRoot, head, inclusion) {
895
1000
  const signed = normalizeBoundRoot(signedRoot);
896
1001
  const supplied = normalizeBoundRoot(head?.root);
@@ -902,8 +1007,10 @@ function suppliedHeadCovers(receipt, signedRoot, head, inclusion) {
902
1007
  return true;
903
1008
  if (receipt.task_id == null)
904
1009
  return false;
905
- const row = inclusion.row_hash ?? receipt.book_chain?.row_hash ?? '';
906
- const leaf = (0, anchor_witness_js_1.leafHash)(Buffer.from(`${receipt.task_id}|${row}`));
1010
+ const bound = inclusionRow(receipt, inclusion);
1011
+ if (!bound.ok)
1012
+ return false;
1013
+ const leaf = (0, anchor_witness_js_1.leafHash)(Buffer.from(`${receipt.task_id}|${bound.row}`));
907
1014
  if (typeof inclusion.leaf === 'string' && /^[0-9a-fA-F]{64}$/.test(inclusion.leaf)
908
1015
  && inclusion.leaf.toLowerCase() !== leaf.toString('hex')) {
909
1016
  return false;
@@ -913,7 +1020,17 @@ function suppliedHeadCovers(receipt, signedRoot, head, inclusion) {
913
1020
  return false;
914
1021
  return (0, anchor_witness_js_1.verifyMerkleInclusion)(leaf, Number(inclusion.leaf_index), Number(size), supplied, inclusion.proof);
915
1022
  }
1023
+ /** v1–v10 verifier. A v11 payload is `unsupported_version` and is not checked as v10. */
1024
+ async function verifyReceiptUpToV10(receipt, options = {}) {
1025
+ return (0, v11_receipt_js_1.verifyReceiptUpToV10)(receipt, options, verifyReceipt);
1026
+ }
916
1027
  async function verifyReceipt(receipt, options = {}) {
1028
+ const preDecoded = receipt?.issuer_signature?.jws
1029
+ ? (0, payer_js_1.decodeJwsPayload)(receipt.issuer_signature.jws)
1030
+ : null;
1031
+ if (preDecoded?.v === 11) {
1032
+ return (0, v11_receipt_js_1.verifyV11Receipt)(receipt, options);
1033
+ }
917
1034
  const errors = [];
918
1035
  const trustedKids = options.trustedKids ?? jws_js_1.DEFAULT_TRUSTED_ISSUER_KIDS;
919
1036
  const trustedHosts = options.trustedJwksHosts ?? jws_js_1.DEFAULT_TRUSTED_JWKS_HOSTS;
@@ -956,6 +1073,7 @@ async function verifyReceipt(receipt, options = {}) {
956
1073
  ? (0, payer_js_1.decodeJwsPayload)(receipt.issuer_signature.jws)
957
1074
  : null;
958
1075
  const claim_mismatches = diffOuterClaims(receipt, decoded);
1076
+ const unsigned_fields = unsignedOuterFields(receipt, decoded);
959
1077
  for (const mismatch of claim_mismatches) {
960
1078
  errors.push(`outer/signed mismatch: ${mismatch.field} (outer ${mismatch.outer}, signed ${mismatch.signed})`);
961
1079
  }
@@ -980,6 +1098,79 @@ async function verifyReceipt(receipt, options = {}) {
980
1098
  errors.push('tree_head_mismatch');
981
1099
  }
982
1100
  }
1101
+ const issuedAt = (verifiedClaims && 'iat' in verifiedClaims ? verifiedClaims.iat : null)
1102
+ ?? decoded?.iat
1103
+ ?? receipt.created_at
1104
+ ?? null;
1105
+ const historyPin = (0, issuer_history_js_1.readIssuerHistoryPin)(verifiedClaims);
1106
+ const payloadVersion = Number(verifiedClaims?.payload_version);
1107
+ // Payload v10 signs the history pin. A missing pin fails even when the
1108
+ // caller did not pass a history file or ask for a fetch.
1109
+ const pinRequired = !options.skipIssuerHistory
1110
+ && Number.isFinite(payloadVersion)
1111
+ && payloadVersion >= canonical_preimage_js_1.CANONICAL_PAYLOAD_VERSION;
1112
+ const historyAsked = pinRequired || (!options.skipIssuerHistory && !!(options.issuerHistory
1113
+ || options.issuerHistoryBytes
1114
+ || options.fetchIssuerHistory
1115
+ || options.strictIssuerHistory
1116
+ || options.issuerHistoryUrl
1117
+ || historyPin));
1118
+ const issuer_history = historyAsked
1119
+ ? await (0, issuer_history_js_1.checkReceiptIssuerHistory)(receipt, {
1120
+ document: options.issuerHistory ?? null,
1121
+ documentBytes: options.issuerHistoryBytes ?? null,
1122
+ fetchHistory: options.fetchIssuerHistory === true || options.strictIssuerHistory === true,
1123
+ strict: options.strictIssuerHistory === true,
1124
+ historyUrl: options.issuerHistoryUrl ?? null,
1125
+ jwks,
1126
+ trustedKids,
1127
+ fetchImpl: options.fetchImpl,
1128
+ trustedHosts,
1129
+ issuedAt,
1130
+ kid: issuer_signature.kid ?? receipt.issuer_signature?.kid ?? null,
1131
+ pin: historyPin,
1132
+ requirePin: pinRequired,
1133
+ })
1134
+ : {
1135
+ checked: false,
1136
+ ok: true,
1137
+ unreachable: false,
1138
+ warning: null,
1139
+ reason: null,
1140
+ kid: issuer_signature.kid ?? receipt.issuer_signature?.kid ?? null,
1141
+ document: null,
1142
+ loaded: false,
1143
+ };
1144
+ // Offline: a tree-head witness is trusted only when its ES256 signature
1145
+ // covers the outer size, root, and the other fields anchor mode already
1146
+ // compares. A missing signature is head_signature_missing. The history
1147
+ // body loaded above is the one this check trusts. Chain RPC is not used.
1148
+ let headTrustFailed = false;
1149
+ const suppliedHead = options.head;
1150
+ if (offlineHeadNeedsSignature(suppliedHead)) {
1151
+ const trust = (0, anchor_trust_js_1.verifyTreeHeadTrust)(suppliedHead, {
1152
+ jwks,
1153
+ trustedKids,
1154
+ issuerHistory: issuer_history.document,
1155
+ strictIssuerHistory: options.strictIssuerHistory === true,
1156
+ });
1157
+ if (!trust.ok) {
1158
+ headTrustFailed = true;
1159
+ errors.push(trust.reason || 'head_signature_invalid');
1160
+ }
1161
+ else if (issuer_history.loaded && !issuer_history.document) {
1162
+ headTrustFailed = true;
1163
+ errors.push('issuer_history_invalid');
1164
+ }
1165
+ }
1166
+ let inclusionFailed = false;
1167
+ if (options.inclusion && (options.inclusion.proof || options.inclusion.leaf_index != null)) {
1168
+ const bound = offlineInclusionBound(receipt, options.head ?? null, options.inclusion);
1169
+ if (!bound.ok) {
1170
+ inclusionFailed = true;
1171
+ errors.push(bound.reason);
1172
+ }
1173
+ }
983
1174
  let binding;
984
1175
  if (receipt.issuer_signature?.jws) {
985
1176
  if (verifiedClaims) {
@@ -1120,47 +1311,6 @@ async function verifyReceipt(receipt, options = {}) {
1120
1311
  errors.push(`canonical preimage: ${fileCheck.reason}`);
1121
1312
  }
1122
1313
  }
1123
- const issuedAt = (verifiedClaims && 'iat' in verifiedClaims ? verifiedClaims.iat : null)
1124
- ?? decoded?.iat
1125
- ?? receipt.created_at
1126
- ?? null;
1127
- const historyPin = (0, issuer_history_js_1.readIssuerHistoryPin)(verifiedClaims);
1128
- const payloadVersion = Number(verifiedClaims?.payload_version);
1129
- // Payload v10 signs the history pin. A missing pin fails even when the
1130
- // caller did not pass a history file or ask for a fetch.
1131
- const pinRequired = !options.skipIssuerHistory
1132
- && Number.isFinite(payloadVersion)
1133
- && payloadVersion >= canonical_preimage_js_1.CANONICAL_PAYLOAD_VERSION;
1134
- const historyAsked = pinRequired || (!options.skipIssuerHistory && !!(options.issuerHistory
1135
- || options.issuerHistoryBytes
1136
- || options.fetchIssuerHistory
1137
- || options.strictIssuerHistory
1138
- || options.issuerHistoryUrl
1139
- || historyPin));
1140
- const issuer_history = historyAsked
1141
- ? await (0, issuer_history_js_1.checkReceiptIssuerHistory)(receipt, {
1142
- document: options.issuerHistory ?? null,
1143
- documentBytes: options.issuerHistoryBytes ?? null,
1144
- fetchHistory: options.fetchIssuerHistory === true || options.strictIssuerHistory === true,
1145
- strict: options.strictIssuerHistory === true,
1146
- historyUrl: options.issuerHistoryUrl ?? null,
1147
- jwks,
1148
- trustedKids,
1149
- fetchImpl: options.fetchImpl,
1150
- trustedHosts,
1151
- issuedAt,
1152
- kid: issuer_signature.kid ?? receipt.issuer_signature?.kid ?? null,
1153
- pin: historyPin,
1154
- requirePin: pinRequired,
1155
- })
1156
- : {
1157
- checked: false,
1158
- ok: true,
1159
- unreachable: false,
1160
- warning: null,
1161
- reason: null,
1162
- kid: issuer_signature.kid ?? receipt.issuer_signature?.kid ?? null,
1163
- };
1164
1314
  if (issuer_history.warning)
1165
1315
  warnings.push(issuer_history.warning);
1166
1316
  if (issuer_history.checked && !issuer_history.ok && issuer_history.reason) {
@@ -1184,7 +1334,7 @@ async function verifyReceipt(receipt, options = {}) {
1184
1334
  let overall;
1185
1335
  const preimageFailed = !preimages.ok;
1186
1336
  const historyFailed = issuer_history.checked && !issuer_history.ok;
1187
- if (signatureFailed || mismatchFailed || bindingFailed || payerFailed || nullifierFailed || claimRefused || headMissing || headMismatch || preimageFailed || historyFailed || canonicalPreimageFailed) {
1337
+ if (signatureFailed || mismatchFailed || bindingFailed || payerFailed || nullifierFailed || claimRefused || headMissing || headMismatch || headTrustFailed || inclusionFailed || preimageFailed || historyFailed || canonicalPreimageFailed) {
1188
1338
  overall = 'failed';
1189
1339
  }
1190
1340
  else if (signatureUnchecked) {
@@ -1210,11 +1360,49 @@ async function verifyReceipt(receipt, options = {}) {
1210
1360
  errors.push('refusal document is not a payment receipt');
1211
1361
  overall = 'failed';
1212
1362
  }
1363
+ let carry_forward;
1364
+ if (options.carry) {
1365
+ const bound = (0, row_hash_js_1.boundRowHash)(receipt, { row_hash: options.carry.row_hash });
1366
+ const leaf = !bound.ok || bound.row == null || bound.row === '' || receipt.task_id == null
1367
+ ? null
1368
+ : (0, anchor_witness_js_1.leafHash)(Buffer.from(`${receipt.task_id}|${bound.row}`));
1369
+ const verdict = !bound.ok
1370
+ ? { applicable: true, ok: false, status: null, reason: bound.reason }
1371
+ : (bound.row == null || bound.row === '')
1372
+ ? { applicable: true, ok: false, status: null, reason: 'row_hash_missing' }
1373
+ : leaf
1374
+ ? (0, carry_forward_js_1.verifyCarryForward)({
1375
+ leaf,
1376
+ oldHead: options.carry.oldHead,
1377
+ oldInclusion: options.carry.oldInclusion,
1378
+ currentHead: options.carry.currentHead,
1379
+ currentInclusions: options.carry.currentInclusions,
1380
+ trustedKids,
1381
+ jwks,
1382
+ })
1383
+ : { applicable: true, ok: false, status: null, reason: 'not_in_tree' };
1384
+ if (verdict.applicable && !verdict.ok) {
1385
+ errors.push(verdict.reason);
1386
+ overall = 'failed';
1387
+ }
1388
+ else if (verdict.applicable && verdict.ok && overall === 'verified') {
1389
+ overall = 'verified_carried_forward';
1390
+ carry_forward = {
1391
+ status: verdict.status,
1392
+ issued_at: verdict.issued_at,
1393
+ issued_epoch: verdict.issued_epoch,
1394
+ logged_at: verdict.logged_at,
1395
+ logged_epoch: verdict.logged_epoch,
1396
+ leaf_index: verdict.leaf_index,
1397
+ };
1398
+ }
1399
+ }
1213
1400
  const signedPayment = asRecord(verifiedClaims?.payment);
1214
1401
  const signedSettlement = asRecord(verifiedClaims?.settlement);
1215
1402
  const receipt_lane = (0, receipt_lane_js_1.receiptLaneFromVerification)({
1216
1403
  receipt,
1217
1404
  claims: {
1405
+ schema: verifiedSchema,
1218
1406
  payment: signedPayment ? {
1219
1407
  ref: typeof signedPayment.ref === 'string' ? signedPayment.ref : null,
1220
1408
  rail: typeof signedPayment.rail === 'string' ? signedPayment.rail : null,
@@ -1240,6 +1428,8 @@ async function verifyReceipt(receipt, options = {}) {
1240
1428
  amount_usdc: facts.amount_usdc,
1241
1429
  tx: facts.tx,
1242
1430
  claim_mismatches,
1431
+ unsigned_fields,
1432
+ verified_scope: 'signed_claims',
1243
1433
  claim_id,
1244
1434
  head_binding: signedBinding
1245
1435
  ? { tree_head_hash: signedBinding.tree_head_hash, tolerance: signedBinding.tolerance }
@@ -1248,6 +1438,7 @@ async function verifyReceipt(receipt, options = {}) {
1248
1438
  preimages,
1249
1439
  issuer_history,
1250
1440
  warnings,
1441
+ ...(carry_forward ? { carry_forward } : {}),
1251
1442
  overall,
1252
1443
  errors,
1253
1444
  };
@@ -1281,14 +1472,23 @@ var refusal_js_2 = require("./refusal.js");
1281
1472
  Object.defineProperty(exports, "isRefusalDocument", { enumerable: true, get: function () { return refusal_js_2.isRefusalDocument; } });
1282
1473
  Object.defineProperty(exports, "verifyRefusal", { enumerable: true, get: function () { return refusal_js_2.verifyRefusal; } });
1283
1474
  Object.defineProperty(exports, "REFUSAL_SCHEMA", { enumerable: true, get: function () { return refusal_js_2.REFUSAL_SCHEMA; } });
1475
+ Object.defineProperty(exports, "REFUSAL_SCHEMA_V2", { enumerable: true, get: function () { return refusal_js_2.REFUSAL_SCHEMA_V2; } });
1284
1476
  Object.defineProperty(exports, "REFUSAL_PAYLOAD_VERSION", { enumerable: true, get: function () { return refusal_js_2.REFUSAL_PAYLOAD_VERSION; } });
1285
1477
  Object.defineProperty(exports, "REFUSAL_PROVES", { enumerable: true, get: function () { return refusal_js_2.REFUSAL_PROVES; } });
1286
1478
  Object.defineProperty(exports, "REFUSAL_DOES_NOT_PROVE", { enumerable: true, get: function () { return refusal_js_2.REFUSAL_DOES_NOT_PROVE; } });
1479
+ var request_binding_js_1 = require("./request-binding.js");
1480
+ Object.defineProperty(exports, "verifyRequestDigest", { enumerable: true, get: function () { return request_binding_js_1.verifyRequestDigest; } });
1481
+ Object.defineProperty(exports, "requestDigestOfPreimage", { enumerable: true, get: function () { return request_binding_js_1.requestDigestOfPreimage; } });
1287
1482
  var epoch_js_1 = require("./epoch.js");
1288
1483
  Object.defineProperty(exports, "acceptTreeHeadSchema", { enumerable: true, get: function () { return epoch_js_1.acceptTreeHeadSchema; } });
1289
1484
  Object.defineProperty(exports, "verifyEpochLink", { enumerable: true, get: function () { return epoch_js_1.verifyEpochLink; } });
1290
1485
  Object.defineProperty(exports, "verifyEpochRecord", { enumerable: true, get: function () { return epoch_js_1.verifyEpochRecord; } });
1291
1486
  Object.defineProperty(exports, "verifyEpochInclusion", { enumerable: true, get: function () { return epoch_js_1.verifyEpochInclusion; } });
1487
+ Object.defineProperty(exports, "verifyUnloggedSection", { enumerable: true, get: function () { return epoch_js_1.verifyUnloggedSection; } });
1488
+ Object.defineProperty(exports, "verifyUnloggedCommitment", { enumerable: true, get: function () { return epoch_js_1.verifyUnloggedCommitment; } });
1489
+ Object.defineProperty(exports, "unloggedIdCommitment", { enumerable: true, get: function () { return epoch_js_1.unloggedIdCommitment; } });
1490
+ Object.defineProperty(exports, "unloggedReasonForTask", { enumerable: true, get: function () { return epoch_js_1.unloggedReasonForTask; } });
1491
+ Object.defineProperty(exports, "canonicalUnloggedRows", { enumerable: true, get: function () { return epoch_js_1.canonicalUnloggedRows; } });
1292
1492
  Object.defineProperty(exports, "TREE_HEAD_SCHEMA_V1", { enumerable: true, get: function () { return epoch_js_1.TREE_HEAD_SCHEMA_V1; } });
1293
1493
  Object.defineProperty(exports, "TREE_HEAD_SCHEMA_V2", { enumerable: true, get: function () { return epoch_js_1.TREE_HEAD_SCHEMA_V2; } });
1294
1494
  Object.defineProperty(exports, "EPOCH1_FINAL_ROOT", { enumerable: true, get: function () { return epoch_js_1.EPOCH1_FINAL_ROOT; } });
@@ -1299,6 +1499,10 @@ Object.defineProperty(exports, "EPOCH1_SIZE2_ROOT", { enumerable: true, get: fun
1299
1499
  Object.defineProperty(exports, "epoch1PrefixRoot", { enumerable: true, get: function () { return epoch_js_1.epoch1PrefixRoot; } });
1300
1500
  Object.defineProperty(exports, "matchEpoch1Prefix", { enumerable: true, get: function () { return epoch_js_1.matchEpoch1Prefix; } });
1301
1501
  Object.defineProperty(exports, "EPOCH2_OPENING_ROOT", { enumerable: true, get: function () { return epoch_js_1.EPOCH2_OPENING_ROOT; } });
1502
+ var carry_forward_js_2 = require("./carry-forward.js");
1503
+ Object.defineProperty(exports, "verifyCarryForward", { enumerable: true, get: function () { return carry_forward_js_2.verifyCarryForward; } });
1504
+ Object.defineProperty(exports, "PINNED_ANCHOR_EPOCHS", { enumerable: true, get: function () { return carry_forward_js_2.PINNED_ANCHOR_EPOCHS; } });
1505
+ Object.defineProperty(exports, "CARRY_FORWARD_STATUS", { enumerable: true, get: function () { return carry_forward_js_2.CARRY_FORWARD_STATUS; } });
1302
1506
  var anchor_witness_js_2 = require("./anchor-witness.js");
1303
1507
  Object.defineProperty(exports, "verifyAnchoredRoot", { enumerable: true, get: function () { return anchor_witness_js_2.verifyAnchoredRoot; } });
1304
1508
  Object.defineProperty(exports, "verifyMerkleInclusion", { enumerable: true, get: function () { return anchor_witness_js_2.verifyMerkleInclusion; } });
@@ -1309,12 +1513,60 @@ Object.defineProperty(exports, "ANCHOR_PROVES", { enumerable: true, get: functio
1309
1513
  Object.defineProperty(exports, "ANCHOR_DOES_NOT_PROVE", { enumerable: true, get: function () { return anchor_witness_js_2.ANCHOR_DOES_NOT_PROVE; } });
1310
1514
  Object.defineProperty(exports, "SOLANA_GENESIS", { enumerable: true, get: function () { return anchor_witness_js_2.SOLANA_GENESIS; } });
1311
1515
  Object.defineProperty(exports, "BASE_MAINNET_CHAIN_ID", { enumerable: true, get: function () { return anchor_witness_js_2.BASE_MAINNET_CHAIN_ID; } });
1516
+ var issuer_pin_js_1 = require("./issuer-pin.js");
1517
+ Object.defineProperty(exports, "assessIssuerPin", { enumerable: true, get: function () { return issuer_pin_js_1.assessIssuerPin; } });
1518
+ Object.defineProperty(exports, "issuerPinContentUrl", { enumerable: true, get: function () { return issuer_pin_js_1.issuerPinContentUrl; } });
1519
+ Object.defineProperty(exports, "issuerPinFileHash", { enumerable: true, get: function () { return issuer_pin_js_1.issuerPinFileHash; } });
1520
+ Object.defineProperty(exports, "loadIssuerPinBytes", { enumerable: true, get: function () { return issuer_pin_js_1.loadIssuerPinBytes; } });
1521
+ Object.defineProperty(exports, "readIssuerPinClaim", { enumerable: true, get: function () { return issuer_pin_js_1.readIssuerPinClaim; } });
1522
+ Object.defineProperty(exports, "registrationPreimage", { enumerable: true, get: function () { return issuer_pin_js_1.registrationPreimage; } });
1523
+ Object.defineProperty(exports, "rotationStatement", { enumerable: true, get: function () { return issuer_pin_js_1.rotationStatement; } });
1524
+ Object.defineProperty(exports, "serializeIssuerPin", { enumerable: true, get: function () { return issuer_pin_js_1.serializeIssuerPin; } });
1525
+ Object.defineProperty(exports, "verifyCitizenRotation", { enumerable: true, get: function () { return issuer_pin_js_1.verifyCitizenRotation; } });
1526
+ Object.defineProperty(exports, "verifyRegistrationSignature", { enumerable: true, get: function () { return issuer_pin_js_1.verifyRegistrationSignature; } });
1527
+ Object.defineProperty(exports, "canonicalPublicKey", { enumerable: true, get: function () { return issuer_pin_js_1.canonicalPublicKey; } });
1528
+ Object.defineProperty(exports, "ISSUER_REGISTRATION_CONTEXT", { enumerable: true, get: function () { return issuer_pin_js_1.ISSUER_REGISTRATION_CONTEXT; } });
1529
+ Object.defineProperty(exports, "ISSUER_ROTATION_CONTEXT", { enumerable: true, get: function () { return issuer_pin_js_1.ISSUER_ROTATION_CONTEXT; } });
1530
+ Object.defineProperty(exports, "ISSUER_PIN_VERSION", { enumerable: true, get: function () { return issuer_pin_js_1.ISSUER_PIN_VERSION; } });
1531
+ Object.defineProperty(exports, "ISSUER_PIN_SCHEMA", { enumerable: true, get: function () { return issuer_pin_js_1.ISSUER_PIN_SCHEMA; } });
1532
+ Object.defineProperty(exports, "ISSUER_PIN_PATH", { enumerable: true, get: function () { return issuer_pin_js_1.ISSUER_PIN_PATH; } });
1533
+ Object.defineProperty(exports, "ISSUER_PIN_CHAIN_ID", { enumerable: true, get: function () { return issuer_pin_js_1.ISSUER_PIN_CHAIN_ID; } });
1534
+ Object.defineProperty(exports, "PUBLISHED_ISSUER_PIN_KID", { enumerable: true, get: function () { return issuer_pin_js_1.PUBLISHED_ISSUER_PIN_KID; } });
1535
+ Object.defineProperty(exports, "CITIZEN_FREEZE_SCHEMA", { enumerable: true, get: function () { return issuer_pin_js_1.CITIZEN_FREEZE_SCHEMA; } });
1536
+ Object.defineProperty(exports, "CITIZEN_FREEZE_PURPOSE", { enumerable: true, get: function () { return issuer_pin_js_1.CITIZEN_FREEZE_PURPOSE; } });
1537
+ Object.defineProperty(exports, "ISSUER_PIN_MISMATCH", { enumerable: true, get: function () { return issuer_pin_js_1.ISSUER_PIN_MISMATCH; } });
1538
+ Object.defineProperty(exports, "ISSUER_PIN_HASH_MISMATCH", { enumerable: true, get: function () { return issuer_pin_js_1.ISSUER_PIN_HASH_MISMATCH; } });
1539
+ Object.defineProperty(exports, "ISSUER_SELF_SIG_INVALID", { enumerable: true, get: function () { return issuer_pin_js_1.ISSUER_SELF_SIG_INVALID; } });
1540
+ Object.defineProperty(exports, "ISSUER_PIN_DOWNGRADE", { enumerable: true, get: function () { return issuer_pin_js_1.ISSUER_PIN_DOWNGRADE; } });
1541
+ Object.defineProperty(exports, "ISSUER_PIN_MUTABLE_REF", { enumerable: true, get: function () { return issuer_pin_js_1.ISSUER_PIN_MUTABLE_REF; } });
1542
+ Object.defineProperty(exports, "ISSUER_ROTATION_UNCONTROLLED", { enumerable: true, get: function () { return issuer_pin_js_1.ISSUER_ROTATION_UNCONTROLLED; } });
1543
+ Object.defineProperty(exports, "ISSUER_PIN_CHAIN_REFUSED", { enumerable: true, get: function () { return issuer_pin_js_1.ISSUER_PIN_CHAIN_REFUSED; } });
1544
+ var anchor_trust_js_2 = require("./anchor-trust.js");
1545
+ Object.defineProperty(exports, "PINNED_BASE_ANCHOR_WALLET", { enumerable: true, get: function () { return anchor_trust_js_2.PINNED_BASE_ANCHOR_WALLET; } });
1546
+ Object.defineProperty(exports, "PINNED_SOLANA_ANCHOR_FEE_PAYER", { enumerable: true, get: function () { return anchor_trust_js_2.PINNED_SOLANA_ANCHOR_FEE_PAYER; } });
1547
+ Object.defineProperty(exports, "ANCHOR_WALLET_SOURCES_NOT_CONSULTED", { enumerable: true, get: function () { return anchor_trust_js_2.ANCHOR_WALLET_SOURCES_NOT_CONSULTED; } });
1548
+ Object.defineProperty(exports, "LEGACY_HEAD_UNPINNED_SIGNER", { enumerable: true, get: function () { return anchor_trust_js_2.LEGACY_HEAD_UNPINNED_SIGNER; } });
1549
+ Object.defineProperty(exports, "HEAD_TRUST_MESSAGES", { enumerable: true, get: function () { return anchor_trust_js_2.HEAD_TRUST_MESSAGES; } });
1550
+ Object.defineProperty(exports, "headOmitsPinnedSigner", { enumerable: true, get: function () { return anchor_trust_js_2.headOmitsPinnedSigner; } });
1551
+ Object.defineProperty(exports, "verifyTreeHeadTrust", { enumerable: true, get: function () { return anchor_trust_js_2.verifyTreeHeadTrust; } });
1552
+ Object.defineProperty(exports, "verifyAnchorWalletDocument", { enumerable: true, get: function () { return anchor_trust_js_2.verifyAnchorWalletDocument; } });
1553
+ Object.defineProperty(exports, "compileAnchorWallets", { enumerable: true, get: function () { return anchor_trust_js_2.compileAnchorWallets; } });
1312
1554
  var canonical_preimage_js_2 = require("./canonical-preimage.js");
1313
1555
  Object.defineProperty(exports, "verifyCanonicalPreimageBytes", { enumerable: true, get: function () { return canonical_preimage_js_2.verifyCanonicalPreimageBytes; } });
1314
1556
  Object.defineProperty(exports, "CANONICAL_PAYLOAD_VERSION", { enumerable: true, get: function () { return canonical_preimage_js_2.CANONICAL_PAYLOAD_VERSION; } });
1315
1557
  var issuer_history_js_2 = require("./issuer-history.js");
1316
1558
  Object.defineProperty(exports, "readIssuerHistoryPin", { enumerable: true, get: function () { return issuer_history_js_2.readIssuerHistoryPin; } });
1317
1559
  Object.defineProperty(exports, "issuerHistoryDocumentHash", { enumerable: true, get: function () { return issuer_history_js_2.issuerHistoryDocumentHash; } });
1560
+ var shell_js_1 = require("./shell.js");
1561
+ Object.defineProperty(exports, "isReceiptShell", { enumerable: true, get: function () { return shell_js_1.isReceiptShell; } });
1562
+ Object.defineProperty(exports, "shellFromHolder", { enumerable: true, get: function () { return shell_js_1.shellFromHolder; } });
1563
+ Object.defineProperty(exports, "compareShellToJws", { enumerable: true, get: function () { return shell_js_1.compareShellToJws; } });
1564
+ Object.defineProperty(exports, "holderDocumentFromOwnerView", { enumerable: true, get: function () { return shell_js_1.holderDocumentFromOwnerView; } });
1565
+ Object.defineProperty(exports, "shellHolderVerdict", { enumerable: true, get: function () { return shell_js_1.shellHolderVerdict; } });
1566
+ Object.defineProperty(exports, "openV11Commitment", { enumerable: true, get: function () { return shell_js_1.openV11Commitment; } });
1567
+ Object.defineProperty(exports, "decodeShellJwsPayload", { enumerable: true, get: function () { return shell_js_1.decodeJwsPayload; } });
1568
+ Object.defineProperty(exports, "SHELL_SCHEMA", { enumerable: true, get: function () { return shell_js_1.SHELL_SCHEMA; } });
1569
+ Object.defineProperty(exports, "INCLUDED_SHELL_LINE", { enumerable: true, get: function () { return shell_js_1.INCLUDED_SHELL_LINE; } });
1318
1570
  exports.default = {
1319
1571
  verifyBinding,
1320
1572
  verifyIssuerSignature,