SHA256
Добавить UI pairing по коду и обновить документацию агента
This commit is contained in:
@@ -171,6 +171,21 @@ export async function deriveMasterSecretFromPassword(password, options = {}) {
|
||||
});
|
||||
}
|
||||
|
||||
export async function deriveOpaqueArgon2Hash(password, options = {}) {
|
||||
const normalizedPassword = String(password ?? '');
|
||||
const normalizedLogin = String(options?.login ?? '');
|
||||
const normalizedSuffix = String(options?.suffix || 'opaque.hash');
|
||||
const salt = await makeArgon2Salt(normalizedLogin, normalizedSuffix);
|
||||
const passBytes = utf8Bytes(`${normalizeLoginForKdf(normalizedLogin)}\n${normalizedPassword}`);
|
||||
const out = await argon2idAsync(passBytes, salt, {
|
||||
t: 2,
|
||||
m: 65536,
|
||||
p: 1,
|
||||
dkLen: 32,
|
||||
});
|
||||
return `argon2id$v=19$m=65536,t=2,p=1$${bytesToBase64(salt)}$${bytesToBase64(new Uint8Array(out))}`;
|
||||
}
|
||||
|
||||
export async function deriveEd25519FromMasterSecret(masterSecret32, suffix) {
|
||||
const secretBytes = masterSecret32 instanceof Uint8Array
|
||||
? masterSecret32
|
||||
|
||||
Reference in New Issue
Block a user