Skip to content

Commit

Permalink
Generate encryption key only once per instance
Browse files Browse the repository at this point in the history
  • Loading branch information
sergiodxa committed Aug 24, 2023
1 parent 324381c commit 1e0145d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/server/honeypot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ export interface HonetpotConfig {
export class SpamError extends Error {}

export class Honeypot {
private generatedEncryptionSeed = this.randomValue();

constructor(protected config: HonetpotConfig = {}) {}

public getInputProps(): HoneypotInputProps {
Expand Down Expand Up @@ -75,7 +77,7 @@ export class Honeypot {
}

protected get encryptionSeed() {
return this.config.encryptionSeed ?? this.randomValue();
return this.config.encryptionSeed ?? this.generatedEncryptionSeed;
}

protected getRandomizedNameFieldName(
Expand Down

0 comments on commit 1e0145d

Please sign in to comment.