mirror of
https://github.com/logos-messaging/js-rln.git
synced 2026-01-02 13:43:06 +00:00
add keys operation to Keystore
This commit is contained in:
parent
eb119aa763
commit
17e48d12da
@ -164,6 +164,14 @@ export class Keystore {
|
||||
return this.data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Read array of hashes of current credentials
|
||||
* @returns array of keys of credentials in current Keystore
|
||||
*/
|
||||
public keys(): string[] {
|
||||
return Object.keys(this.toObject().credentials || {});
|
||||
}
|
||||
|
||||
private static isValidNwakuStore(obj: unknown): boolean {
|
||||
if (!isKeystoreValid(obj)) {
|
||||
return false;
|
||||
|
||||
@ -203,7 +203,7 @@ export class RLNInstance {
|
||||
private _contract: undefined | RLNContract;
|
||||
private _signer: undefined | ethers.Signer;
|
||||
|
||||
private _keystore = Keystore.create();
|
||||
private keystore = Keystore.create();
|
||||
private _credentials: undefined | DecryptedCredentials;
|
||||
|
||||
constructor(
|
||||
@ -219,10 +219,6 @@ export class RLNInstance {
|
||||
return this._signer;
|
||||
}
|
||||
|
||||
public get keystore(): Keystore {
|
||||
return this._keystore;
|
||||
}
|
||||
|
||||
public async start(options: StartRLNOptions = {}): Promise<void> {
|
||||
if (this.started || this.starting) {
|
||||
return;
|
||||
@ -297,7 +293,7 @@ export class RLNInstance {
|
||||
throw Error("Failed to start RLN: cannot read Keystore provided.");
|
||||
}
|
||||
|
||||
this._keystore = keystore;
|
||||
this.keystore = keystore;
|
||||
this._credentials = await keystore.readCredential(
|
||||
credentials.id,
|
||||
credentials.password
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user