@smartledger/bsv 3.2.2 → 3.3.3

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 (95) hide show
  1. package/CHANGELOG.md +279 -4
  2. package/README.md +266 -71
  3. package/bsv-covenant.min.js +26 -3
  4. package/bsv-gdaf.min.js +39 -0
  5. package/bsv-ltp.min.js +39 -0
  6. package/bsv-script-helper.min.js +2 -2
  7. package/bsv-security.min.js +3 -24
  8. package/bsv-shamir.min.js +12 -0
  9. package/bsv-smartcontract.min.js +10 -8
  10. package/bsv.bundle.js +7 -7
  11. package/bsv.min.js +10 -8
  12. package/build/webpack.bundle.config.js +2 -2
  13. package/build/webpack.config.js +2 -2
  14. package/build/webpack.covenant.config.js +2 -2
  15. package/build/webpack.gdaf.config.js +17 -0
  16. package/build/webpack.ltp.config.js +17 -0
  17. package/build/webpack.script-helper.config.js +2 -2
  18. package/build/webpack.security.config.js +2 -2
  19. package/build/webpack.smartcontract.config.js +2 -2
  20. package/bundle-entry.js +1 -265
  21. package/covenant-entry.js +1 -44
  22. package/docs/DOCUMENTATION_REVIEW_REPORT.md +295 -0
  23. package/docs/MODULE_REFERENCE_COMPLETE.md +330 -0
  24. package/docs/README.md +107 -79
  25. package/docs/advanced/LEGAL_TOKEN_PROTOCOL.md +411 -0
  26. package/docs/advanced/SMART_CONTRACT_GUIDE.md +1255 -0
  27. package/docs/advanced/UTXO_MANAGER_GUIDE.md +851 -0
  28. package/docs/api/LTP.md +334 -0
  29. package/docs/getting-started/INSTALLATION.md +410 -0
  30. package/docs/getting-started/QUICK_START.md +180 -0
  31. package/docs/migration/FROM_BSV_1_5_6.md +260 -0
  32. package/docs/technical/GDAF_DEVELOPER_INTERFACE.md +187 -0
  33. package/docs/technical/GDAF_IMPLEMENTATION_COMPLETE.md +190 -0
  34. package/docs/technical/SHAMIR_INTEGRATION_SUMMARY.md +165 -0
  35. package/docs/technical/roadmap.md +1250 -0
  36. package/docs/technical/trust_law.md +142 -0
  37. package/gdaf-entry.js +2 -0
  38. package/index.js +291 -0
  39. package/lib/crypto/shamir.js +360 -0
  40. package/lib/gdaf/attestation-signer.js +461 -0
  41. package/lib/gdaf/attestation-verifier.js +600 -0
  42. package/lib/gdaf/did-resolver.js +382 -0
  43. package/lib/gdaf/index.js +471 -0
  44. package/lib/gdaf/schema-validator.js +682 -0
  45. package/lib/gdaf/smartledger-anchor.js +486 -0
  46. package/lib/gdaf/zk-prover.js +507 -0
  47. package/lib/ltp/anchor.js +438 -0
  48. package/lib/ltp/claim.js +1026 -0
  49. package/lib/ltp/index.js +470 -0
  50. package/lib/ltp/obligation.js +945 -0
  51. package/lib/ltp/proof.js +828 -0
  52. package/lib/ltp/registry.js +702 -0
  53. package/lib/ltp/right.js +765 -0
  54. package/lib/smart_contract/API_REFERENCE.md +1 -1
  55. package/lib/smart_contract/EXAMPLES.md +2 -2
  56. package/lib/smart_contract/QUICK_START.md +2 -2
  57. package/lib/smart_contract/README.md +1 -1
  58. package/ltp-entry.js +2 -0
  59. package/package.json +48 -6
  60. package/script-helper-entry.js +1 -49
  61. package/security-entry.js +1 -70
  62. package/shamir-entry.js +1 -0
  63. package/smartcontract-entry.js +1 -133
  64. package/tests/test_builtin_verify.js +117 -0
  65. package/tests/test_debug_integration.js +71 -0
  66. package/tests/test_ecdsa_little.js +70 -0
  67. package/tests/test_shamir.js +221 -0
  68. package/tests/test_smartverify_der.js +110 -0
  69. package/tests/test_standalone_shamir.html +83 -0
  70. package/utilities/blockchain-state.js +155 -155
  71. package/utilities/blockchain-state.json +103293 -5244
  72. package/utilities/miner-simulator.js +354 -358
  73. package/utilities/mock-utxo-generator.js +54 -54
  74. package/utilities/raw-tx-examples.js +120 -122
  75. package/utilities/success-demo.js +104 -105
  76. package/utilities/transaction-examples.js +188 -188
  77. package/utilities/utxo-manager.js +91 -91
  78. package/utilities/wallet-setup.js +79 -80
  79. package/utilities/working-signature-demo.js +108 -110
  80. package/SECURITY.md +0 -75
  81. package/build/bsv-covenant.min.js +0 -10
  82. package/build/bsv-script-helper.min.js +0 -10
  83. package/build/bsv-security.min.js +0 -31
  84. package/build/bsv-smartcontract.min.js +0 -37
  85. package/build/bsv.bundle.js +0 -39
  86. package/build/bsv.min.js +0 -37
  87. package/validation_test.js +0 -97
  88. /package/docs/{ADVANCED_COVENANT_DEVELOPMENT.md → advanced/ADVANCED_COVENANT_DEVELOPMENT.md} +0 -0
  89. /package/docs/{CUSTOM_SCRIPT_DEVELOPMENT.md → advanced/CUSTOM_SCRIPT_DEVELOPMENT.md} +0 -0
  90. /package/docs/{block.md → api/BLOCKS.md} +0 -0
  91. /package/docs/{ecies.md → api/ECIES.md} +0 -0
  92. /package/docs/{networks.md → api/NETWORKS.md} +0 -0
  93. /package/docs/{script.md → api/SCRIPTS.md} +0 -0
  94. /package/docs/{transaction.md → api/TRANSACTIONS.md} +0 -0
  95. /package/docs/{unspentoutput.md → api/UTXO.md} +0 -0
@@ -0,0 +1,142 @@
1
+ Excellent. Below is the **Trust Protocol Mapping Document (Draft v1.0)** — a comprehensive bridge between *traditional common-law trust principles* (as represented in Weiss’s Concise Trustee Handbook and similar express-trust doctrines) and *SmartLedger’s modern digital legal architecture* (SmartLedger-BSV + LTP + GDAF + NotaryHash).
2
+
3
+ ---
4
+
5
+ # 🧾 **Trust Protocol Mapping Document (v1.0)**
6
+
7
+ ### *Bridging Express Trust Law and the Legal Token Protocol (LTP)*
8
+
9
+ ---
10
+
11
+ ## ⚖️ 1. Core Legal–Digital Mapping
12
+
13
+ | **Traditional Trust Element** | **Description (Common Law)** | **Digital Representation (SmartLedger Framework)** | **Implemented In** |
14
+ | ----------------------------- | ------------------------------------------------------------------------ | -------------------------------------------------------------------------- | ---------------------------------- |
15
+ | **Settlor (Grantor)** | Creator of the trust; provides property or rights to be held in trust. | DID representing issuing authority (may be individual, corporation, DAO). | `identity/` → `createDID()` |
16
+ | **Trustee(s)** | Hold and manage property for benefit of beneficiary; owe fiduciary duty. | DID(s) with VC attestation of role and fiduciary obligations. | `identity/`, `legal/ltp/`, `gdaf/` |
17
+ | **Beneficiary(ies)** | The party entitled to benefit from the trust corpus. | Subject DID(s) listed in claim or rights object. | `legal/ltp/` |
18
+ | **Corpus (Res)** | Property, asset, or rights being held. | Tokenized “claim” object within Legal Token Protocol. | `ltp/` |
19
+ | **Trust Instrument** | Written or oral declaration establishing trust terms. | JSON-LD trust schema anchored via NotaryHash; cryptographically signed. | `anchor/`, `gdaf/` |
20
+ | **Purpose Clause** | Lawful reason for trust (charitable, private, etc.). | `purpose` field in token schema (ISO 3166 jurisdictional & legal tags). | `ltp/schema` |
21
+ | **Jurisdiction (Situs)** | Governing law and forum. | `jurisdiction` field in credential metadata (ISO country + legal system). | `compliance/` |
22
+ | **Trust Certificate** | Document showing beneficial ownership or capital interest. | Token credential (VC or NFT-style right token) anchored on-chain. | `ltp/`, `gdaf/` |
23
+ | **Minutes / Accounting** | Trustee logs of actions, decisions, disbursements. | Verifiable “ActionLogCredential” anchored on-chain (audit trail). | `anchor/`, `gdaf/` |
24
+ | **Trustee Resolution** | Decision or vote by trustees. | Multi-sig or VC “ResolutionCredential” anchored + signed by quorum. | `ltp/`, `identity/` |
25
+ | **Revocation / Termination** | Ending or amending trust instrument. | `revokeRightToken(tokenId)` + updated anchor proof in revocation registry. | `ltp/` |
26
+ | **Liability & Indemnity** | Limits trustee liability or defines indemnification. | Schema fields `trusteeIndemnity`, `liabilityLimit`, hashed in corpus. | `ltp/schema` |
27
+ | **Audit & Oversight** | External or internal verification of compliance. | Chain-based audit credential + GDAF selective proof verification. | `gdaf/`, `anchor/` |
28
+
29
+ ---
30
+
31
+ ## 🧱 2. Protocol Flow Example: Creation → Management → Termination
32
+
33
+ 1. **Declaration Phase**
34
+
35
+ ```js
36
+ const settlorDid = SmartLedgerBSV.GDAF.createDID(pubKey);
37
+ const trusteeDid = SmartLedgerBSV.GDAF.createDID(trusteeKey);
38
+ const trustSchema = SmartLedgerBSV.LTP.createRightToken(
39
+ 'PrivateExpressTrust',
40
+ trusteeDid,
41
+ { corpus: 'DigitalAssetXYZ', purpose: 'Beneficiary Support', jurisdiction: 'US-VA' },
42
+ settlorKey
43
+ );
44
+ const txid = SmartLedgerBSV.Anchor.commitHash(trustSchema.rootHash, { purpose: 'trust-declaration' });
45
+ ```
46
+
47
+ 2. **Operation Phase**
48
+
49
+ * Trustees issue VC “TrusteeActionCredential” for each action (investment, distribution, amendment).
50
+ * Anchors created via NotaryHash.
51
+ * Beneficiaries view proofs using ZK disclosure of entitlement without revealing full corpus.
52
+
53
+ 3. **Termination Phase**
54
+
55
+ ```js
56
+ SmartLedgerBSV.LTP.revokeRightToken(trustSchema.id);
57
+ SmartLedgerBSV.Anchor.commitHash(revocationHash, { purpose: 'trust-termination' });
58
+ ```
59
+
60
+ ---
61
+
62
+ ## 🧩 3. Compliance & Legal Framework Overlay
63
+
64
+ | **Principle** | **SmartLedger Implementation** | **Effect** |
65
+ | ------------------ | ---------------------------------------------------------------- | -------------------------------------------- |
66
+ | *Lawful purpose* | Schema validation forbids unlawful or undefined `purpose` field. | Ensures digital trusts are legally valid. |
67
+ | *Fiduciary duty* | VC attestation + signature requirement for trustee actions. | Enforceable accountability. |
68
+ | *Privacy duty* | HMAC/commitment model, zero-knowledge field proofs. | GDPR & fiduciary confidentiality compliance. |
69
+ | *Accounting duty* | Immutable audit logs via anchor proofs. | Transparent stewardship. |
70
+ | *Right to redress* | Dispute resolution VC + signature chain. | Legal recourse framework. |
71
+
72
+ ---
73
+
74
+ ## 🔐 4. Schema Alignment
75
+
76
+ ### TrustCredential (example)
77
+
78
+ ```json
79
+ {
80
+ "@context": ["https://www.w3.org/2018/credentials/v1", "https://smartledger.org/ltp/trust/v1"],
81
+ "type": ["VerifiableCredential", "TrustCredential"],
82
+ "issuer": "did:smartledger:abcd1234",
83
+ "issuanceDate": "2025-10-22T00:00:00Z",
84
+ "credentialSubject": {
85
+ "trustName": "Ward Family Private Express Trust",
86
+ "settlor": "did:smartledger:settlor123",
87
+ "trustee": ["did:smartledger:trustee456"],
88
+ "beneficiary": ["did:smartledger:beneficiary789"],
89
+ "corpus": { "assetType": "DigitalProperty", "assetId": "hash:abcd" },
90
+ "purpose": "Estate Preservation",
91
+ "jurisdiction": "US-VA"
92
+ },
93
+ "proof": {
94
+ "type": "SmartLedgerSignature2025",
95
+ "created": "2025-10-22T00:00:00Z",
96
+ "proofPurpose": "assertionMethod",
97
+ "verificationMethod": "did:smartledger:abcd1234#keys-1",
98
+ "jws": "eyJhbGciOiJFUzI1NiIsInR5cCI6..."
99
+ }
100
+ }
101
+ ```
102
+
103
+ ---
104
+
105
+ ## 🧩 5. Inter-Protocol Integration
106
+
107
+ | **Component** | **Purpose** | **Trust-Mapping Equivalent** |
108
+ | -------------------------------- | ------------------------------------------------------- | --------------------------------------------------------------- |
109
+ | **SmartLedger-BSV Crypto Layer** | Provides signature, Shamir recovery, canonical hashing. | Legal “seal” of trustee instrument. |
110
+ | **GDAF (Identity)** | Defines DID, VC issuance, selective proof. | Identifies Settlor/Trustee/Beneficiary with attested authority. |
111
+ | **LTP (Legal Tokens)** | Encodes property, licenses, rights. | Defines trust corpus & certificates. |
112
+ | **NotaryHash** | Anchors proofs on-chain. | Ledgered minutes, immutable recordkeeping. |
113
+ | **Compliance Module** | Applies GDPR/eIDAS/KYC filters. | Ensures lawful privacy & admissibility. |
114
+
115
+ ---
116
+
117
+ ## 🌐 6. Future Extensions
118
+
119
+ | **Goal** | **Description** |
120
+ | ------------------------------------------- | -------------------------------------------------------------------- |
121
+ | **Multi-jurisdiction Templates** | Schema variants for US Common Law, UK Equity, EU Civil Trusts. |
122
+ | **Trustee Dashboard SDK** | UI toolkit to manage credentials, actions, audit logs. |
123
+ | **AI Compliance Auditor** | GDAF-linked AI validator for fiduciary & jurisdictional consistency. |
124
+ | **Integration with National ID frameworks** | Optional verification with eIDAS/eID. |
125
+
126
+ ---
127
+
128
+ ## 🧭 7. Conclusion
129
+
130
+ By aligning SmartLedger’s LTP & GDAF architecture with express trust law, the system transforms **trusts, contracts, and fiduciary duties** into **digitally verifiable legal primitives**.
131
+
132
+ Every trustee signature, declaration, and action can now be:
133
+ ✅ Proven on-chain
134
+ ✅ Audited under jurisdiction
135
+ ✅ Recovered by lawful heirs
136
+ ✅ Compliant with privacy & fiduciary standards
137
+
138
+ This makes SmartLedger’s infrastructure the **world’s first “Trust-as-Code” framework** — where **Law, Ledger, and Logic** converge.
139
+
140
+ ---
141
+
142
+ Would you like me to extend this into a **formal Trust Protocol Specification (TPS 1.0)** — with detailed JSON schemas, method signatures, and governance model (Trust Registrar, Revocation Registry, Jurisdiction Tags, etc.) so your LTP developers can begin implementation directly?
package/gdaf-entry.js ADDED
@@ -0,0 +1,2 @@
1
+ // GDAF module placeholder - will be implemented in future release
2
+ module.exports = require('./lib/smart_contract');
package/index.js CHANGED
@@ -48,6 +48,7 @@ bsv.crypto.Hash = require('./lib/crypto/hash')
48
48
  bsv.crypto.Random = require('./lib/crypto/random')
49
49
  bsv.crypto.Point = require('./lib/crypto/point')
50
50
  bsv.crypto.Signature = require('./lib/crypto/signature')
51
+ bsv.crypto.Shamir = require('./lib/crypto/shamir')
51
52
 
52
53
  // SmartLedger security enhancements
53
54
  bsv.crypto.SmartVerify = require('./lib/crypto/smartledger_verify')
@@ -82,8 +83,14 @@ bsv.PrivateKey = require('./lib/privatekey')
82
83
  bsv.PublicKey = require('./lib/publickey')
83
84
  bsv.Script = require('./lib/script')
84
85
  bsv.Transaction = require('./lib/transaction')
86
+ bsv.Input = require('./lib/transaction').Input
87
+ bsv.Output = require('./lib/transaction').Output
88
+ bsv.UnspentOutput = require('./lib/transaction').UnspentOutput
85
89
  bsv.Message = require('./lib/message')
90
+ bsv.Mnemonic = require('./lib/mnemonic')
91
+ bsv.ECIES = require('./lib/ecies')
86
92
  bsv.Signature = require('./lib/crypto/signature')
93
+ bsv.Shamir = require('./lib/crypto/shamir')
87
94
 
88
95
  // SmartLedger security modules (top-level access)
89
96
  bsv.SmartLedger = {
@@ -119,5 +126,289 @@ if (typeof window === 'undefined' && typeof require === 'function') {
119
126
  }
120
127
  }
121
128
 
129
+ // Global Digital Attestation Framework (GDAF)
130
+ bsv.GDAF = require('./lib/gdaf')
131
+
132
+ // GDAF Direct Access Methods (for easier developer experience)
133
+ bsv.createDID = function(publicKey) {
134
+ var gdaf = new bsv.GDAF()
135
+ return gdaf.createDID(publicKey)
136
+ }
137
+
138
+ bsv.resolveDID = function(did) {
139
+ var gdaf = new bsv.GDAF()
140
+ return gdaf.resolveDID(did)
141
+ }
142
+
143
+ bsv.createEmailCredential = function(issuerDID, subjectDID, email, issuerPrivateKey) {
144
+ var gdaf = new bsv.GDAF()
145
+ return gdaf.createEmailCredential(issuerDID, subjectDID, email, issuerPrivateKey)
146
+ }
147
+
148
+ bsv.createAgeCredential = function(issuerDID, subjectDID, ageThreshold, birthDate, issuerPrivateKey) {
149
+ var gdaf = new bsv.GDAF()
150
+ return gdaf.createAgeCredential(issuerDID, subjectDID, ageThreshold, birthDate, issuerPrivateKey)
151
+ }
152
+
153
+ bsv.createKYCCredential = function(issuerDID, subjectDID, level, piiHashes, issuerPrivateKey) {
154
+ var gdaf = new bsv.GDAF()
155
+ return gdaf.createKYCCredential(issuerDID, subjectDID, level, piiHashes, issuerPrivateKey)
156
+ }
157
+
158
+ bsv.verifyCredential = function(credential, options) {
159
+ var gdaf = new bsv.GDAF()
160
+ return gdaf.verifyCredential(credential, options)
161
+ }
162
+
163
+ bsv.validateCredential = function(credential, schema) {
164
+ var gdaf = new bsv.GDAF()
165
+ return gdaf.validateCredential(credential, schema)
166
+ }
167
+
168
+ bsv.generateSelectiveProof = function(credential, revealedFields, nonce) {
169
+ var gdaf = new bsv.GDAF()
170
+ return gdaf.generateSelectiveProof(credential, revealedFields, nonce)
171
+ }
172
+
173
+ bsv.generateAgeProof = function(ageCredential, minimumAge, nonce) {
174
+ var gdaf = new bsv.GDAF()
175
+ return gdaf.generateAgeProof(ageCredential, minimumAge, nonce)
176
+ }
177
+
178
+ bsv.verifyAgeProof = function(proof, minimumAge, issuerDID) {
179
+ var gdaf = new bsv.GDAF()
180
+ return gdaf.verifyAgeProof(proof, minimumAge, issuerDID)
181
+ }
182
+
183
+ bsv.createPresentation = function(credentials, holderDID, holderPrivateKey, options) {
184
+ var gdaf = new bsv.GDAF()
185
+ return gdaf.createPresentation(credentials, holderDID, holderPrivateKey, options)
186
+ }
187
+
188
+ bsv.getCredentialSchemas = function() {
189
+ var gdaf = new bsv.GDAF()
190
+ return gdaf.getAllSchemas()
191
+ }
192
+
193
+ bsv.createCredentialTemplate = function(credentialType) {
194
+ var gdaf = new bsv.GDAF()
195
+ return gdaf.createTemplate(credentialType)
196
+ }
197
+
198
+ // Legal Token Protocol (LTP) - Primitives-Only Interface
199
+ bsv.LTP = require('./lib/ltp')
200
+
201
+ // LTP Right Token Primitives
202
+ bsv.prepareRightToken = function(type, issuerDID, subjectDID, claim, issuerPrivateKey, options) {
203
+ return bsv.LTP.Right.prepareRightToken(type, issuerDID, subjectDID, claim, issuerPrivateKey, options)
204
+ }
205
+
206
+ bsv.prepareRightTokenVerification = function(token, options) {
207
+ return bsv.LTP.Right.prepareRightTokenVerification(token, options)
208
+ }
209
+
210
+ bsv.prepareRightTokenTransfer = function(token, newOwnerDID, currentOwnerKey, options) {
211
+ return bsv.LTP.Right.prepareRightTokenTransfer(token, newOwnerDID, currentOwnerKey, options)
212
+ }
213
+
214
+ bsv.prepareRightTypeValidation = function(type) {
215
+ return bsv.LTP.Right.prepareRightTypeValidation(type)
216
+ }
217
+
218
+ // LTP Obligation Token Primitives
219
+ bsv.prepareObligationToken = function(type, issuerDID, obligorDID, obligation, issuerPrivateKey, options) {
220
+ return bsv.LTP.Obligation.prepareObligationToken(type, issuerDID, obligorDID, obligation, issuerPrivateKey, options)
221
+ }
222
+
223
+ bsv.prepareObligationVerification = function(token, options) {
224
+ return bsv.LTP.Obligation.prepareObligationVerification(token, options)
225
+ }
226
+
227
+ bsv.prepareObligationFulfillment = function(token, fulfillment, obligorKey, options) {
228
+ return bsv.LTP.Obligation.prepareObligationFulfillment(token, fulfillment, obligorKey, options)
229
+ }
230
+
231
+ bsv.prepareObligationBreachAssessment = function(token, breach, assessor) {
232
+ return bsv.LTP.Obligation.prepareObligationBreachAssessment(token, breach, assessor)
233
+ }
234
+
235
+ bsv.prepareObligationMonitoringReport = function(obligations, criteria) {
236
+ return bsv.LTP.Obligation.prepareObligationMonitoringReport(obligations, criteria)
237
+ }
238
+
239
+ // LTP Claim Validation Primitives
240
+ bsv.prepareClaimValidation = function(claim, schemaName) {
241
+ return bsv.LTP.Claim.prepareClaimValidation(claim, schemaName)
242
+ }
243
+
244
+ bsv.prepareClaimAttestation = function(claim, schemaName, attestor) {
245
+ return bsv.LTP.Claim.prepareClaimAttestation(claim, schemaName, attestor)
246
+ }
247
+
248
+ bsv.prepareClaimDispute = function(claimHash, disputant, dispute) {
249
+ return bsv.LTP.Claim.prepareClaimDispute(claimHash, disputant, dispute)
250
+ }
251
+
252
+ bsv.prepareBulkClaimValidation = function(claims, schemaName) {
253
+ return bsv.LTP.Claim.prepareBulkClaimValidation(claims, schemaName)
254
+ }
255
+
256
+ bsv.prepareClaimTemplate = function(schemaName, options) {
257
+ return bsv.LTP.Claim.prepareClaimTemplate(schemaName, options)
258
+ }
259
+
260
+ // LTP Proof Generation Primitives
261
+ bsv.prepareSignatureProof = function(token, privateKey, options) {
262
+ return bsv.LTP.Proof.prepareSignatureProof(token, privateKey, options)
263
+ }
264
+
265
+ bsv.prepareSignatureVerification = function(token, publicKey) {
266
+ return bsv.LTP.Proof.prepareSignatureVerification(token, publicKey)
267
+ }
268
+
269
+ bsv.prepareSelectiveDisclosure = function(token, revealedFields, nonce) {
270
+ return bsv.LTP.Proof.prepareSelectiveDisclosure(token, revealedFields, nonce)
271
+ }
272
+
273
+ bsv.prepareSelectiveDisclosureVerification = function(proof, expectedNonce) {
274
+ return bsv.LTP.Proof.prepareSelectiveDisclosureVerification(proof, expectedNonce)
275
+ }
276
+
277
+ bsv.prepareLegalValidityProof = function(token, jurisdiction, nonce) {
278
+ return bsv.LTP.Proof.prepareLegalValidityProof(token, jurisdiction, nonce)
279
+ }
280
+
281
+ bsv.prepareZeroKnowledgeProof = function(token, statement, nonce) {
282
+ return bsv.LTP.Proof.prepareZeroKnowledgeProof(token, statement, nonce)
283
+ }
284
+
285
+ // LTP Registry Management Primitives
286
+ bsv.prepareRegistry = function(config) {
287
+ return bsv.LTP.Registry.prepareRegistry(config)
288
+ }
289
+
290
+ bsv.prepareTokenRegistration = function(token, registryConfig, options) {
291
+ return bsv.LTP.Registry.prepareTokenRegistration(token, registryConfig, options)
292
+ }
293
+
294
+ bsv.prepareTokenApproval = function(tokenId, approver, registryConfig) {
295
+ return bsv.LTP.Registry.prepareTokenApproval(tokenId, approver, registryConfig)
296
+ }
297
+
298
+ bsv.prepareTokenRevocation = function(tokenId, revocation, registryConfig) {
299
+ return bsv.LTP.Registry.prepareTokenRevocation(tokenId, revocation, registryConfig)
300
+ }
301
+
302
+ bsv.prepareTokenStatusQuery = function(tokenId, registryConfig) {
303
+ return bsv.LTP.Registry.prepareTokenStatusQuery(tokenId, registryConfig)
304
+ }
305
+
306
+ bsv.prepareTokenSearch = function(criteria, registryConfig) {
307
+ return bsv.LTP.Registry.prepareTokenSearch(criteria, registryConfig)
308
+ }
309
+
310
+ bsv.prepareStatisticsQuery = function(registryConfig) {
311
+ return bsv.LTP.Registry.prepareStatisticsQuery(registryConfig)
312
+ }
313
+
314
+ bsv.prepareAuditLogQuery = function(registryConfig, options) {
315
+ return bsv.LTP.Registry.prepareAuditLogQuery(registryConfig, options)
316
+ }
317
+
318
+ // LTP Blockchain Anchoring Primitives
319
+ bsv.prepareTokenCommitment = function(token, options) {
320
+ return bsv.LTP.Anchor.prepareTokenCommitment(token, options)
321
+ }
322
+
323
+ bsv.prepareBatchCommitment = function(tokens, options) {
324
+ return bsv.LTP.Anchor.prepareBatchCommitment(tokens, options)
325
+ }
326
+
327
+ bsv.verifyTokenAnchor = function(token, txid, txData) {
328
+ return bsv.LTP.Anchor.verifyTokenAnchor(token, txid, txData)
329
+ }
330
+
331
+ bsv.formatRevocation = function(tokenId, revocationData) {
332
+ return bsv.LTP.Anchor.formatRevocation(tokenId, revocationData)
333
+ }
334
+
335
+ // Backward Compatibility: Direct LTP Functions (Wrapper Layer)
336
+ // These functions provide the old-style direct API that demos expect
337
+
338
+ bsv.createRightToken = function(rightData, privateKey, options) {
339
+ var ltp = new bsv.LTP()
340
+ return ltp.createRightToken(rightData, privateKey, options)
341
+ }
342
+
343
+ bsv.verifyLegalToken = function(token, publicKey) {
344
+ var ltp = new bsv.LTP()
345
+ return ltp.verifyToken(token, publicKey)
346
+ }
347
+
348
+ bsv.validateLegalClaim = function(claimData, schemaType) {
349
+ var ltp = new bsv.LTP()
350
+ return ltp.validateClaim(claimData, schemaType)
351
+ }
352
+
353
+ bsv.createSelectiveDisclosure = function(token, revealedFields, nonce) {
354
+ var ltp = new bsv.LTP()
355
+ return ltp.createSelectiveDisclosure(token, revealedFields, nonce)
356
+ }
357
+
358
+ bsv.createLegalRegistry = function(config) {
359
+ return bsv.LTP.Registry.prepareRegistry(config)
360
+ }
361
+
362
+ bsv.createLegalValidityProof = function(token, jurisdiction, nonce) {
363
+ var ltp = new bsv.LTP()
364
+ return ltp.createLegalValidityProof(token, jurisdiction, nonce)
365
+ }
366
+
367
+ // LTP Static Data Access (unchanged)
368
+ bsv.getRightTypes = function() {
369
+ return bsv.LTP.Right.getRightTypes()
370
+ }
371
+
372
+ bsv.getObligationTypes = function() {
373
+ return bsv.LTP.Obligation.getObligationTypes()
374
+ }
375
+
376
+ bsv.getObligationPriority = function() {
377
+ return bsv.LTP.Obligation.getObligationPriority()
378
+ }
379
+
380
+ bsv.getObligationStatus = function() {
381
+ return bsv.LTP.Obligation.getObligationStatus()
382
+ }
383
+
384
+ bsv.getClaimSchemas = function() {
385
+ return bsv.LTP.Claim.getSchemas()
386
+ }
387
+
388
+ bsv.getClaimSchemaNames = function() {
389
+ return bsv.LTP.Claim.getSchemaNames()
390
+ }
391
+
392
+ bsv.getClaimSchema = function(schemaName) {
393
+ return bsv.LTP.Claim.getSchema(schemaName)
394
+ }
395
+
396
+ bsv.createClaimTemplate = function(schemaName) {
397
+ return bsv.LTP.Claim.createTemplate(schemaName)
398
+ }
399
+
400
+ // LTP Utility Functions
401
+ bsv.canonicalizeClaim = function(claim) {
402
+ return bsv.LTP.Claim.canonicalize(claim)
403
+ }
404
+
405
+ bsv.hashClaim = function(claim) {
406
+ return bsv.LTP.Claim.hash(claim)
407
+ }
408
+
409
+ bsv.addCustomClaimSchema = function(name, schema) {
410
+ return bsv.LTP.Claim.addSchema(name, schema)
411
+ }
412
+
122
413
  // Internal usage, exposed for testing/advanced tweaking
123
414
  bsv.Transaction.sighash = require('./lib/transaction/sighash')