Skip to content

UserHasher

Defined in: packages/core/src/hash.ts:35

Pseudonymises Discord user IDs inside the bot process: HMAC-SHA-256(period salt, userId), truncated to 16 bytes and formatted as h1:<period>:<32 hex>. Keyed, because snowflakes are guessable and a plain hash could be reversed.

new UserHasher(): UserHasher

UserHasher

deleteSalt(label): void

Defined in: packages/core/src/hash.ts:56

Removes a period’s salt, such as one the collector has destroyed, and every hash computed with it.

string

void


hash(userId, label): Promise<string | undefined>

Defined in: packages/core/src/hash.ts:69

The user hash, or undefined when no salt is installed for the period.

string

string

Promise<string | undefined>


hasSalt(label): boolean

Defined in: packages/core/src/hash.ts:64

string

boolean


labels(): string[]

Defined in: packages/core/src/hash.ts:60

string[]


setSalt(label, salt): Promise<void>

Defined in: packages/core/src/hash.ts:41

Installs a period’s salt (32 bytes). Only the three most recently added periods are kept.

string

Uint8Array

Promise<void>