+ authenticationUpdateOTPKey(dbCtx, identifier, otpKey) {
+ const _scope = _fileScope('authenticationUpdateOTPKey');
+ const scrubbedOTPKey = '*'.repeat((otpKey || '').length) || null;
+ this.logger.debug(_scope, 'called', { identifier, scrubbedOTPKey });
+
+ let result;
+ try {
+ result = this.statement.authenticationUpdateOtpKey.run({ identifier, otpKey });
+ if (result.changes != 1) {
+ throw new DBErrors.UnexpectedResult('did not update authentication otp key');
+ }
+ } catch (e) {
+ this.logger.error(_scope, 'failed', { error: e, identifier, scrubbedOTPKey });
+ throw e;
+ }
+ }
+
+
+ authenticationUpdateCredential(dbCtx, identifier, credential) {
+ const _scope = _fileScope('authenticationUpdateCredential');
+ const scrubbedCredential = '*'.repeat((credential || '').length);
+ this.logger.debug(_scope, 'called', { identifier, scrubbedCredential });
+
+ let result;
+ try {
+ result = this.statement.authenticationUpdateCredential.run({ identifier, credential });
+ if (result.changes != 1) {
+ throw new DBErrors.UnexpectedResult('did not update authentication credential');
+ }
+ } catch (e) {
+ this.logger.error(_scope, 'failed', { error: e, identifier, scrubbedCredential });
+ throw e;
+ }
+ }
+
+
+ /**
+ * Converts engine subscription fields to native types.
+ * @param {object} data subscription data
+ * @returns {object} data
+ */
+ static _subscriptionDataToNative(data) {
+ if (data) {
+ ['created', 'verified', 'expires', 'contentDelivered'].forEach((field) => {
+ // eslint-disable-next-line security/detect-object-injection
+ data[field] = epochToDate(data[field]);
+ });
+ }
+ return data;
+ }
+
+