expo-passkey
Version:
Passkey authentication for Expo apps with Better Auth integration
36 lines • 1.17 kB
JavaScript
/**
* @file Rate limiting configuration
* @description Rate limiting definitions for passkey operations
*/
/**
* Creates rate limiting configuration for the passkey plugin
*/
export const createRateLimits = (options = {}) => {
const opts = {
registerWindow: options.registerWindow || 300,
registerMax: options.registerMax || 3,
authenticateWindow: options.authenticateWindow || 60,
authenticateMax: options.authenticateMax || 5,
};
return [
// Rate limit for registration endpoint
{
pathMatcher: (path) => path === "/expo-passkey/register",
window: opts.registerWindow,
max: opts.registerMax,
},
// Rate limit for authentication endpoint
{
pathMatcher: (path) => path === "/expo-passkey/authenticate",
window: opts.authenticateWindow,
max: opts.authenticateMax,
},
// Global rate limit for all passkey endpoints
{
pathMatcher: (path) => path.startsWith("/expo-passkey/"),
window: 60,
max: 30,
},
];
};
//# sourceMappingURL=rate-limit.js.map