@celo/keystores"file-keystore"FileKeystore

Class: FileKeystore

Hierarchy

FileKeystore

Index

Constructors

Methods

Constructors

constructor

+ new FileKeystore(keystoreDir: string): FileKeystore

Defined in file-keystore.ts:10

Creates (but does not overwrite existing) directory for containing keystore entries.

Parameters:

Name Type Description
keystoreDir string Path to directory where keystore will be saved

Returns: FileKeystore

Methods

changeKeystorePassphrase

changeKeystorePassphrase(address: string, oldPassphrase: string, newPassphrase: string): Promise‹void›

Inherited from KeystoreBase.changeKeystorePassphrase

Defined in keystore-base.ts:132

Change secret phrase used to encrypt the private key of an address

Parameters:

Name Type Description
address string Account address
oldPassphrase string Secret phrase used to encrypt the private key
newPassphrase string New secret phrase to re-encrypt the private key

Returns: Promise‹void›


deleteKeystore

deleteKeystore(address: string): Promise‹void›

Inherited from KeystoreBase.deleteKeystore

Defined in keystore-base.ts:145

Permanently removes keystore entry from keystore

Parameters:

Name Type Description
address string Account address of keystore to be deleted

Returns: Promise‹void›


getAddress

getAddress(keystoreName: string): string

Inherited from KeystoreBase.getAddress

Defined in keystore-base.ts:51

Gets the address corresponding to a particular keystore entry

Parameters:

Name Type Description
keystoreName string Name of keystore entry belonging to the address

Returns: string

Account address


getAddressMap

getAddressMap(): Promise‹Record‹string, string››

Inherited from KeystoreBase.getAddressMap

Defined in keystore-base.ts:72

Maps account addresses to their respective keystore entries (names)

Returns: Promise‹Record‹string, string››

Record with account addresses as keys, keystore entry names as values


getAllKeystoreNames

getAllKeystoreNames(): Promise‹string[]›

Overrides KeystoreBase.getAllKeystoreNames

Defined in file-keystore.ts:27

Returns: Promise‹string[]›

List of file names (keystore entries) in the keystore


getKeystoreName

getKeystoreName(address: string): Promise‹string›

Inherited from KeystoreBase.getKeystoreName

Defined in keystore-base.ts:106

Gets name of keystore entry corresponding to an address

Parameters:

Name Type Description
address string Account address

Returns: Promise‹string›

Name of corresponding keystore entry


getPrivateKey

getPrivateKey(address: string, passphrase: string): Promise‹string›

Inherited from KeystoreBase.getPrivateKey

Defined in keystore-base.ts:120

Gets decrypted (plaintext) private key for an account address

Parameters:

Name Type Description
address string Account address
passphrase string Secret phrase used to encrypt the private key

Returns: Promise‹string›


getRawKeystore

getRawKeystore(keystoreName: string): string

Overrides KeystoreBase.getRawKeystore

Defined in file-keystore.ts:45

Gets contents of keystore entry file

Parameters:

Name Type Description
keystoreName string File name of keystore entry

Returns: string

V3Keystore string entry


importPrivateKey

importPrivateKey(privateKey: string, passphrase: string): Promise‹void›

Inherited from KeystoreBase.importPrivateKey

Defined in keystore-base.ts:86

Encrypts and stores a private key as a new keystore entry

Parameters:

Name Type Description
privateKey string Private key to encrypted
passphrase string Secret string to encrypt private key

Returns: Promise‹void›


listKeystoreAddresses

listKeystoreAddresses(): Promise‹string[]›

Inherited from KeystoreBase.listKeystoreAddresses

Defined in keystore-base.ts:64

Gets a list of all account addresses in the keystore

Returns: Promise‹string[]›

List of account address strings


persistKeystore

persistKeystore(keystoreName: string, keystore: string): void

Overrides KeystoreBase.persistKeystore

Defined in file-keystore.ts:36

Saves keystore entries as a file in the keystore directory

Parameters:

Name Type Description
keystoreName string File name of keystore entry
keystore string V3Keystore string entry

Returns: void


removeKeystore

removeKeystore(keystoreName: string): void

Overrides KeystoreBase.removeKeystore

Defined in file-keystore.ts:53

Deletes file keystore entry from directory

Parameters:

Name Type Description
keystoreName string File name of keystore entry to be removed

Returns: void