nucypher-experimental-taco-storage
Version:
TypeScript SDK for encrypted data storage with TACo (Threshold Access Control), supporting multiple storage providers including IPFS and SQLite
63 lines • 2.1 kB
TypeScript
import { CID } from 'multiformats/cid';
import { BaseStorageAdapter } from '../base';
import { StorageMetadata } from '../../types';
/**
* Abstract base class for IPFS-based storage adapters.
* Provides common IPFS functionality and validation.
*/
export declare abstract class BaseIPFSAdapter extends BaseStorageAdapter {
/**
* Validates if a string is a valid IPFS hash (CID).
* Supports both CIDv0 (Qm...) and CIDv1 (baf...) formats.
*/
protected validateIPFSHash(hash: string): boolean;
/**
* Parses a CID from a string, with validation.
*/
protected parseCID(hash: string): CID;
/**
* Formats an IPFS hash as a storage reference.
*/
protected formatReference(hash: string): string;
/**
* Extracts IPFS hash from a storage reference.
* Handles both "ipfs://hash" and plain "hash" formats.
*/
protected parseReference(reference: string): string;
/**
* Creates storage metadata with IPFS hash included.
*/
protected createIPFSMetadata(hash: string, originalMetadata: StorageMetadata): StorageMetadata;
/**
* Validates reference format and returns the IPFS hash.
*/
protected validateAndParseReference(reference: string): string;
/**
* Add content to IPFS and return the hash.
*/
protected abstract addContent(data: Uint8Array): Promise<string>;
/**
* Retrieve content from IPFS by hash.
*/
protected abstract getContent(hash: string): Promise<Uint8Array>;
/**
* Pin content in IPFS (if supported).
*/
protected abstract pinContent(hash: string): Promise<void>;
/**
* Unpin content from IPFS (if supported).
*/
protected abstract unpinContent(hash: string): Promise<void>;
/**
* Check if content exists in IPFS.
*/
protected abstract contentExists(hash: string): Promise<boolean>;
/**
* Get health status of the IPFS connection.
*/
protected abstract getIPFSHealth(): Promise<{
connected: boolean;
nodeId?: string;
}>;
}
//# sourceMappingURL=base.d.ts.map