@cardanowall/poe-standard 0.2.0 → 0.4.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/dist/index.d.cts CHANGED
@@ -1,60 +1,6 @@
1
- export { Argon2idParams, Argon2idParamsSchema, ChunkedBytesArray, ChunkedBytesArraySchema, EXTENSION_KEY_COMPANION_RE, EXTENSION_KEY_VENDOR_RE, EncryptionEnvelope, EncryptionEnvelopeSchema, HashDigestSchema, HashesMap, HashesMapSchema, ItemEntry, ItemEntrySchema, MerkleCommit, MerkleCommitSchema, PassphraseBlock, PassphraseBlockSchema, PoeRecord, PoeRecordSchema, SigEntry, SigEntrySchema, Slot, SlotSchema, Supersedes, SupersedesSchema, TOP_LEVEL_BASE_KEYS, UriChunkArray, UriChunkArraySchema, VersionLiteralSchema, isExtensionKey } from './schema.cjs';
1
+ export { Argon2idParams, Argon2idParamsSchema, EXTENSION_KEY_COMPANION_RE, EXTENSION_KEY_VENDOR_RE, EncOpaque, EncOpaqueSchema, EncScheme1, EncScheme1Schema, EncryptionEnvelope, EncryptionEnvelopeSchema, HashDigestSchema, HashesMap, HashesMapSchema, ItemEntry, ItemEntrySchema, MerkleCommit, MerkleCommitSchema, PassphraseBlock, PassphraseBlockSchema, PoeRecord, PoeRecordSchema, SigEntry, SigEntrySchema, Slot, SlotSchema, Supersedes, SupersedesSchema, TOP_LEVEL_BASE_KEYS, Uri, UriSchema, VersionLiteralSchema, isExtensionKey } from './schema.cjs';
2
2
  export { encodePoeRecord, encodeRecordBodyForSigning } from './encoder.cjs';
3
- export { ValidateResult, ValidationIssue, validateCidProfile, validatePoeRecord } from './validator.cjs';
4
- export { ERROR_CODES, ErrorCode, SEVERITY, STRUCTURAL_ERROR_CODES, Severity, StructuralErrorCode, VERIFIER_ERROR_CODES, VerifierErrorCode, severityOf } from './error-codes.cjs';
3
+ export { Label309ReassemblyResult, TRANSPORT_CHUNK_MAX_BYTES, chunkRecordBody, encodeLabel309Value, reassembleLabel309Value } from './carriage.cjs';
4
+ export { Argon2ParamsCeiling, DEFAULT_PASSPHRASE_PARAMS_CEILING, ValidationIssue, ValidationResult, ValidatorOptions, ValidatorRole, validateCidProfile, validatePoeRecord } from './validator.cjs';
5
+ export { CARRIAGE_ERROR_CODES, DUAL_SEVERITY_CODES, ERROR_CODES, ERROR_CODE_PART, ErrorCode, ErrorCodePart, SEVERITY, STRUCTURAL_ERROR_CODES, Severity, StructuralErrorCode, VERIFIER_ERROR_CODES, VerifierErrorCode, errorCodeRegistryIndex, severityOf } from './error-codes.cjs';
5
6
  import 'zod';
6
-
7
- /**
8
- * Split a logical byte string into ≤ 64-byte CBOR-bytes chunks
9
- * (`bytes-chunk-array`). Always returns a non-empty array.
10
- *
11
- * For empty inputs, returns `[<empty>]` so the caller's schema gate fails
12
- * later via `CHUNK_TOO_LARGE` (zero-length chunks are rejected). Real callers
13
- * feed COSE_Sign1 / cbor<COSE_Key> byte strings, which are never empty.
14
- */
15
- declare function chunkBytes(value: Uint8Array): Uint8Array[];
16
- /**
17
- * Reverse of {@link chunkBytes}: concatenate chunked bytes (`sigs[i].cose_sign1`,
18
- * `sigs[i].cose_key`) into a single buffer for downstream CBOR/COSE decode.
19
- * The validator-layer schema enforces the per-chunk size + non-empty-array
20
- * invariants before this helper runs, so it makes no length checks.
21
- */
22
- declare function bytesChunkArrayConcat(chunks: ReadonlyArray<Uint8Array>): Uint8Array;
23
- type ReconstructUriResult = {
24
- ok: true;
25
- uri: string;
26
- } | {
27
- ok: false;
28
- code: 'INVALID_URI';
29
- reason: string;
30
- };
31
- /**
32
- * Reconstruct a chunked URI (`uri-chunk-array`) into its logical string.
33
- *
34
- * The chunks arrive as JS strings produced by the canonical-CBOR decoder,
35
- * which already rejects any non-UTF-8 `tstr` (surfacing it upstream as
36
- * `MALFORMED_CBOR`) — so by the time this helper runs the only structural
37
- * task left is to byte-concatenate and decode. We re-encode each chunk to its
38
- * UTF-8 bytes, concatenate, and decode the whole with `{ fatal: true }`. A
39
- * conformant producer never splits a multi-byte codepoint across chunks (the
40
- * Cardano 64-byte cap is applied on codepoint boundaries), so this decode
41
- * succeeds for every well-formed record; the `INVALID_URI` branch is the
42
- * residual guard for a byte sequence that does not reconstruct to valid UTF-8.
43
- *
44
- * Per-scheme shape validation (the IPFS CID profile) and absolute-URI /
45
- * fragment-identifier / scheme-set checks fire in `validator.ts`, NOT here —
46
- * this helper is structural-only.
47
- */
48
- declare function reconstructChunkedUri(chunks: ReadonlyArray<string>): ReconstructUriResult;
49
- /**
50
- * Chunk a URI string into `[ tstr .size (1..64) ]`, splitting on UTF-8 byte
51
- * boundaries so no multi-byte codepoint straddles a chunk.
52
- *
53
- * For pure-ASCII URIs (the common `ar://`, `ipfs://` cases) this collapses
54
- * to plain 64-byte byte-slice chunks. For URIs with non-ASCII path components
55
- * (rare but possible — RFC 3986 §2.5 IRIs / percent-encoded UTF-8) the
56
- * algorithm rewinds to the nearest codepoint boundary at each chunk break.
57
- */
58
- declare function chunkUri(uri: string): string[];
59
-
60
- export { type ReconstructUriResult, bytesChunkArrayConcat, chunkBytes, chunkUri, reconstructChunkedUri };
package/dist/index.d.ts CHANGED
@@ -1,60 +1,6 @@
1
- export { Argon2idParams, Argon2idParamsSchema, ChunkedBytesArray, ChunkedBytesArraySchema, EXTENSION_KEY_COMPANION_RE, EXTENSION_KEY_VENDOR_RE, EncryptionEnvelope, EncryptionEnvelopeSchema, HashDigestSchema, HashesMap, HashesMapSchema, ItemEntry, ItemEntrySchema, MerkleCommit, MerkleCommitSchema, PassphraseBlock, PassphraseBlockSchema, PoeRecord, PoeRecordSchema, SigEntry, SigEntrySchema, Slot, SlotSchema, Supersedes, SupersedesSchema, TOP_LEVEL_BASE_KEYS, UriChunkArray, UriChunkArraySchema, VersionLiteralSchema, isExtensionKey } from './schema.js';
1
+ export { Argon2idParams, Argon2idParamsSchema, EXTENSION_KEY_COMPANION_RE, EXTENSION_KEY_VENDOR_RE, EncOpaque, EncOpaqueSchema, EncScheme1, EncScheme1Schema, EncryptionEnvelope, EncryptionEnvelopeSchema, HashDigestSchema, HashesMap, HashesMapSchema, ItemEntry, ItemEntrySchema, MerkleCommit, MerkleCommitSchema, PassphraseBlock, PassphraseBlockSchema, PoeRecord, PoeRecordSchema, SigEntry, SigEntrySchema, Slot, SlotSchema, Supersedes, SupersedesSchema, TOP_LEVEL_BASE_KEYS, Uri, UriSchema, VersionLiteralSchema, isExtensionKey } from './schema.js';
2
2
  export { encodePoeRecord, encodeRecordBodyForSigning } from './encoder.js';
3
- export { ValidateResult, ValidationIssue, validateCidProfile, validatePoeRecord } from './validator.js';
4
- export { ERROR_CODES, ErrorCode, SEVERITY, STRUCTURAL_ERROR_CODES, Severity, StructuralErrorCode, VERIFIER_ERROR_CODES, VerifierErrorCode, severityOf } from './error-codes.js';
3
+ export { Label309ReassemblyResult, TRANSPORT_CHUNK_MAX_BYTES, chunkRecordBody, encodeLabel309Value, reassembleLabel309Value } from './carriage.js';
4
+ export { Argon2ParamsCeiling, DEFAULT_PASSPHRASE_PARAMS_CEILING, ValidationIssue, ValidationResult, ValidatorOptions, ValidatorRole, validateCidProfile, validatePoeRecord } from './validator.js';
5
+ export { CARRIAGE_ERROR_CODES, DUAL_SEVERITY_CODES, ERROR_CODES, ERROR_CODE_PART, ErrorCode, ErrorCodePart, SEVERITY, STRUCTURAL_ERROR_CODES, Severity, StructuralErrorCode, VERIFIER_ERROR_CODES, VerifierErrorCode, errorCodeRegistryIndex, severityOf } from './error-codes.js';
5
6
  import 'zod';
6
-
7
- /**
8
- * Split a logical byte string into ≤ 64-byte CBOR-bytes chunks
9
- * (`bytes-chunk-array`). Always returns a non-empty array.
10
- *
11
- * For empty inputs, returns `[<empty>]` so the caller's schema gate fails
12
- * later via `CHUNK_TOO_LARGE` (zero-length chunks are rejected). Real callers
13
- * feed COSE_Sign1 / cbor<COSE_Key> byte strings, which are never empty.
14
- */
15
- declare function chunkBytes(value: Uint8Array): Uint8Array[];
16
- /**
17
- * Reverse of {@link chunkBytes}: concatenate chunked bytes (`sigs[i].cose_sign1`,
18
- * `sigs[i].cose_key`) into a single buffer for downstream CBOR/COSE decode.
19
- * The validator-layer schema enforces the per-chunk size + non-empty-array
20
- * invariants before this helper runs, so it makes no length checks.
21
- */
22
- declare function bytesChunkArrayConcat(chunks: ReadonlyArray<Uint8Array>): Uint8Array;
23
- type ReconstructUriResult = {
24
- ok: true;
25
- uri: string;
26
- } | {
27
- ok: false;
28
- code: 'INVALID_URI';
29
- reason: string;
30
- };
31
- /**
32
- * Reconstruct a chunked URI (`uri-chunk-array`) into its logical string.
33
- *
34
- * The chunks arrive as JS strings produced by the canonical-CBOR decoder,
35
- * which already rejects any non-UTF-8 `tstr` (surfacing it upstream as
36
- * `MALFORMED_CBOR`) — so by the time this helper runs the only structural
37
- * task left is to byte-concatenate and decode. We re-encode each chunk to its
38
- * UTF-8 bytes, concatenate, and decode the whole with `{ fatal: true }`. A
39
- * conformant producer never splits a multi-byte codepoint across chunks (the
40
- * Cardano 64-byte cap is applied on codepoint boundaries), so this decode
41
- * succeeds for every well-formed record; the `INVALID_URI` branch is the
42
- * residual guard for a byte sequence that does not reconstruct to valid UTF-8.
43
- *
44
- * Per-scheme shape validation (the IPFS CID profile) and absolute-URI /
45
- * fragment-identifier / scheme-set checks fire in `validator.ts`, NOT here —
46
- * this helper is structural-only.
47
- */
48
- declare function reconstructChunkedUri(chunks: ReadonlyArray<string>): ReconstructUriResult;
49
- /**
50
- * Chunk a URI string into `[ tstr .size (1..64) ]`, splitting on UTF-8 byte
51
- * boundaries so no multi-byte codepoint straddles a chunk.
52
- *
53
- * For pure-ASCII URIs (the common `ar://`, `ipfs://` cases) this collapses
54
- * to plain 64-byte byte-slice chunks. For URIs with non-ASCII path components
55
- * (rare but possible — RFC 3986 §2.5 IRIs / percent-encoded UTF-8) the
56
- * algorithm rewinds to the nearest codepoint boundary at each chunk break.
57
- */
58
- declare function chunkUri(uri: string): string[];
59
-
60
- export { type ReconstructUriResult, bytesChunkArrayConcat, chunkBytes, chunkUri, reconstructChunkedUri };