mirror of
https://github.com/logos-messaging/logos-messaging-js.git
synced 2026-05-18 02:29:29 +00:00
Merge branch 'master' of github.com:waku-org/js-waku into chore/match-spec-format
This commit is contained in:
commit
6dc7b07fa8
@ -30,11 +30,11 @@ export class RLNCredentialsManager {
|
|||||||
protected started = false;
|
protected started = false;
|
||||||
protected starting = false;
|
protected starting = false;
|
||||||
|
|
||||||
private _contract: undefined | RLNBaseContract;
|
public contract: undefined | RLNBaseContract;
|
||||||
private _signer: undefined | ethers.Signer;
|
public signer: undefined | ethers.Signer;
|
||||||
|
|
||||||
protected keystore = Keystore.create();
|
protected keystore = Keystore.create();
|
||||||
private _credentials: undefined | DecryptedCredentials;
|
public credentials: undefined | DecryptedCredentials;
|
||||||
|
|
||||||
public zerokit: undefined | Zerokit;
|
public zerokit: undefined | Zerokit;
|
||||||
|
|
||||||
@ -43,30 +43,6 @@ export class RLNCredentialsManager {
|
|||||||
this.zerokit = zerokit;
|
this.zerokit = zerokit;
|
||||||
}
|
}
|
||||||
|
|
||||||
public get contract(): undefined | RLNBaseContract {
|
|
||||||
return this._contract;
|
|
||||||
}
|
|
||||||
|
|
||||||
public set contract(contract: RLNBaseContract | undefined) {
|
|
||||||
this._contract = contract;
|
|
||||||
}
|
|
||||||
|
|
||||||
public get signer(): undefined | ethers.Signer {
|
|
||||||
return this._signer;
|
|
||||||
}
|
|
||||||
|
|
||||||
public set signer(signer: ethers.Signer | undefined) {
|
|
||||||
this._signer = signer;
|
|
||||||
}
|
|
||||||
|
|
||||||
public get credentials(): undefined | DecryptedCredentials {
|
|
||||||
return this._credentials;
|
|
||||||
}
|
|
||||||
|
|
||||||
public set credentials(credentials: DecryptedCredentials | undefined) {
|
|
||||||
this._credentials = credentials;
|
|
||||||
}
|
|
||||||
|
|
||||||
public get provider(): undefined | ethers.providers.Provider {
|
public get provider(): undefined | ethers.providers.Provider {
|
||||||
return this.contract?.provider;
|
return this.contract?.provider;
|
||||||
}
|
}
|
||||||
@ -102,12 +78,12 @@ export class RLNCredentialsManager {
|
|||||||
log.info("Using provided keystore");
|
log.info("Using provided keystore");
|
||||||
}
|
}
|
||||||
|
|
||||||
this._credentials = credentials;
|
this.credentials = credentials;
|
||||||
this._signer = signer!;
|
this.signer = signer!;
|
||||||
this._contract = new RLNBaseContract({
|
this.contract = new RLNBaseContract({
|
||||||
address: address!,
|
address: address!,
|
||||||
signer: signer!,
|
signer: signer!,
|
||||||
rateLimit: rateLimit ?? this.zerokit?.getRateLimit
|
rateLimit: rateLimit ?? this.zerokit?.rateLimit
|
||||||
});
|
});
|
||||||
|
|
||||||
log.info("RLNCredentialsManager successfully started");
|
log.info("RLNCredentialsManager successfully started");
|
||||||
@ -160,8 +136,8 @@ export class RLNCredentialsManager {
|
|||||||
*/
|
*/
|
||||||
public async useCredentials(id: string, password: Password): Promise<void> {
|
public async useCredentials(id: string, password: Password): Promise<void> {
|
||||||
log.info(`Attempting to use credentials with ID: ${id}`);
|
log.info(`Attempting to use credentials with ID: ${id}`);
|
||||||
this._credentials = await this.keystore?.readCredential(id, password);
|
this.credentials = await this.keystore?.readCredential(id, password);
|
||||||
if (this._credentials) {
|
if (this.credentials) {
|
||||||
log.info("Successfully loaded credentials");
|
log.info("Successfully loaded credentials");
|
||||||
} else {
|
} else {
|
||||||
log.warn("Failed to load credentials");
|
log.warn("Failed to load credentials");
|
||||||
|
|||||||
@ -58,6 +58,7 @@ export class RLNInstance extends RLNCredentialsManager {
|
|||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private constructor(public zerokit: Zerokit) {
|
private constructor(public zerokit: Zerokit) {
|
||||||
super(zerokit);
|
super(zerokit);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,7 +16,7 @@ export class Zerokit {
|
|||||||
public constructor(
|
public constructor(
|
||||||
private readonly zkRLN: number,
|
private readonly zkRLN: number,
|
||||||
private readonly witnessCalculator: WitnessCalculator,
|
private readonly witnessCalculator: WitnessCalculator,
|
||||||
private readonly rateLimit: number = DEFAULT_RATE_LIMIT
|
private readonly _rateLimit: number = DEFAULT_RATE_LIMIT
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
public get getZkRLN(): number {
|
public get getZkRLN(): number {
|
||||||
@ -27,8 +27,8 @@ export class Zerokit {
|
|||||||
return this.witnessCalculator;
|
return this.witnessCalculator;
|
||||||
}
|
}
|
||||||
|
|
||||||
public get getRateLimit(): number {
|
public get rateLimit(): number {
|
||||||
return this.rateLimit;
|
return this._rateLimit;
|
||||||
}
|
}
|
||||||
|
|
||||||
public generateIdentityCredentials(): IdentityCredential {
|
public generateIdentityCredentials(): IdentityCredential {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user