foundry-keystore
Version:
Foundry keystore [](https://travis-ci.org/CodeChain-io/foundry-keystore-js) ===================
66 lines (65 loc) • 1.72 kB
TypeScript
import { Key, PrivateKey, PublicKey, SecretStorage } from "./types";
export { SecretStorage };
export interface KeyStore {
getKeys(): Promise<Key[]>;
importRaw(params: {
privateKey: PrivateKey;
passphrase?: string;
meta?: string;
}): Promise<Key>;
exportKey(params: {
key: Key;
passphrase: string;
}): Promise<SecretStorage>;
importKey(params: {
secret: SecretStorage;
passphrase: string;
}): Promise<Key>;
exportRawKey(params: {
key: Key;
passphrase: string;
}): Promise<PrivateKey>;
getPublicKey(params: {
key: Key;
passphrase: string;
}): Promise<PublicKey | null>;
createKey(params: {
passphrase?: string;
meta?: string;
}): Promise<Key>;
deleteKey(params: {
key: Key;
}): Promise<boolean>;
sign(params: {
key: Key;
message: string;
passphrase: string;
}): Promise<string>;
getMeta(params: {
key: Key;
}): Promise<string>;
save(): Promise<SecretStorage[]>;
load(value: SecretStorage[]): Promise<void>;
clear(): Promise<void>;
}
declare class CCKey {
private context;
static CCKey: typeof CCKey;
static create(params?: {
dbType?: string;
dbPath?: string;
}): Promise<CCKey>;
static exist(params?: {
dbType?: string;
dbPath?: string;
}): Promise<boolean>;
keystore: KeyStore;
private constructor();
getMeta(): Promise<string>;
setMeta(meta: string): Promise<string>;
close(): Promise<void>;
save(): Promise<string>;
load(value: string): Promise<void>;
clear(): Promise<void>;
}
export { CCKey };