@ew-did-registry/did-ipfs-store
Version:
IPFS-based implementation of IDidStore
34 lines (33 loc) • 1.2 kB
TypeScript
import { IDidStore } from '@ew-did-registry/did-store-interface';
import { IpfsClientOptions } from './ipfs.types';
/**
* Implements decentralized storage in IPFS
*/
export declare class DidStore implements IDidStore {
private baseUrl;
private headers?;
private apiPath;
private readonly DEFAULT_GET_TIMEOUT;
private readonly DEFAULT_IPFS_API_PATH;
private params;
/**
* @param baseUrl Base url of IPFS API endpoint
* @param opts Connection options of endpoint exposing IPFS API. When connecting to IPFS gateway only `get` method should be used
*/
constructor(baseUrl: string | URL, opts?: IpfsClientOptions);
/**
* @param claim stringified content
*/
save(claim: string): Promise<string>;
/**
* Looks up content identified by `cid`. If no content found during `timeout`, then `ContentNotFound` error is thrown.
* @param cid CID of the content
* @param timeout time limit for getting response, milliseconds
* @returns stringified content
*/
get(cid: string, timeout?: number): Promise<string>;
delete(cid: string): Promise<boolean>;
private add;
private request;
private encodeParams;
}