anon-identity
Version:
Decentralized identity framework with DIDs, Verifiable Credentials, and privacy-preserving selective disclosure
76 lines • 3.99 kB
TypeScript
import { IStorageProvider, RevocationList, CredentialSchema, StorageConfig } from '../types';
import { VerifiableCredential } from '../../types';
import { DIDDocument } from '../../types/did';
interface HybridStorageConfig extends StorageConfig {
hybrid?: {
routing?: {
dids?: 'blockchain' | 'ipfs' | 'local';
credentials?: 'blockchain' | 'ipfs' | 'local';
revocations?: 'blockchain' | 'ipfs' | 'local';
schemas?: 'blockchain' | 'ipfs' | 'local';
};
sizeThresholds?: {
useIPFS?: number;
useLocal?: number;
};
sync?: {
enabled: boolean;
interval?: number;
conflictResolution?: 'newest' | 'blockchain' | 'local';
};
fallback?: {
enabled: boolean;
order?: ('blockchain' | 'ipfs' | 'local')[];
retries?: number;
retryDelay?: number;
};
};
}
export declare class HybridStorageProvider implements IStorageProvider {
private providers;
private config;
private syncInterval?;
private dataIndex;
constructor(config: HybridStorageConfig);
private getProviderForDataType;
private executeWithFallback;
private trackDataLocation;
storeDID(did: string, document: DIDDocument): Promise<void>;
resolveDID(did: string): Promise<DIDDocument | null>;
listDIDs(owner?: string): Promise<string[]>;
storeCredential(credential: VerifiableCredential): Promise<void>;
getCredential(id: string): Promise<VerifiableCredential | null>;
listCredentials(holder: string): Promise<VerifiableCredential[]>;
deleteCredential(id: string): Promise<void>;
publishRevocation(issuerDID: string, revocationList: RevocationList): Promise<void>;
checkRevocation(issuerDID: string, credentialId: string): Promise<boolean>;
getRevocationList(issuerDID: string): Promise<RevocationList | null>;
storeKeyPair(identifier: string, encryptedKeyPair: string): Promise<void>;
retrieveKeyPair(identifier: string): Promise<string | null>;
deleteKeyPair(identifier: string): Promise<void>;
registerSchema(schema: CredentialSchema): Promise<string>;
getSchema(schemaId: string): Promise<CredentialSchema | null>;
listSchemas(issuerDID?: string): Promise<CredentialSchema[]>;
clear(): Promise<void>;
private startSync;
private performSync;
private syncData;
storePhoneNumber(userDID: string, phoneNumber: import('../../types').PhoneNumber): Promise<string>;
getPhoneNumber(userDID: string, phoneId: string): Promise<import('../../types').PhoneNumber | null>;
listPhoneNumbers(userDID: string): Promise<import('../../types').PhoneNumber[]>;
updatePhoneNumber(userDID: string, phoneId: string, phoneNumber: Partial<import('../../types').PhoneNumber>): Promise<void>;
deletePhoneNumber(userDID: string, phoneId: string): Promise<void>;
storeAddress(userDID: string, address: import('../../types').Address): Promise<string>;
getAddress(userDID: string, addressId: string): Promise<import('../../types').Address | null>;
listAddresses(userDID: string): Promise<import('../../types').Address[]>;
updateAddress(userDID: string, addressId: string, address: Partial<import('../../types').Address>): Promise<void>;
deleteAddress(userDID: string, addressId: string): Promise<void>;
storeEmailAddress(userDID: string, emailAddress: import('../../types').EmailAddress): Promise<string>;
getEmailAddress(userDID: string, emailId: string): Promise<import('../../types').EmailAddress | null>;
listEmailAddresses(userDID: string): Promise<import('../../types').EmailAddress[]>;
updateEmailAddress(userDID: string, emailId: string, emailAddress: Partial<import('../../types').EmailAddress>): Promise<void>;
deleteEmailAddress(userDID: string, emailId: string): Promise<void>;
destroy(): void;
}
export {};
//# sourceMappingURL=hybrid-storage-provider.d.ts.map