import { SignedCredential } from 'jolocom-lib/js/credentials/signedCredential/signedCredential'; import { JSONWebToken } from 'jolocom-lib/js/interactionTokens/JSONWebToken'; import { InternalDb } from '@jolocom/local-resolver-registrar/js/db'; import { IdentitySummary, CredentialMetadataSummary } from '../types'; import { Identity } from 'jolocom-lib/js/identity/identity'; export interface EncryptedSeedAttributes { encryptedEntropy: string; timestamp: number; } export interface EncryptedWalletAttributes { id: string; encryptedWallet: string; timestamp: number; } export interface CredentialQueryAttrs { id?: string; issuer?: string; subject?: string; type?: string[]; } export declare type CredentialQuery = CredentialQueryAttrs | CredentialQueryAttrs[]; export interface QueryOptions { skip?: number; take?: number; order?: { [k: string]: 'ASC' | 'DESC'; }; } /** * @todo IdentitySummary is a UI type, which can always be * derived from a DID Doc and Public Profile. * Perhaps that's what we should store instead, since those * are more generic and can be reused. */ export interface IStorageStore { setting(key: string, value: any): Promise; verifiableCredential(vCred: SignedCredential): Promise; encryptedWallet(args: EncryptedWalletAttributes): Promise; credentialMetadata(credentialMetadata: CredentialMetadataSummary): Promise; issuerProfile(issuer: IdentitySummary): Promise; identity(identity: Identity): Promise; interactionToken(token: JSONWebToken): Promise; } export interface InteractionTokenQueryAttrs { nonce?: string; type?: string; issuer?: string; } export declare type InteractionTokenQuery = InteractionTokenQueryAttrs | InteractionTokenQueryAttrs[]; export interface InteractionQueryAttrs { id?: string; type?: string; types?: string[]; initiator?: string; responder?: string; } export declare type InteractionQuery = InteractionQueryAttrs | InteractionQueryAttrs[]; export interface IStorageGet { settingsObject(): Promise<{ [key: string]: any; }>; setting(key: string): Promise; verifiableCredential(query?: CredentialQuery, options?: QueryOptions): Promise; encryptedWallet(id?: string): Promise; credentialMetadata(credential: SignedCredential): Promise; credentialMetadataById(id: string): Promise; publicProfile(did: string): Promise; identity(did: string): Promise; interactionTokens(query?: InteractionTokenQuery, options?: QueryOptions): Promise>>; interactionIds(query?: InteractionQuery, options?: QueryOptions): Promise>; } export interface IStorageDelete { verifiableCredential(id: string): Promise; identity(did: string): Promise; encryptedWallet(did: string): Promise; verifiableCredentials(query: CredentialQuery): Promise; interactions(attrs?: InteractionTokenQuery): Promise; } export interface IStorage { get: IStorageGet; store: IStorageStore; delete: IStorageDelete; eventDB: InternalDb; } export interface IPasswordStore { getPassword: () => Promise; } export declare class NaivePasswordStore implements IPasswordStore { private _pass; constructor(); getPassword(): Promise; }