strapi-plugin-magic-link-v5 5.5.4 → 5.5.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/dist/_chunks/{index-C6WRQuex.mjs → index-34ICAF9_.mjs} +3 -3
- package/dist/_chunks/{index-DoSROJog.js → index-BFzW7Xex.js} +3 -3
- package/dist/_chunks/{index-Ki-zhMlp.mjs → index-BZFGxKmY.mjs} +1 -1
- package/dist/_chunks/{index-DJyAppvB.js → index-CddEy_As.js} +1 -1
- package/dist/_chunks/{index-CQ3Kd12m.js → index-CuXnqVl4.js} +12 -10
- package/dist/_chunks/{index-B9M8wkAj.mjs → index-CxCULraY.mjs} +1 -1
- package/dist/_chunks/{index-DC00x-wm.js → index-M5s7QN5m.js} +1 -1
- package/dist/_chunks/{index-CoZjdlQd.mjs → index-ivgYEX37.mjs} +12 -10
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/server/index.js +414 -425
- package/dist/server/index.mjs +412 -423
- package/package.json +8 -2
package/dist/server/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
const require$$0$3 = require("crypto");
|
|
2
3
|
const require$$0$6 = require("lodash");
|
|
3
4
|
const require$$1$2 = require("nanoid");
|
|
4
|
-
const require$$0$
|
|
5
|
+
const require$$0$4 = require("fs");
|
|
5
6
|
const require$$1 = require("path");
|
|
6
|
-
const require$$0$4 = require("crypto");
|
|
7
7
|
const require$$0$5 = require("zod");
|
|
8
8
|
const require$$1$1 = require("@strapi/utils");
|
|
9
9
|
const require$$1$3 = require("os");
|
|
@@ -11,11 +11,11 @@ const require$$0$7 = require("rate-limiter-flexible");
|
|
|
11
11
|
const require$$1$4 = require("speakeasy");
|
|
12
12
|
const require$$2 = require("qrcode");
|
|
13
13
|
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
14
|
+
const require$$0__default = /* @__PURE__ */ _interopDefault(require$$0$3);
|
|
14
15
|
const require$$0__default$3 = /* @__PURE__ */ _interopDefault(require$$0$6);
|
|
15
16
|
const require$$1__default$2 = /* @__PURE__ */ _interopDefault(require$$1$2);
|
|
16
|
-
const require$$0__default = /* @__PURE__ */ _interopDefault(require$$0$3);
|
|
17
|
-
const require$$1__default = /* @__PURE__ */ _interopDefault(require$$1);
|
|
18
17
|
const require$$0__default$1 = /* @__PURE__ */ _interopDefault(require$$0$4);
|
|
18
|
+
const require$$1__default = /* @__PURE__ */ _interopDefault(require$$1);
|
|
19
19
|
const require$$0__default$2 = /* @__PURE__ */ _interopDefault(require$$0$5);
|
|
20
20
|
const require$$1__default$1 = /* @__PURE__ */ _interopDefault(require$$1$1);
|
|
21
21
|
const require$$1__default$3 = /* @__PURE__ */ _interopDefault(require$$1$3);
|
|
@@ -26,6 +26,143 @@ var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof win
|
|
|
26
26
|
function getDefaultExportFromCjs(x) {
|
|
27
27
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
28
28
|
}
|
|
29
|
+
const crypto$3 = require$$0__default.default;
|
|
30
|
+
let warnedMissingKey = false;
|
|
31
|
+
let warnedMissingPepper = false;
|
|
32
|
+
const isProduction = () => process.env.NODE_ENV === "production";
|
|
33
|
+
const devFallbackMaterial = () => process.env.ADMIN_JWT_SECRET || (Array.isArray(process.env.APP_KEYS) ? process.env.APP_KEYS[0] : process.env.APP_KEYS) || "magic-link-dev-fallback-DO-NOT-USE-IN-PRODUCTION";
|
|
34
|
+
const getEncryptionKey = () => {
|
|
35
|
+
const raw = process.env.MAGIC_LINK_ENCRYPTION_KEY;
|
|
36
|
+
if (raw && raw.length > 0) {
|
|
37
|
+
return crypto$3.createHash("sha256").update(raw).digest();
|
|
38
|
+
}
|
|
39
|
+
if (isProduction()) {
|
|
40
|
+
throw new Error(
|
|
41
|
+
`[magic-link] MAGIC_LINK_ENCRYPTION_KEY env var is required in production. Generate one with: node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"`
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
if (!warnedMissingKey) {
|
|
45
|
+
warnedMissingKey = true;
|
|
46
|
+
console.warn(
|
|
47
|
+
"[magic-link] MAGIC_LINK_ENCRYPTION_KEY not set — using dev fallback. Set this env var before going to production (it is NOT rotatable)."
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
return crypto$3.createHash("sha256").update(devFallbackMaterial()).digest();
|
|
51
|
+
};
|
|
52
|
+
const getOtpPepper = () => {
|
|
53
|
+
const raw = process.env.MAGIC_LINK_OTP_PEPPER || process.env.OTP_PEPPER;
|
|
54
|
+
if (raw && raw.length >= 16) {
|
|
55
|
+
return raw;
|
|
56
|
+
}
|
|
57
|
+
if (isProduction()) {
|
|
58
|
+
throw new Error(
|
|
59
|
+
`[magic-link] MAGIC_LINK_OTP_PEPPER env var is required in production (min 16 characters). Generate one with: node -e "console.log(require('crypto').randomBytes(24).toString('hex'))"`
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
if (!warnedMissingPepper) {
|
|
63
|
+
warnedMissingPepper = true;
|
|
64
|
+
console.warn(
|
|
65
|
+
"[magic-link] MAGIC_LINK_OTP_PEPPER not set — using dev fallback. Set this before deploying to production."
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
return "magic-link-otp-dev-pepper-DO-NOT-USE-IN-PRODUCTION";
|
|
69
|
+
};
|
|
70
|
+
const hash = (value) => {
|
|
71
|
+
if (!value) return null;
|
|
72
|
+
return crypto$3.createHash("sha256").update(String(value)).digest("hex");
|
|
73
|
+
};
|
|
74
|
+
const hashToken = (token2, salt = null) => {
|
|
75
|
+
if (!token2) return { hash: null, salt: null };
|
|
76
|
+
const tokenSalt = salt || crypto$3.randomBytes(16).toString("hex");
|
|
77
|
+
const hashedToken = crypto$3.createHash("sha256").update(token2 + tokenSalt).digest("hex");
|
|
78
|
+
return { hash: hashedToken, salt: tokenSalt };
|
|
79
|
+
};
|
|
80
|
+
const verifyToken = (token2, storedHash, salt) => {
|
|
81
|
+
if (!token2 || !storedHash) return false;
|
|
82
|
+
const { hash: computedHash } = hashToken(token2, salt);
|
|
83
|
+
return crypto$3.timingSafeEqual(
|
|
84
|
+
Buffer.from(computedHash, "hex"),
|
|
85
|
+
Buffer.from(storedHash, "hex")
|
|
86
|
+
);
|
|
87
|
+
};
|
|
88
|
+
const encrypt = (value) => {
|
|
89
|
+
if (!value) return null;
|
|
90
|
+
const key = getEncryptionKey();
|
|
91
|
+
const iv = crypto$3.randomBytes(16);
|
|
92
|
+
const cipher = crypto$3.createCipheriv("aes-256-gcm", key, iv);
|
|
93
|
+
let encrypted = cipher.update(String(value), "utf8", "hex");
|
|
94
|
+
encrypted += cipher.final("hex");
|
|
95
|
+
const authTag = cipher.getAuthTag();
|
|
96
|
+
return Buffer.from(
|
|
97
|
+
iv.toString("hex") + ":" + authTag.toString("hex") + ":" + encrypted
|
|
98
|
+
).toString("base64");
|
|
99
|
+
};
|
|
100
|
+
const decrypt = (encryptedValue) => {
|
|
101
|
+
if (!encryptedValue) return null;
|
|
102
|
+
const key = getEncryptionKey();
|
|
103
|
+
const data = Buffer.from(encryptedValue, "base64").toString("utf8");
|
|
104
|
+
const parts = data.split(":");
|
|
105
|
+
if (parts.length !== 3) {
|
|
106
|
+
throw new Error("[Crypto] decrypt: malformed ciphertext (expected iv:tag:ct)");
|
|
107
|
+
}
|
|
108
|
+
const [ivHex, authTagHex, encryptedHex] = parts;
|
|
109
|
+
if (!ivHex || !authTagHex || !encryptedHex) {
|
|
110
|
+
throw new Error("[Crypto] decrypt: missing ciphertext components");
|
|
111
|
+
}
|
|
112
|
+
const iv = Buffer.from(ivHex, "hex");
|
|
113
|
+
const authTag = Buffer.from(authTagHex, "hex");
|
|
114
|
+
const decipher = crypto$3.createDecipheriv("aes-256-gcm", key, iv);
|
|
115
|
+
decipher.setAuthTag(authTag);
|
|
116
|
+
let decrypted = decipher.update(encryptedHex, "hex", "utf8");
|
|
117
|
+
decrypted += decipher.final("utf8");
|
|
118
|
+
return decrypted;
|
|
119
|
+
};
|
|
120
|
+
const generateSecureRandom = (length = 32) => {
|
|
121
|
+
return crypto$3.randomBytes(Math.ceil(length / 2)).toString("hex").slice(0, length);
|
|
122
|
+
};
|
|
123
|
+
const hashOTP = (code) => {
|
|
124
|
+
if (!code) return null;
|
|
125
|
+
const pepper = getOtpPepper();
|
|
126
|
+
return crypto$3.createHash("sha256").update(code + pepper).digest("hex");
|
|
127
|
+
};
|
|
128
|
+
const verifyOTP = (code, storedHash) => {
|
|
129
|
+
if (!code || !storedHash) return false;
|
|
130
|
+
const computedHash = hashOTP(code);
|
|
131
|
+
try {
|
|
132
|
+
return crypto$3.timingSafeEqual(
|
|
133
|
+
Buffer.from(computedHash, "hex"),
|
|
134
|
+
Buffer.from(storedHash, "hex")
|
|
135
|
+
);
|
|
136
|
+
} catch {
|
|
137
|
+
return false;
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
const isEncrypted = (value) => {
|
|
141
|
+
if (!value) return false;
|
|
142
|
+
try {
|
|
143
|
+
const decoded = Buffer.from(value, "base64").toString("utf8");
|
|
144
|
+
const parts = decoded.split(":");
|
|
145
|
+
return parts.length === 3 && parts[0].length === 32 && parts[1].length === 32;
|
|
146
|
+
} catch {
|
|
147
|
+
return false;
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
const hashJwt = (jwt2) => {
|
|
151
|
+
if (!jwt2) return null;
|
|
152
|
+
return crypto$3.createHash("sha256").update(jwt2).digest("hex");
|
|
153
|
+
};
|
|
154
|
+
var crypto_1 = {
|
|
155
|
+
hash,
|
|
156
|
+
hashToken,
|
|
157
|
+
verifyToken,
|
|
158
|
+
encrypt,
|
|
159
|
+
decrypt,
|
|
160
|
+
generateSecureRandom,
|
|
161
|
+
hashOTP,
|
|
162
|
+
verifyOTP,
|
|
163
|
+
isEncrypted,
|
|
164
|
+
hashJwt
|
|
165
|
+
};
|
|
29
166
|
const magicLinkActions = {
|
|
30
167
|
actions: [
|
|
31
168
|
{
|
|
@@ -51,11 +188,11 @@ const magicLinkActions = {
|
|
|
51
188
|
}
|
|
52
189
|
]
|
|
53
190
|
};
|
|
191
|
+
const cryptoUtilsSelfTest = crypto_1;
|
|
54
192
|
var bootstrap$1 = async ({ strapi: strapi2 }) => {
|
|
55
193
|
try {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
cryptoUtils2.hashOTP("000000");
|
|
194
|
+
cryptoUtilsSelfTest.encrypt("self-test");
|
|
195
|
+
cryptoUtilsSelfTest.hashOTP("000000");
|
|
59
196
|
} catch (e) {
|
|
60
197
|
strapi2.log.error(`[magic-link] ${e.message}`);
|
|
61
198
|
throw e;
|
|
@@ -793,7 +930,7 @@ This link will expire in 1 hour.`,
|
|
|
793
930
|
}
|
|
794
931
|
}
|
|
795
932
|
};
|
|
796
|
-
const fs$1 = require$$0__default.default;
|
|
933
|
+
const fs$1 = require$$0__default$1.default;
|
|
797
934
|
const path$1 = require$$1__default.default;
|
|
798
935
|
class I18n {
|
|
799
936
|
constructor() {
|
|
@@ -935,143 +1072,6 @@ class I18n {
|
|
|
935
1072
|
}
|
|
936
1073
|
const i18n$1 = new I18n();
|
|
937
1074
|
var i18n_1 = i18n$1;
|
|
938
|
-
const crypto$3 = require$$0__default$1.default;
|
|
939
|
-
let warnedMissingKey = false;
|
|
940
|
-
let warnedMissingPepper = false;
|
|
941
|
-
const isProduction = () => process.env.NODE_ENV === "production";
|
|
942
|
-
const devFallbackMaterial = () => process.env.ADMIN_JWT_SECRET || (Array.isArray(process.env.APP_KEYS) ? process.env.APP_KEYS[0] : process.env.APP_KEYS) || "magic-link-dev-fallback-DO-NOT-USE-IN-PRODUCTION";
|
|
943
|
-
const getEncryptionKey = () => {
|
|
944
|
-
const raw = process.env.MAGIC_LINK_ENCRYPTION_KEY;
|
|
945
|
-
if (raw && raw.length > 0) {
|
|
946
|
-
return crypto$3.createHash("sha256").update(raw).digest();
|
|
947
|
-
}
|
|
948
|
-
if (isProduction()) {
|
|
949
|
-
throw new Error(
|
|
950
|
-
`[magic-link] MAGIC_LINK_ENCRYPTION_KEY env var is required in production. Generate one with: node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"`
|
|
951
|
-
);
|
|
952
|
-
}
|
|
953
|
-
if (!warnedMissingKey) {
|
|
954
|
-
warnedMissingKey = true;
|
|
955
|
-
console.warn(
|
|
956
|
-
"[magic-link] MAGIC_LINK_ENCRYPTION_KEY not set — using dev fallback. Set this env var before going to production (it is NOT rotatable)."
|
|
957
|
-
);
|
|
958
|
-
}
|
|
959
|
-
return crypto$3.createHash("sha256").update(devFallbackMaterial()).digest();
|
|
960
|
-
};
|
|
961
|
-
const getOtpPepper = () => {
|
|
962
|
-
const raw = process.env.MAGIC_LINK_OTP_PEPPER || process.env.OTP_PEPPER;
|
|
963
|
-
if (raw && raw.length >= 16) {
|
|
964
|
-
return raw;
|
|
965
|
-
}
|
|
966
|
-
if (isProduction()) {
|
|
967
|
-
throw new Error(
|
|
968
|
-
`[magic-link] MAGIC_LINK_OTP_PEPPER env var is required in production (min 16 characters). Generate one with: node -e "console.log(require('crypto').randomBytes(24).toString('hex'))"`
|
|
969
|
-
);
|
|
970
|
-
}
|
|
971
|
-
if (!warnedMissingPepper) {
|
|
972
|
-
warnedMissingPepper = true;
|
|
973
|
-
console.warn(
|
|
974
|
-
"[magic-link] MAGIC_LINK_OTP_PEPPER not set — using dev fallback. Set this before deploying to production."
|
|
975
|
-
);
|
|
976
|
-
}
|
|
977
|
-
return "magic-link-otp-dev-pepper-DO-NOT-USE-IN-PRODUCTION";
|
|
978
|
-
};
|
|
979
|
-
const hash = (value) => {
|
|
980
|
-
if (!value) return null;
|
|
981
|
-
return crypto$3.createHash("sha256").update(String(value)).digest("hex");
|
|
982
|
-
};
|
|
983
|
-
const hashToken = (token2, salt = null) => {
|
|
984
|
-
if (!token2) return { hash: null, salt: null };
|
|
985
|
-
const tokenSalt = salt || crypto$3.randomBytes(16).toString("hex");
|
|
986
|
-
const hashedToken = crypto$3.createHash("sha256").update(token2 + tokenSalt).digest("hex");
|
|
987
|
-
return { hash: hashedToken, salt: tokenSalt };
|
|
988
|
-
};
|
|
989
|
-
const verifyToken = (token2, storedHash, salt) => {
|
|
990
|
-
if (!token2 || !storedHash) return false;
|
|
991
|
-
const { hash: computedHash } = hashToken(token2, salt);
|
|
992
|
-
return crypto$3.timingSafeEqual(
|
|
993
|
-
Buffer.from(computedHash, "hex"),
|
|
994
|
-
Buffer.from(storedHash, "hex")
|
|
995
|
-
);
|
|
996
|
-
};
|
|
997
|
-
const encrypt = (value) => {
|
|
998
|
-
if (!value) return null;
|
|
999
|
-
const key = getEncryptionKey();
|
|
1000
|
-
const iv = crypto$3.randomBytes(16);
|
|
1001
|
-
const cipher = crypto$3.createCipheriv("aes-256-gcm", key, iv);
|
|
1002
|
-
let encrypted = cipher.update(String(value), "utf8", "hex");
|
|
1003
|
-
encrypted += cipher.final("hex");
|
|
1004
|
-
const authTag = cipher.getAuthTag();
|
|
1005
|
-
return Buffer.from(
|
|
1006
|
-
iv.toString("hex") + ":" + authTag.toString("hex") + ":" + encrypted
|
|
1007
|
-
).toString("base64");
|
|
1008
|
-
};
|
|
1009
|
-
const decrypt = (encryptedValue) => {
|
|
1010
|
-
if (!encryptedValue) return null;
|
|
1011
|
-
const key = getEncryptionKey();
|
|
1012
|
-
const data = Buffer.from(encryptedValue, "base64").toString("utf8");
|
|
1013
|
-
const parts = data.split(":");
|
|
1014
|
-
if (parts.length !== 3) {
|
|
1015
|
-
throw new Error("[Crypto] decrypt: malformed ciphertext (expected iv:tag:ct)");
|
|
1016
|
-
}
|
|
1017
|
-
const [ivHex, authTagHex, encryptedHex] = parts;
|
|
1018
|
-
if (!ivHex || !authTagHex || !encryptedHex) {
|
|
1019
|
-
throw new Error("[Crypto] decrypt: missing ciphertext components");
|
|
1020
|
-
}
|
|
1021
|
-
const iv = Buffer.from(ivHex, "hex");
|
|
1022
|
-
const authTag = Buffer.from(authTagHex, "hex");
|
|
1023
|
-
const decipher = crypto$3.createDecipheriv("aes-256-gcm", key, iv);
|
|
1024
|
-
decipher.setAuthTag(authTag);
|
|
1025
|
-
let decrypted = decipher.update(encryptedHex, "hex", "utf8");
|
|
1026
|
-
decrypted += decipher.final("utf8");
|
|
1027
|
-
return decrypted;
|
|
1028
|
-
};
|
|
1029
|
-
const generateSecureRandom = (length = 32) => {
|
|
1030
|
-
return crypto$3.randomBytes(Math.ceil(length / 2)).toString("hex").slice(0, length);
|
|
1031
|
-
};
|
|
1032
|
-
const hashOTP = (code) => {
|
|
1033
|
-
if (!code) return null;
|
|
1034
|
-
const pepper = getOtpPepper();
|
|
1035
|
-
return crypto$3.createHash("sha256").update(code + pepper).digest("hex");
|
|
1036
|
-
};
|
|
1037
|
-
const verifyOTP = (code, storedHash) => {
|
|
1038
|
-
if (!code || !storedHash) return false;
|
|
1039
|
-
const computedHash = hashOTP(code);
|
|
1040
|
-
try {
|
|
1041
|
-
return crypto$3.timingSafeEqual(
|
|
1042
|
-
Buffer.from(computedHash, "hex"),
|
|
1043
|
-
Buffer.from(storedHash, "hex")
|
|
1044
|
-
);
|
|
1045
|
-
} catch {
|
|
1046
|
-
return false;
|
|
1047
|
-
}
|
|
1048
|
-
};
|
|
1049
|
-
const isEncrypted = (value) => {
|
|
1050
|
-
if (!value) return false;
|
|
1051
|
-
try {
|
|
1052
|
-
const decoded = Buffer.from(value, "base64").toString("utf8");
|
|
1053
|
-
const parts = decoded.split(":");
|
|
1054
|
-
return parts.length === 3 && parts[0].length === 32 && parts[1].length === 32;
|
|
1055
|
-
} catch {
|
|
1056
|
-
return false;
|
|
1057
|
-
}
|
|
1058
|
-
};
|
|
1059
|
-
const hashJwt = (jwt2) => {
|
|
1060
|
-
if (!jwt2) return null;
|
|
1061
|
-
return crypto$3.createHash("sha256").update(jwt2).digest("hex");
|
|
1062
|
-
};
|
|
1063
|
-
var crypto_1 = {
|
|
1064
|
-
hash,
|
|
1065
|
-
hashToken,
|
|
1066
|
-
verifyToken,
|
|
1067
|
-
encrypt,
|
|
1068
|
-
decrypt,
|
|
1069
|
-
generateSecureRandom,
|
|
1070
|
-
hashOTP,
|
|
1071
|
-
verifyOTP,
|
|
1072
|
-
isEncrypted,
|
|
1073
|
-
hashJwt
|
|
1074
|
-
};
|
|
1075
1075
|
const normalizeEmail$2 = (raw) => {
|
|
1076
1076
|
if (typeof raw !== "string") return null;
|
|
1077
1077
|
const trimmed = raw.trim();
|
|
@@ -1968,7 +1968,7 @@ var emailHelpers$3 = {
|
|
|
1968
1968
|
validateEmailConfig
|
|
1969
1969
|
};
|
|
1970
1970
|
const { nanoid: nanoid$1 } = require$$1__default$2.default;
|
|
1971
|
-
const crypto$2 = require$$0__default
|
|
1971
|
+
const crypto$2 = require$$0__default.default;
|
|
1972
1972
|
const emailHelpers$2 = emailHelpers$3;
|
|
1973
1973
|
const cryptoUtils$3 = crypto_1;
|
|
1974
1974
|
const formatExpiryText$1 = (minutes) => {
|
|
@@ -4823,271 +4823,265 @@ var store$1 = ({ strapi: strapi2 }) => ({
|
|
|
4823
4823
|
return pluginStore.set({ key: "settings", value: settings });
|
|
4824
4824
|
}
|
|
4825
4825
|
});
|
|
4826
|
-
var features$1
|
|
4827
|
-
|
|
4828
|
-
|
|
4829
|
-
|
|
4830
|
-
|
|
4831
|
-
|
|
4832
|
-
//
|
|
4833
|
-
|
|
4834
|
-
|
|
4835
|
-
|
|
4836
|
-
|
|
4837
|
-
//
|
|
4838
|
-
|
|
4839
|
-
//
|
|
4840
|
-
|
|
4841
|
-
|
|
4842
|
-
|
|
4843
|
-
|
|
4844
|
-
|
|
4845
|
-
|
|
4846
|
-
|
|
4847
|
-
|
|
4848
|
-
|
|
4849
|
-
|
|
4850
|
-
|
|
4851
|
-
|
|
4852
|
-
|
|
4853
|
-
|
|
4854
|
-
|
|
4855
|
-
|
|
4856
|
-
|
|
4857
|
-
|
|
4858
|
-
|
|
4859
|
-
//
|
|
4860
|
-
|
|
4861
|
-
|
|
4862
|
-
|
|
4863
|
-
|
|
4864
|
-
|
|
4865
|
-
|
|
4866
|
-
|
|
4867
|
-
|
|
4868
|
-
|
|
4869
|
-
|
|
4870
|
-
|
|
4871
|
-
|
|
4872
|
-
|
|
4873
|
-
|
|
4874
|
-
|
|
4875
|
-
|
|
4876
|
-
|
|
4877
|
-
|
|
4878
|
-
|
|
4879
|
-
|
|
4880
|
-
|
|
4881
|
-
|
|
4882
|
-
|
|
4883
|
-
|
|
4884
|
-
|
|
4885
|
-
|
|
4886
|
-
|
|
4887
|
-
|
|
4888
|
-
|
|
4889
|
-
|
|
4890
|
-
|
|
4891
|
-
|
|
4892
|
-
|
|
4893
|
-
|
|
4894
|
-
|
|
4895
|
-
|
|
4896
|
-
|
|
4897
|
-
|
|
4898
|
-
//
|
|
4899
|
-
|
|
4900
|
-
|
|
4901
|
-
|
|
4902
|
-
|
|
4903
|
-
|
|
4904
|
-
|
|
4905
|
-
|
|
4906
|
-
|
|
4907
|
-
|
|
4908
|
-
|
|
4909
|
-
|
|
4910
|
-
|
|
4911
|
-
|
|
4912
|
-
|
|
4913
|
-
|
|
4914
|
-
|
|
4915
|
-
|
|
4916
|
-
|
|
4917
|
-
|
|
4918
|
-
|
|
4919
|
-
|
|
4920
|
-
|
|
4921
|
-
|
|
4922
|
-
|
|
4923
|
-
|
|
4924
|
-
|
|
4925
|
-
|
|
4926
|
-
|
|
4927
|
-
|
|
4928
|
-
|
|
4929
|
-
|
|
4930
|
-
|
|
4931
|
-
|
|
4932
|
-
|
|
4933
|
-
|
|
4934
|
-
|
|
4935
|
-
|
|
4936
|
-
|
|
4937
|
-
|
|
4938
|
-
|
|
4939
|
-
|
|
4940
|
-
|
|
4941
|
-
|
|
4942
|
-
|
|
4943
|
-
|
|
4944
|
-
|
|
4945
|
-
|
|
4946
|
-
|
|
4947
|
-
|
|
4948
|
-
|
|
4949
|
-
|
|
4950
|
-
|
|
4951
|
-
|
|
4952
|
-
|
|
4953
|
-
|
|
4954
|
-
|
|
4955
|
-
|
|
4956
|
-
|
|
4957
|
-
|
|
4958
|
-
|
|
4959
|
-
|
|
4960
|
-
|
|
4961
|
-
|
|
4962
|
-
|
|
4963
|
-
|
|
4964
|
-
|
|
4965
|
-
|
|
4966
|
-
|
|
4967
|
-
|
|
4968
|
-
|
|
4969
|
-
|
|
4970
|
-
|
|
4971
|
-
|
|
4972
|
-
|
|
4973
|
-
|
|
4974
|
-
|
|
4975
|
-
|
|
4976
|
-
|
|
4977
|
-
|
|
4978
|
-
|
|
4979
|
-
|
|
4980
|
-
|
|
4981
|
-
|
|
4982
|
-
|
|
4983
|
-
|
|
4984
|
-
|
|
4985
|
-
|
|
4986
|
-
|
|
4987
|
-
|
|
4988
|
-
|
|
4989
|
-
|
|
4990
|
-
|
|
4991
|
-
|
|
4992
|
-
|
|
4993
|
-
|
|
4994
|
-
|
|
4995
|
-
|
|
4996
|
-
|
|
4997
|
-
|
|
4998
|
-
|
|
4999
|
-
|
|
5000
|
-
|
|
5001
|
-
|
|
5002
|
-
|
|
5003
|
-
|
|
5004
|
-
|
|
5005
|
-
|
|
5006
|
-
/**
|
|
5007
|
-
* Check if a feature is available for given license tier
|
|
5008
|
-
*/
|
|
5009
|
-
hasFeature(licenseData, featureName) {
|
|
5010
|
-
if (!licenseData) {
|
|
5011
|
-
return this.free.features.includes(featureName);
|
|
5012
|
-
}
|
|
5013
|
-
let isEnterprise = false;
|
|
5014
|
-
let isAdvanced = false;
|
|
5015
|
-
let isPremium = false;
|
|
5016
|
-
if (licenseData.tier) {
|
|
5017
|
-
isEnterprise = licenseData.tier === "enterprise";
|
|
5018
|
-
isAdvanced = licenseData.tier === "advanced";
|
|
5019
|
-
isPremium = licenseData.tier === "premium";
|
|
5020
|
-
}
|
|
5021
|
-
if (licenseData.features) {
|
|
5022
|
-
isEnterprise = isEnterprise || licenseData.features.enterprise === true;
|
|
5023
|
-
isAdvanced = isAdvanced || licenseData.features.advanced === true;
|
|
5024
|
-
isPremium = isPremium || licenseData.features.premium === true;
|
|
5025
|
-
}
|
|
5026
|
-
if (licenseData.featureEnterprise === true) {
|
|
5027
|
-
isEnterprise = true;
|
|
5028
|
-
}
|
|
5029
|
-
if (licenseData.featureAdvanced === true) {
|
|
5030
|
-
isAdvanced = true;
|
|
5031
|
-
}
|
|
5032
|
-
if (licenseData.featurePremium === true) {
|
|
5033
|
-
isPremium = true;
|
|
5034
|
-
}
|
|
5035
|
-
if (isEnterprise && this.enterprise.features.includes(featureName)) {
|
|
5036
|
-
return true;
|
|
5037
|
-
}
|
|
5038
|
-
if (isAdvanced && this.advanced.features.includes(featureName)) {
|
|
5039
|
-
return true;
|
|
5040
|
-
}
|
|
5041
|
-
if (isPremium && this.premium.features.includes(featureName)) {
|
|
5042
|
-
return true;
|
|
5043
|
-
}
|
|
4826
|
+
var features$1 = {
|
|
4827
|
+
// FREE/DEMO Features
|
|
4828
|
+
free: {
|
|
4829
|
+
maxTokens: 100,
|
|
4830
|
+
// 100 aktive Tokens gleichzeitig
|
|
4831
|
+
maxSessions: 50,
|
|
4832
|
+
// 50 aktive JWT Sessions
|
|
4833
|
+
maxIPBans: 10,
|
|
4834
|
+
// 10 gebannte IPs
|
|
4835
|
+
features: [
|
|
4836
|
+
"basic-magic-link",
|
|
4837
|
+
// Basis Magic Link Auth
|
|
4838
|
+
"email-templates",
|
|
4839
|
+
// Basis Email Templates
|
|
4840
|
+
"jwt-sessions",
|
|
4841
|
+
// JWT Session Management
|
|
4842
|
+
"ip-tracking",
|
|
4843
|
+
// IP Tracking für Security
|
|
4844
|
+
"rate-limiting",
|
|
4845
|
+
// Basis Rate Limiting
|
|
4846
|
+
"auto-user-creation",
|
|
4847
|
+
// Auto User Creation
|
|
4848
|
+
"token-management",
|
|
4849
|
+
// Token Dashboard
|
|
4850
|
+
"ip-bans"
|
|
4851
|
+
// IP Ban Management
|
|
4852
|
+
]
|
|
4853
|
+
},
|
|
4854
|
+
// PREMIUM Features
|
|
4855
|
+
premium: {
|
|
4856
|
+
maxTokens: 1e3,
|
|
4857
|
+
// 1000 aktive Tokens
|
|
4858
|
+
maxSessions: 500,
|
|
4859
|
+
// 500 aktive Sessions
|
|
4860
|
+
maxIPBans: 100,
|
|
4861
|
+
// 100 gebannte IPs
|
|
4862
|
+
features: [
|
|
4863
|
+
"basic-magic-link",
|
|
4864
|
+
"email-templates",
|
|
4865
|
+
"jwt-sessions",
|
|
4866
|
+
"ip-tracking",
|
|
4867
|
+
"rate-limiting",
|
|
4868
|
+
"auto-user-creation",
|
|
4869
|
+
"token-management",
|
|
4870
|
+
"ip-bans",
|
|
4871
|
+
"otp-email",
|
|
4872
|
+
// Email OTP (6-digit code)
|
|
4873
|
+
"mfa-totp",
|
|
4874
|
+
// MFA: Magic Link + TOTP (Szenario 1)
|
|
4875
|
+
"custom-email-templates",
|
|
4876
|
+
// Custom HTML/Text Templates
|
|
4877
|
+
"email-designer-integration",
|
|
4878
|
+
// Email Designer 5 Support
|
|
4879
|
+
"magic-mail-integration",
|
|
4880
|
+
// MagicMail Integration
|
|
4881
|
+
"advanced-rate-limiting",
|
|
4882
|
+
// Custom Rate Limits
|
|
4883
|
+
"session-management",
|
|
4884
|
+
// Erweiterte Session Verwaltung
|
|
4885
|
+
"bulk-operations",
|
|
4886
|
+
// Bulk Token/Session Operations
|
|
4887
|
+
"extended-logging",
|
|
4888
|
+
// Erweiterte Login-Info Logs
|
|
4889
|
+
"custom-redirect-urls"
|
|
4890
|
+
// Custom Redirect URLs per Token
|
|
4891
|
+
]
|
|
4892
|
+
},
|
|
4893
|
+
// ADVANCED Features
|
|
4894
|
+
advanced: {
|
|
4895
|
+
maxTokens: -1,
|
|
4896
|
+
// Unlimited
|
|
4897
|
+
maxSessions: -1,
|
|
4898
|
+
// Unlimited
|
|
4899
|
+
maxIPBans: -1,
|
|
4900
|
+
// Unlimited
|
|
4901
|
+
features: [
|
|
4902
|
+
"basic-magic-link",
|
|
4903
|
+
"email-templates",
|
|
4904
|
+
"jwt-sessions",
|
|
4905
|
+
"ip-tracking",
|
|
4906
|
+
"rate-limiting",
|
|
4907
|
+
"auto-user-creation",
|
|
4908
|
+
"token-management",
|
|
4909
|
+
"ip-bans",
|
|
4910
|
+
"otp-email",
|
|
4911
|
+
"mfa-totp",
|
|
4912
|
+
// MFA: Magic Link + TOTP (Szenario 1)
|
|
4913
|
+
"otp-sms",
|
|
4914
|
+
// SMS OTP via Twilio/Vonage
|
|
4915
|
+
"otp-totp",
|
|
4916
|
+
// TOTP (Authenticator Apps)
|
|
4917
|
+
"totp-primary-login",
|
|
4918
|
+
// Login with Email + TOTP only (Szenario 2)
|
|
4919
|
+
"custom-email-templates",
|
|
4920
|
+
"email-designer-integration",
|
|
4921
|
+
"magic-mail-integration",
|
|
4922
|
+
"advanced-rate-limiting",
|
|
4923
|
+
"session-management",
|
|
4924
|
+
"bulk-operations",
|
|
4925
|
+
"extended-logging",
|
|
4926
|
+
"custom-redirect-urls",
|
|
4927
|
+
"webhook-notifications",
|
|
4928
|
+
// Webhooks für Events
|
|
4929
|
+
"api-access-tokens",
|
|
4930
|
+
// API Tokens für Programmatic Access
|
|
4931
|
+
"advanced-analytics",
|
|
4932
|
+
// Analytics Dashboard
|
|
4933
|
+
"custom-token-context",
|
|
4934
|
+
// Custom Context Data in Tokens
|
|
4935
|
+
"geolocation-tracking",
|
|
4936
|
+
// GeoIP Tracking
|
|
4937
|
+
"device-fingerprinting",
|
|
4938
|
+
// Device Fingerprinting
|
|
4939
|
+
"suspicious-login-alerts"
|
|
4940
|
+
// Alerts für verdächtige Logins
|
|
4941
|
+
]
|
|
4942
|
+
},
|
|
4943
|
+
// ENTERPRISE Features
|
|
4944
|
+
enterprise: {
|
|
4945
|
+
maxTokens: -1,
|
|
4946
|
+
maxSessions: -1,
|
|
4947
|
+
maxIPBans: -1,
|
|
4948
|
+
features: [
|
|
4949
|
+
"basic-magic-link",
|
|
4950
|
+
"email-templates",
|
|
4951
|
+
"jwt-sessions",
|
|
4952
|
+
"ip-tracking",
|
|
4953
|
+
"rate-limiting",
|
|
4954
|
+
"auto-user-creation",
|
|
4955
|
+
"token-management",
|
|
4956
|
+
"ip-bans",
|
|
4957
|
+
"otp-email",
|
|
4958
|
+
"mfa-totp",
|
|
4959
|
+
// MFA: Magic Link + TOTP (Szenario 1)
|
|
4960
|
+
"otp-sms",
|
|
4961
|
+
"otp-totp",
|
|
4962
|
+
"totp-primary-login",
|
|
4963
|
+
// Login with Email + TOTP only (Szenario 2)
|
|
4964
|
+
"otp-backup-codes",
|
|
4965
|
+
// Backup Recovery Codes
|
|
4966
|
+
"biometric-support",
|
|
4967
|
+
// WebAuthn/FIDO2
|
|
4968
|
+
"custom-email-templates",
|
|
4969
|
+
"email-designer-integration",
|
|
4970
|
+
"magic-mail-integration",
|
|
4971
|
+
"advanced-rate-limiting",
|
|
4972
|
+
"session-management",
|
|
4973
|
+
"bulk-operations",
|
|
4974
|
+
"extended-logging",
|
|
4975
|
+
"custom-redirect-urls",
|
|
4976
|
+
"webhook-notifications",
|
|
4977
|
+
"api-access-tokens",
|
|
4978
|
+
"advanced-analytics",
|
|
4979
|
+
"custom-token-context",
|
|
4980
|
+
"geolocation-tracking",
|
|
4981
|
+
"device-fingerprinting",
|
|
4982
|
+
"suspicious-login-alerts",
|
|
4983
|
+
"sso-integration",
|
|
4984
|
+
// SSO/SAML Integration
|
|
4985
|
+
"ldap-sync",
|
|
4986
|
+
// LDAP/AD Sync
|
|
4987
|
+
"audit-logs",
|
|
4988
|
+
// Vollständige Audit Logs
|
|
4989
|
+
"compliance-reports",
|
|
4990
|
+
// GDPR/SOC2 Reports
|
|
4991
|
+
"priority-support",
|
|
4992
|
+
// 24/7 Priority Support
|
|
4993
|
+
"custom-security-rules",
|
|
4994
|
+
// Custom Security Rules
|
|
4995
|
+
"multi-tenant",
|
|
4996
|
+
// Multi-Tenant Support
|
|
4997
|
+
"white-label"
|
|
4998
|
+
// White-Label Branding
|
|
4999
|
+
]
|
|
5000
|
+
},
|
|
5001
|
+
/**
|
|
5002
|
+
* Check if a feature is available for given license tier
|
|
5003
|
+
*/
|
|
5004
|
+
hasFeature(licenseData, featureName) {
|
|
5005
|
+
if (!licenseData) {
|
|
5044
5006
|
return this.free.features.includes(featureName);
|
|
5045
|
-
},
|
|
5046
|
-
/**
|
|
5047
|
-
* Get max allowed tokens for license tier
|
|
5048
|
-
*/
|
|
5049
|
-
getMaxTokens(licenseData) {
|
|
5050
|
-
if (!licenseData) return this.free.maxTokens;
|
|
5051
|
-
if (licenseData.featureEnterprise === true || licenseData.features?.enterprise === true) return this.enterprise.maxTokens;
|
|
5052
|
-
if (licenseData.featureAdvanced === true || licenseData.features?.advanced === true) return this.advanced.maxTokens;
|
|
5053
|
-
if (licenseData.featurePremium === true || licenseData.features?.premium === true) return this.premium.maxTokens;
|
|
5054
|
-
return this.free.maxTokens;
|
|
5055
|
-
},
|
|
5056
|
-
/**
|
|
5057
|
-
* Get max allowed sessions for license tier
|
|
5058
|
-
*/
|
|
5059
|
-
getMaxSessions(licenseData) {
|
|
5060
|
-
if (!licenseData) return this.free.maxSessions;
|
|
5061
|
-
if (licenseData.featureEnterprise === true || licenseData.features?.enterprise === true) return this.enterprise.maxSessions;
|
|
5062
|
-
if (licenseData.featureAdvanced === true || licenseData.features?.advanced === true) return this.advanced.maxSessions;
|
|
5063
|
-
if (licenseData.featurePremium === true || licenseData.features?.premium === true) return this.premium.maxSessions;
|
|
5064
|
-
return this.free.maxSessions;
|
|
5065
|
-
},
|
|
5066
|
-
/**
|
|
5067
|
-
* Get max allowed IP bans for license tier
|
|
5068
|
-
*/
|
|
5069
|
-
getMaxIPBans(licenseData) {
|
|
5070
|
-
if (!licenseData) return this.free.maxIPBans;
|
|
5071
|
-
if (licenseData.featureEnterprise === true || licenseData.features?.enterprise === true) return this.enterprise.maxIPBans;
|
|
5072
|
-
if (licenseData.featureAdvanced === true || licenseData.features?.advanced === true) return this.advanced.maxIPBans;
|
|
5073
|
-
if (licenseData.featurePremium === true || licenseData.features?.premium === true) return this.premium.maxIPBans;
|
|
5074
|
-
return this.free.maxIPBans;
|
|
5075
|
-
},
|
|
5076
|
-
/**
|
|
5077
|
-
* Get tier name from license data
|
|
5078
|
-
*/
|
|
5079
|
-
getTierName(licenseData) {
|
|
5080
|
-
if (!licenseData) return "free";
|
|
5081
|
-
if (licenseData.featureEnterprise === true || licenseData.features?.enterprise === true) return "enterprise";
|
|
5082
|
-
if (licenseData.featureAdvanced === true || licenseData.features?.advanced === true) return "advanced";
|
|
5083
|
-
if (licenseData.featurePremium === true || licenseData.features?.premium === true) return "premium";
|
|
5084
|
-
return "free";
|
|
5085
5007
|
}
|
|
5086
|
-
|
|
5087
|
-
|
|
5088
|
-
|
|
5089
|
-
|
|
5008
|
+
let isEnterprise = false;
|
|
5009
|
+
let isAdvanced = false;
|
|
5010
|
+
let isPremium = false;
|
|
5011
|
+
if (licenseData.tier) {
|
|
5012
|
+
isEnterprise = licenseData.tier === "enterprise";
|
|
5013
|
+
isAdvanced = licenseData.tier === "advanced";
|
|
5014
|
+
isPremium = licenseData.tier === "premium";
|
|
5015
|
+
}
|
|
5016
|
+
if (licenseData.features) {
|
|
5017
|
+
isEnterprise = isEnterprise || licenseData.features.enterprise === true;
|
|
5018
|
+
isAdvanced = isAdvanced || licenseData.features.advanced === true;
|
|
5019
|
+
isPremium = isPremium || licenseData.features.premium === true;
|
|
5020
|
+
}
|
|
5021
|
+
if (licenseData.featureEnterprise === true) {
|
|
5022
|
+
isEnterprise = true;
|
|
5023
|
+
}
|
|
5024
|
+
if (licenseData.featureAdvanced === true) {
|
|
5025
|
+
isAdvanced = true;
|
|
5026
|
+
}
|
|
5027
|
+
if (licenseData.featurePremium === true) {
|
|
5028
|
+
isPremium = true;
|
|
5029
|
+
}
|
|
5030
|
+
if (isEnterprise && this.enterprise.features.includes(featureName)) {
|
|
5031
|
+
return true;
|
|
5032
|
+
}
|
|
5033
|
+
if (isAdvanced && this.advanced.features.includes(featureName)) {
|
|
5034
|
+
return true;
|
|
5035
|
+
}
|
|
5036
|
+
if (isPremium && this.premium.features.includes(featureName)) {
|
|
5037
|
+
return true;
|
|
5038
|
+
}
|
|
5039
|
+
return this.free.features.includes(featureName);
|
|
5040
|
+
},
|
|
5041
|
+
/**
|
|
5042
|
+
* Get max allowed tokens for license tier
|
|
5043
|
+
*/
|
|
5044
|
+
getMaxTokens(licenseData) {
|
|
5045
|
+
if (!licenseData) return this.free.maxTokens;
|
|
5046
|
+
if (licenseData.featureEnterprise === true || licenseData.features?.enterprise === true) return this.enterprise.maxTokens;
|
|
5047
|
+
if (licenseData.featureAdvanced === true || licenseData.features?.advanced === true) return this.advanced.maxTokens;
|
|
5048
|
+
if (licenseData.featurePremium === true || licenseData.features?.premium === true) return this.premium.maxTokens;
|
|
5049
|
+
return this.free.maxTokens;
|
|
5050
|
+
},
|
|
5051
|
+
/**
|
|
5052
|
+
* Get max allowed sessions for license tier
|
|
5053
|
+
*/
|
|
5054
|
+
getMaxSessions(licenseData) {
|
|
5055
|
+
if (!licenseData) return this.free.maxSessions;
|
|
5056
|
+
if (licenseData.featureEnterprise === true || licenseData.features?.enterprise === true) return this.enterprise.maxSessions;
|
|
5057
|
+
if (licenseData.featureAdvanced === true || licenseData.features?.advanced === true) return this.advanced.maxSessions;
|
|
5058
|
+
if (licenseData.featurePremium === true || licenseData.features?.premium === true) return this.premium.maxSessions;
|
|
5059
|
+
return this.free.maxSessions;
|
|
5060
|
+
},
|
|
5061
|
+
/**
|
|
5062
|
+
* Get max allowed IP bans for license tier
|
|
5063
|
+
*/
|
|
5064
|
+
getMaxIPBans(licenseData) {
|
|
5065
|
+
if (!licenseData) return this.free.maxIPBans;
|
|
5066
|
+
if (licenseData.featureEnterprise === true || licenseData.features?.enterprise === true) return this.enterprise.maxIPBans;
|
|
5067
|
+
if (licenseData.featureAdvanced === true || licenseData.features?.advanced === true) return this.advanced.maxIPBans;
|
|
5068
|
+
if (licenseData.featurePremium === true || licenseData.features?.premium === true) return this.premium.maxIPBans;
|
|
5069
|
+
return this.free.maxIPBans;
|
|
5070
|
+
},
|
|
5071
|
+
/**
|
|
5072
|
+
* Get tier name from license data
|
|
5073
|
+
*/
|
|
5074
|
+
getTierName(licenseData) {
|
|
5075
|
+
if (!licenseData) return "free";
|
|
5076
|
+
if (licenseData.featureEnterprise === true || licenseData.features?.enterprise === true) return "enterprise";
|
|
5077
|
+
if (licenseData.featureAdvanced === true || licenseData.features?.advanced === true) return "advanced";
|
|
5078
|
+
if (licenseData.featurePremium === true || licenseData.features?.premium === true) return "premium";
|
|
5079
|
+
return "free";
|
|
5080
|
+
}
|
|
5081
|
+
};
|
|
5082
|
+
const crypto$1 = require$$0__default.default;
|
|
5090
5083
|
const os = require$$1__default$3.default;
|
|
5084
|
+
const features = features$1;
|
|
5091
5085
|
const LICENSE_SERVER_URL = "https://magicapi.fitlex.me";
|
|
5092
5086
|
const envTimeout = Number(process.env.MAGIC_LICENSE_TIMEOUT_MS);
|
|
5093
5087
|
const DEFAULT_FETCH_TIMEOUT_MS = Number.isFinite(envTimeout) && envTimeout > 0 ? envTimeout : 12e3;
|
|
@@ -5469,14 +5463,13 @@ var licenseGuard$1 = ({ strapi: strapi2 }) => ({
|
|
|
5469
5463
|
*/
|
|
5470
5464
|
async hasFeature(featureName) {
|
|
5471
5465
|
try {
|
|
5472
|
-
const features2 = requireFeatures();
|
|
5473
5466
|
const pluginStore = strapi2.store({ type: "plugin", name: "magic-link" });
|
|
5474
5467
|
const licenseKey = await pluginStore.get({ key: "licenseKey" });
|
|
5475
5468
|
if (!licenseKey) {
|
|
5476
|
-
return
|
|
5469
|
+
return features.hasFeature(null, featureName);
|
|
5477
5470
|
}
|
|
5478
5471
|
const licenseData = await this.getLicenseByKey(licenseKey);
|
|
5479
|
-
return
|
|
5472
|
+
return features.hasFeature(licenseData, featureName);
|
|
5480
5473
|
} catch (error) {
|
|
5481
5474
|
strapi2.log.error("Error checking feature:", error);
|
|
5482
5475
|
return false;
|
|
@@ -5488,14 +5481,13 @@ var licenseGuard$1 = ({ strapi: strapi2 }) => ({
|
|
|
5488
5481
|
*/
|
|
5489
5482
|
async getMaxTokens() {
|
|
5490
5483
|
try {
|
|
5491
|
-
const features2 = requireFeatures();
|
|
5492
5484
|
const pluginStore = strapi2.store({ type: "plugin", name: "magic-link" });
|
|
5493
5485
|
const licenseKey = await pluginStore.get({ key: "licenseKey" });
|
|
5494
5486
|
if (!licenseKey) {
|
|
5495
|
-
return
|
|
5487
|
+
return features.getMaxTokens(null);
|
|
5496
5488
|
}
|
|
5497
5489
|
const licenseData = await this.getLicenseByKey(licenseKey);
|
|
5498
|
-
return
|
|
5490
|
+
return features.getMaxTokens(licenseData);
|
|
5499
5491
|
} catch (error) {
|
|
5500
5492
|
strapi2.log.error("Error getting max tokens:", error);
|
|
5501
5493
|
return features.free.maxTokens;
|
|
@@ -5507,14 +5499,13 @@ var licenseGuard$1 = ({ strapi: strapi2 }) => ({
|
|
|
5507
5499
|
*/
|
|
5508
5500
|
async getMaxSessions() {
|
|
5509
5501
|
try {
|
|
5510
|
-
const features2 = requireFeatures();
|
|
5511
5502
|
const pluginStore = strapi2.store({ type: "plugin", name: "magic-link" });
|
|
5512
5503
|
const licenseKey = await pluginStore.get({ key: "licenseKey" });
|
|
5513
5504
|
if (!licenseKey) {
|
|
5514
|
-
return
|
|
5505
|
+
return features.getMaxSessions(null);
|
|
5515
5506
|
}
|
|
5516
5507
|
const licenseData = await this.getLicenseByKey(licenseKey);
|
|
5517
|
-
return
|
|
5508
|
+
return features.getMaxSessions(licenseData);
|
|
5518
5509
|
} catch (error) {
|
|
5519
5510
|
strapi2.log.error("Error getting max sessions:", error);
|
|
5520
5511
|
return features.free.maxSessions;
|
|
@@ -5526,14 +5517,13 @@ var licenseGuard$1 = ({ strapi: strapi2 }) => ({
|
|
|
5526
5517
|
*/
|
|
5527
5518
|
async getMaxIPBans() {
|
|
5528
5519
|
try {
|
|
5529
|
-
const features2 = requireFeatures();
|
|
5530
5520
|
const pluginStore = strapi2.store({ type: "plugin", name: "magic-link" });
|
|
5531
5521
|
const licenseKey = await pluginStore.get({ key: "licenseKey" });
|
|
5532
5522
|
if (!licenseKey) {
|
|
5533
|
-
return
|
|
5523
|
+
return features.getMaxIPBans(null);
|
|
5534
5524
|
}
|
|
5535
5525
|
const licenseData = await this.getLicenseByKey(licenseKey);
|
|
5536
|
-
return
|
|
5526
|
+
return features.getMaxIPBans(licenseData);
|
|
5537
5527
|
} catch (error) {
|
|
5538
5528
|
strapi2.log.error("Error getting max IP bans:", error);
|
|
5539
5529
|
return features.free.maxIPBans;
|
|
@@ -5545,14 +5535,13 @@ var licenseGuard$1 = ({ strapi: strapi2 }) => ({
|
|
|
5545
5535
|
*/
|
|
5546
5536
|
async getAvailableOTPTypes() {
|
|
5547
5537
|
try {
|
|
5548
|
-
const features2 = requireFeatures();
|
|
5549
5538
|
const pluginStore = strapi2.store({ type: "plugin", name: "magic-link" });
|
|
5550
5539
|
const licenseKey = await pluginStore.get({ key: "licenseKey" });
|
|
5551
5540
|
if (!licenseKey) {
|
|
5552
|
-
return
|
|
5541
|
+
return features.getAvailableOTPTypes(null);
|
|
5553
5542
|
}
|
|
5554
5543
|
const licenseData = await this.getLicenseByKey(licenseKey);
|
|
5555
|
-
return
|
|
5544
|
+
return features.getAvailableOTPTypes(licenseData);
|
|
5556
5545
|
} catch (error) {
|
|
5557
5546
|
strapi2.log.error("Error getting available OTP types:", error);
|
|
5558
5547
|
return [];
|
|
@@ -5723,7 +5712,7 @@ var rateLimiter$1 = ({ strapi: strapi2 }) => {
|
|
|
5723
5712
|
}
|
|
5724
5713
|
};
|
|
5725
5714
|
};
|
|
5726
|
-
const crypto = require$$0__default
|
|
5715
|
+
const crypto = require$$0__default.default;
|
|
5727
5716
|
const speakeasy = require$$1__default$4.default;
|
|
5728
5717
|
const QRCode = require$$2__default.default;
|
|
5729
5718
|
const emailHelpers = emailHelpers$3;
|
|
@@ -6367,7 +6356,7 @@ If you didn't request this code, you can safely ignore this email.
|
|
|
6367
6356
|
};
|
|
6368
6357
|
};
|
|
6369
6358
|
const path = require$$1__default.default;
|
|
6370
|
-
const fs = require$$0__default.default;
|
|
6359
|
+
const fs = require$$0__default$1.default;
|
|
6371
6360
|
let baileys = null;
|
|
6372
6361
|
const getMagicMailWhatsApp = (strapi2) => {
|
|
6373
6362
|
try {
|