@bcts/provenance-mark 1.0.0-alpha.17 → 1.0.0-alpha.18
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 +1 -1
- package/dist/index.cjs +385 -347
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +120 -104
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +120 -104
- package/dist/index.d.mts.map +1 -1
- package/dist/index.iife.js +385 -347
- package/dist/index.iife.js.map +1 -1
- package/dist/index.mjs +381 -349
- package/dist/index.mjs.map +1 -1
- package/package.json +8 -8
- package/src/envelope.ts +39 -153
- package/src/index.ts +3 -1
- package/src/mark-info.ts +1 -1
- package/src/mark.ts +107 -40
- package/src/validate.ts +39 -54
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Cbor } from "@bcts/dcbor";
|
|
2
2
|
import { BytewordsStyle, UR } from "@bcts/uniform-resources";
|
|
3
|
-
import { Envelope } from "@bcts/envelope";
|
|
3
|
+
import { Envelope, FormatContext, FormatContext as FormatContext$1 } from "@bcts/envelope";
|
|
4
4
|
|
|
5
5
|
//#region src/error.d.ts
|
|
6
6
|
/**
|
|
@@ -388,6 +388,92 @@ declare class ProvenanceSeed {
|
|
|
388
388
|
static fromCbor(cborValue: Cbor): ProvenanceSeed;
|
|
389
389
|
}
|
|
390
390
|
//#endregion
|
|
391
|
+
//#region src/validate.d.ts
|
|
392
|
+
/**
|
|
393
|
+
* Format for validation report output.
|
|
394
|
+
*/
|
|
395
|
+
declare enum ValidationReportFormat {
|
|
396
|
+
/** Human-readable text format */
|
|
397
|
+
Text = "text",
|
|
398
|
+
/** Compact JSON format (no whitespace) */
|
|
399
|
+
JsonCompact = "json-compact",
|
|
400
|
+
/** Pretty-printed JSON format (with indentation) */
|
|
401
|
+
JsonPretty = "json-pretty"
|
|
402
|
+
}
|
|
403
|
+
/**
|
|
404
|
+
* Issue flagged during validation.
|
|
405
|
+
*/
|
|
406
|
+
type ValidationIssue = {
|
|
407
|
+
type: "HashMismatch";
|
|
408
|
+
expected: string;
|
|
409
|
+
actual: string;
|
|
410
|
+
} | {
|
|
411
|
+
type: "KeyMismatch";
|
|
412
|
+
} | {
|
|
413
|
+
type: "SequenceGap";
|
|
414
|
+
expected: number;
|
|
415
|
+
actual: number;
|
|
416
|
+
} | {
|
|
417
|
+
type: "DateOrdering";
|
|
418
|
+
previous: string;
|
|
419
|
+
next: string;
|
|
420
|
+
} | {
|
|
421
|
+
type: "NonGenesisAtZero";
|
|
422
|
+
} | {
|
|
423
|
+
type: "InvalidGenesisKey";
|
|
424
|
+
};
|
|
425
|
+
/**
|
|
426
|
+
* Format a validation issue as a string.
|
|
427
|
+
*/
|
|
428
|
+
declare function formatValidationIssue(issue: ValidationIssue): string;
|
|
429
|
+
/**
|
|
430
|
+
* A mark with any issues flagged during validation.
|
|
431
|
+
*/
|
|
432
|
+
interface FlaggedMark {
|
|
433
|
+
mark: ProvenanceMark;
|
|
434
|
+
issues: ValidationIssue[];
|
|
435
|
+
}
|
|
436
|
+
/**
|
|
437
|
+
* Report for a contiguous sequence of marks within a chain.
|
|
438
|
+
*/
|
|
439
|
+
interface SequenceReport {
|
|
440
|
+
startSeq: number;
|
|
441
|
+
endSeq: number;
|
|
442
|
+
marks: FlaggedMark[];
|
|
443
|
+
}
|
|
444
|
+
/**
|
|
445
|
+
* Report for a chain of marks with the same chain ID.
|
|
446
|
+
*/
|
|
447
|
+
interface ChainReport {
|
|
448
|
+
chainId: Uint8Array;
|
|
449
|
+
hasGenesis: boolean;
|
|
450
|
+
marks: ProvenanceMark[];
|
|
451
|
+
sequences: SequenceReport[];
|
|
452
|
+
}
|
|
453
|
+
/**
|
|
454
|
+
* Get the chain ID as a hex string for display.
|
|
455
|
+
*/
|
|
456
|
+
declare function chainIdHex(report: ChainReport): string;
|
|
457
|
+
/**
|
|
458
|
+
* Complete validation report.
|
|
459
|
+
*/
|
|
460
|
+
interface ValidationReport {
|
|
461
|
+
marks: ProvenanceMark[];
|
|
462
|
+
chains: ChainReport[];
|
|
463
|
+
}
|
|
464
|
+
/**
|
|
465
|
+
* Check if the validation report has any issues.
|
|
466
|
+
*/
|
|
467
|
+
declare function hasIssues(report: ValidationReport): boolean;
|
|
468
|
+
/**
|
|
469
|
+
* Format the validation report.
|
|
470
|
+
*/
|
|
471
|
+
declare function formatReport(report: ValidationReport, format: ValidationReportFormat): string;
|
|
472
|
+
/**
|
|
473
|
+
* Validate a collection of provenance marks.
|
|
474
|
+
*/
|
|
475
|
+
declare function validate(marks: ProvenanceMark[]): ValidationReport;
|
|
476
|
+
//#endregion
|
|
391
477
|
//#region src/mark.d.ts
|
|
392
478
|
/**
|
|
393
479
|
* A cryptographically-secured provenance mark.
|
|
@@ -436,6 +522,15 @@ declare class ProvenanceMark {
|
|
|
436
522
|
* Get the first four bytes of the hash as upper-case ByteWords.
|
|
437
523
|
*/
|
|
438
524
|
bytewordsIdentifier(prefix: boolean): string;
|
|
525
|
+
/**
|
|
526
|
+
* A compact 8-letter identifier derived from the upper-case ByteWords
|
|
527
|
+
* identifier by taking the first and last letter of each ByteWords word
|
|
528
|
+
* (4 words x 2 letters = 8 letters).
|
|
529
|
+
*
|
|
530
|
+
* Example: "ABLE ACID ALSO APEX" -> "AEADAOAX"
|
|
531
|
+
* If prefix is true, prepends the provenance mark prefix character.
|
|
532
|
+
*/
|
|
533
|
+
bytewordsMinimalIdentifier(prefix: boolean): string;
|
|
439
534
|
/**
|
|
440
535
|
* Get the first four bytes of the hash as Bytemoji.
|
|
441
536
|
*/
|
|
@@ -446,6 +541,8 @@ declare class ProvenanceMark {
|
|
|
446
541
|
precedes(next: ProvenanceMark): boolean;
|
|
447
542
|
/**
|
|
448
543
|
* Check if this mark precedes another mark, throwing on validation errors.
|
|
544
|
+
* Errors carry a structured `validationIssue` in their details, matching Rust's
|
|
545
|
+
* `Error::Validation(ValidationIssue)` pattern.
|
|
449
546
|
*/
|
|
450
547
|
precedesOpt(next: ProvenanceMark): void;
|
|
451
548
|
/**
|
|
@@ -542,16 +639,24 @@ declare class ProvenanceMark {
|
|
|
542
639
|
*/
|
|
543
640
|
static fromJSON(json: Record<string, unknown>): ProvenanceMark;
|
|
544
641
|
/**
|
|
545
|
-
*
|
|
642
|
+
* Validate a collection of provenance marks.
|
|
546
643
|
*
|
|
547
|
-
*
|
|
644
|
+
* Matches Rust: `ProvenanceMark::validate()` which delegates to
|
|
645
|
+
* `ValidationReport::validate()`.
|
|
646
|
+
*/
|
|
647
|
+
static validate(marks: ProvenanceMark[]): ValidationReport;
|
|
648
|
+
/**
|
|
649
|
+
* Convert this provenance mark to a Gordian Envelope.
|
|
548
650
|
*
|
|
549
|
-
*
|
|
651
|
+
* Creates a leaf envelope containing the tagged CBOR representation.
|
|
652
|
+
* Matches Rust: `Envelope::new(mark.to_cbor())` which creates a CBOR leaf.
|
|
550
653
|
*/
|
|
551
654
|
intoEnvelope(): Envelope;
|
|
552
655
|
/**
|
|
553
656
|
* Extract a ProvenanceMark from a Gordian Envelope.
|
|
554
657
|
*
|
|
658
|
+
* Matches Rust: `envelope.subject().try_leaf()?.try_into()`
|
|
659
|
+
*
|
|
555
660
|
* @param envelope - The envelope to extract from
|
|
556
661
|
* @returns The extracted provenance mark
|
|
557
662
|
* @throws ProvenanceMarkError if extraction fails
|
|
@@ -634,92 +739,6 @@ declare class ProvenanceMarkGenerator {
|
|
|
634
739
|
static fromEnvelope(envelope: Envelope): ProvenanceMarkGenerator;
|
|
635
740
|
}
|
|
636
741
|
//#endregion
|
|
637
|
-
//#region src/validate.d.ts
|
|
638
|
-
/**
|
|
639
|
-
* Format for validation report output.
|
|
640
|
-
*/
|
|
641
|
-
declare enum ValidationReportFormat {
|
|
642
|
-
/** Human-readable text format */
|
|
643
|
-
Text = "text",
|
|
644
|
-
/** Compact JSON format (no whitespace) */
|
|
645
|
-
JsonCompact = "json-compact",
|
|
646
|
-
/** Pretty-printed JSON format (with indentation) */
|
|
647
|
-
JsonPretty = "json-pretty"
|
|
648
|
-
}
|
|
649
|
-
/**
|
|
650
|
-
* Issue flagged during validation.
|
|
651
|
-
*/
|
|
652
|
-
type ValidationIssue = {
|
|
653
|
-
type: "HashMismatch";
|
|
654
|
-
expected: string;
|
|
655
|
-
actual: string;
|
|
656
|
-
} | {
|
|
657
|
-
type: "KeyMismatch";
|
|
658
|
-
} | {
|
|
659
|
-
type: "SequenceGap";
|
|
660
|
-
expected: number;
|
|
661
|
-
actual: number;
|
|
662
|
-
} | {
|
|
663
|
-
type: "DateOrdering";
|
|
664
|
-
previous: string;
|
|
665
|
-
next: string;
|
|
666
|
-
} | {
|
|
667
|
-
type: "NonGenesisAtZero";
|
|
668
|
-
} | {
|
|
669
|
-
type: "InvalidGenesisKey";
|
|
670
|
-
};
|
|
671
|
-
/**
|
|
672
|
-
* Format a validation issue as a string.
|
|
673
|
-
*/
|
|
674
|
-
declare function formatValidationIssue(issue: ValidationIssue): string;
|
|
675
|
-
/**
|
|
676
|
-
* A mark with any issues flagged during validation.
|
|
677
|
-
*/
|
|
678
|
-
interface FlaggedMark {
|
|
679
|
-
mark: ProvenanceMark;
|
|
680
|
-
issues: ValidationIssue[];
|
|
681
|
-
}
|
|
682
|
-
/**
|
|
683
|
-
* Report for a contiguous sequence of marks within a chain.
|
|
684
|
-
*/
|
|
685
|
-
interface SequenceReport {
|
|
686
|
-
startSeq: number;
|
|
687
|
-
endSeq: number;
|
|
688
|
-
marks: FlaggedMark[];
|
|
689
|
-
}
|
|
690
|
-
/**
|
|
691
|
-
* Report for a chain of marks with the same chain ID.
|
|
692
|
-
*/
|
|
693
|
-
interface ChainReport {
|
|
694
|
-
chainId: Uint8Array;
|
|
695
|
-
hasGenesis: boolean;
|
|
696
|
-
marks: ProvenanceMark[];
|
|
697
|
-
sequences: SequenceReport[];
|
|
698
|
-
}
|
|
699
|
-
/**
|
|
700
|
-
* Get the chain ID as a hex string for display.
|
|
701
|
-
*/
|
|
702
|
-
declare function chainIdHex(report: ChainReport): string;
|
|
703
|
-
/**
|
|
704
|
-
* Complete validation report.
|
|
705
|
-
*/
|
|
706
|
-
interface ValidationReport {
|
|
707
|
-
marks: ProvenanceMark[];
|
|
708
|
-
chains: ChainReport[];
|
|
709
|
-
}
|
|
710
|
-
/**
|
|
711
|
-
* Check if the validation report has any issues.
|
|
712
|
-
*/
|
|
713
|
-
declare function hasIssues(report: ValidationReport): boolean;
|
|
714
|
-
/**
|
|
715
|
-
* Format the validation report.
|
|
716
|
-
*/
|
|
717
|
-
declare function formatReport(report: ValidationReport, format: ValidationReportFormat): string;
|
|
718
|
-
/**
|
|
719
|
-
* Validate a collection of provenance marks.
|
|
720
|
-
*/
|
|
721
|
-
declare function validate(marks: ProvenanceMark[]): ValidationReport;
|
|
722
|
-
//#endregion
|
|
723
742
|
//#region src/mark-info.d.ts
|
|
724
743
|
/**
|
|
725
744
|
* Wrapper for a provenance mark with additional display information.
|
|
@@ -758,23 +777,21 @@ declare class ProvenanceMarkInfo {
|
|
|
758
777
|
/**
|
|
759
778
|
* Registers provenance mark tags in the global format context.
|
|
760
779
|
*
|
|
761
|
-
*
|
|
762
|
-
* provenance marks in a human-readable format.
|
|
780
|
+
* Matches Rust: register_tags()
|
|
763
781
|
*/
|
|
764
782
|
declare function registerTags(): void;
|
|
765
783
|
/**
|
|
766
784
|
* Registers provenance mark tags in a specific format context.
|
|
767
785
|
*
|
|
786
|
+
* Matches Rust: register_tags_in()
|
|
787
|
+
*
|
|
768
788
|
* @param context - The format context to register tags in
|
|
769
789
|
*/
|
|
770
|
-
declare function registerTagsIn(context:
|
|
771
|
-
interface TagsContext {
|
|
772
|
-
setSummarizer(tag: number, summarizer: (cbor: Cbor) => string): void;
|
|
773
|
-
}
|
|
790
|
+
declare function registerTagsIn(context: FormatContext$1): void;
|
|
774
791
|
/**
|
|
775
792
|
* Convert a ProvenanceMark to an Envelope.
|
|
776
793
|
*
|
|
777
|
-
*
|
|
794
|
+
* Delegates to ProvenanceMark.intoEnvelope() — single source of truth.
|
|
778
795
|
*
|
|
779
796
|
* @param mark - The provenance mark to convert
|
|
780
797
|
* @returns An envelope containing the mark
|
|
@@ -783,6 +800,8 @@ declare function provenanceMarkToEnvelope(mark: ProvenanceMark): Envelope;
|
|
|
783
800
|
/**
|
|
784
801
|
* Extract a ProvenanceMark from an Envelope.
|
|
785
802
|
*
|
|
803
|
+
* Delegates to ProvenanceMark.fromEnvelope() — single source of truth.
|
|
804
|
+
*
|
|
786
805
|
* @param envelope - The envelope to extract from
|
|
787
806
|
* @returns The extracted provenance mark
|
|
788
807
|
* @throws ProvenanceMarkError if extraction fails
|
|
@@ -791,12 +810,7 @@ declare function provenanceMarkFromEnvelope(envelope: Envelope): ProvenanceMark;
|
|
|
791
810
|
/**
|
|
792
811
|
* Convert a ProvenanceMarkGenerator to an Envelope.
|
|
793
812
|
*
|
|
794
|
-
*
|
|
795
|
-
* - type: "provenance-generator"
|
|
796
|
-
* - res: The resolution
|
|
797
|
-
* - seed: The seed
|
|
798
|
-
* - next-seq: The next sequence number
|
|
799
|
-
* - rng-state: The RNG state
|
|
813
|
+
* Delegates to ProvenanceMarkGenerator.intoEnvelope() — single source of truth.
|
|
800
814
|
*
|
|
801
815
|
* @param generator - The generator to convert
|
|
802
816
|
* @returns An envelope containing the generator
|
|
@@ -805,11 +819,13 @@ declare function provenanceMarkGeneratorToEnvelope(generator: ProvenanceMarkGene
|
|
|
805
819
|
/**
|
|
806
820
|
* Extract a ProvenanceMarkGenerator from an Envelope.
|
|
807
821
|
*
|
|
822
|
+
* Delegates to ProvenanceMarkGenerator.fromEnvelope() — single source of truth.
|
|
823
|
+
*
|
|
808
824
|
* @param envelope - The envelope to extract from
|
|
809
825
|
* @returns The extracted generator
|
|
810
826
|
* @throws ProvenanceMarkError if extraction fails
|
|
811
827
|
*/
|
|
812
828
|
declare function provenanceMarkGeneratorFromEnvelope(envelope: Envelope): ProvenanceMarkGenerator;
|
|
813
829
|
//#endregion
|
|
814
|
-
export { type ChainReport, type FlaggedMark, PROVENANCE_SEED_LENGTH, ProvenanceMark, ProvenanceMarkError, ProvenanceMarkErrorType, ProvenanceMarkGenerator, ProvenanceMarkInfo, ProvenanceMarkResolution, type ProvenanceMarkResult, ProvenanceSeed, RNG_STATE_LENGTH, RngState, SHA256_SIZE, type SequenceReport, type SerializableDate, type
|
|
830
|
+
export { type ChainReport, type FlaggedMark, FormatContext, PROVENANCE_SEED_LENGTH, ProvenanceMark, ProvenanceMarkError, ProvenanceMarkErrorType, ProvenanceMarkGenerator, ProvenanceMarkInfo, ProvenanceMarkResolution, type ProvenanceMarkResult, ProvenanceSeed, RNG_STATE_LENGTH, RngState, SHA256_SIZE, type SequenceReport, type SerializableDate, type ValidationIssue, type ValidationReport, ValidationReportFormat, Xoshiro256StarStar, chainIdHex, chainIdRange, dateBytesLength, dateBytesRange, dateFromIso8601, dateToDateString, dateToIso8601, deserialize2Bytes, deserialize4Bytes, deserialize6Bytes, deserializeDate, deserializeSeq, extendKey, fixedLength, formatReport, formatValidationIssue, hasIssues, hashRange, hkdfHmacSha256, infoRangeStart, keyRange, linkLength, obfuscate, provenanceMarkFromEnvelope, provenanceMarkGeneratorFromEnvelope, provenanceMarkGeneratorToEnvelope, provenanceMarkToEnvelope, rangeOfDaysInMonth, registerTags, registerTagsIn, resolutionFromCbor, resolutionFromNumber, resolutionToCbor, resolutionToNumber, resolutionToString, seqBytesLength, seqBytesRange, serialize2Bytes, serialize4Bytes, serialize6Bytes, serializeDate, serializeSeq, sha256, sha256Prefix, validate };
|
|
815
831
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/error.ts","../src/resolution.ts","../src/date.ts","../src/crypto-utils.ts","../src/xoshiro256starstar.ts","../src/rng-state.ts","../src/seed.ts","../src/
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/error.ts","../src/resolution.ts","../src/date.ts","../src/crypto-utils.ts","../src/xoshiro256starstar.ts","../src/rng-state.ts","../src/seed.ts","../src/validate.ts","../src/mark.ts","../src/generator.ts","../src/mark-info.ts","../src/envelope.ts"],"mappings":";;;;;;;;aAKY,uBAAA;;EAEV,iBAAA;EAFiC;EAIjC,YAAA;EAJiC;EAMjC,UAAA;EAFA;EAIA,UAAA;EAAA;EAEA,SAAA;EAEA;EAAA,gBAAA;EAIA;EAFA,oBAAA;EAMA;EAJA,oBAAA;EAQA;EANA,oBAAA;EAUA;EARA,eAAA;EAYA;EAVA,cAAA;EAcA;EAZA,WAAA;EAgBA;EAdA,mBAAA;EAkBA;EAhBA,cAAA;EAkBe;EAhBf,iBAAA;EAsBW;EApBX,eAAA;;EAEA,cAAA;EAoBmB;EAlBnB,SAAA;EAoBuE;EAlBvE,QAAA;EAc4C;EAZ5C,WAAA;EAYuC;EAVvC,SAAA;EAWe;EATf,sBAAA;EAUmB;EARnB,eAAA;AAAA;;;;cAMW,mBAAA,SAA4B,KAAA;EAAA,SAC9B,IAAA,EAAM,uBAAA;EAAA,SACN,OAAA,GAAU,MAAA;cAEP,IAAA,EAAM,uBAAA,EAAyB,OAAA,WAAkB,OAAA,GAAU,MAAA;EAAA,eAWxD,cAAA;AAAA;;;;KAoEL,oBAAA,MAA0B,CAAA;;;;;;;aCnG1B,wBAAA;EACV,GAAA;EACA,MAAA;EACA,QAAA;EACA,IAAA;AAAA;;;;iBAMc,kBAAA,CAAmB,GAAA,EAAK,wBAAA;;;;iBAOxB,oBAAA,CAAqB,KAAA,WAAgB,wBAAA;;;;iBAoBrC,UAAA,CAAW,GAAA,EAAK,wBAAA;;;;iBAgBhB,cAAA,CAAe,GAAA,EAAK,wBAAA;;;;iBAcpB,eAAA,CAAgB,GAAA,EAAK,wBAAA;;;;iBAerB,WAAA,CAAY,GAAA,EAAK,wBAAA;;;;iBAOjB,QAAA,CAAS,GAAA,EAAK,wBAAA;EAA6B,KAAA;EAAe,GAAA;AAAA;;;;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QAAA,GAAW,uBAAA"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Cbor } from "@bcts/dcbor";
|
|
2
2
|
import { BytewordsStyle, UR } from "@bcts/uniform-resources";
|
|
3
|
-
import { Envelope } from "@bcts/envelope";
|
|
3
|
+
import { Envelope, FormatContext, FormatContext as FormatContext$1 } from "@bcts/envelope";
|
|
4
4
|
|
|
5
5
|
//#region src/error.d.ts
|
|
6
6
|
/**
|
|
@@ -388,6 +388,92 @@ declare class ProvenanceSeed {
|
|
|
388
388
|
static fromCbor(cborValue: Cbor): ProvenanceSeed;
|
|
389
389
|
}
|
|
390
390
|
//#endregion
|
|
391
|
+
//#region src/validate.d.ts
|
|
392
|
+
/**
|
|
393
|
+
* Format for validation report output.
|
|
394
|
+
*/
|
|
395
|
+
declare enum ValidationReportFormat {
|
|
396
|
+
/** Human-readable text format */
|
|
397
|
+
Text = "text",
|
|
398
|
+
/** Compact JSON format (no whitespace) */
|
|
399
|
+
JsonCompact = "json-compact",
|
|
400
|
+
/** Pretty-printed JSON format (with indentation) */
|
|
401
|
+
JsonPretty = "json-pretty"
|
|
402
|
+
}
|
|
403
|
+
/**
|
|
404
|
+
* Issue flagged during validation.
|
|
405
|
+
*/
|
|
406
|
+
type ValidationIssue = {
|
|
407
|
+
type: "HashMismatch";
|
|
408
|
+
expected: string;
|
|
409
|
+
actual: string;
|
|
410
|
+
} | {
|
|
411
|
+
type: "KeyMismatch";
|
|
412
|
+
} | {
|
|
413
|
+
type: "SequenceGap";
|
|
414
|
+
expected: number;
|
|
415
|
+
actual: number;
|
|
416
|
+
} | {
|
|
417
|
+
type: "DateOrdering";
|
|
418
|
+
previous: string;
|
|
419
|
+
next: string;
|
|
420
|
+
} | {
|
|
421
|
+
type: "NonGenesisAtZero";
|
|
422
|
+
} | {
|
|
423
|
+
type: "InvalidGenesisKey";
|
|
424
|
+
};
|
|
425
|
+
/**
|
|
426
|
+
* Format a validation issue as a string.
|
|
427
|
+
*/
|
|
428
|
+
declare function formatValidationIssue(issue: ValidationIssue): string;
|
|
429
|
+
/**
|
|
430
|
+
* A mark with any issues flagged during validation.
|
|
431
|
+
*/
|
|
432
|
+
interface FlaggedMark {
|
|
433
|
+
mark: ProvenanceMark;
|
|
434
|
+
issues: ValidationIssue[];
|
|
435
|
+
}
|
|
436
|
+
/**
|
|
437
|
+
* Report for a contiguous sequence of marks within a chain.
|
|
438
|
+
*/
|
|
439
|
+
interface SequenceReport {
|
|
440
|
+
startSeq: number;
|
|
441
|
+
endSeq: number;
|
|
442
|
+
marks: FlaggedMark[];
|
|
443
|
+
}
|
|
444
|
+
/**
|
|
445
|
+
* Report for a chain of marks with the same chain ID.
|
|
446
|
+
*/
|
|
447
|
+
interface ChainReport {
|
|
448
|
+
chainId: Uint8Array;
|
|
449
|
+
hasGenesis: boolean;
|
|
450
|
+
marks: ProvenanceMark[];
|
|
451
|
+
sequences: SequenceReport[];
|
|
452
|
+
}
|
|
453
|
+
/**
|
|
454
|
+
* Get the chain ID as a hex string for display.
|
|
455
|
+
*/
|
|
456
|
+
declare function chainIdHex(report: ChainReport): string;
|
|
457
|
+
/**
|
|
458
|
+
* Complete validation report.
|
|
459
|
+
*/
|
|
460
|
+
interface ValidationReport {
|
|
461
|
+
marks: ProvenanceMark[];
|
|
462
|
+
chains: ChainReport[];
|
|
463
|
+
}
|
|
464
|
+
/**
|
|
465
|
+
* Check if the validation report has any issues.
|
|
466
|
+
*/
|
|
467
|
+
declare function hasIssues(report: ValidationReport): boolean;
|
|
468
|
+
/**
|
|
469
|
+
* Format the validation report.
|
|
470
|
+
*/
|
|
471
|
+
declare function formatReport(report: ValidationReport, format: ValidationReportFormat): string;
|
|
472
|
+
/**
|
|
473
|
+
* Validate a collection of provenance marks.
|
|
474
|
+
*/
|
|
475
|
+
declare function validate(marks: ProvenanceMark[]): ValidationReport;
|
|
476
|
+
//#endregion
|
|
391
477
|
//#region src/mark.d.ts
|
|
392
478
|
/**
|
|
393
479
|
* A cryptographically-secured provenance mark.
|
|
@@ -436,6 +522,15 @@ declare class ProvenanceMark {
|
|
|
436
522
|
* Get the first four bytes of the hash as upper-case ByteWords.
|
|
437
523
|
*/
|
|
438
524
|
bytewordsIdentifier(prefix: boolean): string;
|
|
525
|
+
/**
|
|
526
|
+
* A compact 8-letter identifier derived from the upper-case ByteWords
|
|
527
|
+
* identifier by taking the first and last letter of each ByteWords word
|
|
528
|
+
* (4 words x 2 letters = 8 letters).
|
|
529
|
+
*
|
|
530
|
+
* Example: "ABLE ACID ALSO APEX" -> "AEADAOAX"
|
|
531
|
+
* If prefix is true, prepends the provenance mark prefix character.
|
|
532
|
+
*/
|
|
533
|
+
bytewordsMinimalIdentifier(prefix: boolean): string;
|
|
439
534
|
/**
|
|
440
535
|
* Get the first four bytes of the hash as Bytemoji.
|
|
441
536
|
*/
|
|
@@ -446,6 +541,8 @@ declare class ProvenanceMark {
|
|
|
446
541
|
precedes(next: ProvenanceMark): boolean;
|
|
447
542
|
/**
|
|
448
543
|
* Check if this mark precedes another mark, throwing on validation errors.
|
|
544
|
+
* Errors carry a structured `validationIssue` in their details, matching Rust's
|
|
545
|
+
* `Error::Validation(ValidationIssue)` pattern.
|
|
449
546
|
*/
|
|
450
547
|
precedesOpt(next: ProvenanceMark): void;
|
|
451
548
|
/**
|
|
@@ -542,16 +639,24 @@ declare class ProvenanceMark {
|
|
|
542
639
|
*/
|
|
543
640
|
static fromJSON(json: Record<string, unknown>): ProvenanceMark;
|
|
544
641
|
/**
|
|
545
|
-
*
|
|
642
|
+
* Validate a collection of provenance marks.
|
|
546
643
|
*
|
|
547
|
-
*
|
|
644
|
+
* Matches Rust: `ProvenanceMark::validate()` which delegates to
|
|
645
|
+
* `ValidationReport::validate()`.
|
|
646
|
+
*/
|
|
647
|
+
static validate(marks: ProvenanceMark[]): ValidationReport;
|
|
648
|
+
/**
|
|
649
|
+
* Convert this provenance mark to a Gordian Envelope.
|
|
548
650
|
*
|
|
549
|
-
*
|
|
651
|
+
* Creates a leaf envelope containing the tagged CBOR representation.
|
|
652
|
+
* Matches Rust: `Envelope::new(mark.to_cbor())` which creates a CBOR leaf.
|
|
550
653
|
*/
|
|
551
654
|
intoEnvelope(): Envelope;
|
|
552
655
|
/**
|
|
553
656
|
* Extract a ProvenanceMark from a Gordian Envelope.
|
|
554
657
|
*
|
|
658
|
+
* Matches Rust: `envelope.subject().try_leaf()?.try_into()`
|
|
659
|
+
*
|
|
555
660
|
* @param envelope - The envelope to extract from
|
|
556
661
|
* @returns The extracted provenance mark
|
|
557
662
|
* @throws ProvenanceMarkError if extraction fails
|
|
@@ -634,92 +739,6 @@ declare class ProvenanceMarkGenerator {
|
|
|
634
739
|
static fromEnvelope(envelope: Envelope): ProvenanceMarkGenerator;
|
|
635
740
|
}
|
|
636
741
|
//#endregion
|
|
637
|
-
//#region src/validate.d.ts
|
|
638
|
-
/**
|
|
639
|
-
* Format for validation report output.
|
|
640
|
-
*/
|
|
641
|
-
declare enum ValidationReportFormat {
|
|
642
|
-
/** Human-readable text format */
|
|
643
|
-
Text = "text",
|
|
644
|
-
/** Compact JSON format (no whitespace) */
|
|
645
|
-
JsonCompact = "json-compact",
|
|
646
|
-
/** Pretty-printed JSON format (with indentation) */
|
|
647
|
-
JsonPretty = "json-pretty"
|
|
648
|
-
}
|
|
649
|
-
/**
|
|
650
|
-
* Issue flagged during validation.
|
|
651
|
-
*/
|
|
652
|
-
type ValidationIssue = {
|
|
653
|
-
type: "HashMismatch";
|
|
654
|
-
expected: string;
|
|
655
|
-
actual: string;
|
|
656
|
-
} | {
|
|
657
|
-
type: "KeyMismatch";
|
|
658
|
-
} | {
|
|
659
|
-
type: "SequenceGap";
|
|
660
|
-
expected: number;
|
|
661
|
-
actual: number;
|
|
662
|
-
} | {
|
|
663
|
-
type: "DateOrdering";
|
|
664
|
-
previous: string;
|
|
665
|
-
next: string;
|
|
666
|
-
} | {
|
|
667
|
-
type: "NonGenesisAtZero";
|
|
668
|
-
} | {
|
|
669
|
-
type: "InvalidGenesisKey";
|
|
670
|
-
};
|
|
671
|
-
/**
|
|
672
|
-
* Format a validation issue as a string.
|
|
673
|
-
*/
|
|
674
|
-
declare function formatValidationIssue(issue: ValidationIssue): string;
|
|
675
|
-
/**
|
|
676
|
-
* A mark with any issues flagged during validation.
|
|
677
|
-
*/
|
|
678
|
-
interface FlaggedMark {
|
|
679
|
-
mark: ProvenanceMark;
|
|
680
|
-
issues: ValidationIssue[];
|
|
681
|
-
}
|
|
682
|
-
/**
|
|
683
|
-
* Report for a contiguous sequence of marks within a chain.
|
|
684
|
-
*/
|
|
685
|
-
interface SequenceReport {
|
|
686
|
-
startSeq: number;
|
|
687
|
-
endSeq: number;
|
|
688
|
-
marks: FlaggedMark[];
|
|
689
|
-
}
|
|
690
|
-
/**
|
|
691
|
-
* Report for a chain of marks with the same chain ID.
|
|
692
|
-
*/
|
|
693
|
-
interface ChainReport {
|
|
694
|
-
chainId: Uint8Array;
|
|
695
|
-
hasGenesis: boolean;
|
|
696
|
-
marks: ProvenanceMark[];
|
|
697
|
-
sequences: SequenceReport[];
|
|
698
|
-
}
|
|
699
|
-
/**
|
|
700
|
-
* Get the chain ID as a hex string for display.
|
|
701
|
-
*/
|
|
702
|
-
declare function chainIdHex(report: ChainReport): string;
|
|
703
|
-
/**
|
|
704
|
-
* Complete validation report.
|
|
705
|
-
*/
|
|
706
|
-
interface ValidationReport {
|
|
707
|
-
marks: ProvenanceMark[];
|
|
708
|
-
chains: ChainReport[];
|
|
709
|
-
}
|
|
710
|
-
/**
|
|
711
|
-
* Check if the validation report has any issues.
|
|
712
|
-
*/
|
|
713
|
-
declare function hasIssues(report: ValidationReport): boolean;
|
|
714
|
-
/**
|
|
715
|
-
* Format the validation report.
|
|
716
|
-
*/
|
|
717
|
-
declare function formatReport(report: ValidationReport, format: ValidationReportFormat): string;
|
|
718
|
-
/**
|
|
719
|
-
* Validate a collection of provenance marks.
|
|
720
|
-
*/
|
|
721
|
-
declare function validate(marks: ProvenanceMark[]): ValidationReport;
|
|
722
|
-
//#endregion
|
|
723
742
|
//#region src/mark-info.d.ts
|
|
724
743
|
/**
|
|
725
744
|
* Wrapper for a provenance mark with additional display information.
|
|
@@ -758,23 +777,21 @@ declare class ProvenanceMarkInfo {
|
|
|
758
777
|
/**
|
|
759
778
|
* Registers provenance mark tags in the global format context.
|
|
760
779
|
*
|
|
761
|
-
*
|
|
762
|
-
* provenance marks in a human-readable format.
|
|
780
|
+
* Matches Rust: register_tags()
|
|
763
781
|
*/
|
|
764
782
|
declare function registerTags(): void;
|
|
765
783
|
/**
|
|
766
784
|
* Registers provenance mark tags in a specific format context.
|
|
767
785
|
*
|
|
786
|
+
* Matches Rust: register_tags_in()
|
|
787
|
+
*
|
|
768
788
|
* @param context - The format context to register tags in
|
|
769
789
|
*/
|
|
770
|
-
declare function registerTagsIn(context:
|
|
771
|
-
interface TagsContext {
|
|
772
|
-
setSummarizer(tag: number, summarizer: (cbor: Cbor) => string): void;
|
|
773
|
-
}
|
|
790
|
+
declare function registerTagsIn(context: FormatContext$1): void;
|
|
774
791
|
/**
|
|
775
792
|
* Convert a ProvenanceMark to an Envelope.
|
|
776
793
|
*
|
|
777
|
-
*
|
|
794
|
+
* Delegates to ProvenanceMark.intoEnvelope() — single source of truth.
|
|
778
795
|
*
|
|
779
796
|
* @param mark - The provenance mark to convert
|
|
780
797
|
* @returns An envelope containing the mark
|
|
@@ -783,6 +800,8 @@ declare function provenanceMarkToEnvelope(mark: ProvenanceMark): Envelope;
|
|
|
783
800
|
/**
|
|
784
801
|
* Extract a ProvenanceMark from an Envelope.
|
|
785
802
|
*
|
|
803
|
+
* Delegates to ProvenanceMark.fromEnvelope() — single source of truth.
|
|
804
|
+
*
|
|
786
805
|
* @param envelope - The envelope to extract from
|
|
787
806
|
* @returns The extracted provenance mark
|
|
788
807
|
* @throws ProvenanceMarkError if extraction fails
|
|
@@ -791,12 +810,7 @@ declare function provenanceMarkFromEnvelope(envelope: Envelope): ProvenanceMark;
|
|
|
791
810
|
/**
|
|
792
811
|
* Convert a ProvenanceMarkGenerator to an Envelope.
|
|
793
812
|
*
|
|
794
|
-
*
|
|
795
|
-
* - type: "provenance-generator"
|
|
796
|
-
* - res: The resolution
|
|
797
|
-
* - seed: The seed
|
|
798
|
-
* - next-seq: The next sequence number
|
|
799
|
-
* - rng-state: The RNG state
|
|
813
|
+
* Delegates to ProvenanceMarkGenerator.intoEnvelope() — single source of truth.
|
|
800
814
|
*
|
|
801
815
|
* @param generator - The generator to convert
|
|
802
816
|
* @returns An envelope containing the generator
|
|
@@ -805,11 +819,13 @@ declare function provenanceMarkGeneratorToEnvelope(generator: ProvenanceMarkGene
|
|
|
805
819
|
/**
|
|
806
820
|
* Extract a ProvenanceMarkGenerator from an Envelope.
|
|
807
821
|
*
|
|
822
|
+
* Delegates to ProvenanceMarkGenerator.fromEnvelope() — single source of truth.
|
|
823
|
+
*
|
|
808
824
|
* @param envelope - The envelope to extract from
|
|
809
825
|
* @returns The extracted generator
|
|
810
826
|
* @throws ProvenanceMarkError if extraction fails
|
|
811
827
|
*/
|
|
812
828
|
declare function provenanceMarkGeneratorFromEnvelope(envelope: Envelope): ProvenanceMarkGenerator;
|
|
813
829
|
//#endregion
|
|
814
|
-
export { type ChainReport, type FlaggedMark, PROVENANCE_SEED_LENGTH, ProvenanceMark, ProvenanceMarkError, ProvenanceMarkErrorType, ProvenanceMarkGenerator, ProvenanceMarkInfo, ProvenanceMarkResolution, type ProvenanceMarkResult, ProvenanceSeed, RNG_STATE_LENGTH, RngState, SHA256_SIZE, type SequenceReport, type SerializableDate, type
|
|
830
|
+
export { type ChainReport, type FlaggedMark, FormatContext, PROVENANCE_SEED_LENGTH, ProvenanceMark, ProvenanceMarkError, ProvenanceMarkErrorType, ProvenanceMarkGenerator, ProvenanceMarkInfo, ProvenanceMarkResolution, type ProvenanceMarkResult, ProvenanceSeed, RNG_STATE_LENGTH, RngState, SHA256_SIZE, type SequenceReport, type SerializableDate, type ValidationIssue, type ValidationReport, ValidationReportFormat, Xoshiro256StarStar, chainIdHex, chainIdRange, dateBytesLength, dateBytesRange, dateFromIso8601, dateToDateString, dateToIso8601, deserialize2Bytes, deserialize4Bytes, deserialize6Bytes, deserializeDate, deserializeSeq, extendKey, fixedLength, formatReport, formatValidationIssue, hasIssues, hashRange, hkdfHmacSha256, infoRangeStart, keyRange, linkLength, obfuscate, provenanceMarkFromEnvelope, provenanceMarkGeneratorFromEnvelope, provenanceMarkGeneratorToEnvelope, provenanceMarkToEnvelope, rangeOfDaysInMonth, registerTags, registerTagsIn, resolutionFromCbor, resolutionFromNumber, resolutionToCbor, resolutionToNumber, resolutionToString, seqBytesLength, seqBytesRange, serialize2Bytes, serialize4Bytes, serialize6Bytes, serializeDate, serializeSeq, sha256, sha256Prefix, validate };
|
|
815
831
|
//# sourceMappingURL=index.d.mts.map
|