@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/carriage.cjs +1972 -0
- package/dist/carriage.cjs.map +1 -0
- package/dist/carriage.d.cts +55 -0
- package/dist/carriage.d.ts +55 -0
- package/dist/carriage.js +1967 -0
- package/dist/carriage.js.map +1 -0
- package/dist/encoder.cjs +29 -77
- package/dist/encoder.cjs.map +1 -1
- package/dist/encoder.d.cts +10 -0
- package/dist/encoder.d.ts +10 -0
- package/dist/encoder.js +29 -77
- package/dist/encoder.js.map +1 -1
- package/dist/error-codes.cjs +129 -31
- package/dist/error-codes.cjs.map +1 -1
- package/dist/error-codes.d.cts +11 -6
- package/dist/error-codes.d.ts +11 -6
- package/dist/error-codes.js +126 -32
- package/dist/error-codes.js.map +1 -1
- package/dist/index.cjs +1127 -766
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -58
- package/dist/index.d.ts +4 -58
- package/dist/index.js +1116 -761
- package/dist/index.js.map +1 -1
- package/dist/schema.cjs +101 -87
- package/dist/schema.cjs.map +1 -1
- package/dist/schema.d.cts +69 -47
- package/dist/schema.d.ts +69 -47
- package/dist/schema.js +99 -86
- package/dist/schema.js.map +1 -1
- package/dist/validator.cjs +973 -512
- package/dist/validator.cjs.map +1 -1
- package/dist/validator.d.cts +48 -7
- package/dist/validator.d.ts +48 -7
- package/dist/validator.js +973 -513
- package/dist/validator.js.map +1 -1
- package/package.json +8 -2
package/dist/validator.d.cts
CHANGED
|
@@ -2,22 +2,63 @@ import { ErrorCode, Severity } from './error-codes.cjs';
|
|
|
2
2
|
import { PoeRecord } from './schema.cjs';
|
|
3
3
|
import 'zod';
|
|
4
4
|
|
|
5
|
+
type ValidatorRole = 'public' | 'recipient_or_strict';
|
|
6
|
+
interface Argon2ParamsCeiling {
|
|
7
|
+
readonly m: number;
|
|
8
|
+
readonly t: number;
|
|
9
|
+
readonly p: number;
|
|
10
|
+
}
|
|
11
|
+
declare const DEFAULT_PASSPHRASE_PARAMS_CEILING: Argon2ParamsCeiling;
|
|
12
|
+
interface ValidatorOptions {
|
|
13
|
+
/**
|
|
14
|
+
* Names of the critical extensions this validator implements. Default: the
|
|
15
|
+
* empty set — a default-configured validator therefore fails every
|
|
16
|
+
* `crit`-bearing record with `EXTENSION_UNSUPPORTED_CRITICAL`, by design.
|
|
17
|
+
*/
|
|
18
|
+
readonly supportedCriticalExtensions?: ReadonlySet<string>;
|
|
19
|
+
/**
|
|
20
|
+
* The validation reading for dual-severity envelope dispositions.
|
|
21
|
+
* `public` (default): an envelope under an unsupported `scheme` / `kem` /
|
|
22
|
+
* `aead` degrades to opaque and `ENC_UNSUPPORTED` is informational.
|
|
23
|
+
* `recipient_or_strict` (the recipient verifier and strict sealed-crypto
|
|
24
|
+
* mode): the same condition is a hard reject — `ENC_UNSUPPORTED` escalates
|
|
25
|
+
* to `error` and co-fires with the identifier-specific `UNSUPPORTED_*`
|
|
26
|
+
* code.
|
|
27
|
+
*/
|
|
28
|
+
readonly role?: ValidatorRole;
|
|
29
|
+
/** Slot-count resource bound (reference bound 1024; deployments MAY tighten). */
|
|
30
|
+
readonly maxSlots?: number;
|
|
31
|
+
/** Decoded-envelope byte resource bound (reference bound 65536). */
|
|
32
|
+
readonly maxEncEnvelopeBytes?: number;
|
|
33
|
+
/**
|
|
34
|
+
* Upper policy ceiling on Argon2id parameters
|
|
35
|
+
* (`ENC_PASSPHRASE_PARAMS_EXCEED_POLICY`). Defaults to
|
|
36
|
+
* `DEFAULT_PASSPHRASE_PARAMS_CEILING`; `null` disables the ceiling.
|
|
37
|
+
*/
|
|
38
|
+
readonly passphraseParamsCeiling?: Argon2ParamsCeiling | null;
|
|
39
|
+
}
|
|
5
40
|
interface ValidationIssue {
|
|
6
|
-
|
|
41
|
+
/**
|
|
42
|
+
* Segments from the record root: text map keys and integer array indices
|
|
43
|
+
* (e.g. `["items", 0, "hashes", "sha2-256"]`). A dotted string is a display
|
|
44
|
+
* rendering only — the segment list is the API form, so map keys containing
|
|
45
|
+
* `.` need no escaping.
|
|
46
|
+
*/
|
|
7
47
|
readonly path: ReadonlyArray<string | number>;
|
|
8
|
-
readonly
|
|
48
|
+
readonly code: ErrorCode;
|
|
9
49
|
readonly severity: Severity;
|
|
50
|
+
readonly message: string;
|
|
10
51
|
}
|
|
11
|
-
type
|
|
12
|
-
readonly
|
|
52
|
+
type ValidationResult = {
|
|
53
|
+
readonly valid: true;
|
|
13
54
|
readonly record: PoeRecord;
|
|
14
55
|
readonly warnings?: ReadonlyArray<ValidationIssue>;
|
|
15
56
|
readonly info?: ReadonlyArray<ValidationIssue>;
|
|
16
57
|
} | {
|
|
17
|
-
readonly
|
|
58
|
+
readonly valid: false;
|
|
18
59
|
readonly issues: ReadonlyArray<ValidationIssue>;
|
|
19
60
|
};
|
|
20
|
-
declare function validatePoeRecord(bytes: Uint8Array):
|
|
61
|
+
declare function validatePoeRecord(bytes: Uint8Array, options?: ValidatorOptions): ValidationResult;
|
|
21
62
|
declare function validateCidProfile(cid: string): boolean;
|
|
22
63
|
|
|
23
|
-
export { type
|
|
64
|
+
export { type Argon2ParamsCeiling, DEFAULT_PASSPHRASE_PARAMS_CEILING, type ValidationIssue, type ValidationResult, type ValidatorOptions, type ValidatorRole, validateCidProfile, validatePoeRecord };
|
package/dist/validator.d.ts
CHANGED
|
@@ -2,22 +2,63 @@ import { ErrorCode, Severity } from './error-codes.js';
|
|
|
2
2
|
import { PoeRecord } from './schema.js';
|
|
3
3
|
import 'zod';
|
|
4
4
|
|
|
5
|
+
type ValidatorRole = 'public' | 'recipient_or_strict';
|
|
6
|
+
interface Argon2ParamsCeiling {
|
|
7
|
+
readonly m: number;
|
|
8
|
+
readonly t: number;
|
|
9
|
+
readonly p: number;
|
|
10
|
+
}
|
|
11
|
+
declare const DEFAULT_PASSPHRASE_PARAMS_CEILING: Argon2ParamsCeiling;
|
|
12
|
+
interface ValidatorOptions {
|
|
13
|
+
/**
|
|
14
|
+
* Names of the critical extensions this validator implements. Default: the
|
|
15
|
+
* empty set — a default-configured validator therefore fails every
|
|
16
|
+
* `crit`-bearing record with `EXTENSION_UNSUPPORTED_CRITICAL`, by design.
|
|
17
|
+
*/
|
|
18
|
+
readonly supportedCriticalExtensions?: ReadonlySet<string>;
|
|
19
|
+
/**
|
|
20
|
+
* The validation reading for dual-severity envelope dispositions.
|
|
21
|
+
* `public` (default): an envelope under an unsupported `scheme` / `kem` /
|
|
22
|
+
* `aead` degrades to opaque and `ENC_UNSUPPORTED` is informational.
|
|
23
|
+
* `recipient_or_strict` (the recipient verifier and strict sealed-crypto
|
|
24
|
+
* mode): the same condition is a hard reject — `ENC_UNSUPPORTED` escalates
|
|
25
|
+
* to `error` and co-fires with the identifier-specific `UNSUPPORTED_*`
|
|
26
|
+
* code.
|
|
27
|
+
*/
|
|
28
|
+
readonly role?: ValidatorRole;
|
|
29
|
+
/** Slot-count resource bound (reference bound 1024; deployments MAY tighten). */
|
|
30
|
+
readonly maxSlots?: number;
|
|
31
|
+
/** Decoded-envelope byte resource bound (reference bound 65536). */
|
|
32
|
+
readonly maxEncEnvelopeBytes?: number;
|
|
33
|
+
/**
|
|
34
|
+
* Upper policy ceiling on Argon2id parameters
|
|
35
|
+
* (`ENC_PASSPHRASE_PARAMS_EXCEED_POLICY`). Defaults to
|
|
36
|
+
* `DEFAULT_PASSPHRASE_PARAMS_CEILING`; `null` disables the ceiling.
|
|
37
|
+
*/
|
|
38
|
+
readonly passphraseParamsCeiling?: Argon2ParamsCeiling | null;
|
|
39
|
+
}
|
|
5
40
|
interface ValidationIssue {
|
|
6
|
-
|
|
41
|
+
/**
|
|
42
|
+
* Segments from the record root: text map keys and integer array indices
|
|
43
|
+
* (e.g. `["items", 0, "hashes", "sha2-256"]`). A dotted string is a display
|
|
44
|
+
* rendering only — the segment list is the API form, so map keys containing
|
|
45
|
+
* `.` need no escaping.
|
|
46
|
+
*/
|
|
7
47
|
readonly path: ReadonlyArray<string | number>;
|
|
8
|
-
readonly
|
|
48
|
+
readonly code: ErrorCode;
|
|
9
49
|
readonly severity: Severity;
|
|
50
|
+
readonly message: string;
|
|
10
51
|
}
|
|
11
|
-
type
|
|
12
|
-
readonly
|
|
52
|
+
type ValidationResult = {
|
|
53
|
+
readonly valid: true;
|
|
13
54
|
readonly record: PoeRecord;
|
|
14
55
|
readonly warnings?: ReadonlyArray<ValidationIssue>;
|
|
15
56
|
readonly info?: ReadonlyArray<ValidationIssue>;
|
|
16
57
|
} | {
|
|
17
|
-
readonly
|
|
58
|
+
readonly valid: false;
|
|
18
59
|
readonly issues: ReadonlyArray<ValidationIssue>;
|
|
19
60
|
};
|
|
20
|
-
declare function validatePoeRecord(bytes: Uint8Array):
|
|
61
|
+
declare function validatePoeRecord(bytes: Uint8Array, options?: ValidatorOptions): ValidationResult;
|
|
21
62
|
declare function validateCidProfile(cid: string): boolean;
|
|
22
63
|
|
|
23
|
-
export { type
|
|
64
|
+
export { type Argon2ParamsCeiling, DEFAULT_PASSPHRASE_PARAMS_CEILING, type ValidationIssue, type ValidationResult, type ValidatorOptions, type ValidatorRole, validateCidProfile, validatePoeRecord };
|