CreateAuthenticationSettingsFromPasswordHash (open)

Returns authentication settings with the specified password hash as current password.

Syntax

LOADLIB "mod::wrd/lib/auth.whlib";

RECORD FUNCTION CreateAuthenticationSettingsFromPasswordHash(STRING passwordhash, RECORD options)

Parameters

STRING passwordhash

Current password hash

RECORD options

Options

validfrom

Date when the password was set, defaults to current time

Return value

RECORD

Authentication settings

RECORD ARRAY passwords

List of passwords, last one is current valid password.

STRING passwords.passwordhash

Password hash.

DATETIME passwords.validfrom

Date from when this password hash. Must be increasing and smaller than GetCurrentDateTime().

RECORD totp

TOTP second factor settings

RECORD ARRAY totp.backupcodes

List of backup codes

STRING totp.backupcodes.code

Backup code

DATETIME totp.locked

Datime when normal code entry was locked due to too many failures

STRING totp.url

TOTP configuration url, see GetTOTPUrl

DATETIME totp.used

Date when backup code was used

INTEGER version

Settings version, should be 1.

Description

This should be used when creating new entities, but not to update password as using the returned value won't retain any password history and will reset 2FA settings