@cardanowall/poe-standard 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 +19 -14
- package/dist/encoder.cjs.map +1 -1
- package/dist/encoder.js.map +1 -1
- package/dist/error-codes.cjs.map +1 -1
- package/dist/error-codes.js.map +1 -1
- package/dist/index.cjs +6 -18
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +6 -18
- package/dist/index.js.map +1 -1
- package/dist/schema.cjs.map +1 -1
- package/dist/schema.js.map +1 -1
- package/dist/validator.cjs +6 -18
- package/dist/validator.cjs.map +1 -1
- package/dist/validator.js +6 -18
- package/dist/validator.js.map +1 -1
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
# @cardanowall/poe-standard — the
|
|
1
|
+
# @cardanowall/poe-standard — the Label 309 wire-format library
|
|
2
2
|
|
|
3
|
-
The wire-format library for [
|
|
3
|
+
The wire-format library for [Label 309](https://cips.cardano.org/) Proof-of-Existence records: the
|
|
4
4
|
record schema, the canonical-CBOR encoder, the pure structural validator, and the canonical
|
|
5
5
|
error-code catalogue. Pure functions over bytes — no I/O, no network, no clock.
|
|
6
6
|
|
|
7
7
|
## What it is
|
|
8
8
|
|
|
9
9
|
This package owns the **bytes**. It builds the exact canonical CBOR that goes on chain under Cardano
|
|
10
|
-
metadata label 309, and it decides whether an arbitrary byte string is a structurally valid
|
|
11
|
-
record. It is the **structural validator** of the three
|
|
10
|
+
metadata label 309, and it decides whether an arbitrary byte string is a structurally valid Label 309
|
|
11
|
+
record. It is the **structural validator** of the three Label 309 verifier roles: a pure function over
|
|
12
12
|
CBOR bytes, with no cryptographic signature checks, no chain resolution, and no decryption — those
|
|
13
13
|
belong to the verifier layer in [`@cardanowall/sdk-ts`](https://www.npmjs.com/package/@cardanowall/sdk-ts)
|
|
14
14
|
and its byte-parity twins.
|
|
15
15
|
|
|
16
|
-
Everything here is deterministic and side-effect-free, which is what makes a
|
|
16
|
+
Everything here is deterministic and side-effect-free, which is what makes a Label 309 proof
|
|
17
17
|
independently checkable: the same bytes always encode to the same record and validate to the same
|
|
18
18
|
result, in any implementation, against shared test vectors.
|
|
19
19
|
|
|
20
20
|
## Install
|
|
21
21
|
|
|
22
|
-
The
|
|
22
|
+
The Label 309 TypeScript packages are pre-1.0 and not yet published to npm. Build from the workspace:
|
|
23
23
|
|
|
24
24
|
```sh
|
|
25
25
|
pnpm install
|
|
@@ -83,7 +83,7 @@ import { encodeRecordBodyForSigning, type PoeRecord } from '@cardanowall/poe-sta
|
|
|
83
83
|
|
|
84
84
|
const record: PoeRecord = { v: 1, items: [{ hashes: { 'sha2-256': digest } }] };
|
|
85
85
|
|
|
86
|
-
// record_body = the full record map MINUS sigs. Producers prepend the
|
|
86
|
+
// record_body = the full record map MINUS sigs. Producers prepend the Label 309
|
|
87
87
|
// domain-separation prefix and wrap the result in a COSE Sig_structure before
|
|
88
88
|
// signing with Ed25519 (see @cardanowall/crypto-core for the COSE helper).
|
|
89
89
|
const body: Uint8Array = encodeRecordBodyForSigning(record);
|
|
@@ -91,7 +91,7 @@ const body: Uint8Array = encodeRecordBodyForSigning(record);
|
|
|
91
91
|
|
|
92
92
|
## Records on chain: chunk → validate
|
|
93
93
|
|
|
94
|
-
The Cardano ledger caps every metadata byte string and text string at 64 bytes, so a
|
|
94
|
+
The Cardano ledger caps every metadata byte string and text string at 64 bytes, so a Label 309 record
|
|
95
95
|
is stored as an **array of ≤64-byte CBOR-bytes chunks** under label 309, and the metadata map itself
|
|
96
96
|
is wrapped in the Conway tag-259 form. A verifier reassembles the chunk array (and unwraps tag-259)
|
|
97
97
|
before calling `validatePoeRecord` — the validator operates on the single reconstructed record byte
|
|
@@ -113,26 +113,30 @@ The package root re-exports every group. Subpath imports are available for `./sc
|
|
|
113
113
|
`./validator`, and `./error-codes`.
|
|
114
114
|
|
|
115
115
|
**Encode** (`@cardanowall/poe-standard/encoder`)
|
|
116
|
+
|
|
116
117
|
- `encodePoeRecord(record)` — canonical CBOR for chain submission.
|
|
117
118
|
- `encodeRecordBodyForSigning(record)` — the `record_body` (full map minus `sigs`) that record-level
|
|
118
119
|
COSE_Sign1 signatures sign over.
|
|
119
120
|
|
|
120
121
|
**Validate** (`@cardanowall/poe-standard/validator`)
|
|
122
|
+
|
|
121
123
|
- `validatePoeRecord(bytes)` — the structural pipeline: canonical decode → schema parse → cross-field
|
|
122
124
|
domain checks. Returns a discriminated `ValidateResult`; never throws.
|
|
123
|
-
- `validateCidProfile(cid)` — offline IPFS CID-profile parser (CIDv0 and the
|
|
125
|
+
- `validateCidProfile(cid)` — offline IPFS CID-profile parser (CIDv0 and the Label 309 CIDv1 multibase
|
|
124
126
|
/ multicodec / multihash profile).
|
|
125
127
|
- `type ValidateResult`, `type ValidationIssue`.
|
|
126
128
|
|
|
127
129
|
**Error codes** (`@cardanowall/poe-standard/error-codes`)
|
|
130
|
+
|
|
128
131
|
- `STRUCTURAL_ERROR_CODES` — the codes the structural validator emits (Part A).
|
|
129
132
|
- `VERIFIER_ERROR_CODES` — the verifier-layer codes (Part B), re-exported so downstream verifiers
|
|
130
133
|
dispatch on a single union without round-tripping through the SDK.
|
|
131
134
|
- `ERROR_CODES` — their union; `SEVERITY` / `severityOf(code)` map each to `'error' | 'warning' |
|
|
132
|
-
|
|
135
|
+
'info'`. Codes are SCREAMING_SNAKE_CASE and byte-exact across implementations.
|
|
133
136
|
- `type ErrorCode`, `type StructuralErrorCode`, `type VerifierErrorCode`, `type Severity`.
|
|
134
137
|
|
|
135
138
|
**Schema + types** (`@cardanowall/poe-standard/schema`)
|
|
139
|
+
|
|
136
140
|
- Zod schemas for the full v1 wire surface: `PoeRecordSchema`, `ItemEntrySchema`,
|
|
137
141
|
`MerkleCommitSchema`, `EncryptionEnvelopeSchema`, `SlotSchema`, `PassphraseBlockSchema`,
|
|
138
142
|
`Argon2idParamsSchema`, `HashesMapSchema`, `HashDigestSchema`, `SigEntrySchema`,
|
|
@@ -145,6 +149,7 @@ The package root re-exports every group. Subpath imports are available for `./sc
|
|
|
145
149
|
`EXTENSION_KEY_COMPANION_RE`.
|
|
146
150
|
|
|
147
151
|
**Chunking** (re-exported from the root)
|
|
152
|
+
|
|
148
153
|
- `chunkBytes` / `bytesChunkArrayConcat` — split/reassemble chunked byte strings (COSE_Sign1,
|
|
149
154
|
COSE_Key blobs).
|
|
150
155
|
- `chunkUri` / `reconstructChunkedUri` — split/reassemble chunked URI arrays on UTF-8 boundaries.
|
|
@@ -175,13 +180,13 @@ const record: PoeRecord = {
|
|
|
175
180
|
};
|
|
176
181
|
```
|
|
177
182
|
|
|
178
|
-
The validator enforces the
|
|
183
|
+
The validator enforces the Label 309 registries (hash algorithms, AEAD, KEM, Merkle commitment, and
|
|
179
184
|
passphrase-KDF), rejects unauthenticated ciphers by name, pins each KEM's recipient-slot shape, and
|
|
180
185
|
guards against publishing private key material on chain.
|
|
181
186
|
|
|
182
187
|
## Cross-implementation parity
|
|
183
188
|
|
|
184
|
-
The encoder and validator are byte-identical across the
|
|
189
|
+
The encoder and validator are byte-identical across the Label 309 implementations —
|
|
185
190
|
`@cardanowall/poe-standard` (TS), the Python twin, and the Rust crate — validated against the same
|
|
186
191
|
shared canonical-CBOR known-answer test vectors. Encoding the same record yields byte-identical CBOR
|
|
187
192
|
in every implementation; validating the same bytes yields the same ordered list of issue codes with
|
|
@@ -189,7 +194,7 @@ the same severities. That parity is what lets a proof published by one tool veri
|
|
|
189
194
|
|
|
190
195
|
## Standard / service independence
|
|
191
196
|
|
|
192
|
-
A
|
|
197
|
+
A Label 309 proof is verifiable from transaction metadata, the optional content bytes, and a public
|
|
193
198
|
blockchain explorer — no issuer server is required. This package is the structural half of that
|
|
194
199
|
guarantee: given the reassembled record bytes, `validatePoeRecord` decides structural validity
|
|
195
200
|
offline, with no trust in the publisher, the gateway, or any domain. Signature verification, chain
|
|
@@ -201,7 +206,7 @@ in the SDKs.
|
|
|
201
206
|
- **`@cardanowall/crypto-core`** — closed-catalogue cryptographic primitives (hash, KDF, signature,
|
|
202
207
|
KEM, AEAD, CBOR, COSE, sealed-PoE, Merkle). Supplies the canonical CBOR codec and COSE decoder this
|
|
203
208
|
package builds on.
|
|
204
|
-
- **`@cardanowall/poe-standard`** — this package: the
|
|
209
|
+
- **`@cardanowall/poe-standard`** — this package: the Label 309 wire format (schema, encoder, structural
|
|
205
210
|
validator, error codes).
|
|
206
211
|
- **`@cardanowall/sdk-ts`** — the browser + Node SDK: the standalone verifier (all three roles), the
|
|
207
212
|
gateway-agnostic HTTP client, off-host signing, and seed-derived identity helpers.
|