better-auth
Version:
The most comprehensive authentication framework for TypeScript.
22 lines (21 loc) • 491 B
JavaScript
//#region src/plugins/test-utils/otp-sink.ts
/**
* Creates an instance-scoped OTP store for capturing OTPs during testing.
* Each auth instance gets its own store to avoid cross-contamination.
*/
function createOTPStore() {
const otpStore = /* @__PURE__ */ new Map();
return {
capture(identifier, otp) {
otpStore.set(identifier, otp);
},
get(identifier) {
return otpStore.get(identifier);
},
clear() {
otpStore.clear();
}
};
}
//#endregion
export { createOTPStore };