@xfuel/verify 0.3.0 → 0.3.3
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/README.md +37 -16
- package/dist/anchor-trust.d.ts +129 -0
- package/dist/anchor-trust.d.ts.map +1 -0
- package/dist/anchor-trust.js +395 -0
- package/dist/anchor-trust.js.map +1 -0
- package/dist/anchor-witness.d.ts +134 -7
- package/dist/anchor-witness.d.ts.map +1 -1
- package/dist/anchor-witness.js +497 -44
- package/dist/anchor-witness.js.map +1 -1
- package/dist/carry-forward.d.ts +79 -0
- package/dist/carry-forward.d.ts.map +1 -0
- package/dist/carry-forward.js +184 -0
- package/dist/carry-forward.js.map +1 -0
- package/dist/cli.js +674 -30
- package/dist/cli.js.map +1 -1
- package/dist/epoch.d.ts +143 -0
- package/dist/epoch.d.ts.map +1 -0
- package/dist/epoch.js +352 -0
- package/dist/epoch.js.map +1 -0
- package/dist/index.d.ts +86 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +395 -118
- package/dist/index.js.map +1 -1
- package/dist/issuer-history.d.ts +19 -0
- package/dist/issuer-history.d.ts.map +1 -1
- package/dist/issuer-history.js +131 -75
- package/dist/issuer-history.js.map +1 -1
- package/dist/issuer-pin.d.ts +126 -0
- package/dist/issuer-pin.d.ts.map +1 -0
- package/dist/issuer-pin.js +567 -0
- package/dist/issuer-pin.js.map +1 -0
- package/dist/preimage.d.ts +29 -0
- package/dist/preimage.d.ts.map +1 -1
- package/dist/preimage.js +162 -2
- package/dist/preimage.js.map +1 -1
- package/dist/receipt-lane.d.ts +1 -0
- package/dist/receipt-lane.d.ts.map +1 -1
- package/dist/receipt-lane.js +5 -2
- package/dist/receipt-lane.js.map +1 -1
- package/dist/refusal.d.ts +5 -2
- package/dist/refusal.d.ts.map +1 -1
- package/dist/refusal.js +28 -6
- package/dist/refusal.js.map +1 -1
- package/dist/request-binding.d.ts +7 -0
- package/dist/request-binding.d.ts.map +1 -0
- package/dist/request-binding.js +26 -0
- package/dist/request-binding.js.map +1 -0
- package/dist/row-hash.d.ts +22 -0
- package/dist/row-hash.d.ts.map +1 -0
- package/dist/row-hash.js +26 -0
- package/dist/row-hash.js.map +1 -0
- package/dist/v11-receipt.d.ts +21 -0
- package/dist/v11-receipt.d.ts.map +1 -0
- package/dist/v11-receipt.js +351 -0
- package/dist/v11-receipt.js.map +1 -0
- 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.
|
|
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.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,11 +26,16 @@ exports.verifyNullifier = verifyNullifier;
|
|
|
25
26
|
exports.hashCanonicalPayload = hashCanonicalPayload;
|
|
26
27
|
exports.claimIdVerdict = claimIdVerdict;
|
|
27
28
|
exports.diffOuterClaims = diffOuterClaims;
|
|
29
|
+
exports.unsignedOuterFields = unsignedOuterFields;
|
|
30
|
+
exports.loadIssuerJwks = loadIssuerJwks;
|
|
28
31
|
exports.fetchIssuerJwks = fetchIssuerJwks;
|
|
29
32
|
exports.receiptPayerClaims = receiptPayerClaims;
|
|
33
|
+
exports.verifyReceiptUpToV10 = verifyReceiptUpToV10;
|
|
30
34
|
exports.verifyReceipt = verifyReceipt;
|
|
31
35
|
const ethers_1 = require("ethers");
|
|
32
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");
|
|
33
39
|
const node_crypto_1 = require("node:crypto");
|
|
34
40
|
const binding_js_1 = require("./binding.js");
|
|
35
41
|
Object.defineProperty(exports, "computePaymentCommitment", { enumerable: true, get: function () { return binding_js_1.computePaymentCommitment; } });
|
|
@@ -57,6 +63,7 @@ const payer_js_1 = require("./payer.js");
|
|
|
57
63
|
Object.defineProperty(exports, "verifyPayerBinding", { enumerable: true, get: function () { return payer_js_1.verifyPayerBinding; } });
|
|
58
64
|
Object.defineProperty(exports, "receiptPayerClaimsFromEnvelope", { enumerable: true, get: function () { return payer_js_1.receiptPayerClaimsFromEnvelope; } });
|
|
59
65
|
Object.defineProperty(exports, "decodeJwsPayload", { enumerable: true, get: function () { return payer_js_1.decodeJwsPayload; } });
|
|
66
|
+
const v11_receipt_js_1 = require("./v11-receipt.js");
|
|
60
67
|
const jws_js_1 = require("./jws.js");
|
|
61
68
|
const head_binding_js_1 = require("./head-binding.js");
|
|
62
69
|
const receipt_lane_js_1 = require("./receipt-lane.js");
|
|
@@ -64,6 +71,7 @@ const refusal_js_1 = require("./refusal.js");
|
|
|
64
71
|
const preimage_js_1 = require("./preimage.js");
|
|
65
72
|
const issuer_history_js_1 = require("./issuer-history.js");
|
|
66
73
|
const canonical_preimage_js_1 = require("./canonical-preimage.js");
|
|
74
|
+
const anchor_trust_js_1 = require("./anchor-trust.js");
|
|
67
75
|
/** ZKVerifierSP1 contract on Base mainnet. */
|
|
68
76
|
exports.ZK_VERIFIER_ADDRESS = '0x9373499645292715a2275A78eD65B14215C41c06';
|
|
69
77
|
/** Base Sepolia testnet RPC. */
|
|
@@ -649,66 +657,118 @@ function asRecord(value) {
|
|
|
649
657
|
return null;
|
|
650
658
|
return value;
|
|
651
659
|
}
|
|
652
|
-
function
|
|
653
|
-
|
|
654
|
-
|
|
660
|
+
function isPlain(value) {
|
|
661
|
+
return !!value && typeof value === 'object' && !Array.isArray(value);
|
|
662
|
+
}
|
|
663
|
+
function formatClaim(value) {
|
|
664
|
+
if (value == null)
|
|
655
665
|
return null;
|
|
656
|
-
|
|
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);
|
|
657
686
|
}
|
|
658
687
|
/**
|
|
659
|
-
*
|
|
660
|
-
*
|
|
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.
|
|
661
727
|
*/
|
|
662
|
-
const CLAIM_COMPARE = [
|
|
663
|
-
{ field: 'task_id', outer: (r) => r.task_id, signed: (c) => c.task_id },
|
|
664
|
-
{ field: 'payment.rail', outer: (r) => r.payment?.rail, signed: (c) => asRecord(c.payment)?.rail },
|
|
665
|
-
{ field: 'payment.ref', outer: (r) => r.payment?.ref, signed: (c) => asRecord(c.payment)?.ref },
|
|
666
|
-
{ field: 'payment.gross_amount', outer: (r) => r.payment?.gross_amount, signed: (c) => asRecord(c.payment)?.gross_amount },
|
|
667
|
-
{ field: 'payment.settled_amount', outer: (r) => r.payment?.settled_amount, signed: (c) => asRecord(c.payment)?.settled_amount },
|
|
668
|
-
{ field: 'payment.net_amount', outer: (r) => r.payment?.net_amount, signed: (c) => asRecord(c.payment)?.net_amount },
|
|
669
|
-
{ field: 'payment.asset', outer: (r) => r.payment?.asset, signed: (c) => asRecord(c.payment)?.asset, address: true },
|
|
670
|
-
{ field: 'payment.payee', outer: (r) => r.payment?.payee, signed: (c) => asRecord(c.payment)?.payee, address: true },
|
|
671
|
-
{ field: 'caller_binding.payer_wallet', outer: (r) => r.caller_binding?.payer_wallet, signed: (c) => asRecord(c.caller_binding)?.payer_wallet, address: true },
|
|
672
|
-
{ field: 'caller_binding.agent_pubkey', outer: (r) => r.caller_binding?.agent_pubkey, signed: (c) => asRecord(c.caller_binding)?.agent_pubkey },
|
|
673
|
-
{ field: 'caller_binding.api_key_hash', outer: (r) => r.caller_binding?.api_key_hash, signed: (c) => asRecord(c.caller_binding)?.api_key_hash },
|
|
674
|
-
{ field: 'claim_id', outer: (r) => r.claim_id, signed: (c) => c.claim_id },
|
|
675
|
-
{ field: 'route.model', outer: (r) => r.route?.model, signed: (c) => asRecord(c.route)?.model },
|
|
676
|
-
{ field: 'route.provider', outer: (r) => r.route?.provider, signed: (c) => asRecord(c.route)?.provider },
|
|
677
|
-
{ field: 'output.hash', outer: (r) => r.output?.hash, signed: (c) => asRecord(c.output)?.hash },
|
|
678
|
-
{ field: 'binding.expected_commitment', outer: (r) => r.binding?.expected_commitment, signed: (c) => asRecord(c.binding)?.expected_commitment },
|
|
679
|
-
{ field: 'provider_cogs.actual', outer: (r) => r.provider_cogs?.actual, signed: (c) => asRecord(c.provider_cogs)?.actual },
|
|
680
|
-
];
|
|
681
|
-
/** Flag unsigned outer copies that disagree with the JWS payload. */
|
|
682
728
|
function diffOuterClaims(receipt, claims) {
|
|
683
729
|
if (!claims)
|
|
684
730
|
return [];
|
|
685
731
|
const mismatches = [];
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
}
|
|
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;
|
|
696
745
|
}
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
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;
|
|
709
761
|
}
|
|
762
|
+
const sv = signedObj[key];
|
|
763
|
+
if (isPlain(outer[key]) && isPlain(sv))
|
|
764
|
+
collectUnsigned(outer[key], sv, path, paths);
|
|
710
765
|
}
|
|
711
|
-
|
|
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;
|
|
712
772
|
}
|
|
713
773
|
function receiptViewFromClaims(receipt, claims) {
|
|
714
774
|
const payment = asRecord(claims.payment);
|
|
@@ -794,10 +854,10 @@ function factsFromClaims(claims) {
|
|
|
794
854
|
};
|
|
795
855
|
}
|
|
796
856
|
function issuerJwksUri(receipt) {
|
|
797
|
-
const fromVerification = receipt
|
|
857
|
+
const fromVerification = receipt?.verification?.jwks_uri;
|
|
798
858
|
if (typeof fromVerification === 'string' && fromVerification.startsWith('https://'))
|
|
799
859
|
return fromVerification;
|
|
800
|
-
const jws = receipt
|
|
860
|
+
const jws = receipt?.issuer_signature?.jws;
|
|
801
861
|
const header = jws ? (0, jws_js_1.readJwsHeader)(jws) : null;
|
|
802
862
|
if (header?.jku && header.jku.startsWith('https://'))
|
|
803
863
|
return header.jku;
|
|
@@ -826,6 +886,36 @@ function mergeJwks(primary, extra) {
|
|
|
826
886
|
}
|
|
827
887
|
return { keys: deduped };
|
|
828
888
|
}
|
|
889
|
+
/**
|
|
890
|
+
* Key sources shared by receipt verification and the epoch-record check:
|
|
891
|
+
* a caller-supplied JWKS, `--jwks-url` (any https URL), and `--fetch-jwks`
|
|
892
|
+
* from an allowlisted host. A failed fetch is an error. It does not add a key.
|
|
893
|
+
*/
|
|
894
|
+
async function loadIssuerJwks(source, options = {}) {
|
|
895
|
+
const errors = [];
|
|
896
|
+
let jwks = options.jwks;
|
|
897
|
+
const trustedHosts = options.trustedJwksHosts ?? jws_js_1.DEFAULT_TRUSTED_JWKS_HOSTS;
|
|
898
|
+
if (options.jwksUri || options.fetchJwks) {
|
|
899
|
+
const uri = options.jwksUri || issuerJwksUri(source);
|
|
900
|
+
const allowed = !!uri && (options.jwksUri ? httpsUrl(uri) : (0, jws_js_1.jwksHostAllowed)(uri, trustedHosts));
|
|
901
|
+
if (uri && allowed) {
|
|
902
|
+
try {
|
|
903
|
+
const fetched = await fetchIssuerJwks(uri, options.fetchImpl);
|
|
904
|
+
jwks = mergeJwks(jwks, fetched);
|
|
905
|
+
}
|
|
906
|
+
catch (err) {
|
|
907
|
+
errors.push(`JWKS fetch failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
else if (options.jwksUri) {
|
|
911
|
+
errors.push('JWKS URI rejected — only https URLs are fetched');
|
|
912
|
+
}
|
|
913
|
+
else if (options.fetchJwks && uri) {
|
|
914
|
+
errors.push(`JWKS host untrusted: ${uri}`);
|
|
915
|
+
}
|
|
916
|
+
}
|
|
917
|
+
return { jwks, errors };
|
|
918
|
+
}
|
|
829
919
|
/** Fetch a JWKS document. Caller decides whether the URL is a trust root. */
|
|
830
920
|
async function fetchIssuerJwks(uri, fetchImpl = globalThis.fetch) {
|
|
831
921
|
if (!httpsUrl(uri))
|
|
@@ -857,9 +947,55 @@ function normalizeBoundRoot(root) {
|
|
|
857
947
|
return /^[0-9a-f]{64}$/.test(hex) ? hex : null;
|
|
858
948
|
}
|
|
859
949
|
/**
|
|
860
|
-
*
|
|
861
|
-
|
|
950
|
+
* Row hash for an offline leaf. Null and `''` are missing: do not hash `task_id|`.
|
|
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.
|
|
862
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
|
+
}
|
|
863
999
|
function suppliedHeadCovers(receipt, signedRoot, head, inclusion) {
|
|
864
1000
|
const signed = normalizeBoundRoot(signedRoot);
|
|
865
1001
|
const supplied = normalizeBoundRoot(head?.root);
|
|
@@ -871,8 +1007,10 @@ function suppliedHeadCovers(receipt, signedRoot, head, inclusion) {
|
|
|
871
1007
|
return true;
|
|
872
1008
|
if (receipt.task_id == null)
|
|
873
1009
|
return false;
|
|
874
|
-
const
|
|
875
|
-
|
|
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}`));
|
|
876
1014
|
if (typeof inclusion.leaf === 'string' && /^[0-9a-fA-F]{64}$/.test(inclusion.leaf)
|
|
877
1015
|
&& inclusion.leaf.toLowerCase() !== leaf.toString('hex')) {
|
|
878
1016
|
return false;
|
|
@@ -882,30 +1020,29 @@ function suppliedHeadCovers(receipt, signedRoot, head, inclusion) {
|
|
|
882
1020
|
return false;
|
|
883
1021
|
return (0, anchor_witness_js_1.verifyMerkleInclusion)(leaf, Number(inclusion.leaf_index), Number(size), supplied, inclusion.proof);
|
|
884
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
|
+
}
|
|
885
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
|
+
}
|
|
886
1034
|
const errors = [];
|
|
887
1035
|
const trustedKids = options.trustedKids ?? jws_js_1.DEFAULT_TRUSTED_ISSUER_KIDS;
|
|
888
1036
|
const trustedHosts = options.trustedJwksHosts ?? jws_js_1.DEFAULT_TRUSTED_JWKS_HOSTS;
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
catch (err) {
|
|
899
|
-
errors.push(`JWKS fetch failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
900
|
-
}
|
|
901
|
-
}
|
|
902
|
-
else if (options.jwksUri) {
|
|
903
|
-
errors.push('JWKS URI rejected — only https URLs are fetched');
|
|
904
|
-
}
|
|
905
|
-
else if (options.fetchJwks && uri) {
|
|
906
|
-
errors.push(`JWKS host untrusted: ${uri}`);
|
|
907
|
-
}
|
|
908
|
-
}
|
|
1037
|
+
const loadedKeys = await loadIssuerJwks(receipt, {
|
|
1038
|
+
jwks: options.jwks,
|
|
1039
|
+
jwksUri: options.jwksUri,
|
|
1040
|
+
fetchJwks: options.fetchJwks,
|
|
1041
|
+
trustedJwksHosts: trustedHosts,
|
|
1042
|
+
fetchImpl: options.fetchImpl,
|
|
1043
|
+
});
|
|
1044
|
+
const jwks = loadedKeys.jwks;
|
|
1045
|
+
errors.push(...loadedKeys.errors);
|
|
909
1046
|
let issuer_signature;
|
|
910
1047
|
if (receipt.issuer_signature?.jws || receipt.issuer_signature?.value) {
|
|
911
1048
|
issuer_signature = verifyIssuerSignatureWithJwks(receipt, jwks, { trustedKids });
|
|
@@ -936,6 +1073,7 @@ async function verifyReceipt(receipt, options = {}) {
|
|
|
936
1073
|
? (0, payer_js_1.decodeJwsPayload)(receipt.issuer_signature.jws)
|
|
937
1074
|
: null;
|
|
938
1075
|
const claim_mismatches = diffOuterClaims(receipt, decoded);
|
|
1076
|
+
const unsigned_fields = unsignedOuterFields(receipt, decoded);
|
|
939
1077
|
for (const mismatch of claim_mismatches) {
|
|
940
1078
|
errors.push(`outer/signed mismatch: ${mismatch.field} (outer ${mismatch.outer}, signed ${mismatch.signed})`);
|
|
941
1079
|
}
|
|
@@ -960,6 +1098,79 @@ async function verifyReceipt(receipt, options = {}) {
|
|
|
960
1098
|
errors.push('tree_head_mismatch');
|
|
961
1099
|
}
|
|
962
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
|
+
}
|
|
963
1174
|
let binding;
|
|
964
1175
|
if (receipt.issuer_signature?.jws) {
|
|
965
1176
|
if (verifiedClaims) {
|
|
@@ -1100,47 +1311,6 @@ async function verifyReceipt(receipt, options = {}) {
|
|
|
1100
1311
|
errors.push(`canonical preimage: ${fileCheck.reason}`);
|
|
1101
1312
|
}
|
|
1102
1313
|
}
|
|
1103
|
-
const issuedAt = (verifiedClaims && 'iat' in verifiedClaims ? verifiedClaims.iat : null)
|
|
1104
|
-
?? decoded?.iat
|
|
1105
|
-
?? receipt.created_at
|
|
1106
|
-
?? null;
|
|
1107
|
-
const historyPin = (0, issuer_history_js_1.readIssuerHistoryPin)(verifiedClaims);
|
|
1108
|
-
const payloadVersion = Number(verifiedClaims?.payload_version);
|
|
1109
|
-
// Payload v10 signs the history pin. A missing pin fails even when the
|
|
1110
|
-
// caller did not pass a history file or ask for a fetch.
|
|
1111
|
-
const pinRequired = !options.skipIssuerHistory
|
|
1112
|
-
&& Number.isFinite(payloadVersion)
|
|
1113
|
-
&& payloadVersion >= canonical_preimage_js_1.CANONICAL_PAYLOAD_VERSION;
|
|
1114
|
-
const historyAsked = pinRequired || (!options.skipIssuerHistory && !!(options.issuerHistory
|
|
1115
|
-
|| options.issuerHistoryBytes
|
|
1116
|
-
|| options.fetchIssuerHistory
|
|
1117
|
-
|| options.strictIssuerHistory
|
|
1118
|
-
|| options.issuerHistoryUrl
|
|
1119
|
-
|| historyPin));
|
|
1120
|
-
const issuer_history = historyAsked
|
|
1121
|
-
? await (0, issuer_history_js_1.checkReceiptIssuerHistory)(receipt, {
|
|
1122
|
-
document: options.issuerHistory ?? null,
|
|
1123
|
-
documentBytes: options.issuerHistoryBytes ?? null,
|
|
1124
|
-
fetchHistory: options.fetchIssuerHistory === true || options.strictIssuerHistory === true,
|
|
1125
|
-
strict: options.strictIssuerHistory === true,
|
|
1126
|
-
historyUrl: options.issuerHistoryUrl ?? null,
|
|
1127
|
-
jwks,
|
|
1128
|
-
trustedKids,
|
|
1129
|
-
fetchImpl: options.fetchImpl,
|
|
1130
|
-
trustedHosts,
|
|
1131
|
-
issuedAt,
|
|
1132
|
-
kid: issuer_signature.kid ?? receipt.issuer_signature?.kid ?? null,
|
|
1133
|
-
pin: historyPin,
|
|
1134
|
-
requirePin: pinRequired,
|
|
1135
|
-
})
|
|
1136
|
-
: {
|
|
1137
|
-
checked: false,
|
|
1138
|
-
ok: true,
|
|
1139
|
-
unreachable: false,
|
|
1140
|
-
warning: null,
|
|
1141
|
-
reason: null,
|
|
1142
|
-
kid: issuer_signature.kid ?? receipt.issuer_signature?.kid ?? null,
|
|
1143
|
-
};
|
|
1144
1314
|
if (issuer_history.warning)
|
|
1145
1315
|
warnings.push(issuer_history.warning);
|
|
1146
1316
|
if (issuer_history.checked && !issuer_history.ok && issuer_history.reason) {
|
|
@@ -1164,7 +1334,7 @@ async function verifyReceipt(receipt, options = {}) {
|
|
|
1164
1334
|
let overall;
|
|
1165
1335
|
const preimageFailed = !preimages.ok;
|
|
1166
1336
|
const historyFailed = issuer_history.checked && !issuer_history.ok;
|
|
1167
|
-
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) {
|
|
1168
1338
|
overall = 'failed';
|
|
1169
1339
|
}
|
|
1170
1340
|
else if (signatureUnchecked) {
|
|
@@ -1190,11 +1360,49 @@ async function verifyReceipt(receipt, options = {}) {
|
|
|
1190
1360
|
errors.push('refusal document is not a payment receipt');
|
|
1191
1361
|
overall = 'failed';
|
|
1192
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
|
+
}
|
|
1193
1400
|
const signedPayment = asRecord(verifiedClaims?.payment);
|
|
1194
1401
|
const signedSettlement = asRecord(verifiedClaims?.settlement);
|
|
1195
1402
|
const receipt_lane = (0, receipt_lane_js_1.receiptLaneFromVerification)({
|
|
1196
1403
|
receipt,
|
|
1197
1404
|
claims: {
|
|
1405
|
+
schema: verifiedSchema,
|
|
1198
1406
|
payment: signedPayment ? {
|
|
1199
1407
|
ref: typeof signedPayment.ref === 'string' ? signedPayment.ref : null,
|
|
1200
1408
|
rail: typeof signedPayment.rail === 'string' ? signedPayment.rail : null,
|
|
@@ -1220,6 +1428,8 @@ async function verifyReceipt(receipt, options = {}) {
|
|
|
1220
1428
|
amount_usdc: facts.amount_usdc,
|
|
1221
1429
|
tx: facts.tx,
|
|
1222
1430
|
claim_mismatches,
|
|
1431
|
+
unsigned_fields,
|
|
1432
|
+
verified_scope: 'signed_claims',
|
|
1223
1433
|
claim_id,
|
|
1224
1434
|
head_binding: signedBinding
|
|
1225
1435
|
? { tree_head_hash: signedBinding.tree_head_hash, tolerance: signedBinding.tolerance }
|
|
@@ -1228,6 +1438,7 @@ async function verifyReceipt(receipt, options = {}) {
|
|
|
1228
1438
|
preimages,
|
|
1229
1439
|
issuer_history,
|
|
1230
1440
|
warnings,
|
|
1441
|
+
...(carry_forward ? { carry_forward } : {}),
|
|
1231
1442
|
overall,
|
|
1232
1443
|
errors,
|
|
1233
1444
|
};
|
|
@@ -1261,9 +1472,37 @@ var refusal_js_2 = require("./refusal.js");
|
|
|
1261
1472
|
Object.defineProperty(exports, "isRefusalDocument", { enumerable: true, get: function () { return refusal_js_2.isRefusalDocument; } });
|
|
1262
1473
|
Object.defineProperty(exports, "verifyRefusal", { enumerable: true, get: function () { return refusal_js_2.verifyRefusal; } });
|
|
1263
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; } });
|
|
1264
1476
|
Object.defineProperty(exports, "REFUSAL_PAYLOAD_VERSION", { enumerable: true, get: function () { return refusal_js_2.REFUSAL_PAYLOAD_VERSION; } });
|
|
1265
1477
|
Object.defineProperty(exports, "REFUSAL_PROVES", { enumerable: true, get: function () { return refusal_js_2.REFUSAL_PROVES; } });
|
|
1266
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; } });
|
|
1482
|
+
var epoch_js_1 = require("./epoch.js");
|
|
1483
|
+
Object.defineProperty(exports, "acceptTreeHeadSchema", { enumerable: true, get: function () { return epoch_js_1.acceptTreeHeadSchema; } });
|
|
1484
|
+
Object.defineProperty(exports, "verifyEpochLink", { enumerable: true, get: function () { return epoch_js_1.verifyEpochLink; } });
|
|
1485
|
+
Object.defineProperty(exports, "verifyEpochRecord", { enumerable: true, get: function () { return epoch_js_1.verifyEpochRecord; } });
|
|
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; } });
|
|
1492
|
+
Object.defineProperty(exports, "TREE_HEAD_SCHEMA_V1", { enumerable: true, get: function () { return epoch_js_1.TREE_HEAD_SCHEMA_V1; } });
|
|
1493
|
+
Object.defineProperty(exports, "TREE_HEAD_SCHEMA_V2", { enumerable: true, get: function () { return epoch_js_1.TREE_HEAD_SCHEMA_V2; } });
|
|
1494
|
+
Object.defineProperty(exports, "EPOCH1_FINAL_ROOT", { enumerable: true, get: function () { return epoch_js_1.EPOCH1_FINAL_ROOT; } });
|
|
1495
|
+
Object.defineProperty(exports, "EPOCH1_FINAL_SIZE", { enumerable: true, get: function () { return epoch_js_1.EPOCH1_FINAL_SIZE; } });
|
|
1496
|
+
Object.defineProperty(exports, "EPOCH1_GENESIS_DIGEST", { enumerable: true, get: function () { return epoch_js_1.EPOCH1_GENESIS_DIGEST; } });
|
|
1497
|
+
Object.defineProperty(exports, "EPOCH1_SIZE1_ROOT", { enumerable: true, get: function () { return epoch_js_1.EPOCH1_SIZE1_ROOT; } });
|
|
1498
|
+
Object.defineProperty(exports, "EPOCH1_SIZE2_ROOT", { enumerable: true, get: function () { return epoch_js_1.EPOCH1_SIZE2_ROOT; } });
|
|
1499
|
+
Object.defineProperty(exports, "epoch1PrefixRoot", { enumerable: true, get: function () { return epoch_js_1.epoch1PrefixRoot; } });
|
|
1500
|
+
Object.defineProperty(exports, "matchEpoch1Prefix", { enumerable: true, get: function () { return epoch_js_1.matchEpoch1Prefix; } });
|
|
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; } });
|
|
1267
1506
|
var anchor_witness_js_2 = require("./anchor-witness.js");
|
|
1268
1507
|
Object.defineProperty(exports, "verifyAnchoredRoot", { enumerable: true, get: function () { return anchor_witness_js_2.verifyAnchoredRoot; } });
|
|
1269
1508
|
Object.defineProperty(exports, "verifyMerkleInclusion", { enumerable: true, get: function () { return anchor_witness_js_2.verifyMerkleInclusion; } });
|
|
@@ -1274,6 +1513,44 @@ Object.defineProperty(exports, "ANCHOR_PROVES", { enumerable: true, get: functio
|
|
|
1274
1513
|
Object.defineProperty(exports, "ANCHOR_DOES_NOT_PROVE", { enumerable: true, get: function () { return anchor_witness_js_2.ANCHOR_DOES_NOT_PROVE; } });
|
|
1275
1514
|
Object.defineProperty(exports, "SOLANA_GENESIS", { enumerable: true, get: function () { return anchor_witness_js_2.SOLANA_GENESIS; } });
|
|
1276
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; } });
|
|
1277
1554
|
var canonical_preimage_js_2 = require("./canonical-preimage.js");
|
|
1278
1555
|
Object.defineProperty(exports, "verifyCanonicalPreimageBytes", { enumerable: true, get: function () { return canonical_preimage_js_2.verifyCanonicalPreimageBytes; } });
|
|
1279
1556
|
Object.defineProperty(exports, "CANONICAL_PAYLOAD_VERSION", { enumerable: true, get: function () { return canonical_preimage_js_2.CANONICAL_PAYLOAD_VERSION; } });
|