Oslo

Argon2id

Provides methods for hashing passwords and verifying hashes with argon2id. By default, the configuration is set to the recommended values.

Implements PasswordHashingAlgorithm.

Constructor

function constructor(options?: {
	memorySize?: number;
	iterations?: number;
	tagLength?: number;
	parallelism?: number;
	secret?: ArrayBuffer | TypedArray;
}): this;

Parameters

  • options
    • memorySize (default: 19456)
    • iterations (default: 2)
    • tagLength (default: 32)
    • parallelism (default: 1)
    • secret

Methods

Example

import { Argon2id } from "oslo/password";

const argon2id = new Argon2id();
const hash = await argon2id.hash(password);
const validPassword = await argon2id.verify(hash, password);