+ await db.authenticationUpsert(dbCtx, identifier, credential, otpKey);
+ const authInfo = await db.authenticationGet(dbCtx, identifier);
+ assert.strictEqual(authInfo.credential, credential);
+ assert.strictEqual(authInfo.otpKey, otpKey);
+ });
+ });
+ step('update auth otp key', async function () {
+ await db.context(async (dbCtx) => {
+ const removedOTPKey = null;
+ await db.authenticationUpdateOTPKey(dbCtx, identifier, removedOTPKey);
+ const authInfo = await db.authenticationGet(dbCtx, identifier);
+ assert.strictEqual(authInfo.otpKey, removedOTPKey);
+ });
+ });
+ step('update credential', async function () {
+ await db.context(async (dbCtx) => {
+ credential = '$plain$anotherCredential';
+ await db.authenticationUpdateCredential(dbCtx, identifier, credential);