tenzro-sdk 0.1.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.
Files changed (151) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +107 -0
  3. package/dist/agent-payments.d.ts +47 -0
  4. package/dist/agent-payments.d.ts.map +1 -0
  5. package/dist/agent-payments.js +76 -0
  6. package/dist/agent-payments.js.map +1 -0
  7. package/dist/agent.d.ts +177 -0
  8. package/dist/agent.d.ts.map +1 -0
  9. package/dist/agent.js +300 -0
  10. package/dist/agent.js.map +1 -0
  11. package/dist/ap2.d.ts +54 -0
  12. package/dist/ap2.d.ts.map +1 -0
  13. package/dist/ap2.js +88 -0
  14. package/dist/ap2.js.map +1 -0
  15. package/dist/app.d.ts +186 -0
  16. package/dist/app.d.ts.map +1 -0
  17. package/dist/app.js +317 -0
  18. package/dist/app.js.map +1 -0
  19. package/dist/bridge.d.ts +64 -0
  20. package/dist/bridge.d.ts.map +1 -0
  21. package/dist/bridge.js +93 -0
  22. package/dist/bridge.js.map +1 -0
  23. package/dist/canton.d.ts +36 -0
  24. package/dist/canton.d.ts.map +1 -0
  25. package/dist/canton.js +46 -0
  26. package/dist/canton.js.map +1 -0
  27. package/dist/circuit-breaker.d.ts +35 -0
  28. package/dist/circuit-breaker.d.ts.map +1 -0
  29. package/dist/circuit-breaker.js +53 -0
  30. package/dist/circuit-breaker.js.map +1 -0
  31. package/dist/client.d.ts +134 -0
  32. package/dist/client.d.ts.map +1 -0
  33. package/dist/client.js +265 -0
  34. package/dist/client.js.map +1 -0
  35. package/dist/compliance.d.ts +83 -0
  36. package/dist/compliance.d.ts.map +1 -0
  37. package/dist/compliance.js +74 -0
  38. package/dist/compliance.js.map +1 -0
  39. package/dist/config.d.ts +10 -0
  40. package/dist/config.d.ts.map +1 -0
  41. package/dist/config.js +24 -0
  42. package/dist/config.js.map +1 -0
  43. package/dist/contract.d.ts +68 -0
  44. package/dist/contract.d.ts.map +1 -0
  45. package/dist/contract.js +59 -0
  46. package/dist/contract.js.map +1 -0
  47. package/dist/crypto.d.ts +112 -0
  48. package/dist/crypto.d.ts.map +1 -0
  49. package/dist/crypto.js +97 -0
  50. package/dist/crypto.js.map +1 -0
  51. package/dist/custody.d.ts +114 -0
  52. package/dist/custody.d.ts.map +1 -0
  53. package/dist/custody.js +96 -0
  54. package/dist/custody.js.map +1 -0
  55. package/dist/debridge.d.ts +129 -0
  56. package/dist/debridge.d.ts.map +1 -0
  57. package/dist/debridge.js +93 -0
  58. package/dist/debridge.js.map +1 -0
  59. package/dist/erc7802.d.ts +36 -0
  60. package/dist/erc7802.d.ts.map +1 -0
  61. package/dist/erc7802.js +52 -0
  62. package/dist/erc7802.js.map +1 -0
  63. package/dist/events.d.ts +112 -0
  64. package/dist/events.d.ts.map +1 -0
  65. package/dist/events.js +70 -0
  66. package/dist/events.js.map +1 -0
  67. package/dist/governance.d.ts +55 -0
  68. package/dist/governance.d.ts.map +1 -0
  69. package/dist/governance.js +77 -0
  70. package/dist/governance.js.map +1 -0
  71. package/dist/identity.d.ts +102 -0
  72. package/dist/identity.d.ts.map +1 -0
  73. package/dist/identity.js +147 -0
  74. package/dist/identity.js.map +1 -0
  75. package/dist/index.d.ts +67 -0
  76. package/dist/index.d.ts.map +1 -0
  77. package/dist/index.js +85 -0
  78. package/dist/index.js.map +1 -0
  79. package/dist/inference.d.ts +27 -0
  80. package/dist/inference.d.ts.map +1 -0
  81. package/dist/inference.js +43 -0
  82. package/dist/inference.js.map +1 -0
  83. package/dist/marketplace.d.ts +44 -0
  84. package/dist/marketplace.d.ts.map +1 -0
  85. package/dist/marketplace.js +74 -0
  86. package/dist/marketplace.js.map +1 -0
  87. package/dist/nanopayment.d.ts +53 -0
  88. package/dist/nanopayment.d.ts.map +1 -0
  89. package/dist/nanopayment.js +81 -0
  90. package/dist/nanopayment.js.map +1 -0
  91. package/dist/nft.d.ts +127 -0
  92. package/dist/nft.d.ts.map +1 -0
  93. package/dist/nft.js +99 -0
  94. package/dist/nft.js.map +1 -0
  95. package/dist/payment.d.ts +71 -0
  96. package/dist/payment.d.ts.map +1 -0
  97. package/dist/payment.js +105 -0
  98. package/dist/payment.js.map +1 -0
  99. package/dist/provider.d.ts +351 -0
  100. package/dist/provider.d.ts.map +1 -0
  101. package/dist/provider.js +368 -0
  102. package/dist/provider.js.map +1 -0
  103. package/dist/rpc.d.ts +35 -0
  104. package/dist/rpc.d.ts.map +1 -0
  105. package/dist/rpc.js +127 -0
  106. package/dist/rpc.js.map +1 -0
  107. package/dist/settlement.d.ts +52 -0
  108. package/dist/settlement.d.ts.map +1 -0
  109. package/dist/settlement.js +86 -0
  110. package/dist/settlement.js.map +1 -0
  111. package/dist/skill.d.ts +55 -0
  112. package/dist/skill.d.ts.map +1 -0
  113. package/dist/skill.js +79 -0
  114. package/dist/skill.js.map +1 -0
  115. package/dist/staking.d.ts +42 -0
  116. package/dist/staking.d.ts.map +1 -0
  117. package/dist/staking.js +62 -0
  118. package/dist/staking.js.map +1 -0
  119. package/dist/streaming.d.ts +83 -0
  120. package/dist/streaming.d.ts.map +1 -0
  121. package/dist/streaming.js +193 -0
  122. package/dist/streaming.js.map +1 -0
  123. package/dist/task.d.ts +46 -0
  124. package/dist/task.d.ts.map +1 -0
  125. package/dist/task.js +76 -0
  126. package/dist/task.js.map +1 -0
  127. package/dist/tee.d.ts +88 -0
  128. package/dist/tee.d.ts.map +1 -0
  129. package/dist/tee.js +62 -0
  130. package/dist/tee.js.map +1 -0
  131. package/dist/token.d.ts +165 -0
  132. package/dist/token.d.ts.map +1 -0
  133. package/dist/token.js +80 -0
  134. package/dist/token.js.map +1 -0
  135. package/dist/tool.d.ts +55 -0
  136. package/dist/tool.d.ts.map +1 -0
  137. package/dist/tool.js +79 -0
  138. package/dist/tool.js.map +1 -0
  139. package/dist/types.d.ts +1318 -0
  140. package/dist/types.d.ts.map +1 -0
  141. package/dist/types.js +117 -0
  142. package/dist/types.js.map +1 -0
  143. package/dist/wallet.d.ts +44 -0
  144. package/dist/wallet.d.ts.map +1 -0
  145. package/dist/wallet.js +75 -0
  146. package/dist/wallet.js.map +1 -0
  147. package/dist/zk.d.ts +66 -0
  148. package/dist/zk.d.ts.map +1 -0
  149. package/dist/zk.js +58 -0
  150. package/dist/zk.js.map +1 -0
  151. package/package.json +41 -0
package/dist/config.js ADDED
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LOCAL_CONFIG = exports.TESTNET_CONFIG = exports.MAINNET_CONFIG = void 0;
4
+ // Note: Mainnet is not yet live. This configuration is a placeholder.
5
+ // Use TESTNET_CONFIG to connect to the live Tenzro testnet (chainId: 1337).
6
+ exports.MAINNET_CONFIG = {
7
+ endpoint: "https://rpc.tenzro.network",
8
+ apiEndpoint: "https://api.tenzro.network",
9
+ chainId: 1,
10
+ timeout: 30000,
11
+ };
12
+ exports.TESTNET_CONFIG = {
13
+ endpoint: "https://rpc.tenzro.network",
14
+ apiEndpoint: "https://api.tenzro.network",
15
+ chainId: 1337,
16
+ timeout: 30000,
17
+ };
18
+ exports.LOCAL_CONFIG = {
19
+ endpoint: "http://localhost:8545",
20
+ apiEndpoint: "http://localhost:8080",
21
+ chainId: 1337,
22
+ timeout: 10000,
23
+ };
24
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";;;AAOA,sEAAsE;AACtE,4EAA4E;AAC/D,QAAA,cAAc,GAAiB;IAC1C,QAAQ,EAAE,4BAA4B;IACtC,WAAW,EAAE,4BAA4B;IACzC,OAAO,EAAE,CAAC;IACV,OAAO,EAAE,KAAK;CACf,CAAC;AAEW,QAAA,cAAc,GAAiB;IAC1C,QAAQ,EAAE,4BAA4B;IACtC,WAAW,EAAE,4BAA4B;IACzC,OAAO,EAAE,IAAI;IACb,OAAO,EAAE,KAAK;CACf,CAAC;AAEW,QAAA,YAAY,GAAiB;IACxC,QAAQ,EAAE,uBAAuB;IACjC,WAAW,EAAE,uBAAuB;IACpC,OAAO,EAAE,IAAI;IACb,OAAO,EAAE,KAAK;CACf,CAAC"}
@@ -0,0 +1,68 @@
1
+ import type { RpcClient } from './rpc';
2
+ /** Parameters for deploying a contract. */
3
+ export interface DeployContractParams {
4
+ /** Hex-encoded bytecode to deploy */
5
+ bytecode: string;
6
+ /** Target VM: "evm", "svm", or "daml" */
7
+ vm_type: string;
8
+ /** Deployer address */
9
+ from: string;
10
+ /** Optional constructor arguments (ABI-encoded hex for EVM) */
11
+ constructor_args?: string;
12
+ /** Optional gas limit */
13
+ gas_limit?: number;
14
+ }
15
+ /** Result of a read-only contract call. */
16
+ export interface CallResult {
17
+ /** Hex-encoded return data */
18
+ data: string;
19
+ }
20
+ /** Result of a contract deployment. */
21
+ export interface DeployResult {
22
+ /** Transaction hash */
23
+ tx_hash: string;
24
+ /** Deployed contract address */
25
+ contract_address: string;
26
+ /** VM the contract was deployed to */
27
+ vm_type: string;
28
+ /** Gas used */
29
+ gas_used?: number;
30
+ /** Deployment status */
31
+ status: string;
32
+ }
33
+ /**
34
+ * Client for smart contract deployment via the MultiVmRuntime.
35
+ * Supports deploying bytecode to EVM, SVM, or DAML VMs.
36
+ */
37
+ export declare class ContractClient {
38
+ private readonly rpc;
39
+ constructor(rpc: RpcClient);
40
+ /**
41
+ * Deploy a contract to the specified VM.
42
+ * @param params - Deployment parameters including bytecode and target VM
43
+ * @returns Deployment result with contract address and transaction hash
44
+ */
45
+ deploy(params: DeployContractParams): Promise<DeployResult>;
46
+ /**
47
+ * Perform a read-only contract call (eth_call).
48
+ * @param to - Contract address (hex)
49
+ * @param data - ABI-encoded call data (hex)
50
+ * @param block - Block number or "latest" (default: "latest")
51
+ */
52
+ callContract(to: string, data: string, block?: string): Promise<CallResult>;
53
+ /**
54
+ * ABI-encode a function call.
55
+ * @param functionSig - Function signature (e.g., "transfer(address,uint256)")
56
+ * @param args - Function arguments
57
+ * @returns Hex-encoded call data
58
+ */
59
+ encodeFunction(functionSig: string, args: unknown[]): Promise<string>;
60
+ /**
61
+ * Decode ABI-encoded return data.
62
+ * @param data - Hex-encoded return data
63
+ * @param outputTypes - Expected output types (e.g., ["uint256", "address"])
64
+ * @returns Decoded values
65
+ */
66
+ decodeResult(data: string, outputTypes: string[]): Promise<unknown[]>;
67
+ }
68
+ //# sourceMappingURL=contract.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvC,2CAA2C;AAC3C,MAAM,WAAW,oBAAoB;IACnC,qCAAqC;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,yCAAyC;IACzC,OAAO,EAAE,MAAM,CAAC;IAChB,uBAAuB;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,+DAA+D;IAC/D,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,yBAAyB;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAID,2CAA2C;AAC3C,MAAM,WAAW,UAAU;IACzB,8BAA8B;IAC9B,IAAI,EAAE,MAAM,CAAC;CACd;AAED,uCAAuC;AACvC,MAAM,WAAW,YAAY;IAC3B,uBAAuB;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,gCAAgC;IAChC,gBAAgB,EAAE,MAAM,CAAC;IACzB,sCAAsC;IACtC,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,wBAAwB;IACxB,MAAM,EAAE,MAAM,CAAC;CAChB;AAID;;;GAGG;AACH,qBAAa,cAAc;IACb,OAAO,CAAC,QAAQ,CAAC,GAAG;gBAAH,GAAG,EAAE,SAAS;IAE3C;;;;OAIG;IACG,MAAM,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,YAAY,CAAC;IAIjE;;;;;OAKG;IACG,YAAY,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAQjF;;;;;OAKG;IACG,cAAc,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC;IAM3E;;;;;OAKG;IACG,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;CAK5E"}
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ContractClient = void 0;
4
+ // ── Client ──
5
+ /**
6
+ * Client for smart contract deployment via the MultiVmRuntime.
7
+ * Supports deploying bytecode to EVM, SVM, or DAML VMs.
8
+ */
9
+ class ContractClient {
10
+ rpc;
11
+ constructor(rpc) {
12
+ this.rpc = rpc;
13
+ }
14
+ /**
15
+ * Deploy a contract to the specified VM.
16
+ * @param params - Deployment parameters including bytecode and target VM
17
+ * @returns Deployment result with contract address and transaction hash
18
+ */
19
+ async deploy(params) {
20
+ return this.rpc.call('tenzro_deployContract', [params]);
21
+ }
22
+ /**
23
+ * Perform a read-only contract call (eth_call).
24
+ * @param to - Contract address (hex)
25
+ * @param data - ABI-encoded call data (hex)
26
+ * @param block - Block number or "latest" (default: "latest")
27
+ */
28
+ async callContract(to, data, block) {
29
+ const result = await this.rpc.call('eth_call', [
30
+ { to, data },
31
+ block ?? 'latest',
32
+ ]);
33
+ return { data: result };
34
+ }
35
+ /**
36
+ * ABI-encode a function call.
37
+ * @param functionSig - Function signature (e.g., "transfer(address,uint256)")
38
+ * @param args - Function arguments
39
+ * @returns Hex-encoded call data
40
+ */
41
+ async encodeFunction(functionSig, args) {
42
+ return this.rpc.call('tenzro_encodeFunction', [
43
+ { function_sig: functionSig, args },
44
+ ]);
45
+ }
46
+ /**
47
+ * Decode ABI-encoded return data.
48
+ * @param data - Hex-encoded return data
49
+ * @param outputTypes - Expected output types (e.g., ["uint256", "address"])
50
+ * @returns Decoded values
51
+ */
52
+ async decodeResult(data, outputTypes) {
53
+ return this.rpc.call('tenzro_decodeResult', [
54
+ { data, output_types: outputTypes },
55
+ ]);
56
+ }
57
+ }
58
+ exports.ContractClient = ContractClient;
59
+ //# sourceMappingURL=contract.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contract.js","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":";;;AAwCA,eAAe;AAEf;;;GAGG;AACH,MAAa,cAAc;IACI;IAA7B,YAA6B,GAAc;QAAd,QAAG,GAAH,GAAG,CAAW;IAAG,CAAC;IAE/C;;;;OAIG;IACH,KAAK,CAAC,MAAM,CAAC,MAA4B;QACvC,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAe,uBAAuB,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IACxE,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,YAAY,CAAC,EAAU,EAAE,IAAY,EAAE,KAAc;QACzD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,IAAI,CAAS,UAAU,EAAE;YACrD,EAAE,EAAE,EAAE,IAAI,EAAE;YACZ,KAAK,IAAI,QAAQ;SAClB,CAAC,CAAC;QACH,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;IAC1B,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,cAAc,CAAC,WAAmB,EAAE,IAAe;QACvD,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAS,uBAAuB,EAAE;YACpD,EAAE,YAAY,EAAE,WAAW,EAAE,IAAI,EAAE;SACpC,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,YAAY,CAAC,IAAY,EAAE,WAAqB;QACpD,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAY,qBAAqB,EAAE;YACrD,EAAE,IAAI,EAAE,YAAY,EAAE,WAAW,EAAE;SACpC,CAAC,CAAC;IACL,CAAC;CACF;AAjDD,wCAiDC"}
@@ -0,0 +1,112 @@
1
+ import type { RpcClient } from './rpc';
2
+ /** Result of a message signing operation. */
3
+ export interface SignatureResult {
4
+ /** Hex-encoded signature */
5
+ signature: string;
6
+ /** Hex-encoded public key of the signer */
7
+ public_key: string;
8
+ }
9
+ /** Result of a signature verification. */
10
+ export interface VerifyResult {
11
+ /** Whether the signature is valid */
12
+ valid: boolean;
13
+ }
14
+ /** Result of an encryption operation. */
15
+ export interface EncryptResult {
16
+ /** Hex-encoded ciphertext */
17
+ ciphertext: string;
18
+ /** Hex-encoded nonce (12 bytes) */
19
+ nonce: string;
20
+ }
21
+ /** Result of a decryption operation. */
22
+ export interface DecryptResult {
23
+ /** Hex-encoded plaintext */
24
+ plaintext: string;
25
+ }
26
+ /** Key derived from a password. */
27
+ export interface DerivedKey {
28
+ /** Hex-encoded derived key */
29
+ key: string;
30
+ /** Hex-encoded salt */
31
+ salt: string;
32
+ }
33
+ /** Generated keypair. */
34
+ export interface KeyPair {
35
+ /** Hex-encoded public key */
36
+ public_key: string;
37
+ /** Hex-encoded private key */
38
+ private_key: string;
39
+ /** Key algorithm ("ed25519" or "secp256k1") */
40
+ key_type: string;
41
+ }
42
+ /** Shared secret from X25519 key exchange. */
43
+ export interface SharedSecret {
44
+ /** Hex-encoded shared secret (32 bytes) */
45
+ secret: string;
46
+ }
47
+ /**
48
+ * Client for cryptographic operations.
49
+ *
50
+ * Provides signing, verification, encryption, hashing, key generation,
51
+ * and X25519 Diffie-Hellman key exchange.
52
+ */
53
+ export declare class CryptoClient {
54
+ private readonly rpc;
55
+ constructor(rpc: RpcClient);
56
+ /**
57
+ * Sign a message using Ed25519 or Secp256k1.
58
+ * @param privateKey - Hex-encoded private key
59
+ * @param message - Hex-encoded message bytes
60
+ */
61
+ signMessage(privateKey: string, message: string): Promise<SignatureResult>;
62
+ /**
63
+ * Verify a signature against a message and public key.
64
+ * @param publicKey - Hex-encoded public key
65
+ * @param message - Hex-encoded message bytes
66
+ * @param signature - Hex-encoded signature
67
+ */
68
+ verifySignature(publicKey: string, message: string, signature: string): Promise<VerifyResult>;
69
+ /**
70
+ * Encrypt data using AES-256-GCM.
71
+ * @param key - Hex-encoded 256-bit encryption key
72
+ * @param plaintext - Hex-encoded plaintext
73
+ */
74
+ encrypt(key: string, plaintext: string): Promise<EncryptResult>;
75
+ /**
76
+ * Decrypt data using AES-256-GCM.
77
+ * @param key - Hex-encoded 256-bit encryption key
78
+ * @param ciphertext - Hex-encoded ciphertext
79
+ * @param nonce - Hex-encoded 12-byte nonce
80
+ */
81
+ decrypt(key: string, ciphertext: string, nonce: string): Promise<DecryptResult>;
82
+ /**
83
+ * Derive a key from a password using Argon2id (64MB, 3 iterations).
84
+ * @param password - Password to derive key from
85
+ * @param salt - Hex-encoded salt (16 bytes recommended)
86
+ */
87
+ deriveKey(password: string, salt: string): Promise<DerivedKey>;
88
+ /**
89
+ * Generate a new Ed25519 or Secp256k1 keypair.
90
+ * @param keyType - "ed25519" or "secp256k1"
91
+ */
92
+ generateKeypair(keyType: 'ed25519' | 'secp256k1'): Promise<KeyPair>;
93
+ /**
94
+ * Compute SHA-256 hash.
95
+ * @param data - Hex-encoded data
96
+ * @returns Hex-encoded hash
97
+ */
98
+ hashSha256(data: string): Promise<string>;
99
+ /**
100
+ * Compute Keccak-256 hash (Ethereum compatible).
101
+ * @param data - Hex-encoded data
102
+ * @returns Hex-encoded hash
103
+ */
104
+ hashKeccak256(data: string): Promise<string>;
105
+ /**
106
+ * Perform X25519 Diffie-Hellman key exchange.
107
+ * @param privateKey - Hex-encoded X25519 private key
108
+ * @param publicKey - Hex-encoded X25519 public key of the peer
109
+ */
110
+ x25519KeyExchange(privateKey: string, publicKey: string): Promise<SharedSecret>;
111
+ }
112
+ //# sourceMappingURL=crypto.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file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O,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IAMnG;;;;OAIG;IACG,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAIrE;;;;;OAKG;IACG,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAIrF;;;;OAIG;IACG,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAIpE;;;OAGG;IACG,eAAe,CAAC,OAAO,EAAE,SAAS,GAAG,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC;IAIzE;;;;OAIG;IACG,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAI/C;;;;OAIG;IACG,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAIlD;;;;OAIG;IACG,iBAAiB,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;CAKtF"}
package/dist/crypto.js ADDED
@@ -0,0 +1,97 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CryptoClient = void 0;
4
+ // ── Client ──
5
+ /**
6
+ * Client for cryptographic operations.
7
+ *
8
+ * Provides signing, verification, encryption, hashing, key generation,
9
+ * and X25519 Diffie-Hellman key exchange.
10
+ */
11
+ class CryptoClient {
12
+ rpc;
13
+ constructor(rpc) {
14
+ this.rpc = rpc;
15
+ }
16
+ /**
17
+ * Sign a message using Ed25519 or Secp256k1.
18
+ * @param privateKey - Hex-encoded private key
19
+ * @param message - Hex-encoded message bytes
20
+ */
21
+ async signMessage(privateKey, message) {
22
+ return this.rpc.call('tenzro_signMessage', [
23
+ { private_key: privateKey, message },
24
+ ]);
25
+ }
26
+ /**
27
+ * Verify a signature against a message and public key.
28
+ * @param publicKey - Hex-encoded public key
29
+ * @param message - Hex-encoded message bytes
30
+ * @param signature - Hex-encoded signature
31
+ */
32
+ async verifySignature(publicKey, message, signature) {
33
+ return this.rpc.call('tenzro_verifySignature', [
34
+ { public_key: publicKey, message, signature },
35
+ ]);
36
+ }
37
+ /**
38
+ * Encrypt data using AES-256-GCM.
39
+ * @param key - Hex-encoded 256-bit encryption key
40
+ * @param plaintext - Hex-encoded plaintext
41
+ */
42
+ async encrypt(key, plaintext) {
43
+ return this.rpc.call('tenzro_encrypt', [{ key, plaintext }]);
44
+ }
45
+ /**
46
+ * Decrypt data using AES-256-GCM.
47
+ * @param key - Hex-encoded 256-bit encryption key
48
+ * @param ciphertext - Hex-encoded ciphertext
49
+ * @param nonce - Hex-encoded 12-byte nonce
50
+ */
51
+ async decrypt(key, ciphertext, nonce) {
52
+ return this.rpc.call('tenzro_decrypt', [{ key, ciphertext, nonce }]);
53
+ }
54
+ /**
55
+ * Derive a key from a password using Argon2id (64MB, 3 iterations).
56
+ * @param password - Password to derive key from
57
+ * @param salt - Hex-encoded salt (16 bytes recommended)
58
+ */
59
+ async deriveKey(password, salt) {
60
+ return this.rpc.call('tenzro_deriveKey', [{ password, salt }]);
61
+ }
62
+ /**
63
+ * Generate a new Ed25519 or Secp256k1 keypair.
64
+ * @param keyType - "ed25519" or "secp256k1"
65
+ */
66
+ async generateKeypair(keyType) {
67
+ return this.rpc.call('tenzro_generateKeypair', [{ key_type: keyType }]);
68
+ }
69
+ /**
70
+ * Compute SHA-256 hash.
71
+ * @param data - Hex-encoded data
72
+ * @returns Hex-encoded hash
73
+ */
74
+ async hashSha256(data) {
75
+ return this.rpc.call('tenzro_hashSha256', [{ data }]);
76
+ }
77
+ /**
78
+ * Compute Keccak-256 hash (Ethereum compatible).
79
+ * @param data - Hex-encoded data
80
+ * @returns Hex-encoded hash
81
+ */
82
+ async hashKeccak256(data) {
83
+ return this.rpc.call('tenzro_hashKeccak256', [{ data }]);
84
+ }
85
+ /**
86
+ * Perform X25519 Diffie-Hellman key exchange.
87
+ * @param privateKey - Hex-encoded X25519 private key
88
+ * @param publicKey - Hex-encoded X25519 public key of the peer
89
+ */
90
+ async x25519KeyExchange(privateKey, publicKey) {
91
+ return this.rpc.call('tenzro_x25519KeyExchange', [
92
+ { private_key: privateKey, public_key: publicKey },
93
+ ]);
94
+ }
95
+ }
96
+ exports.CryptoClient = CryptoClient;
97
+ //# sourceMappingURL=crypto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"crypto.js","sourceRoot":"","sources":["../src/crypto.ts"],"names":[],"mappings":";;;AAwDA,eAAe;AAEf;;;;;GAKG;AACH,MAAa,YAAY;IACM;IAA7B,YAA6B,GAAc;QAAd,QAAG,GAAH,GAAG,CAAW;IAAG,CAAC;IAE/C;;;;OAIG;IACH,KAAK,CAAC,WAAW,CAAC,UAAkB,EAAE,OAAe;QACnD,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAkB,oBAAoB,EAAE;YAC1D,EAAE,WAAW,EAAE,UAAU,EAAE,OAAO,EAAE;SACrC,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,eAAe,CAAC,SAAiB,EAAE,OAAe,EAAE,SAAiB;QACzE,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAe,wBAAwB,EAAE;YAC3D,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE;SAC9C,CAAC,CAAC;IACL,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,OAAO,CAAC,GAAW,EAAE,SAAiB;QAC1C,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAgB,gBAAgB,EAAE,CAAC,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC;IAC9E,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,OAAO,CAAC,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 wallet_id: string;
6
+ /** Wallet address (hex) */
7
+ address: string;
8
+ /** Signing threshold (e.g., 2) */
9
+ threshold: number;
10
+ /** Total number of key shares (e.g., 3) */
11
+ total_shares: number;
12
+ }
13
+ /** Encrypted keystore export. */
14
+ export interface EncryptedKeystore {
15
+ /** Encrypted keystore data (JSON string) */
16
+ encrypted: string;
17
+ /** Key derivation function used ("argon2id") */
18
+ kdf: string;
19
+ /** Cipher used ("aes-256-gcm") */
20
+ cipher: string;
21
+ }
22
+ /** Key share metadata (not the actual share material). */
23
+ export interface KeyShare {
24
+ /** Share index (1-based) */
25
+ index: number;
26
+ /** When this share was created */
27
+ created_at: string;
28
+ }
29
+ /** Result of a key rotation operation. */
30
+ export interface RotationResult {
31
+ /** Whether the rotation succeeded */
32
+ success: boolean;
33
+ /** Number of shares rotated */
34
+ shares_rotated: number;
35
+ /** New rotation epoch */
36
+ epoch: number;
37
+ }
38
+ /** Wallet spending policy. */
39
+ export interface SpendingPolicy {
40
+ /** Maximum daily spending (in smallest unit, as string for BigInt support) */
41
+ daily_limit: string;
42
+ /** Maximum per-transaction spending (in smallest unit, as string) */
43
+ per_tx_limit: string;
44
+ /** Amount already spent today (in smallest unit, as string) */
45
+ daily_spent: string;
46
+ }
47
+ /** Scoped session key for temporary wallet access. */
48
+ export interface SessionKey {
49
+ /** Session key identifier */
50
+ session_id: string;
51
+ /** When the session expires (ISO 8601) */
52
+ expires_at: string;
53
+ /** Allowed operations */
54
+ operations: string[];
55
+ }
56
+ /**
57
+ * Client for key custody and wallet security operations.
58
+ *
59
+ * Provides MPC wallet creation, keystore management, key rotation,
60
+ * spending policies, and session key authorization.
61
+ */
62
+ export declare class CustodyClient {
63
+ private readonly rpc;
64
+ constructor(rpc: RpcClient);
65
+ /**
66
+ * Create a new MPC threshold wallet.
67
+ * @param threshold - Minimum number of shares required to sign
68
+ * @param totalShares - Total number of key shares
69
+ * @param keyType - "ed25519" or "secp256k1"
70
+ */
71
+ createMpcWallet(threshold: number, totalShares: number, keyType: 'ed25519' | 'secp256k1'): Promise<MpcWallet>;
72
+ /**
73
+ * Export an encrypted keystore (Argon2id + AES-256-GCM).
74
+ * @param walletId - Wallet identifier
75
+ * @param password - Password to encrypt the keystore
76
+ */
77
+ exportKeystore(walletId: string, password: string): Promise<EncryptedKeystore>;
78
+ /**
79
+ * Import a wallet from an encrypted keystore.
80
+ * @param keystore - Encrypted keystore JSON string
81
+ * @param password - Password to decrypt the keystore
82
+ */
83
+ importKeystore(keystore: string, password: string): Promise<MpcWallet>;
84
+ /**
85
+ * Get key share metadata (not the actual shares).
86
+ * @param walletId - Wallet identifier
87
+ */
88
+ getKeyShares(walletId: string): Promise<KeyShare[]>;
89
+ /**
90
+ * Rotate MPC key shares (same public key, new shares).
91
+ * @param walletId - Wallet identifier
92
+ */
93
+ rotateKeys(walletId: string): Promise<RotationResult>;
94
+ /**
95
+ * Set spending limits for a wallet.
96
+ * @param walletId - Wallet identifier
97
+ * @param dailyLimit - Maximum daily spending (in smallest unit)
98
+ * @param perTxLimit - Maximum per-transaction spending
99
+ */
100
+ setSpendingLimits(walletId: string, dailyLimit: bigint, perTxLimit: bigint): Promise<SpendingPolicy>;
101
+ /**
102
+ * Get current spending limits for a wallet.
103
+ * @param walletId - Wallet identifier
104
+ */
105
+ getSpendingLimits(walletId: string): Promise<SpendingPolicy>;
106
+ /**
107
+ * Create a session key with scoped permissions.
108
+ * @param walletId - Wallet identifier
109
+ * @param durationSecs - Session validity duration in seconds
110
+ * @param operations - Allowed operations (e.g., "transfer", "stake")
111
+ */
112
+ authorizeSession(walletId: string, durationSecs: number, operations: string[]): Promise<SessionKey>;
113
+ }
114
+ //# sourceMappingURL=custody.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"custody.d.ts","sourceRoot":"","sources":["../src/custody.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvC,wCAAwC;AACxC,MAAM,WAAW,SAAS;IACxB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E,SAAS,GAAG,WAAW,GAC/B,OAAO,CAAC,SAAS,CAAC;IAMrB;;;;OAIG;IACG,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAMpF;;;;OAIG;IACG,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC;IAI5E;;;OAGG;IACG,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IAIzD;;;OAGG;IACG,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAI3D;;;;;OAKG;IACG,iBAAiB,CACrB,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,cAAc,CAAC;IAU1B;;;OAGG;IACG,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAMlE;;;;;OAKG;IACG,gBAAgB,CACpB,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,MAAM,EAAE,GACnB,OAAO,CAAC,UAAU,CAAC;CAKvB"}
@@ -0,0 +1,96 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CustodyClient = void 0;
4
+ // ── Client ──
5
+ /**
6
+ * Client for key custody and wallet security operations.
7
+ *
8
+ * Provides MPC wallet creation, keystore management, key rotation,
9
+ * spending policies, and session key authorization.
10
+ */
11
+ class CustodyClient {
12
+ rpc;
13
+ constructor(rpc) {
14
+ this.rpc = rpc;
15
+ }
16
+ /**
17
+ * Create a new MPC threshold wallet.
18
+ * @param threshold - Minimum number of shares required to sign
19
+ * @param totalShares - Total number of key shares
20
+ * @param keyType - "ed25519" or "secp256k1"
21
+ */
22
+ async createMpcWallet(threshold, totalShares, keyType) {
23
+ return this.rpc.call('tenzro_createMpcWallet', [
24
+ { threshold, total_shares: totalShares, key_type: keyType },
25
+ ]);
26
+ }
27
+ /**
28
+ * Export an encrypted keystore (Argon2id + AES-256-GCM).
29
+ * @param walletId - Wallet identifier
30
+ * @param password - Password to encrypt the keystore
31
+ */
32
+ async exportKeystore(walletId, password) {
33
+ return this.rpc.call('tenzro_exportKeystore', [
34
+ { wallet_id: walletId, password },
35
+ ]);
36
+ }
37
+ /**
38
+ * Import a wallet from an encrypted keystore.
39
+ * @param keystore - Encrypted keystore JSON string
40
+ * @param password - Password to decrypt the keystore
41
+ */
42
+ async importKeystore(keystore, password) {
43
+ return this.rpc.call('tenzro_importKeystore', [{ keystore, password }]);
44
+ }
45
+ /**
46
+ * Get key share metadata (not the actual shares).
47
+ * @param walletId - Wallet identifier
48
+ */
49
+ async getKeyShares(walletId) {
50
+ return this.rpc.call('tenzro_getKeyShares', [{ wallet_id: walletId }]);
51
+ }
52
+ /**
53
+ * Rotate MPC key shares (same public key, new shares).
54
+ * @param walletId - Wallet identifier
55
+ */
56
+ async rotateKeys(walletId) {
57
+ return this.rpc.call('tenzro_rotateKeys', [{ wallet_id: walletId }]);
58
+ }
59
+ /**
60
+ * Set spending limits for a wallet.
61
+ * @param walletId - Wallet identifier
62
+ * @param dailyLimit - Maximum daily spending (in smallest unit)
63
+ * @param perTxLimit - Maximum per-transaction spending
64
+ */
65
+ async setSpendingLimits(walletId, dailyLimit, perTxLimit) {
66
+ return this.rpc.call('tenzro_setSpendingLimits', [
67
+ {
68
+ wallet_id: walletId,
69
+ daily_limit: dailyLimit.toString(),
70
+ per_tx_limit: perTxLimit.toString(),
71
+ },
72
+ ]);
73
+ }
74
+ /**
75
+ * Get current spending limits for a wallet.
76
+ * @param walletId - Wallet identifier
77
+ */
78
+ async getSpendingLimits(walletId) {
79
+ return this.rpc.call('tenzro_getSpendingLimits', [
80
+ { wallet_id: walletId },
81
+ ]);
82
+ }
83
+ /**
84
+ * Create a session key with scoped permissions.
85
+ * @param walletId - Wallet identifier
86
+ * @param durationSecs - Session validity duration in seconds
87
+ * @param operations - Allowed operations (e.g., "transfer", "stake")
88
+ */
89
+ async authorizeSession(walletId, durationSecs, operations) {
90
+ return this.rpc.call('tenzro_authorizeSession', [
91
+ { wallet_id: walletId, duration_secs: durationSecs, operations },
92
+ ]);
93
+ }
94
+ }
95
+ exports.CustodyClient = CustodyClient;
96
+ //# sourceMappingURL=custody.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"custody.js","sourceRoot":"","sources":["../src/custody.ts"],"names":[],"mappings":";;;AAgEA,eAAe;AAEf;;;;;GAKG;AACH,MAAa,aAAa;IACK;IAA7B,YAA6B,GAAc;QAAd,QAAG,GAAH,GAAG,CAAW;IAAG,CAAC;IAE/C;;;;;OAKG;IACH,KAAK,CAAC,eAAe,CACnB,SAAiB,EACjB,WAAmB,EACnB,OAAgC;QAEhC,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAY,wBAAwB,EAAE;YACxD,EAAE,SAAS,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,OAAO,EAAE;SAC5D,CAAC,CAAC;IACL,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,cAAc,CAAC,QAAgB,EAAE,QAAgB;QACrD,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAoB,uBAAuB,EAAE;YAC/D,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE;SAClC,CAAC,CAAC;IACL,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,cAAc,CAAC,QAAgB,EAAE,QAAgB;QACrD,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAY,uBAAuB,EAAE,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC;IACrF,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,YAAY,CAAC,QAAgB;QACjC,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CA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