UNPKG

payload-totp

Version:

Add an extra security layer to PayloadCMS using a Time-based One-time Password (TOTP).

11 lines (10 loc) 413 B
import { getTotpSecret } from '../utilities/getTotpSecret.js'; export const setHasTotp = (pluginOptions)=>async ({ collection, data, req: { payload } })=>{ const totpSecret = await getTotpSecret({ collection: collection?.slug || pluginOptions.collection, payload, user: data }); return Boolean(totpSecret); }; //# sourceMappingURL=setHasTotp.js.map