nucypher-experimental-taco-storage
Version:
TypeScript SDK for encrypted data storage with TACo (Threshold Access Control), supporting multiple storage providers including IPFS and SQLite
58 lines • 2.21 kB
TypeScript
/**
* Core encryption and decryption functionality using TACo
*/
import { conditions, ThresholdMessageKit } from '@nucypher/taco';
import { ethers } from 'ethers';
import { TacoConfig } from '../types';
/**
* Encryption result containing encrypted data and metadata
*/
export interface EncryptionResult {
/** The encrypted message kit */
messageKit: ThresholdMessageKit;
/** Access control conditions */
conditions: any;
}
/**
* Core encryption service using TACo threshold encryption
*/
export declare class TacoEncryptionService {
private readonly config;
private initialized;
constructor(config: TacoConfig);
/**
* Initialize the TACo system
*/
initialize(): Promise<void>;
/**
* Encrypt data using TACo threshold encryption
* @param data - Data to encrypt
* @param condition - Access control condition
* @param provider - Ethereum provider
* @param signer - Ethereum signer for the encryption
* @returns Promise resolving to encryption result
*/
encrypt(data: Uint8Array | string, condition: conditions.condition.Condition, provider: ethers.providers.Provider, signer: ethers.Signer): Promise<EncryptionResult>;
/**
* Decrypt data using TACo threshold decryption
* @param messageKit - ThresholdMessageKit containing encrypted data
* @param provider - Ethereum provider
* @param context - Optional condition context
* @returns Promise resolving to decrypted data
*/
decrypt(messageKit: ThresholdMessageKit, provider: ethers.providers.Provider, context?: conditions.context.ConditionContext): Promise<Uint8Array>;
/**
* Create simple time-based access conditions
* @param endTime - End time for access
* @returns Time-based condition
*/
createTimeCondition(endTime: Date): conditions.condition.Condition;
/**
* Create NFT ownership conditions
* @param contractAddress - NFT contract address
* @param tokenId - Specific token ID (optional)
* @returns NFT ownership condition
*/
createNFTCondition(contractAddress: string, tokenId?: string): conditions.condition.Condition;
}
//# sourceMappingURL=encryption.d.ts.map