@cloak.ag/sdk 1.0.2 → 1.0.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.
package/dist/index.d.cts CHANGED
@@ -516,12 +516,11 @@ declare class CloakSDK {
516
516
  private wallet?;
517
517
  private cloakKeys?;
518
518
  private indexer;
519
- private artifactProver;
520
519
  private relay;
521
520
  private depositRecovery;
522
521
  private storage;
523
522
  /**
524
- * Create a new Cloak SDK client
523
+ * Create a new Cloak SDK client
525
524
  *
526
525
  * @param config - Client configuration
527
526
  *
@@ -1004,8 +1003,11 @@ declare function poseidonHash(inputs: bigint[]): Promise<bigint>;
1004
1003
  declare function splitTo2Limbs(value: bigint): [bigint, bigint];
1005
1004
  /**
1006
1005
  * Convert a PublicKey (32 bytes) to two 128-bit limbs
1006
+ * Uses duck typing to handle cross-module PublicKey instances
1007
1007
  */
1008
- declare function pubkeyToLimbs(pubkey: Uint8Array | PublicKey): [bigint, bigint];
1008
+ declare function pubkeyToLimbs(pubkey: Uint8Array | PublicKey | {
1009
+ toBytes: () => Uint8Array;
1010
+ }): [bigint, bigint];
1009
1011
  /**
1010
1012
  * Compute Merkle root from leaf and path
1011
1013
  *
@@ -1514,84 +1516,6 @@ declare class IndexerService {
1514
1516
  }>;
1515
1517
  }
1516
1518
 
1517
- /**
1518
- * Options for artifact-based proof generation
1519
- */
1520
- interface ArtifactProofGenerationOptions {
1521
- /** Progress callback - called with percentage (0-100) */
1522
- onProgress?: (progress: number) => void;
1523
- /** Called when proof generation starts */
1524
- onStart?: () => void;
1525
- /** Called on successful proof generation */
1526
- onSuccess?: (result: SP1ProofResult) => void;
1527
- /** Called on error */
1528
- onError?: (error: string) => void;
1529
- /** Custom timeout in milliseconds */
1530
- timeout?: number;
1531
- /** Polling interval for proof status (default: 2000ms) */
1532
- pollInterval?: number;
1533
- }
1534
- /**
1535
- * Artifact-based Prover Service
1536
- *
1537
- * Implements the artifact-based proof generation flow where private inputs
1538
- * are uploaded directly to the TEE, never passing through the backend in plaintext.
1539
- *
1540
- * Flow:
1541
- * 1. Create artifact → get artifact_id and upload_url
1542
- * 2. Upload stdin directly to TEE (bypassing backend)
1543
- * 3. Request proof generation (backend only gets artifact_id)
1544
- * 4. Poll for proof status until ready
1545
- *
1546
- * ✅ PRIVACY: Private inputs never pass through backend in plaintext
1547
- */
1548
- declare class ArtifactProverService {
1549
- private indexerUrl;
1550
- private timeout;
1551
- private pollInterval;
1552
- /**
1553
- * Create a new Artifact Prover Service client
1554
- *
1555
- * @param indexerUrl - Indexer service base URL
1556
- * @param timeout - Proof generation timeout in ms (default: 5 minutes)
1557
- * @param pollInterval - Polling interval for status checks (default: 2 seconds)
1558
- */
1559
- constructor(indexerUrl: string, timeout?: number, pollInterval?: number);
1560
- /**
1561
- * Generate a zero-knowledge proof using artifact-based flow
1562
- *
1563
- * This process typically takes 30-180 seconds depending on the TEE.
1564
- * Private inputs are uploaded directly to TEE, never passing through backend.
1565
- *
1566
- * @param inputs - Circuit inputs (private + public + outputs)
1567
- * @param options - Optional progress tracking and callbacks
1568
- * @returns Proof result with hex-encoded proof and public inputs
1569
- *
1570
- * @example
1571
- * ```typescript
1572
- * const result = await prover.generateProof(inputs);
1573
- * if (result.success) {
1574
- * console.log(`Proof: ${result.proof}`);
1575
- * }
1576
- * ```
1577
- */
1578
- generateProof(inputs: SP1ProofInputs, options?: ArtifactProofGenerationOptions): Promise<SP1ProofResult>;
1579
- /**
1580
- * Check if the artifact prover service is available
1581
- *
1582
- * @returns True if service is healthy
1583
- */
1584
- healthCheck(): Promise<boolean>;
1585
- /**
1586
- * Get the configured timeout
1587
- */
1588
- getTimeout(): number;
1589
- /**
1590
- * Set a new timeout
1591
- */
1592
- setTimeout(timeout: number): void;
1593
- }
1594
-
1595
1519
  /**
1596
1520
  * Options for proof generation
1597
1521
  */
@@ -2083,4 +2007,4 @@ declare function generateWithdrawSwapProof(inputs: WithdrawSwapInputs, circuitsP
2083
2007
 
2084
2008
  declare const VERSION = "1.0.0";
2085
2009
 
2086
- export { type ArtifactProofGenerationOptions, ArtifactProverService, CLOAK_PROGRAM_ID, type CloakConfig, CloakError, type CloakKeyPair, type CloakNote, CloakSDK, type DepositInstructionParams, type DepositOptions, DepositRecoveryService, type DepositResult, type DepositStatus, type EncryptedNote, FIXED_FEE_LAMPORTS, type Groth16Proof, IndexerService, LAMPORTS_PER_SOL, LocalStorageAdapter, type MasterKey, type MaxLengthArray, MemoryStorageAdapter, type MerkleProof, type MerkleRootResponse, type Network, type NoteData, type NotesRangeResponse, type ProofGenerationOptions, type ProofResult, ProverService, type RecoveryOptions, type RecoveryResult, RelayService, type SP1ProofInputs, type SP1ProofResult, type ScanNotesOptions, type ScannedNote, type ShieldPoolPDAs, type SpendKey, type StorageAdapter, type SwapOptions, type SwapParams, type SwapResult, type Transfer, type TransferOptions, type TransferResult, type TxStatus, VARIABLE_FEE_RATE, VERSION, type ViewKey, type WalletAdapter, type WithdrawOptions, type WithdrawRegularInputs, type WithdrawSwapInputs, bigintToBytes32, buildPublicInputsBytes, bytesToHex, calculateFee, calculateRelayFee, computeCommitment, computeMerkleRoot, computeNullifier, computeNullifierAsync, computeNullifierSync, computeOutputsHash, computeOutputsHashAsync, computeOutputsHashSync, computeSwapOutputsHash, computeSwapOutputsHashAsync, computeSwapOutputsHashSync, copyNoteToClipboard, createCloakError, createDepositInstruction, deriveSpendKey, deriveViewKey, detectNetworkFromRpcUrl, downloadNote, encodeNoteSimple, encryptNoteForRecipient, exportKeys, exportNote, exportWalletKeys, filterNotesByNetwork, filterWithdrawableNotes, findNoteByCommitment, formatAmount, formatErrorForLogging, generateCloakKeys, generateCommitment, generateCommitmentAsync, generateMasterSeed, generateNote, generateNoteFromWallet, generateWithdrawRegularProof, generateWithdrawSwapProof, getAddressExplorerUrl, getDistributableAmount, getExplorerUrl, getPublicKey, getPublicViewKey, getRecipientAmount, getRpcUrlForNetwork, getShieldPoolPDAs, getViewKey, hexToBigint, hexToBytes, importKeys, importWalletKeys, isValidHex, isValidRpcUrl, isValidSolanaAddress, isWithdrawable, keypairToAdapter, parseAmount, parseNote, parseTransactionError, poseidonHash, prepareEncryptedOutput, prepareEncryptedOutputForRecipient, proofToBytes, pubkeyToLimbs, randomBytes, scanNotesForWallet, sendTransaction, serializeNote, signTransaction, splitTo2Limbs, tryDecryptNote, updateNoteWithDeposit, validateDepositParams, validateNote, validateOutputsSum, validateTransfers, validateWalletConnected, validateWithdrawableNote };
2010
+ export { CLOAK_PROGRAM_ID, type CloakConfig, CloakError, type CloakKeyPair, type CloakNote, CloakSDK, type DepositInstructionParams, type DepositOptions, DepositRecoveryService, type DepositResult, type DepositStatus, type EncryptedNote, FIXED_FEE_LAMPORTS, type Groth16Proof, IndexerService, LAMPORTS_PER_SOL, LocalStorageAdapter, type MasterKey, type MaxLengthArray, MemoryStorageAdapter, type MerkleProof, type MerkleRootResponse, type Network, type NoteData, type NotesRangeResponse, type ProofGenerationOptions, type ProofResult, ProverService, type RecoveryOptions, type RecoveryResult, RelayService, type SP1ProofInputs, type SP1ProofResult, type ScanNotesOptions, type ScannedNote, type ShieldPoolPDAs, type SpendKey, type StorageAdapter, type SwapOptions, type SwapParams, type SwapResult, type Transfer, type TransferOptions, type TransferResult, type TxStatus, VARIABLE_FEE_RATE, VERSION, type ViewKey, type WalletAdapter, type WithdrawOptions, type WithdrawRegularInputs, type WithdrawSwapInputs, bigintToBytes32, buildPublicInputsBytes, bytesToHex, calculateFee, calculateRelayFee, computeCommitment, computeMerkleRoot, computeNullifier, computeNullifierAsync, computeNullifierSync, computeOutputsHash, computeOutputsHashAsync, computeOutputsHashSync, computeSwapOutputsHash, computeSwapOutputsHashAsync, computeSwapOutputsHashSync, copyNoteToClipboard, createCloakError, createDepositInstruction, deriveSpendKey, deriveViewKey, detectNetworkFromRpcUrl, downloadNote, encodeNoteSimple, encryptNoteForRecipient, exportKeys, exportNote, exportWalletKeys, filterNotesByNetwork, filterWithdrawableNotes, findNoteByCommitment, formatAmount, formatErrorForLogging, generateCloakKeys, generateCommitment, generateCommitmentAsync, generateMasterSeed, generateNote, generateNoteFromWallet, generateWithdrawRegularProof, generateWithdrawSwapProof, getAddressExplorerUrl, getDistributableAmount, getExplorerUrl, getPublicKey, getPublicViewKey, getRecipientAmount, getRpcUrlForNetwork, getShieldPoolPDAs, getViewKey, hexToBigint, hexToBytes, importKeys, importWalletKeys, isValidHex, isValidRpcUrl, isValidSolanaAddress, isWithdrawable, keypairToAdapter, parseAmount, parseNote, parseTransactionError, poseidonHash, prepareEncryptedOutput, prepareEncryptedOutputForRecipient, proofToBytes, pubkeyToLimbs, randomBytes, scanNotesForWallet, sendTransaction, serializeNote, signTransaction, splitTo2Limbs, tryDecryptNote, updateNoteWithDeposit, validateDepositParams, validateNote, validateOutputsSum, validateTransfers, validateWalletConnected, validateWithdrawableNote };
package/dist/index.d.ts CHANGED
@@ -516,12 +516,11 @@ declare class CloakSDK {
516
516
  private wallet?;
517
517
  private cloakKeys?;
518
518
  private indexer;
519
- private artifactProver;
520
519
  private relay;
521
520
  private depositRecovery;
522
521
  private storage;
523
522
  /**
524
- * Create a new Cloak SDK client
523
+ * Create a new Cloak SDK client
525
524
  *
526
525
  * @param config - Client configuration
527
526
  *
@@ -1004,8 +1003,11 @@ declare function poseidonHash(inputs: bigint[]): Promise<bigint>;
1004
1003
  declare function splitTo2Limbs(value: bigint): [bigint, bigint];
1005
1004
  /**
1006
1005
  * Convert a PublicKey (32 bytes) to two 128-bit limbs
1006
+ * Uses duck typing to handle cross-module PublicKey instances
1007
1007
  */
1008
- declare function pubkeyToLimbs(pubkey: Uint8Array | PublicKey): [bigint, bigint];
1008
+ declare function pubkeyToLimbs(pubkey: Uint8Array | PublicKey | {
1009
+ toBytes: () => Uint8Array;
1010
+ }): [bigint, bigint];
1009
1011
  /**
1010
1012
  * Compute Merkle root from leaf and path
1011
1013
  *
@@ -1514,84 +1516,6 @@ declare class IndexerService {
1514
1516
  }>;
1515
1517
  }
1516
1518
 
1517
- /**
1518
- * Options for artifact-based proof generation
1519
- */
1520
- interface ArtifactProofGenerationOptions {
1521
- /** Progress callback - called with percentage (0-100) */
1522
- onProgress?: (progress: number) => void;
1523
- /** Called when proof generation starts */
1524
- onStart?: () => void;
1525
- /** Called on successful proof generation */
1526
- onSuccess?: (result: SP1ProofResult) => void;
1527
- /** Called on error */
1528
- onError?: (error: string) => void;
1529
- /** Custom timeout in milliseconds */
1530
- timeout?: number;
1531
- /** Polling interval for proof status (default: 2000ms) */
1532
- pollInterval?: number;
1533
- }
1534
- /**
1535
- * Artifact-based Prover Service
1536
- *
1537
- * Implements the artifact-based proof generation flow where private inputs
1538
- * are uploaded directly to the TEE, never passing through the backend in plaintext.
1539
- *
1540
- * Flow:
1541
- * 1. Create artifact → get artifact_id and upload_url
1542
- * 2. Upload stdin directly to TEE (bypassing backend)
1543
- * 3. Request proof generation (backend only gets artifact_id)
1544
- * 4. Poll for proof status until ready
1545
- *
1546
- * ✅ PRIVACY: Private inputs never pass through backend in plaintext
1547
- */
1548
- declare class ArtifactProverService {
1549
- private indexerUrl;
1550
- private timeout;
1551
- private pollInterval;
1552
- /**
1553
- * Create a new Artifact Prover Service client
1554
- *
1555
- * @param indexerUrl - Indexer service base URL
1556
- * @param timeout - Proof generation timeout in ms (default: 5 minutes)
1557
- * @param pollInterval - Polling interval for status checks (default: 2 seconds)
1558
- */
1559
- constructor(indexerUrl: string, timeout?: number, pollInterval?: number);
1560
- /**
1561
- * Generate a zero-knowledge proof using artifact-based flow
1562
- *
1563
- * This process typically takes 30-180 seconds depending on the TEE.
1564
- * Private inputs are uploaded directly to TEE, never passing through backend.
1565
- *
1566
- * @param inputs - Circuit inputs (private + public + outputs)
1567
- * @param options - Optional progress tracking and callbacks
1568
- * @returns Proof result with hex-encoded proof and public inputs
1569
- *
1570
- * @example
1571
- * ```typescript
1572
- * const result = await prover.generateProof(inputs);
1573
- * if (result.success) {
1574
- * console.log(`Proof: ${result.proof}`);
1575
- * }
1576
- * ```
1577
- */
1578
- generateProof(inputs: SP1ProofInputs, options?: ArtifactProofGenerationOptions): Promise<SP1ProofResult>;
1579
- /**
1580
- * Check if the artifact prover service is available
1581
- *
1582
- * @returns True if service is healthy
1583
- */
1584
- healthCheck(): Promise<boolean>;
1585
- /**
1586
- * Get the configured timeout
1587
- */
1588
- getTimeout(): number;
1589
- /**
1590
- * Set a new timeout
1591
- */
1592
- setTimeout(timeout: number): void;
1593
- }
1594
-
1595
1519
  /**
1596
1520
  * Options for proof generation
1597
1521
  */
@@ -2083,4 +2007,4 @@ declare function generateWithdrawSwapProof(inputs: WithdrawSwapInputs, circuitsP
2083
2007
 
2084
2008
  declare const VERSION = "1.0.0";
2085
2009
 
2086
- export { type ArtifactProofGenerationOptions, ArtifactProverService, CLOAK_PROGRAM_ID, type CloakConfig, CloakError, type CloakKeyPair, type CloakNote, CloakSDK, type DepositInstructionParams, type DepositOptions, DepositRecoveryService, type DepositResult, type DepositStatus, type EncryptedNote, FIXED_FEE_LAMPORTS, type Groth16Proof, IndexerService, LAMPORTS_PER_SOL, LocalStorageAdapter, type MasterKey, type MaxLengthArray, MemoryStorageAdapter, type MerkleProof, type MerkleRootResponse, type Network, type NoteData, type NotesRangeResponse, type ProofGenerationOptions, type ProofResult, ProverService, type RecoveryOptions, type RecoveryResult, RelayService, type SP1ProofInputs, type SP1ProofResult, type ScanNotesOptions, type ScannedNote, type ShieldPoolPDAs, type SpendKey, type StorageAdapter, type SwapOptions, type SwapParams, type SwapResult, type Transfer, type TransferOptions, type TransferResult, type TxStatus, VARIABLE_FEE_RATE, VERSION, type ViewKey, type WalletAdapter, type WithdrawOptions, type WithdrawRegularInputs, type WithdrawSwapInputs, bigintToBytes32, buildPublicInputsBytes, bytesToHex, calculateFee, calculateRelayFee, computeCommitment, computeMerkleRoot, computeNullifier, computeNullifierAsync, computeNullifierSync, computeOutputsHash, computeOutputsHashAsync, computeOutputsHashSync, computeSwapOutputsHash, computeSwapOutputsHashAsync, computeSwapOutputsHashSync, copyNoteToClipboard, createCloakError, createDepositInstruction, deriveSpendKey, deriveViewKey, detectNetworkFromRpcUrl, downloadNote, encodeNoteSimple, encryptNoteForRecipient, exportKeys, exportNote, exportWalletKeys, filterNotesByNetwork, filterWithdrawableNotes, findNoteByCommitment, formatAmount, formatErrorForLogging, generateCloakKeys, generateCommitment, generateCommitmentAsync, generateMasterSeed, generateNote, generateNoteFromWallet, generateWithdrawRegularProof, generateWithdrawSwapProof, getAddressExplorerUrl, getDistributableAmount, getExplorerUrl, getPublicKey, getPublicViewKey, getRecipientAmount, getRpcUrlForNetwork, getShieldPoolPDAs, getViewKey, hexToBigint, hexToBytes, importKeys, importWalletKeys, isValidHex, isValidRpcUrl, isValidSolanaAddress, isWithdrawable, keypairToAdapter, parseAmount, parseNote, parseTransactionError, poseidonHash, prepareEncryptedOutput, prepareEncryptedOutputForRecipient, proofToBytes, pubkeyToLimbs, randomBytes, scanNotesForWallet, sendTransaction, serializeNote, signTransaction, splitTo2Limbs, tryDecryptNote, updateNoteWithDeposit, validateDepositParams, validateNote, validateOutputsSum, validateTransfers, validateWalletConnected, validateWithdrawableNote };
2010
+ export { CLOAK_PROGRAM_ID, type CloakConfig, CloakError, type CloakKeyPair, type CloakNote, CloakSDK, type DepositInstructionParams, type DepositOptions, DepositRecoveryService, type DepositResult, type DepositStatus, type EncryptedNote, FIXED_FEE_LAMPORTS, type Groth16Proof, IndexerService, LAMPORTS_PER_SOL, LocalStorageAdapter, type MasterKey, type MaxLengthArray, MemoryStorageAdapter, type MerkleProof, type MerkleRootResponse, type Network, type NoteData, type NotesRangeResponse, type ProofGenerationOptions, type ProofResult, ProverService, type RecoveryOptions, type RecoveryResult, RelayService, type SP1ProofInputs, type SP1ProofResult, type ScanNotesOptions, type ScannedNote, type ShieldPoolPDAs, type SpendKey, type StorageAdapter, type SwapOptions, type SwapParams, type SwapResult, type Transfer, type TransferOptions, type TransferResult, type TxStatus, VARIABLE_FEE_RATE, VERSION, type ViewKey, type WalletAdapter, type WithdrawOptions, type WithdrawRegularInputs, type WithdrawSwapInputs, bigintToBytes32, buildPublicInputsBytes, bytesToHex, calculateFee, calculateRelayFee, computeCommitment, computeMerkleRoot, computeNullifier, computeNullifierAsync, computeNullifierSync, computeOutputsHash, computeOutputsHashAsync, computeOutputsHashSync, computeSwapOutputsHash, computeSwapOutputsHashAsync, computeSwapOutputsHashSync, copyNoteToClipboard, createCloakError, createDepositInstruction, deriveSpendKey, deriveViewKey, detectNetworkFromRpcUrl, downloadNote, encodeNoteSimple, encryptNoteForRecipient, exportKeys, exportNote, exportWalletKeys, filterNotesByNetwork, filterWithdrawableNotes, findNoteByCommitment, formatAmount, formatErrorForLogging, generateCloakKeys, generateCommitment, generateCommitmentAsync, generateMasterSeed, generateNote, generateNoteFromWallet, generateWithdrawRegularProof, generateWithdrawSwapProof, getAddressExplorerUrl, getDistributableAmount, getExplorerUrl, getPublicKey, getPublicViewKey, getRecipientAmount, getRpcUrlForNetwork, getShieldPoolPDAs, getViewKey, hexToBigint, hexToBytes, importKeys, importWalletKeys, isValidHex, isValidRpcUrl, isValidSolanaAddress, isWithdrawable, keypairToAdapter, parseAmount, parseNote, parseTransactionError, poseidonHash, prepareEncryptedOutput, prepareEncryptedOutputForRecipient, proofToBytes, pubkeyToLimbs, randomBytes, scanNotesForWallet, sendTransaction, serializeNote, signTransaction, splitTo2Limbs, tryDecryptNote, updateNoteWithDeposit, validateDepositParams, validateNote, validateOutputsSum, validateTransfers, validateWalletConnected, validateWithdrawableNote };