@smartledger/bsv 3.4.3 → 3.4.5

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.
Files changed (89) hide show
  1. package/CHANGELOG.md +367 -0
  2. package/README.md +72 -72
  3. package/SECURITY.md +88 -0
  4. package/bin/cli.js +13 -8
  5. package/bsv-covenant.min.js +4 -4
  6. package/bsv-gdaf.min.js +5 -5
  7. package/bsv-ltp.min.js +7 -7
  8. package/bsv-smartcontract.min.js +5 -5
  9. package/bsv.bundle.js +5 -5
  10. package/bsv.d.ts +486 -9
  11. package/bsv.min.js +5 -5
  12. package/docs/COVENANT_DEVELOPMENT_RESOLVED.md +2 -2
  13. package/docs/MODULE_REFERENCE_COMPLETE.md +60 -57
  14. package/docs/advanced/UTXO_MANAGER_GUIDE.md +1 -1
  15. package/docs/getting-started/INSTALLATION.md +30 -30
  16. package/docs/getting-started/QUICK_START.md +14 -14
  17. package/docs/migration/FROM_BSV_1_5_6.md +5 -5
  18. package/gdaf-entry.js +1 -2
  19. package/index.js +20 -7
  20. package/lib/script/script.js +19 -0
  21. package/lib/smart_contract/covenant.js +10 -1
  22. package/lib/smartutxo.js +20 -12
  23. package/lib/transaction/input/publickeyhash.js +6 -1
  24. package/lib/transaction/transaction.js +12 -1
  25. package/ltp-entry.js +1 -2
  26. package/package.json +3 -3
  27. package/utilities/blockchain-state.js +32 -23
  28. package/demos/README.md +0 -188
  29. package/demos/architecture_demo.js +0 -247
  30. package/demos/browser-test.html +0 -1208
  31. package/demos/bsv_wallet_demo.js +0 -242
  32. package/demos/complete_ltp_demo.js +0 -511
  33. package/demos/debug_tools_demo.js +0 -87
  34. package/demos/demo_features.js +0 -123
  35. package/demos/easy_interface_demo.js +0 -109
  36. package/demos/ecies_demo.js +0 -182
  37. package/demos/gdaf_demo.js +0 -237
  38. package/demos/ltp_demo.js +0 -361
  39. package/demos/ltp_primitives_demo.js +0 -403
  40. package/demos/message_demo.js +0 -209
  41. package/demos/preimage_separation_demo.js +0 -383
  42. package/demos/script_helper_demo.js +0 -289
  43. package/demos/security_demo.js +0 -287
  44. package/demos/shamir_demo.js +0 -121
  45. package/demos/simple_demo.js +0 -204
  46. package/demos/simple_p2pkh_demo.js +0 -169
  47. package/demos/simple_utxo_preimage_demo.js +0 -196
  48. package/demos/smart_contract_demo.html +0 -1347
  49. package/demos/smart_contract_demo.js +0 -910
  50. package/demos/utxo_generator_demo.js +0 -244
  51. package/demos/validation_pipeline_demo.js +0 -155
  52. package/demos/web3keys.html +0 -740
  53. package/examples/README.md +0 -200
  54. package/examples/basic/transaction-creation.js +0 -534
  55. package/examples/basic/transaction_signature_api_gap.js +0 -178
  56. package/examples/complete_workflow_demo.js +0 -783
  57. package/examples/covenants/advanced_covenant_demo.js +0 -219
  58. package/examples/covenants/covenant_interface_demo.js +0 -270
  59. package/examples/covenants/covenant_manual_signature_resolved.js +0 -212
  60. package/examples/covenants/covenant_signature_template.js +0 -117
  61. package/examples/covenants2/covenant_bidirectional_example.js +0 -262
  62. package/examples/covenants2/covenant_utils_demo.js +0 -120
  63. package/examples/covenants2/preimage_covenant_utils.js +0 -287
  64. package/examples/covenants2/production_integration.js +0 -256
  65. package/examples/data/covenant_utxos.json +0 -28
  66. package/examples/data/utxos.json +0 -26
  67. package/examples/definitive_working_demo.js +0 -261
  68. package/examples/final_working_contracts.js +0 -338
  69. package/examples/legacy/README.md +0 -11
  70. package/examples/legacy/smart_contract_test_integration.js +0 -269
  71. package/examples/legacy/test_builtin_verify.js +0 -117
  72. package/examples/legacy/test_debug_integration.js +0 -71
  73. package/examples/legacy/test_ecdsa_little.js +0 -70
  74. package/examples/legacy/test_shamir.js +0 -221
  75. package/examples/legacy/test_smartverify_der.js +0 -110
  76. package/examples/preimage/README.md +0 -178
  77. package/examples/preimage/extract_preimage_bidirectional.js +0 -421
  78. package/examples/preimage/generate_sample_preimage.js +0 -208
  79. package/examples/preimage/generate_sighash_examples.js +0 -152
  80. package/examples/preimage/parse_preimage.js +0 -117
  81. package/examples/preimage/test_preimage_extractor.js +0 -53
  82. package/examples/preimage/test_varint_extraction.js +0 -95
  83. package/examples/scripts/custom_script_helper_example.js +0 -273
  84. package/examples/scripts/script_interpreter.js +0 -193
  85. package/examples/smart_contract/complete_workflow_demo.js +0 -343
  86. package/examples/smart_contract/covenant_builder_demo.js +0 -176
  87. package/examples/smart_contract/script_testing_integration.js +0 -198
  88. package/examples/smart_contract_templates.js +0 -718
  89. package/examples/working_smart_contracts.js +0 -348
package/bsv.d.ts CHANGED
@@ -1,15 +1,15 @@
1
- // Type definitions for bsv 0.30
2
- // Project: https://github.com/moneybutton/bsv
3
- // Forked From: https://github.com/bitpay/bitcore-lib
4
- // Definitions by: Lautaro Dragan <https://github.com/lautarodragan>
5
- // Definitions extended by: David Case <https://github.com/shruggr>
6
- // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
7
-
8
- // TypeScript Version: 2.2
1
+ // Type definitions for @smartledger/bsv 3.4.x
2
+ // Project: https://github.com/codenlighten/smartledger-bsv
3
+ // Forked from: https://github.com/moneybutton/bsv (which forked from https://github.com/bitpay/bitcore-lib)
4
+ // Original definitions by: Lautaro Dragan <https://github.com/lautarodragan>
5
+ // Extended by: David Case <https://github.com/shruggr>
6
+ // SmartLedger v3.3-3.4.x additions: DIDWeb, VcJwt, StatusList, Anchor, GDAF, LTP, SmartContract, SmartVerify, EllipticFixed, Shamir
7
+ //
8
+ // Promise<T> is used for async methods, so TS 2.2+ with --lib es2015 (or later) is required.
9
9
 
10
10
  /// <reference types="node" />
11
11
 
12
- declare module 'bsv' {
12
+ declare module '@smartledger/bsv' {
13
13
 
14
14
  export namespace crypto {
15
15
  class BN { }
@@ -437,4 +437,481 @@ declare module 'bsv' {
437
437
  toBits(): number;
438
438
  toSatoshis(): number;
439
439
  }
440
+
441
+ // ---------------------------------------------------------------------
442
+ // SmartLedger v3.3-3.4.x additions
443
+ //
444
+ // The W3C / legal-token / smart-contract APIs accept and return
445
+ // structured JSON documents whose schemas are intentionally open. We
446
+ // type them loosely (`any` / `object` / named JWK interfaces) so the
447
+ // shapes can evolve without breaking consumer builds. Where the runtime
448
+ // uniformly returns `{success, error?, ...}` result envelopes, those
449
+ // are typed precisely.
450
+ // ---------------------------------------------------------------------
451
+
452
+ export const version: string;
453
+ export const isHardened: boolean;
454
+ export const hardenedBy: string;
455
+ export const baseVersion: string;
456
+ export const securityFeatures: string[];
457
+
458
+ // -------- crypto.SmartVerify / crypto.EllipticFixed / crypto.Shamir --
459
+
460
+ export namespace crypto {
461
+ namespace SmartVerify {
462
+ function smartVerify(msgHash: Buffer, sig: Signature | Buffer, pubkey: PublicKey | Buffer): boolean;
463
+ function isCanonical(sig: Signature | Buffer): boolean;
464
+ function canonicalize(sig: Signature | Buffer): { r: any; s: any };
465
+ const constants: { n: any; nh: any };
466
+ }
467
+ namespace EllipticFixed {
468
+ const ec: {
469
+ verify(msg: Buffer | string, sig: any, key: any, enc?: string, opts?: object): boolean;
470
+ sign(msg: Buffer | string, key: any, enc?: string, options?: object): any;
471
+ };
472
+ }
473
+ class Shamir {
474
+ static split(secret: Buffer | string, threshold: number, shares: number, options?: object): ShamirShare[];
475
+ static combine(shares: ShamirShare[]): Buffer;
476
+ static verifyShare(share: ShamirShare): boolean;
477
+ static generateTestVectors(): {
478
+ secret: string;
479
+ threshold: number;
480
+ totalShares: number;
481
+ shares: ShamirShare[];
482
+ reconstructed: string;
483
+ valid: boolean;
484
+ };
485
+ }
486
+ }
487
+
488
+ export const SmartVerify: typeof crypto.SmartVerify;
489
+ export const EllipticFixed: typeof crypto.EllipticFixed;
490
+ export const Shamir: typeof crypto.Shamir;
491
+
492
+ export interface ShamirShare {
493
+ id: number;
494
+ threshold: number;
495
+ shares: number;
496
+ length: number;
497
+ bytes: string | Buffer;
498
+ }
499
+
500
+ export namespace SmartLedger {
501
+ const version: string;
502
+ const hardenedBy: string;
503
+ const baseVersion: string;
504
+ const securityFeatures: string[];
505
+ const SmartVerify: typeof crypto.SmartVerify;
506
+ const EllipticFixed: typeof crypto.EllipticFixed;
507
+ }
508
+
509
+ // -------- DIDWeb -----------------------------------------------------
510
+
511
+ export interface Jwk {
512
+ kty: string;
513
+ crv?: string;
514
+ x?: string;
515
+ y?: string;
516
+ d?: string;
517
+ [key: string]: any;
518
+ }
519
+
520
+ export interface IssuerKeyset {
521
+ privateJwk: Jwk;
522
+ publicJwk: Jwk;
523
+ kid: string;
524
+ alg: 'ES256' | 'ES256K';
525
+ }
526
+
527
+ export interface DidWebDocuments {
528
+ did: string;
529
+ didDocument: object;
530
+ jwks: { keys: Jwk[] };
531
+ }
532
+
533
+ export namespace DIDWeb {
534
+ function generateIssuerKeys(opts?: { alg?: 'ES256' | 'ES256K'; kid?: string }): Promise<IssuerKeyset>;
535
+ function buildDidWebDocuments(params: {
536
+ domain: string;
537
+ p256?: { jwk: Jwk; kid?: string };
538
+ k1?: { jwk: Jwk; kid?: string };
539
+ controllerName?: string;
540
+ }): DidWebDocuments;
541
+ function rotateIssuerKey(params: {
542
+ domain: string;
543
+ newKey: { jwk: Jwk; kid?: string; alg?: 'ES256' | 'ES256K' };
544
+ keepOldForDays?: number;
545
+ }): DidWebDocuments;
546
+ }
547
+
548
+ // -------- VcJwt -----------------------------------------------------
549
+
550
+ export interface VcJwtIssueResult {
551
+ jwt: string;
552
+ }
553
+
554
+ export interface VcJwtVerifyResult {
555
+ valid: boolean;
556
+ header?: object;
557
+ payload?: object;
558
+ error?: string;
559
+ }
560
+
561
+ export type DidResolver = (did: string) => Promise<{ jwks?: { keys: Jwk[] }; didDocument?: object }>;
562
+
563
+ export namespace VcJwt {
564
+ function issueVcJwt(params: {
565
+ issuerDid: string;
566
+ subjectId: string;
567
+ credentialSubject: object;
568
+ privateJwk: Jwk;
569
+ alg?: 'ES256' | 'ES256K';
570
+ kid?: string;
571
+ types?: string[];
572
+ expSeconds?: number;
573
+ }): Promise<VcJwtIssueResult>;
574
+ function verifyVcJwt(jwt: string, opts?: {
575
+ expectedIssuerDid?: string;
576
+ didResolver?: DidResolver;
577
+ clockToleranceSec?: number;
578
+ }): Promise<VcJwtVerifyResult>;
579
+ function base64UrlEncode(buffer: Buffer): string;
580
+ function base64UrlDecode(str: string): Buffer;
581
+ }
582
+
583
+ // -------- StatusList2021 --------------------------------------------
584
+
585
+ export type CredentialStatus = 'valid' | 'revoked' | 'suspended' | string;
586
+
587
+ export namespace StatusList {
588
+ function createStatusList(params: {
589
+ issuerDid: string;
590
+ privateJwk: Jwk;
591
+ listId?: string;
592
+ listSize?: number;
593
+ }): Promise<{ listVcJwt: string; listId: string }>;
594
+ function updateStatusList(params: {
595
+ listVcJwt: string;
596
+ index: number;
597
+ status: CredentialStatus;
598
+ privateJwk: Jwk;
599
+ }): Promise<{ listVcJwt: string }>;
600
+ function getCredentialStatusEntry(params: { listVcJwt: string; index: number }): CredentialStatus;
601
+ }
602
+
603
+ // -------- Anchor (top-level hash anchoring) -------------------------
604
+
605
+ export type AnchorKind = 'VC_ANCHOR_SHA256' | 'STATUSLIST_SHA256' | 'PRESENTATION_SHA256' | string;
606
+
607
+ export interface AnchorPayload {
608
+ json: object;
609
+ }
610
+
611
+ export interface AnchorParseResult {
612
+ valid: boolean;
613
+ protocol?: string;
614
+ version?: string;
615
+ type?: AnchorKind;
616
+ hash?: string;
617
+ issuer?: string;
618
+ timestamp?: string;
619
+ error?: string;
620
+ }
621
+
622
+ export namespace Anchor {
623
+ function sha256Hex(data: string | Buffer | Uint8Array): string;
624
+ function buildAnchorPayload(params: {
625
+ kind: AnchorKind;
626
+ hash: string;
627
+ issuerDid: string;
628
+ issuedAt?: string;
629
+ }): AnchorPayload;
630
+ function verifyAnchorHash(originalData: string | Buffer, anchorHash: string): boolean;
631
+ function parseAnchorPayload(opReturnData: string): AnchorParseResult;
632
+ }
633
+
634
+ // -------- GDAF (Global Digital Attestation Framework) ---------------
635
+
636
+ export class GDAF {
637
+ constructor(options?: {
638
+ attestationSigner?: object;
639
+ anchor?: object;
640
+ });
641
+
642
+ // DID
643
+ createDID(publicKey: PublicKey): string;
644
+ resolveDID(did: string): object;
645
+ verifyDIDOwnership(did: string, privateKey: PrivateKey): boolean;
646
+
647
+ // Credentials
648
+ createEmailCredential(issuerDID: string, subjectDID: string, email: string, issuerPrivateKey: PrivateKey): object;
649
+ createAgeCredential(issuerDID: string, subjectDID: string, ageThreshold: number, birthDate: Date | string, issuerPrivateKey: PrivateKey): object;
650
+ createKYCCredential(issuerDID: string, subjectDID: string, level: string, piiHashes: object, issuerPrivateKey: PrivateKey): object;
651
+ createOrganizationCredential(issuerDID: string, subjectDID: string, orgData: object, issuerPrivateKey: PrivateKey): object;
652
+ createPresentation(credentials: object[], holderDID: string, holderPrivateKey: PrivateKey, options?: object): object;
653
+ signCredential(credential: object, privateKey: PrivateKey): object;
654
+
655
+ // Verification
656
+ verifyCredential(credential: object, options?: object): { valid: boolean; [key: string]: any };
657
+ verifyPresentation(presentation: object, options?: object): { valid: boolean; [key: string]: any };
658
+ extractClaims(credentials: object[]): object;
659
+
660
+ // Zero-knowledge
661
+ generateSelectiveProof(credential: object, revealedFields: string[], nonce: string): object;
662
+ verifySelectiveProof(proof: object, publicData: object): boolean;
663
+ generateAgeProof(ageCredential: object, minimumAge: number, nonce: string): object;
664
+ verifyAgeProof(proof: object, minimumAge: number, issuerDID: string): boolean;
665
+ generateRangeProof(value: number, min: number, max: number, nonce: string): object;
666
+ verifyRangeProof(proof: object, min: number, max: number): boolean;
667
+ generateMembershipProof(value: string, validSet: string[], nonce: string): object;
668
+ verifyMembershipProof(proof: object, validSet: string[]): boolean;
669
+
670
+ // Anchoring
671
+ anchorCredential(credential: object, privateKey: PrivateKey, options?: object): object;
672
+ anchorBatch(credentials: object[], privateKey: PrivateKey, options?: object): object;
673
+ registerDID(did: string, didDocument: object, privateKey: PrivateKey, options?: object): object;
674
+ revokeCredential(credentialId: string, reason: string, privateKey: PrivateKey, options?: object): object;
675
+ queryAnchoredData(hash: string): object;
676
+
677
+ // Schemas
678
+ validateCredential(credential: object, schema: string | object): { valid: boolean; errors?: string[] };
679
+ getSchema(credentialType: string): object;
680
+ getAllSchemas(): { [name: string]: object };
681
+ addSchema(name: string, definition: object): void;
682
+ createTemplate(credentialType: string): object;
683
+
684
+ // Utilities
685
+ generateNonce(length?: number): string;
686
+ hashData(data: string, salt?: string): string;
687
+ getVersion(): string;
688
+ getInfo(): object;
689
+ }
690
+
691
+ // -------- LTP (Legal Token Protocol) --------------------------------
692
+
693
+ export interface LtpResult<T = object> {
694
+ success: boolean;
695
+ token?: T;
696
+ error?: string;
697
+ [key: string]: any;
698
+ }
699
+
700
+ export class LTP {
701
+ constructor(config?: { registry?: object });
702
+
703
+ registry: object | null;
704
+
705
+ createRightToken(rightData: object, privateKey: PrivateKey, options?: object): LtpResult;
706
+ validateClaim(claimData: object, schemaType: string): { valid: boolean; errors?: string[] };
707
+ createSelectiveDisclosure(token: object, revealedFields: string[], nonce: string): object;
708
+ verifyToken(token: object, publicKey: string | PublicKey): { valid: boolean; error?: string };
709
+ transferRight(token: object, newOwner: string, ownerKey: PrivateKey, options?: object): LtpResult;
710
+ createObligation(rightToken: object, obligationData: object, privateKey: PrivateKey): LtpResult;
711
+ revokeToken(tokenId: string, revocationData: object, authority: string): { success: boolean; error?: string };
712
+ checkTokenStatus(tokenId: string): { found: boolean; error?: string; [key: string]: any };
713
+ searchTokens(criteria: object): { success: boolean; results?: object[]; error?: string };
714
+ getRegistryStats(): object;
715
+ createLegalValidityProof(token: object, jurisdiction: object, nonce: string): object;
716
+ anchorTokenBatch(tokens: object[], options?: object): object;
717
+ verifyAnchor(token: object, txid: string): { valid: boolean; error?: string };
718
+ getRightTypes(): object;
719
+ getClaimSchemas(): object;
720
+ createRegistry(config: object): object;
721
+ setRegistry(registry: object): void;
722
+
723
+ // Static API surface
724
+ static create(config?: object): LTP;
725
+ static createRightToken(rightData: object, privateKey: PrivateKey, options?: object): LtpResult;
726
+ static validateClaim(claimData: object, schemaType: string): { valid: boolean; errors?: string[] };
727
+ static verifyToken(token: object, publicKey: string | PublicKey): { valid: boolean; error?: string };
728
+ static createRegistry(config: object): object;
729
+
730
+ // Component sub-namespaces (each is the corresponding lib/ltp/*.js module)
731
+ static Right: any;
732
+ static Claim: any;
733
+ static Anchor: any;
734
+ static Proof: any;
735
+ static Registry: any;
736
+ static Obligation: any;
737
+ }
738
+
739
+ // -------- SmartContract framework (covenants, BIP-143, JS-to-Script) -
740
+
741
+ // The SmartContract framework spans 12+ classes and a JS-to-Bitcoin-Script
742
+ // DSL. Each class accepts/produces rich domain objects whose shapes are
743
+ // documented in lib/smart_contract/. We declare the surface broadly so
744
+ // users get autocomplete on the public entry points without committing
745
+ // to evolving internal shapes.
746
+
747
+ export namespace SmartContract {
748
+ class Covenant {
749
+ constructor(privateKey: PrivateKey, options?: object);
750
+ [key: string]: any;
751
+ }
752
+ class Preimage {
753
+ constructor(preimageHex: string, options?: object);
754
+ [key: string]: any;
755
+ }
756
+ class SIGHASH {
757
+ constructor(sighashType: number);
758
+ [key: string]: any;
759
+ }
760
+ class Builder {
761
+ constructor(privateKey: PrivateKey, options?: object);
762
+ [key: string]: any;
763
+ }
764
+ class UTXOGenerator {
765
+ constructor(options?: object);
766
+ createRealUTXOs(count: number, satoshis: number): Transaction.UnspentOutput[];
767
+ [key: string]: any;
768
+ }
769
+ class ScriptTester {
770
+ constructor(options?: object);
771
+ [key: string]: any;
772
+ }
773
+ class CovenantBuilder {
774
+ constructor();
775
+ extractField(field: string): CovenantBuilder;
776
+ push(value: any): CovenantBuilder;
777
+ greaterThanOrEqual(): CovenantBuilder;
778
+ build(): any;
779
+ [key: string]: any;
780
+ }
781
+ class StackExaminer {
782
+ constructor(options?: object);
783
+ [key: string]: any;
784
+ }
785
+ class ScriptInterpreter {
786
+ constructor(options?: object);
787
+ [key: string]: any;
788
+ }
789
+ const CovenantTemplates: { [name: string]: any };
790
+ const OpcodeMap: { [opcode: string]: any };
791
+ const ScriptUtils: { [name: string]: any };
792
+
793
+ function createCovenant(privateKey: PrivateKey, options?: object): Covenant;
794
+ function extractPreimage(preimageHex: string, options?: object): Preimage;
795
+ function analyzeSIGHASH(sighashType: number): SIGHASH;
796
+ function buildCovenant(privateKey: PrivateKey, options?: object): Builder;
797
+ function testScript(unlocking: any, locking: any, options?: object): any;
798
+ function testCovenant(preimageHex: string, constraints: object, options?: object): any;
799
+ function debugScript(config: object, options?: object): any;
800
+ function createCovenantBuilder(): CovenantBuilder;
801
+ function scriptToASM(scriptBuffer: Buffer): string;
802
+ function asmToScript(asmString: string): Buffer;
803
+ function asmToHex(asm: string): string;
804
+ function hexToASM(hex: string): string;
805
+ function validateASM(asmString: string): boolean;
806
+ function interpretScript(script: Script | Buffer | string): any;
807
+ function optimizeScript(script: Script | Buffer | string): any;
808
+ }
809
+
810
+ // -------- BrowserUTXOManager ----------------------------------------
811
+
812
+ export class BrowserUTXOManager {
813
+ constructor(options?: {
814
+ storage?: Storage;
815
+ storageKey?: string;
816
+ autoSave?: boolean;
817
+ maxUTXOs?: number;
818
+ });
819
+
820
+ loadFromStorage(): void;
821
+ saveToStorage(): void;
822
+ getStorage(): Storage | null;
823
+ [key: string]: any;
824
+ }
825
+
826
+ // -------- Top-level convenience methods -----------------------------
827
+ //
828
+ // These are shortcut methods on the main `bsv` export that delegate to
829
+ // a freshly constructed GDAF / LTP instance. They mirror the methods
830
+ // above; param/return types are kept loose because they cover the
831
+ // same JSON shapes as the underlying class methods.
832
+
833
+ // GDAF wrappers (index.js:185-249)
834
+ export function createDID(publicKey: PublicKey): string;
835
+ export function resolveDID(did: string): object;
836
+ export function createEmailCredential(issuerDID: string, subjectDID: string, email: string, issuerPrivateKey: PrivateKey): object;
837
+ export function createAgeCredential(issuerDID: string, subjectDID: string, ageThreshold: number, birthDate: Date | string, issuerPrivateKey: PrivateKey): object;
838
+ export function createKYCCredential(issuerDID: string, subjectDID: string, level: string, piiHashes: object, issuerPrivateKey: PrivateKey): object;
839
+ export function verifyCredential(credential: object, options?: object): { valid: boolean; [key: string]: any };
840
+ export function validateCredential(credential: object, schema: string | object): { valid: boolean; errors?: string[] };
841
+ export function generateSelectiveProof(credential: object, revealedFields: string[], nonce: string): object;
842
+ export function generateAgeProof(ageCredential: object, minimumAge: number, nonce: string): object;
843
+ export function verifyAgeProof(proof: object, minimumAge: number, issuerDID: string): boolean;
844
+ export function createPresentation(credentials: object[], holderDID: string, holderPrivateKey: PrivateKey, options?: object): object;
845
+ export function getCredentialSchemas(): { [name: string]: object };
846
+ export function createCredentialTemplate(credentialType: string): object;
847
+
848
+ // LTP Right primitives
849
+ export function prepareRightToken(type: string, issuerDID: string, subjectDID: string, claim: object, issuerPrivateKey: PrivateKey, options?: object): object;
850
+ export function prepareRightTokenVerification(token: object, options?: object): object;
851
+ export function prepareRightTokenTransfer(token: object, newOwnerDID: string, currentOwnerKey: PrivateKey, options?: object): object;
852
+ export function prepareRightTypeValidation(type: string): object;
853
+
854
+ // LTP Obligation primitives
855
+ export function prepareObligationToken(type: string, issuerDID: string, obligorDID: string, obligation: object, issuerPrivateKey: PrivateKey, options?: object): object;
856
+ export function prepareObligationVerification(token: object, options?: object): object;
857
+ export function prepareObligationFulfillment(token: object, fulfillment: object, obligorKey: PrivateKey, options?: object): object;
858
+ export function prepareObligationBreachAssessment(token: object, breach: object, assessor: string): object;
859
+ export function prepareObligationMonitoringReport(obligations: object[], criteria: object): object;
860
+
861
+ // LTP Claim primitives
862
+ export function prepareClaimValidation(claim: object, schemaName: string): object;
863
+ export function prepareClaimAttestation(claim: object, schemaName: string, attestor: string): object;
864
+ export function prepareClaimDispute(claimHash: string, disputant: string, dispute: object): object;
865
+ export function prepareBulkClaimValidation(claims: object[], schemaName: string): object;
866
+ export function prepareClaimTemplate(schemaName: string, options?: object): object;
867
+
868
+ // LTP Proof primitives
869
+ export function prepareSignatureProof(token: object, privateKey: PrivateKey, options?: object): object;
870
+ export function prepareSignatureVerification(token: object, publicKey: string | PublicKey): object;
871
+ export function prepareSelectiveDisclosure(token: object, revealedFields: string[], nonce: string): object;
872
+ export function prepareSelectiveDisclosureVerification(proof: object, expectedNonce: string): object;
873
+ export function prepareLegalValidityProof(token: object, jurisdiction: object, nonce: string): object;
874
+ export function prepareZeroKnowledgeProof(token: object, statement: object, nonce: string): object;
875
+
876
+ // LTP Registry primitives
877
+ export function prepareRegistry(config: object): object;
878
+ export function prepareTokenRegistration(token: object, registryConfig: object, options?: object): object;
879
+ export function prepareTokenApproval(tokenId: string, approver: string, registryConfig: object): object;
880
+ export function prepareTokenRevocation(tokenId: string, revocation: object, registryConfig: object): object;
881
+ export function prepareTokenStatusQuery(tokenId: string, registryConfig: object): object;
882
+ export function prepareTokenSearch(criteria: object, registryConfig: object): object;
883
+ export function prepareStatisticsQuery(registryConfig: object): object;
884
+ export function prepareAuditLogQuery(registryConfig: object, options?: object): object;
885
+
886
+ // LTP Anchor primitives
887
+ export function prepareTokenCommitment(token: object, options?: object): object;
888
+ export function prepareBatchCommitment(tokens: object[], options?: object): object;
889
+ export function verifyTokenAnchor(token: object, txid: string, txData?: object): object;
890
+ export function formatRevocation(tokenId: string, revocationData: object): object;
891
+
892
+ // Legacy LTP compatibility wrappers
893
+ export function createRightToken(rightData: object, privateKey: PrivateKey, options?: object): LtpResult;
894
+ export function verifyLegalToken(token: object, publicKey: string | PublicKey): { valid: boolean; error?: string };
895
+ export function validateLegalClaim(claimData: object, schemaType: string): { valid: boolean; errors?: string[] };
896
+ export function createSelectiveDisclosure(token: object, revealedFields: string[], nonce: string): object;
897
+ export function createLegalRegistry(config: object): object;
898
+ export function createLegalValidityProof(token: object, jurisdiction: object, nonce: string): object;
899
+
900
+ // LTP static data accessors
901
+ export function getRightTypes(): object;
902
+ export function getObligationTypes(): object;
903
+ export function getObligationPriority(): object;
904
+ export function getObligationStatus(): object;
905
+ export function getClaimSchemas(): object;
906
+ export function getClaimSchemaNames(): string[];
907
+ export function getClaimSchema(schemaName: string): object;
908
+ export function createClaimTemplate(schemaName: string): object;
909
+ export function canonicalizeClaim(claim: object): object;
910
+ export function hashClaim(claim: object): string;
911
+ export function addCustomClaimSchema(name: string, schema: object): void;
912
+
913
+ // Shamir convenience wrappers (also available on bsv.Shamir directly)
914
+ export function splitSecret(secret: Buffer | string, totalShares: number, threshold: number, options?: object): ShamirShare[];
915
+ export function reconstructSecret(shares: ShamirShare[]): Buffer;
916
+ export function validateShare(share: ShamirShare): boolean;
440
917
  }