X-Git-Url: https://git.squeep.com/?a=blobdiff_plain;f=lib%2Fauthenticator.js;h=dc56e9e0180d161310b724d28775c1782e157a73;hb=786f4aa122c3c3a1c1c8224abacd12d0ca079cd0;hp=36c1574b507c223fe380a35ab6f0eb991de085e4;hpb=9c604adfcde56e35767e3eba70890308ec2d3110;p=squeep-authentication-module diff --git a/lib/authenticator.js b/lib/authenticator.js index 36c1574..dc56e9e 100644 --- a/lib/authenticator.js +++ b/lib/authenticator.js @@ -319,6 +319,23 @@ class Authenticator { } + /** + * Update the authentication database with a new otp key. + * @param {*} dbCtx db context + * @param {string} identifier identifier + * @param {string=} otpKey otp key + */ + async updateOTPKey(dbCtx, identifier, otpKey) { + const _scope = _fileScope('updateOTPKey'); + try { + await this.db.authenticationUpdateOTPKey(dbCtx, identifier, otpKey); + this.logger.info(_scope, 'otp key updated'); + } catch (e) { + this.logger.error(_scope, 'failed', { error: e, identifier }); + } + } + + /** * Check for valid Basic auth, updates ctx with identifier if valid. * @param {String} credentials