@cardanowall/sdk-ts 0.0.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -19
- package/dist/client/index.cjs +34 -34
- package/dist/client/index.cjs.map +1 -1
- package/dist/client/index.d.cts +52 -52
- package/dist/client/index.d.ts +52 -52
- package/dist/client/index.js +33 -33
- package/dist/client/index.js.map +1 -1
- package/dist/conformance/cli.cjs +34 -34
- package/dist/conformance/cli.cjs.map +1 -1
- package/dist/conformance/cli.js +34 -34
- package/dist/conformance/cli.js.map +1 -1
- package/dist/identity/index.cjs.map +1 -1
- package/dist/identity/index.d.cts +1 -1
- package/dist/identity/index.d.ts +1 -1
- package/dist/identity/index.js.map +1 -1
- package/dist/ids/index.cjs.map +1 -1
- package/dist/ids/index.js.map +1 -1
- package/dist/index.cjs +67 -67
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +65 -65
- package/dist/index.js.map +1 -1
- package/dist/merkle/index.cjs +1 -1
- package/dist/merkle/index.cjs.map +1 -1
- package/dist/merkle/index.js +1 -1
- package/dist/merkle/index.js.map +1 -1
- package/dist/{types-BQMtbRCb.d.cts → types-DGsZTMuZ.d.cts} +6 -6
- package/dist/{types-BQMtbRCb.d.ts → types-DGsZTMuZ.d.ts} +6 -6
- package/dist/verifier/index.cjs +34 -34
- package/dist/verifier/index.cjs.map +1 -1
- package/dist/verifier/index.d.cts +3 -3
- package/dist/verifier/index.d.ts +3 -3
- package/dist/verifier/index.js +34 -34
- package/dist/verifier/index.js.map +1 -1
- package/package.json +10 -9
package/dist/index.d.cts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export { B as BodyTooLargeError, D as DEFAULT_OUTBOUND_MAX_BYTES, a as DENY_HOSTS_DEFAULT, b as DenyHostError, F as FetchOutbound, c as FetchOutboundOptions, d as FetchOutboundResult, H as HttpCallRecord, e as HttpMethod, f as HttpPurpose, O as OutboundExhaustedError, R as RetryConfig, U as UnsupportedMethodError, g as UnsupportedProtocolError, W as WrapFetchOutboundConfig, h as defaultFetchOutbound, i as fetchOutbound, m as matchesDenyList, w as wrapFetchOutbound } from './fetch-outbound-BT5-NiYN.cjs';
|
|
2
2
|
export { DenyHostsFetchOptions, HttpCall, denyHostsFetch } from './fetch/index.cjs';
|
|
3
3
|
export { D as DecryptionVerdict, E as ExitCode, I as ItemHashCheck, M as MerkleVerdict, N as Network, P as PROFILE_RANK, a as Profile, S as SignatureFailureReason, b as SignatureVerdict, c as SignerType, V as Verdict, d as VerifyItemDecryption, e as VerifyMerkleCheck, f as VerifyRecordSignature, g as VerifyReport, h as VerifyTxInput, i as VerifyTxOutput, j as VerifyTxSummary, k as VerifyTxWitness, l as VerifyUriCheck } from './types-CLXdbjqr.cjs';
|
|
4
|
-
export { BLOCKFROST_MAINNET_HOST, CONFIRMATION_DEPTH_THRESHOLD_DEFAULT, DEFAULT_PROFILE, KOIOS_MAINNET_URL,
|
|
5
|
-
export { AccountNamespace, AssembleCoseSign1Args, AssembleCoseSign1Result, BatchEmptyError, BatchTooLargeError,
|
|
6
|
-
export { A as AccountBalance, C as
|
|
4
|
+
export { BLOCKFROST_MAINNET_HOST, CONFIRMATION_DEPTH_THRESHOLD_DEFAULT, DEFAULT_PROFILE, KOIOS_MAINNET_URL, NotALabel309RecordError, ResolvedTx, TxComponents, decodeTxSummary, decodeTxWitnesses, exitCodeForVerdict, extractLabel309Metadata, fetchItemCiphertext, planProfileSkips, profileImplements, resolveCardanoTx, sliceLabel309Value, sliceTxComponents, tryDecryptions, verifyMerkleCommitments, verifyRecordSignatures, verifyReportToDict, verifyResolved, verifyTx } from './verifier/index.cjs';
|
|
5
|
+
export { AccountNamespace, AssembleCoseSign1Args, AssembleCoseSign1Result, BatchEmptyError, BatchTooLargeError, ForbiddenError, IdempotencyConflictError, InsufficientFundsError, InsufficientScopeError, InternalServerError, InvalidBodyError, InvalidClientConfigError, Label309Client, Label309HttpError, Label309HttpErrorInit, MalformedCborError, NotFoundError, OffHostSignError, OffHostSignErrorCode, PartialUploadError, PoeNamespace, PrepareSigStructureArgs, PrepareSigStructureHashedResult, PrepareSigStructureResult, ProblemDetails, ProblemErrorEntry, PublishError, QuoteAlreadyConsumedError, QuoteExpiredError, QuoteNotFoundError, RateLimitedError, RecordNotFoundError, RecordsNamespace, ServiceUnavailableError, UnauthorizedError, ValidationFailedError, assembleCoseSign1, assembleCoseSign1Hashed, buildToSign, parseHttpError, prepareSigStructure, prepareSigStructureHashed } from './client/index.cjs';
|
|
6
|
+
export { A as AccountBalance, C as ConformanceProfile, F as FetchImpl, L as Label309ClientConfig, P as PoeItemResponse, a as PoeStatus, b as PoeVerifyInput, c as PublishBatchEntry, d as PublishBatchFailureEntry, e as PublishBatchFailureError, f as PublishBatchInput, g as PublishBatchResponse, h as PublishBatchResultEntry, i as PublishBatchSuccessEntry, j as PublishContentInput, k as PublishInput, l as PublishMerkleInput, m as PublishMerkleResponse, n as PublishPrehashedInput, o as PublishResponse, p as PublishSealedInput, Q as QuoteInput, q as QuoteResponse, R as RecordResource, r as RecordScheme, s as RecordSignature, t as RecordStatus, u as RecordsListInput, v as RecordsListResponse, S as Signer, w as StorageTarget, x as SupportedHashAlg, U as UploadEntry, y as UploadFailureEntry, z as UploadSuccessEntry, B as UploadsInput, D as UploadsResponse } from './types-DGsZTMuZ.cjs';
|
|
7
7
|
export { CROCKFORD_ENCODED_LENGTH_FOR_UUID, POE_ID_PATTERN, POE_ID_PREFIX, PoeIdSchema, PrefixedId, decodeCrockfordBase32, decodePrefixedId, encodeBytesVariableLength, encodeCrockfordBase32, encodePrefixedId, isPrefixedId } from './ids/index.cjs';
|
|
8
8
|
export { i as merkle } from './index-Cg1QqVmA.cjs';
|
|
9
9
|
export { i as hash } from './index-BhnlWJAY.cjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export { B as BodyTooLargeError, D as DEFAULT_OUTBOUND_MAX_BYTES, a as DENY_HOSTS_DEFAULT, b as DenyHostError, F as FetchOutbound, c as FetchOutboundOptions, d as FetchOutboundResult, H as HttpCallRecord, e as HttpMethod, f as HttpPurpose, O as OutboundExhaustedError, R as RetryConfig, U as UnsupportedMethodError, g as UnsupportedProtocolError, W as WrapFetchOutboundConfig, h as defaultFetchOutbound, i as fetchOutbound, m as matchesDenyList, w as wrapFetchOutbound } from './fetch-outbound-BT5-NiYN.js';
|
|
2
2
|
export { DenyHostsFetchOptions, HttpCall, denyHostsFetch } from './fetch/index.js';
|
|
3
3
|
export { D as DecryptionVerdict, E as ExitCode, I as ItemHashCheck, M as MerkleVerdict, N as Network, P as PROFILE_RANK, a as Profile, S as SignatureFailureReason, b as SignatureVerdict, c as SignerType, V as Verdict, d as VerifyItemDecryption, e as VerifyMerkleCheck, f as VerifyRecordSignature, g as VerifyReport, h as VerifyTxInput, i as VerifyTxOutput, j as VerifyTxSummary, k as VerifyTxWitness, l as VerifyUriCheck } from './types-B8Q3gW54.js';
|
|
4
|
-
export { BLOCKFROST_MAINNET_HOST, CONFIRMATION_DEPTH_THRESHOLD_DEFAULT, DEFAULT_PROFILE, KOIOS_MAINNET_URL,
|
|
5
|
-
export { AccountNamespace, AssembleCoseSign1Args, AssembleCoseSign1Result, BatchEmptyError, BatchTooLargeError,
|
|
6
|
-
export { A as AccountBalance, C as
|
|
4
|
+
export { BLOCKFROST_MAINNET_HOST, CONFIRMATION_DEPTH_THRESHOLD_DEFAULT, DEFAULT_PROFILE, KOIOS_MAINNET_URL, NotALabel309RecordError, ResolvedTx, TxComponents, decodeTxSummary, decodeTxWitnesses, exitCodeForVerdict, extractLabel309Metadata, fetchItemCiphertext, planProfileSkips, profileImplements, resolveCardanoTx, sliceLabel309Value, sliceTxComponents, tryDecryptions, verifyMerkleCommitments, verifyRecordSignatures, verifyReportToDict, verifyResolved, verifyTx } from './verifier/index.js';
|
|
5
|
+
export { AccountNamespace, AssembleCoseSign1Args, AssembleCoseSign1Result, BatchEmptyError, BatchTooLargeError, ForbiddenError, IdempotencyConflictError, InsufficientFundsError, InsufficientScopeError, InternalServerError, InvalidBodyError, InvalidClientConfigError, Label309Client, Label309HttpError, Label309HttpErrorInit, MalformedCborError, NotFoundError, OffHostSignError, OffHostSignErrorCode, PartialUploadError, PoeNamespace, PrepareSigStructureArgs, PrepareSigStructureHashedResult, PrepareSigStructureResult, ProblemDetails, ProblemErrorEntry, PublishError, QuoteAlreadyConsumedError, QuoteExpiredError, QuoteNotFoundError, RateLimitedError, RecordNotFoundError, RecordsNamespace, ServiceUnavailableError, UnauthorizedError, ValidationFailedError, assembleCoseSign1, assembleCoseSign1Hashed, buildToSign, parseHttpError, prepareSigStructure, prepareSigStructureHashed } from './client/index.js';
|
|
6
|
+
export { A as AccountBalance, C as ConformanceProfile, F as FetchImpl, L as Label309ClientConfig, P as PoeItemResponse, a as PoeStatus, b as PoeVerifyInput, c as PublishBatchEntry, d as PublishBatchFailureEntry, e as PublishBatchFailureError, f as PublishBatchInput, g as PublishBatchResponse, h as PublishBatchResultEntry, i as PublishBatchSuccessEntry, j as PublishContentInput, k as PublishInput, l as PublishMerkleInput, m as PublishMerkleResponse, n as PublishPrehashedInput, o as PublishResponse, p as PublishSealedInput, Q as QuoteInput, q as QuoteResponse, R as RecordResource, r as RecordScheme, s as RecordSignature, t as RecordStatus, u as RecordsListInput, v as RecordsListResponse, S as Signer, w as StorageTarget, x as SupportedHashAlg, U as UploadEntry, y as UploadFailureEntry, z as UploadSuccessEntry, B as UploadsInput, D as UploadsResponse } from './types-DGsZTMuZ.js';
|
|
7
7
|
export { CROCKFORD_ENCODED_LENGTH_FOR_UUID, POE_ID_PATTERN, POE_ID_PREFIX, PoeIdSchema, PrefixedId, decodeCrockfordBase32, decodePrefixedId, encodeBytesVariableLength, encodeCrockfordBase32, encodePrefixedId, isPrefixedId } from './ids/index.js';
|
|
8
8
|
export { i as merkle } from './index-Cg1QqVmA.js';
|
|
9
9
|
export { i as hash } from './index-BhnlWJAY.js';
|
package/dist/index.js
CHANGED
|
@@ -477,7 +477,7 @@ function decodeCanonicalCbor(bytes) {
|
|
|
477
477
|
...cdeDecodeOptions,
|
|
478
478
|
rejectStreaming: true,
|
|
479
479
|
rejectDuplicateKeys: true,
|
|
480
|
-
// A
|
|
480
|
+
// A Label 309 record carries integers, byte/text strings, arrays, maps and
|
|
481
481
|
// `null` — and nothing else. Without these rejections the major-type-7
|
|
482
482
|
// surface leaks into the decoder: a float16/32/64 that happens to hold an
|
|
483
483
|
// integral value (e.g. 1.0) silently decodes to the integer 1 and passes
|
|
@@ -624,7 +624,7 @@ function decodeCanonicalCbor2(bytes) {
|
|
|
624
624
|
...cdeDecodeOptions,
|
|
625
625
|
rejectStreaming: true,
|
|
626
626
|
rejectDuplicateKeys: true,
|
|
627
|
-
// A
|
|
627
|
+
// A Label 309 record carries integers, byte/text strings, arrays, maps and
|
|
628
628
|
// `null` — and nothing else. Without these rejections the major-type-7
|
|
629
629
|
// surface leaks into the decoder: a float16/32/64 that happens to hold an
|
|
630
630
|
// integral value (e.g. 1.0) silently decodes to the integer 1 and passes
|
|
@@ -725,7 +725,7 @@ function buildSigStructure(args) {
|
|
|
725
725
|
args.payload
|
|
726
726
|
]);
|
|
727
727
|
}
|
|
728
|
-
function
|
|
728
|
+
function buildLabel309SigStructure(args) {
|
|
729
729
|
const toSign = new Uint8Array(
|
|
730
730
|
CARDANO_POE_SIG_DOMAIN_PREFIX_BYTES.length + args.recordBodyCbor.length
|
|
731
731
|
);
|
|
@@ -808,7 +808,7 @@ function decodeCoseSign1(bytes) {
|
|
|
808
808
|
signature: signatureRaw
|
|
809
809
|
};
|
|
810
810
|
}
|
|
811
|
-
function
|
|
811
|
+
function coseSign1Label309Verify(args) {
|
|
812
812
|
let decoded;
|
|
813
813
|
try {
|
|
814
814
|
decoded = decodeCoseSign1(args.message);
|
|
@@ -875,7 +875,7 @@ function coseSign1Cip309Verify(args) {
|
|
|
875
875
|
payload: hashedPayload
|
|
876
876
|
});
|
|
877
877
|
} else {
|
|
878
|
-
sigStructureBytes =
|
|
878
|
+
sigStructureBytes = buildLabel309SigStructure({
|
|
879
879
|
bodyProtectedBytes: decoded.protectedBytes,
|
|
880
880
|
recordBodyCbor: args.detachedRecordBodyCbor
|
|
881
881
|
});
|
|
@@ -1350,11 +1350,7 @@ function validateOneUri(chunks, path, errors) {
|
|
|
1350
1350
|
const uri = reconstructed.uri;
|
|
1351
1351
|
if (uri.includes("#")) {
|
|
1352
1352
|
errors.push(
|
|
1353
|
-
issue(
|
|
1354
|
-
"INVALID_URI",
|
|
1355
|
-
path,
|
|
1356
|
-
"URI contains a fragment identifier ('#'), which is forbidden"
|
|
1357
|
-
)
|
|
1353
|
+
issue("INVALID_URI", path, "URI contains a fragment identifier ('#'), which is forbidden")
|
|
1358
1354
|
);
|
|
1359
1355
|
return;
|
|
1360
1356
|
}
|
|
@@ -1384,21 +1380,13 @@ function validateOneUri(chunks, path, errors) {
|
|
|
1384
1380
|
const cid = slashIdx === -1 ? rest : rest.slice(0, slashIdx);
|
|
1385
1381
|
if (!validateCidProfile(cid)) {
|
|
1386
1382
|
errors.push(
|
|
1387
|
-
issue(
|
|
1388
|
-
"INVALID_URI",
|
|
1389
|
-
path,
|
|
1390
|
-
"ipfs:// URI is not a valid CID under the CIP-309 profile"
|
|
1391
|
-
)
|
|
1383
|
+
issue("INVALID_URI", path, "ipfs:// URI is not a valid CID under the Label 309 profile")
|
|
1392
1384
|
);
|
|
1393
1385
|
}
|
|
1394
1386
|
return;
|
|
1395
1387
|
}
|
|
1396
1388
|
errors.push(
|
|
1397
|
-
issue(
|
|
1398
|
-
"INVALID_URI",
|
|
1399
|
-
path,
|
|
1400
|
-
"unsupported URI scheme; v1 PoE URI set is {ar://, ipfs://}"
|
|
1401
|
-
)
|
|
1389
|
+
issue("INVALID_URI", path, "unsupported URI scheme; v1 PoE URI set is {ar://, ipfs://}")
|
|
1402
1390
|
);
|
|
1403
1391
|
}
|
|
1404
1392
|
function checkItemEnc(item, idx, errors) {
|
|
@@ -1440,7 +1428,7 @@ function checkItemEnc(item, idx, errors) {
|
|
|
1440
1428
|
issue(
|
|
1441
1429
|
"UNAUTHENTICATED_CIPHER_FORBIDDEN",
|
|
1442
1430
|
[...basePath, "aead"],
|
|
1443
|
-
`'${enc.aead}' is an unauthenticated cipher;
|
|
1431
|
+
`'${enc.aead}' is an unauthenticated cipher; Label 309 mandates an authenticated (AEAD) cipher`
|
|
1444
1432
|
)
|
|
1445
1433
|
);
|
|
1446
1434
|
return;
|
|
@@ -3792,7 +3780,9 @@ async function tryDecryptions(args) {
|
|
|
3792
3780
|
let plaintext = null;
|
|
3793
3781
|
let failure = null;
|
|
3794
3782
|
if (reqHasSecret) {
|
|
3795
|
-
const envelope = sealedEnvelopeFromParsed(
|
|
3783
|
+
const envelope = sealedEnvelopeFromParsed(
|
|
3784
|
+
enc
|
|
3785
|
+
);
|
|
3796
3786
|
if (envelope === null) {
|
|
3797
3787
|
out.push({
|
|
3798
3788
|
item_index: idx,
|
|
@@ -3919,7 +3909,7 @@ function decodeCanonicalCbor3(bytes) {
|
|
|
3919
3909
|
...cdeDecodeOptions,
|
|
3920
3910
|
rejectStreaming: true,
|
|
3921
3911
|
rejectDuplicateKeys: true,
|
|
3922
|
-
// A
|
|
3912
|
+
// A Label 309 record carries integers, byte/text strings, arrays, maps and
|
|
3923
3913
|
// `null` — and nothing else. Without these rejections the major-type-7
|
|
3924
3914
|
// surface leaks into the decoder: a float16/32/64 that happens to hold an
|
|
3925
3915
|
// integral value (e.g. 1.0) silently decodes to the integer 1 and passes
|
|
@@ -4534,11 +4524,11 @@ function decodeIntKey(h) {
|
|
|
4534
4524
|
// src/verifier/resolve.ts
|
|
4535
4525
|
var KOIOS_MAINNET_URL = "https://api.koios.rest/api/v1";
|
|
4536
4526
|
var BLOCKFROST_MAINNET_HOST = "https://cardano-mainnet.blockfrost.io/api/v0";
|
|
4537
|
-
var
|
|
4527
|
+
var NotALabel309RecordError = class extends Error {
|
|
4538
4528
|
code = "METADATA_NOT_FOUND";
|
|
4539
4529
|
constructor(message) {
|
|
4540
4530
|
super(message);
|
|
4541
|
-
this.name = "
|
|
4531
|
+
this.name = "NotALabel309RecordError";
|
|
4542
4532
|
}
|
|
4543
4533
|
};
|
|
4544
4534
|
async function resolveCardanoTx(args) {
|
|
@@ -4549,7 +4539,7 @@ async function resolveCardanoTx(args) {
|
|
|
4549
4539
|
try {
|
|
4550
4540
|
return await resolveViaKoios(input.txHash, koiosUrl, fetchFn);
|
|
4551
4541
|
} catch (e) {
|
|
4552
|
-
if (e instanceof
|
|
4542
|
+
if (e instanceof NotALabel309RecordError) throw e;
|
|
4553
4543
|
lastErr = e;
|
|
4554
4544
|
}
|
|
4555
4545
|
}
|
|
@@ -4557,7 +4547,7 @@ async function resolveCardanoTx(args) {
|
|
|
4557
4547
|
try {
|
|
4558
4548
|
return await resolveViaBlockfrost(input.txHash, input.blockfrostProjectId, fetchFn);
|
|
4559
4549
|
} catch (e) {
|
|
4560
|
-
if (e instanceof
|
|
4550
|
+
if (e instanceof NotALabel309RecordError) throw e;
|
|
4561
4551
|
lastErr = e;
|
|
4562
4552
|
}
|
|
4563
4553
|
}
|
|
@@ -4575,7 +4565,7 @@ async function resolveViaKoios(txHash, koiosUrl, fetchFn) {
|
|
|
4575
4565
|
}
|
|
4576
4566
|
const cborJson = parseJson(cborRes.bytes);
|
|
4577
4567
|
if (!Array.isArray(cborJson) || cborJson.length === 0) {
|
|
4578
|
-
throw new
|
|
4568
|
+
throw new NotALabel309RecordError("koios returned empty array for tx_cbor; tx may not exist");
|
|
4579
4569
|
}
|
|
4580
4570
|
const cborEntry = cborJson[0];
|
|
4581
4571
|
if (typeof cborEntry.cbor !== "string") {
|
|
@@ -4596,7 +4586,7 @@ async function resolveViaKoios(txHash, koiosUrl, fetchFn) {
|
|
|
4596
4586
|
}
|
|
4597
4587
|
const infoJson = parseJson(infoRes.bytes);
|
|
4598
4588
|
if (!Array.isArray(infoJson) || infoJson.length === 0) {
|
|
4599
|
-
throw new
|
|
4589
|
+
throw new NotALabel309RecordError("koios returned empty array for tx_info");
|
|
4600
4590
|
}
|
|
4601
4591
|
const infoEntry = infoJson[0];
|
|
4602
4592
|
if (typeof infoEntry.tx_hash === "string" && infoEntry.tx_hash.toLowerCase() !== txHash.toLowerCase()) {
|
|
@@ -4741,7 +4731,7 @@ async function verifyOneSig(index, entry, recordBodyCbor, input) {
|
|
|
4741
4731
|
return { index, verdict: "unresolved", reason: "SIGNER_KEY_UNRESOLVED" };
|
|
4742
4732
|
}
|
|
4743
4733
|
const { pub, signerType } = resolved;
|
|
4744
|
-
const verifyResult =
|
|
4734
|
+
const verifyResult = coseSign1Label309Verify({
|
|
4745
4735
|
message: coseBytes,
|
|
4746
4736
|
detachedRecordBodyCbor: recordBodyCbor,
|
|
4747
4737
|
expectedSignerKey: pub
|
|
@@ -4973,7 +4963,8 @@ function decodeTxSummary(txBodyBytes, witnessSetBytes, network) {
|
|
|
4973
4963
|
else if (typeof invalidBefore === "bigint") summary.invalid_before = Number(invalidBefore);
|
|
4974
4964
|
const invalidHereafter = body.get(BODY_KEY_INVALID_HEREAFTER);
|
|
4975
4965
|
if (typeof invalidHereafter === "number") summary.invalid_hereafter = invalidHereafter;
|
|
4976
|
-
else if (typeof invalidHereafter === "bigint")
|
|
4966
|
+
else if (typeof invalidHereafter === "bigint")
|
|
4967
|
+
summary.invalid_hereafter = Number(invalidHereafter);
|
|
4977
4968
|
if (requiredSigners.length > 0) summary.required_signer_key_hashes = requiredSigners;
|
|
4978
4969
|
const networkId = body.get(BODY_KEY_NETWORK_ID);
|
|
4979
4970
|
if (typeof networkId === "number") summary.network_id = networkId;
|
|
@@ -5092,7 +5083,7 @@ async function verifyTx(input) {
|
|
|
5092
5083
|
try {
|
|
5093
5084
|
resolved = await resolveCardanoTx({ input, fetchFn });
|
|
5094
5085
|
} catch (e) {
|
|
5095
|
-
if (e instanceof
|
|
5086
|
+
if (e instanceof NotALabel309RecordError) {
|
|
5096
5087
|
return base({
|
|
5097
5088
|
verdict: "failed",
|
|
5098
5089
|
exit_code: 1,
|
|
@@ -5185,7 +5176,16 @@ async function verifyResolved(input) {
|
|
|
5185
5176
|
return report;
|
|
5186
5177
|
}
|
|
5187
5178
|
async function verifyResolvedRecord(args) {
|
|
5188
|
-
const {
|
|
5179
|
+
const {
|
|
5180
|
+
input,
|
|
5181
|
+
metadataBytes,
|
|
5182
|
+
txCbor,
|
|
5183
|
+
numConfirmations,
|
|
5184
|
+
blockTime,
|
|
5185
|
+
blockSlot,
|
|
5186
|
+
httpCalls,
|
|
5187
|
+
fetchFn
|
|
5188
|
+
} = args;
|
|
5189
5189
|
const profile = input.profile ?? DEFAULT_PROFILE;
|
|
5190
5190
|
const threshold = input.confirmationDepthThreshold ?? CONFIRMATION_DEPTH_THRESHOLD_DEFAULT;
|
|
5191
5191
|
const txDescription = txCbor !== void 0 ? decodeTxDescription(txCbor, input) : {};
|
|
@@ -5424,7 +5424,7 @@ function prepareSigStructure(args) {
|
|
|
5424
5424
|
}
|
|
5425
5425
|
const { protectedHeaderBytes } = encodePath1ProtectedHeader(args.signerPubkey);
|
|
5426
5426
|
const recordBodyCbor = encodeRecordBodyForSigning(args.record);
|
|
5427
|
-
const sigStructureBytes =
|
|
5427
|
+
const sigStructureBytes = buildLabel309SigStructure({
|
|
5428
5428
|
bodyProtectedBytes: protectedHeaderBytes,
|
|
5429
5429
|
recordBodyCbor
|
|
5430
5430
|
});
|
|
@@ -5518,7 +5518,7 @@ function extractProblemExtensions(problem) {
|
|
|
5518
5518
|
}
|
|
5519
5519
|
return out;
|
|
5520
5520
|
}
|
|
5521
|
-
var
|
|
5521
|
+
var Label309HttpError = class extends Error {
|
|
5522
5522
|
problem;
|
|
5523
5523
|
code;
|
|
5524
5524
|
httpStatus;
|
|
@@ -5533,7 +5533,7 @@ var Cip309HttpError = class extends Error {
|
|
|
5533
5533
|
retryAfterSeconds;
|
|
5534
5534
|
constructor(init) {
|
|
5535
5535
|
super(init.problem.detail || `${init.problem.title} (HTTP ${init.problem.status})`);
|
|
5536
|
-
this.name = "
|
|
5536
|
+
this.name = "Label309HttpError";
|
|
5537
5537
|
this.problem = init.problem;
|
|
5538
5538
|
this.code = init.problem.code;
|
|
5539
5539
|
this.httpStatus = init.problem.status;
|
|
@@ -5550,7 +5550,7 @@ var Cip309HttpError = class extends Error {
|
|
|
5550
5550
|
};
|
|
5551
5551
|
|
|
5552
5552
|
// src/client/batch-empty-error.ts
|
|
5553
|
-
var BatchEmptyError = class extends
|
|
5553
|
+
var BatchEmptyError = class extends Label309HttpError {
|
|
5554
5554
|
constructor(init) {
|
|
5555
5555
|
super(init);
|
|
5556
5556
|
this.name = "BatchEmptyError";
|
|
@@ -5561,7 +5561,7 @@ var BatchEmptyError = class extends Cip309HttpError {
|
|
|
5561
5561
|
function readInt(value) {
|
|
5562
5562
|
return typeof value === "number" && Number.isFinite(value) ? value : void 0;
|
|
5563
5563
|
}
|
|
5564
|
-
var BatchTooLargeError = class extends
|
|
5564
|
+
var BatchTooLargeError = class extends Label309HttpError {
|
|
5565
5565
|
max;
|
|
5566
5566
|
got;
|
|
5567
5567
|
constructor(init) {
|
|
@@ -5573,7 +5573,7 @@ var BatchTooLargeError = class extends Cip309HttpError {
|
|
|
5573
5573
|
};
|
|
5574
5574
|
|
|
5575
5575
|
// src/client/forbidden-error.ts
|
|
5576
|
-
var ForbiddenError = class extends
|
|
5576
|
+
var ForbiddenError = class extends Label309HttpError {
|
|
5577
5577
|
constructor(init) {
|
|
5578
5578
|
super(init);
|
|
5579
5579
|
this.name = "ForbiddenError";
|
|
@@ -5581,7 +5581,7 @@ var ForbiddenError = class extends Cip309HttpError {
|
|
|
5581
5581
|
};
|
|
5582
5582
|
|
|
5583
5583
|
// src/client/idempotency-conflict-error.ts
|
|
5584
|
-
var IdempotencyConflictError = class extends
|
|
5584
|
+
var IdempotencyConflictError = class extends Label309HttpError {
|
|
5585
5585
|
constructor(init) {
|
|
5586
5586
|
super(init);
|
|
5587
5587
|
this.name = "IdempotencyConflictError";
|
|
@@ -5601,7 +5601,7 @@ function readBigIntString(value) {
|
|
|
5601
5601
|
function readString(value) {
|
|
5602
5602
|
return typeof value === "string" ? value : void 0;
|
|
5603
5603
|
}
|
|
5604
|
-
var InsufficientFundsError = class extends
|
|
5604
|
+
var InsufficientFundsError = class extends Label309HttpError {
|
|
5605
5605
|
balanceUsdMicros;
|
|
5606
5606
|
requiredUsdMicros;
|
|
5607
5607
|
topUpUrl;
|
|
@@ -5619,7 +5619,7 @@ function readScopeArray(value) {
|
|
|
5619
5619
|
if (!Array.isArray(value)) return [];
|
|
5620
5620
|
return value.filter((entry) => typeof entry === "string");
|
|
5621
5621
|
}
|
|
5622
|
-
var InsufficientScopeError = class extends
|
|
5622
|
+
var InsufficientScopeError = class extends Label309HttpError {
|
|
5623
5623
|
requiredScopes;
|
|
5624
5624
|
grantedScopes;
|
|
5625
5625
|
constructor(init) {
|
|
@@ -5635,7 +5635,7 @@ var InsufficientScopeError = class extends Cip309HttpError {
|
|
|
5635
5635
|
};
|
|
5636
5636
|
|
|
5637
5637
|
// src/client/internal-server-error.ts
|
|
5638
|
-
var InternalServerError = class extends
|
|
5638
|
+
var InternalServerError = class extends Label309HttpError {
|
|
5639
5639
|
constructor(init) {
|
|
5640
5640
|
super(init);
|
|
5641
5641
|
this.name = "InternalServerError";
|
|
@@ -5643,7 +5643,7 @@ var InternalServerError = class extends Cip309HttpError {
|
|
|
5643
5643
|
};
|
|
5644
5644
|
|
|
5645
5645
|
// src/client/invalid-body-error.ts
|
|
5646
|
-
var InvalidBodyError = class extends
|
|
5646
|
+
var InvalidBodyError = class extends Label309HttpError {
|
|
5647
5647
|
constructor(init) {
|
|
5648
5648
|
super(init);
|
|
5649
5649
|
this.name = "InvalidBodyError";
|
|
@@ -5651,7 +5651,7 @@ var InvalidBodyError = class extends Cip309HttpError {
|
|
|
5651
5651
|
};
|
|
5652
5652
|
|
|
5653
5653
|
// src/client/malformed-cbor-error.ts
|
|
5654
|
-
var MalformedCborError = class extends
|
|
5654
|
+
var MalformedCborError = class extends Label309HttpError {
|
|
5655
5655
|
constructor(init) {
|
|
5656
5656
|
super(init);
|
|
5657
5657
|
this.name = "MalformedCborError";
|
|
@@ -5659,7 +5659,7 @@ var MalformedCborError = class extends Cip309HttpError {
|
|
|
5659
5659
|
};
|
|
5660
5660
|
|
|
5661
5661
|
// src/client/not-found-error.ts
|
|
5662
|
-
var NotFoundError = class extends
|
|
5662
|
+
var NotFoundError = class extends Label309HttpError {
|
|
5663
5663
|
constructor(init) {
|
|
5664
5664
|
super(init);
|
|
5665
5665
|
this.name = "NotFoundError";
|
|
@@ -5670,7 +5670,7 @@ var NotFoundError = class extends Cip309HttpError {
|
|
|
5670
5670
|
function readString2(value) {
|
|
5671
5671
|
return typeof value === "string" ? value : void 0;
|
|
5672
5672
|
}
|
|
5673
|
-
var QuoteAlreadyConsumedError = class extends
|
|
5673
|
+
var QuoteAlreadyConsumedError = class extends Label309HttpError {
|
|
5674
5674
|
quoteId;
|
|
5675
5675
|
constructor(init) {
|
|
5676
5676
|
super(init);
|
|
@@ -5683,7 +5683,7 @@ var QuoteAlreadyConsumedError = class extends Cip309HttpError {
|
|
|
5683
5683
|
function readString3(value) {
|
|
5684
5684
|
return typeof value === "string" ? value : void 0;
|
|
5685
5685
|
}
|
|
5686
|
-
var QuoteExpiredError = class extends
|
|
5686
|
+
var QuoteExpiredError = class extends Label309HttpError {
|
|
5687
5687
|
quoteId;
|
|
5688
5688
|
constructor(init) {
|
|
5689
5689
|
super(init);
|
|
@@ -5696,7 +5696,7 @@ var QuoteExpiredError = class extends Cip309HttpError {
|
|
|
5696
5696
|
function readString4(value) {
|
|
5697
5697
|
return typeof value === "string" ? value : void 0;
|
|
5698
5698
|
}
|
|
5699
|
-
var QuoteNotFoundError = class extends
|
|
5699
|
+
var QuoteNotFoundError = class extends Label309HttpError {
|
|
5700
5700
|
quoteId;
|
|
5701
5701
|
constructor(init) {
|
|
5702
5702
|
super(init);
|
|
@@ -5706,7 +5706,7 @@ var QuoteNotFoundError = class extends Cip309HttpError {
|
|
|
5706
5706
|
};
|
|
5707
5707
|
|
|
5708
5708
|
// src/client/rate-limited-error.ts
|
|
5709
|
-
var RateLimitedError = class extends
|
|
5709
|
+
var RateLimitedError = class extends Label309HttpError {
|
|
5710
5710
|
constructor(init) {
|
|
5711
5711
|
super(init);
|
|
5712
5712
|
this.name = "RateLimitedError";
|
|
@@ -5714,7 +5714,7 @@ var RateLimitedError = class extends Cip309HttpError {
|
|
|
5714
5714
|
};
|
|
5715
5715
|
|
|
5716
5716
|
// src/client/record-not-found-error.ts
|
|
5717
|
-
var RecordNotFoundError = class extends
|
|
5717
|
+
var RecordNotFoundError = class extends Label309HttpError {
|
|
5718
5718
|
constructor(init) {
|
|
5719
5719
|
super(init);
|
|
5720
5720
|
this.name = "RecordNotFoundError";
|
|
@@ -5722,7 +5722,7 @@ var RecordNotFoundError = class extends Cip309HttpError {
|
|
|
5722
5722
|
};
|
|
5723
5723
|
|
|
5724
5724
|
// src/client/service-unavailable-error.ts
|
|
5725
|
-
var ServiceUnavailableError = class extends
|
|
5725
|
+
var ServiceUnavailableError = class extends Label309HttpError {
|
|
5726
5726
|
constructor(init) {
|
|
5727
5727
|
super(init);
|
|
5728
5728
|
this.name = "ServiceUnavailableError";
|
|
@@ -5730,7 +5730,7 @@ var ServiceUnavailableError = class extends Cip309HttpError {
|
|
|
5730
5730
|
};
|
|
5731
5731
|
|
|
5732
5732
|
// src/client/unauthorized-error.ts
|
|
5733
|
-
var UnauthorizedError = class extends
|
|
5733
|
+
var UnauthorizedError = class extends Label309HttpError {
|
|
5734
5734
|
constructor(init) {
|
|
5735
5735
|
super(init);
|
|
5736
5736
|
this.name = "UnauthorizedError";
|
|
@@ -5738,7 +5738,7 @@ var UnauthorizedError = class extends Cip309HttpError {
|
|
|
5738
5738
|
};
|
|
5739
5739
|
|
|
5740
5740
|
// src/client/validation-failed-error.ts
|
|
5741
|
-
var ValidationFailedError = class extends
|
|
5741
|
+
var ValidationFailedError = class extends Label309HttpError {
|
|
5742
5742
|
constructor(init) {
|
|
5743
5743
|
super(init);
|
|
5744
5744
|
this.name = "ValidationFailedError";
|
|
@@ -5856,7 +5856,7 @@ function parseHttpError(args) {
|
|
|
5856
5856
|
case "fx-stale":
|
|
5857
5857
|
return new ServiceUnavailableError(init);
|
|
5858
5858
|
default:
|
|
5859
|
-
return new
|
|
5859
|
+
return new Label309HttpError(init);
|
|
5860
5860
|
}
|
|
5861
5861
|
}
|
|
5862
5862
|
|
|
@@ -6317,7 +6317,7 @@ var PoeNamespace = class {
|
|
|
6317
6317
|
* publish time against the locked price snapshot.
|
|
6318
6318
|
*
|
|
6319
6319
|
* On HTTP-level failure (auth, rate limit, malformed request) this throws
|
|
6320
|
-
* a typed `
|
|
6320
|
+
* a typed `Label309HttpError` subclass. Per-file failures inside a 200
|
|
6321
6321
|
* response are NOT thrown by `uploads()` itself — the response body is
|
|
6322
6322
|
* returned verbatim so the caller can decide how to react. The
|
|
6323
6323
|
* higher-level helpers (`publishSealed`, `publishMerkle`) treat any failed
|
|
@@ -6402,7 +6402,7 @@ var PoeNamespace = class {
|
|
|
6402
6402
|
}
|
|
6403
6403
|
/**
|
|
6404
6404
|
* High-level hash-only publish: hash the supplied content, build a
|
|
6405
|
-
* single-item
|
|
6405
|
+
* single-item Label 309 record, optionally sign it with the caller-supplied
|
|
6406
6406
|
* signer, and submit. No Arweave, no storage round-trip — anchors the
|
|
6407
6407
|
* digest only.
|
|
6408
6408
|
*/
|
|
@@ -6420,7 +6420,7 @@ var PoeNamespace = class {
|
|
|
6420
6420
|
/**
|
|
6421
6421
|
* Sealed-PoE: encrypt the supplied content to the recipient X25519 public
|
|
6422
6422
|
* keys (age-style sealed envelope), upload the ciphertext to Arweave via
|
|
6423
|
-
* /uploads, build a
|
|
6423
|
+
* /uploads, build a Label 309 record with the resulting `ar://` URI, sign
|
|
6424
6424
|
* it (optional), and submit via /publish.
|
|
6425
6425
|
*
|
|
6426
6426
|
* The sender SHOULD include their own X25519 public key in `recipients`
|
|
@@ -6518,7 +6518,7 @@ var RecordsNamespace = class {
|
|
|
6518
6518
|
return await readJson(response);
|
|
6519
6519
|
}
|
|
6520
6520
|
/**
|
|
6521
|
-
* Run the canonical
|
|
6521
|
+
* Run the canonical Label 309 verifier against the record at `txHash`.
|
|
6522
6522
|
* Returns the same `VerifyReport` shape the standalone verifier emits —
|
|
6523
6523
|
* `VerifyReport` IS the wire body of this endpoint, with no transformer in
|
|
6524
6524
|
* between.
|
|
@@ -6541,31 +6541,31 @@ var RecordsNamespace = class {
|
|
|
6541
6541
|
}
|
|
6542
6542
|
};
|
|
6543
6543
|
|
|
6544
|
-
// src/client/
|
|
6544
|
+
// src/client/label-309-client.ts
|
|
6545
6545
|
function resolveFetch(provided) {
|
|
6546
6546
|
if (provided !== void 0) return provided;
|
|
6547
6547
|
if (typeof globalThis.fetch === "function") {
|
|
6548
6548
|
return globalThis.fetch.bind(globalThis);
|
|
6549
6549
|
}
|
|
6550
6550
|
throw new Error(
|
|
6551
|
-
"
|
|
6551
|
+
"Label309Client: no fetch implementation available. Pass `fetch` in the config or run on a platform with globalThis.fetch."
|
|
6552
6552
|
);
|
|
6553
6553
|
}
|
|
6554
6554
|
function resolveBaseUrl(config) {
|
|
6555
6555
|
const baseUrl = config.baseUrl?.trim();
|
|
6556
6556
|
if (baseUrl === void 0 || baseUrl === "") {
|
|
6557
6557
|
throw new InvalidClientConfigError(
|
|
6558
|
-
"
|
|
6558
|
+
"Label309Client: baseUrl is required. Pass the base URL of the Label 309 gateway you are targeting (e.g. https://gateway.example.com)."
|
|
6559
6559
|
);
|
|
6560
6560
|
}
|
|
6561
6561
|
return baseUrl.replace(/\/$/, "");
|
|
6562
6562
|
}
|
|
6563
|
-
var
|
|
6563
|
+
var Label309Client = class {
|
|
6564
6564
|
poe;
|
|
6565
6565
|
records;
|
|
6566
6566
|
account;
|
|
6567
6567
|
/**
|
|
6568
|
-
* Construct a client against a
|
|
6568
|
+
* Construct a client against a Label 309 gateway.
|
|
6569
6569
|
*
|
|
6570
6570
|
* `config.baseUrl` is required — there is no default deployment. The
|
|
6571
6571
|
* `config.apiKey`, when supplied, is an opaque bearer token sent verbatim as
|
|
@@ -6999,6 +6999,6 @@ function decryptSealedFromSeed(args) {
|
|
|
6999
6999
|
(*! noble-post-quantum - MIT License (c) 2024 Paul Miller (paulmillr.com) *)
|
|
7000
7000
|
*/
|
|
7001
7001
|
|
|
7002
|
-
export { AccountNamespace, BLOCKFROST_MAINNET_HOST, BatchEmptyError, BatchTooLargeError, BodyTooLargeError, CONFIRMATION_DEPTH_THRESHOLD_DEFAULT, CROCKFORD_ENCODED_LENGTH_FOR_UUID,
|
|
7002
|
+
export { AccountNamespace, BLOCKFROST_MAINNET_HOST, BatchEmptyError, BatchTooLargeError, BodyTooLargeError, CONFIRMATION_DEPTH_THRESHOLD_DEFAULT, CROCKFORD_ENCODED_LENGTH_FOR_UUID, DEFAULT_OUTBOUND_MAX_BYTES, DEFAULT_PROFILE, DENY_HOSTS_DEFAULT, DenyHostError, ERROR_CODES, ForbiddenError, IdempotencyConflictError, InsufficientFundsError, InsufficientScopeError, InternalServerError, InvalidBodyError, InvalidClientConfigError, KOIOS_MAINNET_URL, Label309Client, Label309HttpError, MalformedCborError, NotALabel309RecordError, NotFoundError, OffHostSignError, OutboundExhaustedError, POE_ID_PATTERN, POE_ID_PREFIX, PROFILE_RANK, PartialUploadError, PoeIdSchema, PoeNamespace, PoeRecordSchema, PublishError, QuoteAlreadyConsumedError, QuoteExpiredError, QuoteNotFoundError, RateLimitedError, RecordNotFoundError, RecordsNamespace, SEVERITY, STRUCTURAL_ERROR_CODES, ServiceUnavailableError, UnauthorizedError, UnsupportedMethodError, UnsupportedProtocolError, VERIFIER_ERROR_CODES, ValidationFailedError, assembleCoseSign1, assembleCoseSign1Hashed, buildToSign, bytesToHex, decodeBytes as decodeCrockfordBase32, decodePrefixedId, decodeTxSummary, decodeTxWitnesses, decryptSealedFromSeed, defaultFetchOutbound, denyHostsFetch, deriveEd25519KeypairFromSeed, deriveKeysFromSeed, deriveMlKem768X25519KeypairFromSeed, deriveX25519KeypairFromSeed, eciesSealedPoeUnwrap, eciesSealedPoeWrap, encodeAgeX25519Recipient, encodeAgeXWingRecipient, encodeBytesVariableLength, encodeBytes as encodeCrockfordBase32, encodePoeRecord, encodePrefixedId, encodeRecordBodyForSigning, exitCodeForVerdict, extractLabel309Metadata, fetchItemCiphertext, fetchOutbound, hash_exports as hash, isPrefixedId, matchesDenyList, merkle_exports as merkle, parseAgeRecipient, parseHttpError, planProfileSkips, prepareSigStructure, prepareSigStructureHashed, profileImplements, recipientKeyBundleFromSeed, recipientsFromSeed, resolveCardanoTx, severityOf, signerFromSeed, sliceLabel309Value, sliceTxComponents, tryDecryptions, validatePoeRecord, verifyMerkleCommitments, verifyRecordSignatures, verifyReportToDict, verifyResolved, verifyTx, wrapFetchOutbound };
|
|
7003
7003
|
//# sourceMappingURL=index.js.map
|
|
7004
7004
|
//# sourceMappingURL=index.js.map
|