@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/README.md
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
# @cardanowall/sdk-ts — the TypeScript SDK for
|
|
1
|
+
# @cardanowall/sdk-ts — the TypeScript SDK for Label 309 Proof-of-Existence
|
|
2
2
|
|
|
3
|
-
The browser + Node TypeScript SDK for [
|
|
3
|
+
The browser + Node TypeScript SDK for [Label 309](https://cips.cardano.org/) Proof-of-Existence on Cardano: a **standalone verifier** (three roles), a **gateway-agnostic HTTP client**, **off-host signing** helpers, and **seed-derived identity** helpers.
|
|
4
4
|
|
|
5
5
|
## What it is
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Label 309 anchors a content hash on Cardano under metadata label 309 so that anyone can later prove "this content existed on or before block time T" — without trusting any server, domain, or issuer identity. This package is the high-level TypeScript surface over that standard:
|
|
8
8
|
|
|
9
|
-
- **Verify** any
|
|
10
|
-
- **Publish, read, and decrypt** records against **any**
|
|
9
|
+
- **Verify** any Label 309 transaction from chain metadata alone — no issuer server in the trust path.
|
|
10
|
+
- **Publish, read, and decrypt** records against **any** Label 309 gateway (you supply the base URL and an opaque key).
|
|
11
11
|
- **Sign** records off-host (AWS KMS, GCP HSM, YubiHSM, air-gapped) — the private key never touches the SDK.
|
|
12
12
|
- **Derive identity** keypairs, recipient strings, signers, and sealed-PoE decryption from a single 32-byte seed.
|
|
13
13
|
|
|
@@ -42,9 +42,9 @@ const report = await verifyTx({
|
|
|
42
42
|
cardanoGatewayChain: ['https://api.koios.rest/api/v1'], // tried in order
|
|
43
43
|
});
|
|
44
44
|
|
|
45
|
-
console.log(report.verdict);
|
|
45
|
+
console.log(report.verdict); // 'valid' | 'pending' | 'failed'
|
|
46
46
|
console.log(report.exit_code); // 0 valid · 1 integrity fail · 2 network fail · 3 pending
|
|
47
|
-
console.log(report.record);
|
|
47
|
+
console.log(report.record); // the decoded Label 309 PoeRecord
|
|
48
48
|
```
|
|
49
49
|
|
|
50
50
|
To decrypt a sealed PoE addressed to you, run at the **recipient-sealed** profile and supply your X25519 private key per item index:
|
|
@@ -68,11 +68,11 @@ When you already hold the metadata bytes from an indexer mirror, skip the chain
|
|
|
68
68
|
`baseUrl` is **required** — the client binds to no particular deployment. `apiKey`, when present, is an **opaque** bearer token forwarded verbatim as `Authorization: Bearer <apiKey>`; the SDK never parses or assumes its format. Omit it for anonymous read-only use.
|
|
69
69
|
|
|
70
70
|
```ts
|
|
71
|
-
import {
|
|
71
|
+
import { Label309Client } from '@cardanowall/sdk-ts';
|
|
72
72
|
|
|
73
|
-
const client = new
|
|
74
|
-
baseUrl: 'https://gateway.example.com', // any
|
|
75
|
-
apiKey: process.env.
|
|
73
|
+
const client = new Label309Client({
|
|
74
|
+
baseUrl: 'https://gateway.example.com', // any Label 309 gateway
|
|
75
|
+
apiKey: process.env.LABEL309_API_KEY, // opaque; omit for anonymous reads
|
|
76
76
|
});
|
|
77
77
|
|
|
78
78
|
// Read surface — no auth required for public records.
|
|
@@ -94,7 +94,7 @@ const quote = await client.poe.quote({
|
|
|
94
94
|
|
|
95
95
|
// Hash-only PoE: hash the content, build the record, submit. One HTTP call.
|
|
96
96
|
const result = await client.poe.publishContent({
|
|
97
|
-
content: 'hello world',
|
|
97
|
+
content: 'hello world', // string (UTF-8) or Uint8Array
|
|
98
98
|
quoteId: quote.quote_id,
|
|
99
99
|
// signer is optional; omit to publish unsigned (profile=core)
|
|
100
100
|
});
|
|
@@ -132,9 +132,9 @@ import {
|
|
|
132
132
|
decryptSealedFromSeed,
|
|
133
133
|
} from '@cardanowall/sdk-ts';
|
|
134
134
|
|
|
135
|
-
const keys = deriveKeysFromSeed(seed);
|
|
136
|
-
const me = recipientsFromSeed(seed);
|
|
137
|
-
const signer = signerFromSeed(seed);
|
|
135
|
+
const keys = deriveKeysFromSeed(seed); // { ed25519, x25519, mlkem768x25519 }
|
|
136
|
+
const me = recipientsFromSeed(seed); // { age: 'age1…', age1pqc: 'age1pqc…' }
|
|
137
|
+
const signer = signerFromSeed(seed); // a path-1 Signer for the publish helpers
|
|
138
138
|
|
|
139
139
|
// Decrypt a sealed PoE addressed to this seed — works for both classical
|
|
140
140
|
// (x25519) and hybrid post-quantum (mlkem768x25519 / X-Wing) records.
|
|
@@ -149,6 +149,7 @@ if (result.matched) {
|
|
|
149
149
|
Everything is reachable from the package root; submodule entry points (`/verifier`, `/client`, `/identity`, `/merkle`, `/hash`, `/fetch`) exist for tree-shaking.
|
|
150
150
|
|
|
151
151
|
**Verifier** (`@cardanowall/sdk-ts` or `/verifier`)
|
|
152
|
+
|
|
152
153
|
- `verifyTx(input)` / `verifyResolved(input)` — the full pipeline; returns a `VerifyReport`.
|
|
153
154
|
- `verifyRecordSignatures`, `verifyMerkleCommitments`, `tryDecryptions` — individual stages.
|
|
154
155
|
- `DEFAULT_PROFILE`, `profileImplements`, `planProfileSkips` — the four conformance profiles (`core` → `signed` → `sealed` → `recipient-sealed`).
|
|
@@ -156,18 +157,21 @@ Everything is reachable from the package root; submodule entry points (`/verifie
|
|
|
156
157
|
- `resolveCardanoTx`, `extractLabel309Metadata`, `decodeTxWitnesses`, `decodeTxSummary` — resolution + transaction-level description.
|
|
157
158
|
|
|
158
159
|
**Client** (`/client`)
|
|
159
|
-
|
|
160
|
+
|
|
161
|
+
- `Label309Client({ baseUrl, apiKey?, fetch? })` — `baseUrl` required, key opaque.
|
|
160
162
|
- `client.poe.{quote, publishContent, publishPrehashed, publishSealed, publishMerkle, uploads, publish, publishBatch}`.
|
|
161
163
|
- `client.records.{get, verify}`, `client.inbox.{list, get}`, `client.account.balance()`.
|
|
162
164
|
- Off-host signing: `prepareSigStructure`, `assembleCoseSign1`, plus the CIP-8 hashed-mode pair `prepareSigStructureHashed` / `assembleCoseSign1Hashed`.
|
|
163
|
-
- Typed errors extending `
|
|
165
|
+
- Typed errors extending `Label309HttpError`: `InsufficientFundsError`, `QuoteExpiredError`, `QuoteAlreadyConsumedError`, `FxStaleError`, `RateLimitedError`, `UnauthorizedError`, `ValidationFailedError`, `MalformedCborError`, `InvalidClientConfigError`, and more.
|
|
164
166
|
|
|
165
167
|
**Identity** (`/identity`)
|
|
168
|
+
|
|
166
169
|
- `deriveKeysFromSeed`, `recipientsFromSeed`, `signerFromSeed`, `recipientKeyBundleFromSeed`, `decryptSealedFromSeed`.
|
|
167
170
|
- Recipient codecs `encodeAgeX25519Recipient`, `encodeAgeXWingRecipient`, `parseAgeRecipient`.
|
|
168
171
|
- Low-level derive primitives `deriveEd25519KeypairFromSeed`, `deriveX25519KeypairFromSeed`, `deriveMlKem768X25519KeypairFromSeed`.
|
|
169
172
|
|
|
170
173
|
**Wire format & primitives** (re-exported for convenience)
|
|
174
|
+
|
|
171
175
|
- From `@cardanowall/poe-standard`: `validatePoeRecord`, `encodePoeRecord`, `encodeRecordBodyForSigning`, the error-code catalogues (`STRUCTURAL_ERROR_CODES`, `VERIFIER_ERROR_CODES`, `ERROR_CODES`), `severityOf`, `PoeRecordSchema`.
|
|
172
176
|
- From `@cardanowall/crypto-core`: `eciesSealedPoeWrap` / `eciesSealedPoeUnwrap` (sealed PoE), `hash.*` (digests), `merkle.*` (`merkleSha2256Root`, `merkleSha2256InclusionProof`, `merkleSha2256VerifyInclusion`, leaves-list codecs).
|
|
173
177
|
|
|
@@ -193,12 +197,12 @@ The verifier, the structural validator, the sealed-PoE construction, the off-hos
|
|
|
193
197
|
|
|
194
198
|
## Standard & service independence
|
|
195
199
|
|
|
196
|
-
A
|
|
200
|
+
A Label 309 proof verifies from three inputs only: the **transaction metadata**, optionally the **content bytes**, and a **public blockchain explorer**. No issuer server sits in the trust path. `verifyTx` reaches only the gateway chains you pass it, routes every outbound request through a single auditable egress point (every call lands in `VerifyReport.http_calls`), and enforces a deny-host policy — so the standalone verifier can be pointed at any infrastructure and still produce a trustworthy verdict.
|
|
197
201
|
|
|
198
202
|
## Relation to the other packages
|
|
199
203
|
|
|
200
204
|
- **`@cardanowall/crypto-core`** — closed-catalogue cryptographic primitives (hash, KDF, signature, KEM, AEAD, CBOR, COSE, sealed-PoE, Merkle, recipient encoding, seed derivation). The building blocks this SDK is built on.
|
|
201
|
-
- **`@cardanowall/poe-standard`** — the
|
|
205
|
+
- **`@cardanowall/poe-standard`** — the Label 309 wire-format library: record schema, canonical-CBOR encoder, pure structural validator, error-code catalogue.
|
|
202
206
|
- **`@cardanowall/sdk-py`** — the Python SDK: a byte-identical parity twin of this package, validated against the same canonical-CBOR vectors.
|
|
203
207
|
- **`cardanowall`** (Rust crate) — the Rust SDK: the byte-parity twin in Rust, blocking HTTP, secure-by-default egress. The `cardanowall` CLI is built on it.
|
|
204
208
|
|
package/dist/client/index.cjs
CHANGED
|
@@ -78,7 +78,7 @@ function buildSigStructure(args) {
|
|
|
78
78
|
args.payload
|
|
79
79
|
]);
|
|
80
80
|
}
|
|
81
|
-
function
|
|
81
|
+
function buildLabel309SigStructure(args) {
|
|
82
82
|
const toSign = new Uint8Array(
|
|
83
83
|
CARDANO_POE_SIG_DOMAIN_PREFIX_BYTES.length + args.recordBodyCbor.length
|
|
84
84
|
);
|
|
@@ -406,7 +406,7 @@ function prepareSigStructure(args) {
|
|
|
406
406
|
}
|
|
407
407
|
const { protectedHeaderBytes } = encodePath1ProtectedHeader(args.signerPubkey);
|
|
408
408
|
const recordBodyCbor = encodeRecordBodyForSigning(args.record);
|
|
409
|
-
const sigStructureBytes =
|
|
409
|
+
const sigStructureBytes = buildLabel309SigStructure({
|
|
410
410
|
bodyProtectedBytes: protectedHeaderBytes,
|
|
411
411
|
recordBodyCbor
|
|
412
412
|
});
|
|
@@ -500,7 +500,7 @@ function extractProblemExtensions(problem) {
|
|
|
500
500
|
}
|
|
501
501
|
return out;
|
|
502
502
|
}
|
|
503
|
-
var
|
|
503
|
+
var Label309HttpError = class extends Error {
|
|
504
504
|
problem;
|
|
505
505
|
code;
|
|
506
506
|
httpStatus;
|
|
@@ -515,7 +515,7 @@ var Cip309HttpError = class extends Error {
|
|
|
515
515
|
retryAfterSeconds;
|
|
516
516
|
constructor(init) {
|
|
517
517
|
super(init.problem.detail || `${init.problem.title} (HTTP ${init.problem.status})`);
|
|
518
|
-
this.name = "
|
|
518
|
+
this.name = "Label309HttpError";
|
|
519
519
|
this.problem = init.problem;
|
|
520
520
|
this.code = init.problem.code;
|
|
521
521
|
this.httpStatus = init.problem.status;
|
|
@@ -532,7 +532,7 @@ var Cip309HttpError = class extends Error {
|
|
|
532
532
|
};
|
|
533
533
|
|
|
534
534
|
// src/client/batch-empty-error.ts
|
|
535
|
-
var BatchEmptyError = class extends
|
|
535
|
+
var BatchEmptyError = class extends Label309HttpError {
|
|
536
536
|
constructor(init) {
|
|
537
537
|
super(init);
|
|
538
538
|
this.name = "BatchEmptyError";
|
|
@@ -543,7 +543,7 @@ var BatchEmptyError = class extends Cip309HttpError {
|
|
|
543
543
|
function readInt(value) {
|
|
544
544
|
return typeof value === "number" && Number.isFinite(value) ? value : void 0;
|
|
545
545
|
}
|
|
546
|
-
var BatchTooLargeError = class extends
|
|
546
|
+
var BatchTooLargeError = class extends Label309HttpError {
|
|
547
547
|
max;
|
|
548
548
|
got;
|
|
549
549
|
constructor(init) {
|
|
@@ -555,7 +555,7 @@ var BatchTooLargeError = class extends Cip309HttpError {
|
|
|
555
555
|
};
|
|
556
556
|
|
|
557
557
|
// src/client/forbidden-error.ts
|
|
558
|
-
var ForbiddenError = class extends
|
|
558
|
+
var ForbiddenError = class extends Label309HttpError {
|
|
559
559
|
constructor(init) {
|
|
560
560
|
super(init);
|
|
561
561
|
this.name = "ForbiddenError";
|
|
@@ -563,7 +563,7 @@ var ForbiddenError = class extends Cip309HttpError {
|
|
|
563
563
|
};
|
|
564
564
|
|
|
565
565
|
// src/client/idempotency-conflict-error.ts
|
|
566
|
-
var IdempotencyConflictError = class extends
|
|
566
|
+
var IdempotencyConflictError = class extends Label309HttpError {
|
|
567
567
|
constructor(init) {
|
|
568
568
|
super(init);
|
|
569
569
|
this.name = "IdempotencyConflictError";
|
|
@@ -583,7 +583,7 @@ function readBigIntString(value) {
|
|
|
583
583
|
function readString(value) {
|
|
584
584
|
return typeof value === "string" ? value : void 0;
|
|
585
585
|
}
|
|
586
|
-
var InsufficientFundsError = class extends
|
|
586
|
+
var InsufficientFundsError = class extends Label309HttpError {
|
|
587
587
|
balanceUsdMicros;
|
|
588
588
|
requiredUsdMicros;
|
|
589
589
|
topUpUrl;
|
|
@@ -601,7 +601,7 @@ function readScopeArray(value) {
|
|
|
601
601
|
if (!Array.isArray(value)) return [];
|
|
602
602
|
return value.filter((entry) => typeof entry === "string");
|
|
603
603
|
}
|
|
604
|
-
var InsufficientScopeError = class extends
|
|
604
|
+
var InsufficientScopeError = class extends Label309HttpError {
|
|
605
605
|
requiredScopes;
|
|
606
606
|
grantedScopes;
|
|
607
607
|
constructor(init) {
|
|
@@ -617,7 +617,7 @@ var InsufficientScopeError = class extends Cip309HttpError {
|
|
|
617
617
|
};
|
|
618
618
|
|
|
619
619
|
// src/client/internal-server-error.ts
|
|
620
|
-
var InternalServerError = class extends
|
|
620
|
+
var InternalServerError = class extends Label309HttpError {
|
|
621
621
|
constructor(init) {
|
|
622
622
|
super(init);
|
|
623
623
|
this.name = "InternalServerError";
|
|
@@ -625,7 +625,7 @@ var InternalServerError = class extends Cip309HttpError {
|
|
|
625
625
|
};
|
|
626
626
|
|
|
627
627
|
// src/client/invalid-body-error.ts
|
|
628
|
-
var InvalidBodyError = class extends
|
|
628
|
+
var InvalidBodyError = class extends Label309HttpError {
|
|
629
629
|
constructor(init) {
|
|
630
630
|
super(init);
|
|
631
631
|
this.name = "InvalidBodyError";
|
|
@@ -633,7 +633,7 @@ var InvalidBodyError = class extends Cip309HttpError {
|
|
|
633
633
|
};
|
|
634
634
|
|
|
635
635
|
// src/client/malformed-cbor-error.ts
|
|
636
|
-
var MalformedCborError = class extends
|
|
636
|
+
var MalformedCborError = class extends Label309HttpError {
|
|
637
637
|
constructor(init) {
|
|
638
638
|
super(init);
|
|
639
639
|
this.name = "MalformedCborError";
|
|
@@ -641,7 +641,7 @@ var MalformedCborError = class extends Cip309HttpError {
|
|
|
641
641
|
};
|
|
642
642
|
|
|
643
643
|
// src/client/not-found-error.ts
|
|
644
|
-
var NotFoundError = class extends
|
|
644
|
+
var NotFoundError = class extends Label309HttpError {
|
|
645
645
|
constructor(init) {
|
|
646
646
|
super(init);
|
|
647
647
|
this.name = "NotFoundError";
|
|
@@ -652,7 +652,7 @@ var NotFoundError = class extends Cip309HttpError {
|
|
|
652
652
|
function readString2(value) {
|
|
653
653
|
return typeof value === "string" ? value : void 0;
|
|
654
654
|
}
|
|
655
|
-
var QuoteAlreadyConsumedError = class extends
|
|
655
|
+
var QuoteAlreadyConsumedError = class extends Label309HttpError {
|
|
656
656
|
quoteId;
|
|
657
657
|
constructor(init) {
|
|
658
658
|
super(init);
|
|
@@ -665,7 +665,7 @@ var QuoteAlreadyConsumedError = class extends Cip309HttpError {
|
|
|
665
665
|
function readString3(value) {
|
|
666
666
|
return typeof value === "string" ? value : void 0;
|
|
667
667
|
}
|
|
668
|
-
var QuoteExpiredError = class extends
|
|
668
|
+
var QuoteExpiredError = class extends Label309HttpError {
|
|
669
669
|
quoteId;
|
|
670
670
|
constructor(init) {
|
|
671
671
|
super(init);
|
|
@@ -678,7 +678,7 @@ var QuoteExpiredError = class extends Cip309HttpError {
|
|
|
678
678
|
function readString4(value) {
|
|
679
679
|
return typeof value === "string" ? value : void 0;
|
|
680
680
|
}
|
|
681
|
-
var QuoteNotFoundError = class extends
|
|
681
|
+
var QuoteNotFoundError = class extends Label309HttpError {
|
|
682
682
|
quoteId;
|
|
683
683
|
constructor(init) {
|
|
684
684
|
super(init);
|
|
@@ -688,7 +688,7 @@ var QuoteNotFoundError = class extends Cip309HttpError {
|
|
|
688
688
|
};
|
|
689
689
|
|
|
690
690
|
// src/client/rate-limited-error.ts
|
|
691
|
-
var RateLimitedError = class extends
|
|
691
|
+
var RateLimitedError = class extends Label309HttpError {
|
|
692
692
|
constructor(init) {
|
|
693
693
|
super(init);
|
|
694
694
|
this.name = "RateLimitedError";
|
|
@@ -696,7 +696,7 @@ var RateLimitedError = class extends Cip309HttpError {
|
|
|
696
696
|
};
|
|
697
697
|
|
|
698
698
|
// src/client/record-not-found-error.ts
|
|
699
|
-
var RecordNotFoundError = class extends
|
|
699
|
+
var RecordNotFoundError = class extends Label309HttpError {
|
|
700
700
|
constructor(init) {
|
|
701
701
|
super(init);
|
|
702
702
|
this.name = "RecordNotFoundError";
|
|
@@ -704,7 +704,7 @@ var RecordNotFoundError = class extends Cip309HttpError {
|
|
|
704
704
|
};
|
|
705
705
|
|
|
706
706
|
// src/client/service-unavailable-error.ts
|
|
707
|
-
var ServiceUnavailableError = class extends
|
|
707
|
+
var ServiceUnavailableError = class extends Label309HttpError {
|
|
708
708
|
constructor(init) {
|
|
709
709
|
super(init);
|
|
710
710
|
this.name = "ServiceUnavailableError";
|
|
@@ -712,7 +712,7 @@ var ServiceUnavailableError = class extends Cip309HttpError {
|
|
|
712
712
|
};
|
|
713
713
|
|
|
714
714
|
// src/client/unauthorized-error.ts
|
|
715
|
-
var UnauthorizedError = class extends
|
|
715
|
+
var UnauthorizedError = class extends Label309HttpError {
|
|
716
716
|
constructor(init) {
|
|
717
717
|
super(init);
|
|
718
718
|
this.name = "UnauthorizedError";
|
|
@@ -720,7 +720,7 @@ var UnauthorizedError = class extends Cip309HttpError {
|
|
|
720
720
|
};
|
|
721
721
|
|
|
722
722
|
// src/client/validation-failed-error.ts
|
|
723
|
-
var ValidationFailedError = class extends
|
|
723
|
+
var ValidationFailedError = class extends Label309HttpError {
|
|
724
724
|
constructor(init) {
|
|
725
725
|
super(init);
|
|
726
726
|
this.name = "ValidationFailedError";
|
|
@@ -838,7 +838,7 @@ function parseHttpError(args) {
|
|
|
838
838
|
case "fx-stale":
|
|
839
839
|
return new ServiceUnavailableError(init);
|
|
840
840
|
default:
|
|
841
|
-
return new
|
|
841
|
+
return new Label309HttpError(init);
|
|
842
842
|
}
|
|
843
843
|
}
|
|
844
844
|
|
|
@@ -2382,7 +2382,7 @@ var PoeNamespace = class {
|
|
|
2382
2382
|
* publish time against the locked price snapshot.
|
|
2383
2383
|
*
|
|
2384
2384
|
* On HTTP-level failure (auth, rate limit, malformed request) this throws
|
|
2385
|
-
* a typed `
|
|
2385
|
+
* a typed `Label309HttpError` subclass. Per-file failures inside a 200
|
|
2386
2386
|
* response are NOT thrown by `uploads()` itself — the response body is
|
|
2387
2387
|
* returned verbatim so the caller can decide how to react. The
|
|
2388
2388
|
* higher-level helpers (`publishSealed`, `publishMerkle`) treat any failed
|
|
@@ -2467,7 +2467,7 @@ var PoeNamespace = class {
|
|
|
2467
2467
|
}
|
|
2468
2468
|
/**
|
|
2469
2469
|
* High-level hash-only publish: hash the supplied content, build a
|
|
2470
|
-
* single-item
|
|
2470
|
+
* single-item Label 309 record, optionally sign it with the caller-supplied
|
|
2471
2471
|
* signer, and submit. No Arweave, no storage round-trip — anchors the
|
|
2472
2472
|
* digest only.
|
|
2473
2473
|
*/
|
|
@@ -2485,7 +2485,7 @@ var PoeNamespace = class {
|
|
|
2485
2485
|
/**
|
|
2486
2486
|
* Sealed-PoE: encrypt the supplied content to the recipient X25519 public
|
|
2487
2487
|
* keys (age-style sealed envelope), upload the ciphertext to Arweave via
|
|
2488
|
-
* /uploads, build a
|
|
2488
|
+
* /uploads, build a Label 309 record with the resulting `ar://` URI, sign
|
|
2489
2489
|
* it (optional), and submit via /publish.
|
|
2490
2490
|
*
|
|
2491
2491
|
* The sender SHOULD include their own X25519 public key in `recipients`
|
|
@@ -2583,7 +2583,7 @@ var RecordsNamespace = class {
|
|
|
2583
2583
|
return await readJson(response);
|
|
2584
2584
|
}
|
|
2585
2585
|
/**
|
|
2586
|
-
* Run the canonical
|
|
2586
|
+
* Run the canonical Label 309 verifier against the record at `txHash`.
|
|
2587
2587
|
* Returns the same `VerifyReport` shape the standalone verifier emits —
|
|
2588
2588
|
* `VerifyReport` IS the wire body of this endpoint, with no transformer in
|
|
2589
2589
|
* between.
|
|
@@ -2606,31 +2606,31 @@ var RecordsNamespace = class {
|
|
|
2606
2606
|
}
|
|
2607
2607
|
};
|
|
2608
2608
|
|
|
2609
|
-
// src/client/
|
|
2609
|
+
// src/client/label-309-client.ts
|
|
2610
2610
|
function resolveFetch(provided) {
|
|
2611
2611
|
if (provided !== void 0) return provided;
|
|
2612
2612
|
if (typeof globalThis.fetch === "function") {
|
|
2613
2613
|
return globalThis.fetch.bind(globalThis);
|
|
2614
2614
|
}
|
|
2615
2615
|
throw new Error(
|
|
2616
|
-
"
|
|
2616
|
+
"Label309Client: no fetch implementation available. Pass `fetch` in the config or run on a platform with globalThis.fetch."
|
|
2617
2617
|
);
|
|
2618
2618
|
}
|
|
2619
2619
|
function resolveBaseUrl(config) {
|
|
2620
2620
|
const baseUrl = config.baseUrl?.trim();
|
|
2621
2621
|
if (baseUrl === void 0 || baseUrl === "") {
|
|
2622
2622
|
throw new InvalidClientConfigError(
|
|
2623
|
-
"
|
|
2623
|
+
"Label309Client: baseUrl is required. Pass the base URL of the Label 309 gateway you are targeting (e.g. https://gateway.example.com)."
|
|
2624
2624
|
);
|
|
2625
2625
|
}
|
|
2626
2626
|
return baseUrl.replace(/\/$/, "");
|
|
2627
2627
|
}
|
|
2628
|
-
var
|
|
2628
|
+
var Label309Client = class {
|
|
2629
2629
|
poe;
|
|
2630
2630
|
records;
|
|
2631
2631
|
account;
|
|
2632
2632
|
/**
|
|
2633
|
-
* Construct a client against a
|
|
2633
|
+
* Construct a client against a Label 309 gateway.
|
|
2634
2634
|
*
|
|
2635
2635
|
* `config.baseUrl` is required — there is no default deployment. The
|
|
2636
2636
|
* `config.apiKey`, when supplied, is an opaque bearer token sent verbatim as
|
|
@@ -2661,8 +2661,6 @@ var Cip309Client = class {
|
|
|
2661
2661
|
exports.AccountNamespace = AccountNamespace;
|
|
2662
2662
|
exports.BatchEmptyError = BatchEmptyError;
|
|
2663
2663
|
exports.BatchTooLargeError = BatchTooLargeError;
|
|
2664
|
-
exports.Cip309Client = Cip309Client;
|
|
2665
|
-
exports.Cip309HttpError = Cip309HttpError;
|
|
2666
2664
|
exports.ForbiddenError = ForbiddenError;
|
|
2667
2665
|
exports.IdempotencyConflictError = IdempotencyConflictError;
|
|
2668
2666
|
exports.InsufficientFundsError = InsufficientFundsError;
|
|
@@ -2670,6 +2668,8 @@ exports.InsufficientScopeError = InsufficientScopeError;
|
|
|
2670
2668
|
exports.InternalServerError = InternalServerError;
|
|
2671
2669
|
exports.InvalidBodyError = InvalidBodyError;
|
|
2672
2670
|
exports.InvalidClientConfigError = InvalidClientConfigError;
|
|
2671
|
+
exports.Label309Client = Label309Client;
|
|
2672
|
+
exports.Label309HttpError = Label309HttpError;
|
|
2673
2673
|
exports.MalformedCborError = MalformedCborError;
|
|
2674
2674
|
exports.NotFoundError = NotFoundError;
|
|
2675
2675
|
exports.OffHostSignError = OffHostSignError;
|