taler-wallet-embedded: add argon2id test

This commit is contained in:
Iván Ávalos 2023-07-05 12:16:41 -06:00
parent 0f6310bba4
commit 0ac5dba088
No known key found for this signature in database
GPG Key ID: AC47C0E4F348CE33

View File

@ -47,6 +47,9 @@ import {
getRecoveryStartState,
ReducerState,
} from "@gnu-taler/anastasis-core";
import {
userIdentifierDerive,
} from "@gnu-taler/anastasis-core/lib/crypto.js";
setGlobalLogLevelFromString("trace");
@ -307,7 +310,31 @@ export async function testWithLocal() {
w.wallet.stop();
}
export async function testArgon2id() {
const userIdVector = {
input_id_data: {
name: "Fleabag",
ssn: "AB123",
},
input_server_salt: "FZ48EFS7WS3R2ZR4V53A3GFFY4",
output_id:
"YS45R6CGJV84K1NN7T14ZBCPVTZ6H15XJSM1FV0R748MHPV82SM0126EBZKBAAGCR34Q9AFKPEW1HRT2Q9GQ5JRA3642AB571DKZS18",
};
if (await userIdentifierDerive(
userIdVector.input_id_data,
userIdVector.input_server_salt,
) != userIdVector.output_id) {
throw Error("argon2id is not working!");
}
console.log("argon2id is working!");
}
// @ts-ignore
globalThis.testWithGv = testWithGv;
// @ts-ignore
globalThis.testWithLocal = testWithLocal;
// @ts-ignore
globalThis.testArgon2id = testArgon2id;