-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
37 lines (34 loc) · 1.44 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import JWT from "./src/jwt/jwt.jwt.js";
import RateLimiterMiddleware from "./src/security/middleware/security/rateLimiter.middleware.security.js";
import Email from "./src/libs/email/nodemailer.js";
import Hash from "./src/security/hash/hash.security.js";
import Crypto from "./src/security/encrypt/encrypt.security.js";
/**
* AccessFlow class for handling authentication and authorization flows.
* @class
*/
export default class AccessFlow {
/**
* Creates an instance of AccessFlow.
* @constructor
* @param {Object} options - The options object.
* @param {Object} options.jwt - The JWT options object.
* @param {Object} options.rateLimiter - The rate limiter options object.
* @param {Object} options.email - The email options object.
* @param {Object} options.hash - The hash options object.
* @param {Object} options.encrypt - The encrypt options object.
* @throws {Error} Throws an error if options object is not provided.
*/
constructor(options) {
if (!options) {
throw new Error("Options object is required.");
}
this.options = options;
this.jwt = new JWT(options.jwt);
this.rateLimiter = new RateLimiterMiddleware(options.rateLimiter);
this.email = new Email(options.email);
this.hash = new Hash(options.hash);
this.encrypt = new Crypto(options.encrypt);
}
}
export { JWT, RateLimiterMiddleware, Email, Hash, Crypto };