@dymo-api/better-auth 1.2.25 → 1.2.27

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/README.md CHANGED
@@ -24,7 +24,7 @@ You can see the library documentation by clicking [here](https://docs.tpeoficial
24
24
  - ✅ World's largest fraud validation database | `fakeuser@temp.com` -> **Blocked**.
25
25
  - ✅ Fraud validation for personal emails and OAuth (the only one on the market today) | `fakeuser@gmail.com` -> **Blocked**.
26
26
  - ✅ Multi-data validation at no additional cost | Validate email addresses, phone numbers, and more at no additional cost, all in one place.
27
- - ✅ Data normalization | `fo.o+tem.p@gmail.com` -> `foo@gmail.com`.
27
+ - ✅ Data normalization | `fo.o+tem.p@gmail.com` -> `foo@gmail.com` (can be disabled with `normalize: false`).
28
28
 
29
29
  #### Installation
30
30
 
@@ -51,11 +51,12 @@ yarn add @dymo-api/better-auth
51
51
  ```ts
52
52
  export const auth = betterAuth({
53
53
  plugins: [
54
- dymoEmailPlugin({
54
+ dymoEmailPlugin({
55
55
  apiKey: "YOUR_API_KEY_HERE",
56
56
  emailRules: {
57
57
  deny: ["FRAUD", "INVALID", "NO_REPLY_EMAIL"]
58
- }
58
+ }
59
+ // normalize: true (default) - Set to false to disable email normalization
59
60
  })
60
61
  ]
61
62
  });
@@ -66,11 +67,12 @@ export const auth = betterAuth({
66
67
  ```ts
67
68
  export const auth = betterAuth({
68
69
  plugins: [
69
- dymoIPPlugin({
70
+ dymoIPPlugin({
70
71
  apiKey: "YOUR_API_KEY_HERE",
71
72
  ipRules: {
72
73
  deny: ["FRAUD", "INVALID", "TOR_NETWORK"]
73
- }
74
+ }
75
+ // normalize: true (default) - Set to false to disable IP normalization
74
76
  })
75
77
  ]
76
78
  });
@@ -81,11 +83,12 @@ export const auth = betterAuth({
81
83
  ```ts
82
84
  export const auth = betterAuth({
83
85
  plugins: [
84
- dymoPhonePlugin({
86
+ dymoPhonePlugin({
85
87
  apiKey: "YOUR_API_KEY_HERE",
86
88
  phoneRules: {
87
89
  deny: ["FRAUD", "INVALID"]
88
- }
90
+ }
91
+ // normalize: true (default) - Set to false to disable phone normalization
89
92
  })
90
93
  ]
91
94
  });
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.dymoEmailPlugin = void 0;
7
7
  const api_1 = require("better-auth/api");
8
8
  const dymo_api_1 = __importDefault(require("dymo-api"));
9
- const dymoEmailPlugin = ({ apiKey, applyToLogin = false, applyToOAuth = true, emailRules }) => {
9
+ const dymoEmailPlugin = ({ apiKey, applyToLogin = false, applyToOAuth = true, emailRules, normalize = true }) => {
10
10
  const defaultRules = {
11
11
  deny: ["FRAUD", "INVALID", "NO_MX_RECORDS", "NO_REPLY_EMAIL"]
12
12
  };
@@ -55,7 +55,8 @@ const dymoEmailPlugin = ({ apiKey, applyToLogin = false, applyToOAuth = true, em
55
55
  reasons: decision.reasons
56
56
  });
57
57
  }
58
- ctx.body.email = decision.email;
58
+ if (normalize)
59
+ ctx.body.email = decision.email;
59
60
  ctx.dymoEmail = decision.response;
60
61
  return { context: ctx };
61
62
  })
@@ -7,7 +7,7 @@ exports.dymoIPPlugin = void 0;
7
7
  const api_1 = require("better-auth/api");
8
8
  const dymo_api_1 = __importDefault(require("dymo-api"));
9
9
  const ipHeaders = ["x-forwarded-for", "cf-connecting-ip", "x-vercel-forwarded-for", "x-real-ip"];
10
- const dymoIPPlugin = ({ apiKey, applyToLogin = false, applyToOAuth = true, ipRules }) => {
10
+ const dymoIPPlugin = ({ apiKey, applyToLogin = false, applyToOAuth = true, ipRules, normalize = true }) => {
11
11
  const defaultRules = {
12
12
  deny: ["FRAUD", "INVALID", "TOR_NETWORK"]
13
13
  };
@@ -63,8 +63,10 @@ const dymoIPPlugin = ({ apiKey, applyToLogin = false, applyToOAuth = true, ipRul
63
63
  reasons: decision.reasons
64
64
  });
65
65
  }
66
- ctx.body.ip = decision.ip;
67
- ctx.request.headers.set("x-dymo-client-ip", decision.ip);
66
+ if (normalize) {
67
+ ctx.body.ip = decision.ip;
68
+ ctx.request.headers.set("x-dymo-client-ip", decision.ip);
69
+ }
68
70
  ctx.dymoIP = decision.response;
69
71
  return { context: ctx };
70
72
  })
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.dymoPhonePlugin = void 0;
7
7
  const api_1 = require("better-auth/api");
8
8
  const dymo_api_1 = __importDefault(require("dymo-api"));
9
- const dymoPhonePlugin = ({ apiKey, applyToLogin = false, applyToOAuth = true, phoneRules }) => {
9
+ const dymoPhonePlugin = ({ apiKey, applyToLogin = false, applyToOAuth = true, phoneRules, normalize = true }) => {
10
10
  const defaultRules = {
11
11
  deny: ["FRAUD", "INVALID"]
12
12
  };
@@ -48,8 +48,9 @@ const dymoPhonePlugin = ({ apiKey, applyToLogin = false, applyToOAuth = true, ph
48
48
  reasons: decision.reasons
49
49
  });
50
50
  }
51
- ctx.body.phoneNumber = decision.phone;
52
- ctx.dymoEmail = decision.response;
51
+ if (normalize)
52
+ ctx.body.phoneNumber = decision.phone;
53
+ ctx.dymoPhone = decision.response;
53
54
  return { context: ctx };
54
55
  })
55
56
  }
@@ -1,6 +1,6 @@
1
1
  import { APIError, createAuthMiddleware } from "better-auth/api";
2
2
  import DymoAPI from "dymo-api";
3
- export const dymoEmailPlugin = ({ apiKey, applyToLogin = false, applyToOAuth = true, emailRules }) => {
3
+ export const dymoEmailPlugin = ({ apiKey, applyToLogin = false, applyToOAuth = true, emailRules, normalize = true }) => {
4
4
  const defaultRules = {
5
5
  deny: ["FRAUD", "INVALID", "NO_MX_RECORDS", "NO_REPLY_EMAIL"]
6
6
  };
@@ -49,7 +49,8 @@ export const dymoEmailPlugin = ({ apiKey, applyToLogin = false, applyToOAuth = t
49
49
  reasons: decision.reasons
50
50
  });
51
51
  }
52
- ctx.body.email = decision.email;
52
+ if (normalize)
53
+ ctx.body.email = decision.email;
53
54
  ctx.dymoEmail = decision.response;
54
55
  return { context: ctx };
55
56
  })
@@ -1,7 +1,7 @@
1
1
  import { APIError, createAuthMiddleware } from "better-auth/api";
2
2
  import DymoAPI from "dymo-api";
3
3
  const ipHeaders = ["x-forwarded-for", "cf-connecting-ip", "x-vercel-forwarded-for", "x-real-ip"];
4
- export const dymoIPPlugin = ({ apiKey, applyToLogin = false, applyToOAuth = true, ipRules }) => {
4
+ export const dymoIPPlugin = ({ apiKey, applyToLogin = false, applyToOAuth = true, ipRules, normalize = true }) => {
5
5
  const defaultRules = {
6
6
  deny: ["FRAUD", "INVALID", "TOR_NETWORK"]
7
7
  };
@@ -57,8 +57,10 @@ export const dymoIPPlugin = ({ apiKey, applyToLogin = false, applyToOAuth = true
57
57
  reasons: decision.reasons
58
58
  });
59
59
  }
60
- ctx.body.ip = decision.ip;
61
- ctx.request.headers.set("x-dymo-client-ip", decision.ip);
60
+ if (normalize) {
61
+ ctx.body.ip = decision.ip;
62
+ ctx.request.headers.set("x-dymo-client-ip", decision.ip);
63
+ }
62
64
  ctx.dymoIP = decision.response;
63
65
  return { context: ctx };
64
66
  })
@@ -1,6 +1,6 @@
1
1
  import { APIError, createAuthMiddleware } from "better-auth/api";
2
2
  import DymoAPI from "dymo-api";
3
- export const dymoPhonePlugin = ({ apiKey, applyToLogin = false, applyToOAuth = true, phoneRules }) => {
3
+ export const dymoPhonePlugin = ({ apiKey, applyToLogin = false, applyToOAuth = true, phoneRules, normalize = true }) => {
4
4
  const defaultRules = {
5
5
  deny: ["FRAUD", "INVALID"]
6
6
  };
@@ -42,8 +42,9 @@ export const dymoPhonePlugin = ({ apiKey, applyToLogin = false, applyToOAuth = t
42
42
  reasons: decision.reasons
43
43
  });
44
44
  }
45
- ctx.body.phoneNumber = decision.phone;
46
- ctx.dymoEmail = decision.response;
45
+ if (normalize)
46
+ ctx.body.phoneNumber = decision.phone;
47
+ ctx.dymoPhone = decision.response;
47
48
  return { context: ctx };
48
49
  })
49
50
  }
@@ -4,8 +4,9 @@ interface DymoEmailPluginOptions {
4
4
  applyToLogin?: boolean;
5
5
  applyToOAuth?: boolean;
6
6
  emailRules?: Partial<EmailValidatorRules>;
7
+ normalize?: boolean;
7
8
  }
8
- export declare const dymoEmailPlugin: ({ apiKey, applyToLogin, applyToOAuth, emailRules }: DymoEmailPluginOptions) => {
9
+ export declare const dymoEmailPlugin: ({ apiKey, applyToLogin, applyToOAuth, emailRules, normalize }: DymoEmailPluginOptions) => {
9
10
  id: "dymoEmailPlugin";
10
11
  hooks: {
11
12
  before: {
@@ -4,8 +4,9 @@ interface dymoIPPluginOptions {
4
4
  applyToLogin?: boolean;
5
5
  applyToOAuth?: boolean;
6
6
  ipRules?: Partial<IPValidatorRules>;
7
+ normalize?: boolean;
7
8
  }
8
- export declare const dymoIPPlugin: ({ apiKey, applyToLogin, applyToOAuth, ipRules }: dymoIPPluginOptions) => {
9
+ export declare const dymoIPPlugin: ({ apiKey, applyToLogin, applyToOAuth, ipRules, normalize }: dymoIPPluginOptions) => {
9
10
  id: "dymoIPPlugin";
10
11
  hooks: {
11
12
  before: {
@@ -4,8 +4,9 @@ interface DymoPhonePluginOptions {
4
4
  applyToLogin?: boolean;
5
5
  applyToOAuth?: boolean;
6
6
  phoneRules?: Partial<PhoneValidatorRules>;
7
+ normalize?: boolean;
7
8
  }
8
- export declare const dymoPhonePlugin: ({ apiKey, applyToLogin, applyToOAuth, phoneRules }: DymoPhonePluginOptions) => {
9
+ export declare const dymoPhonePlugin: ({ apiKey, applyToLogin, applyToOAuth, phoneRules, normalize }: DymoPhonePluginOptions) => {
9
10
  id: "dymoPhonePlugin";
10
11
  hooks: {
11
12
  before: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dymo-api/better-auth",
3
- "version": "1.2.25",
3
+ "version": "1.2.27",
4
4
  "description": "Flow system for Dymo API.",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -59,7 +59,7 @@
59
59
  "homepage": "https://dymo.tpeoficial.com",
60
60
  "dependencies": {
61
61
  "better-auth": "^1.3.23",
62
- "dymo-api": "^1.2.29",
62
+ "dymo-api": "^1.2.30",
63
63
  "path": "^0.12.7"
64
64
  },
65
65
  "contributors": [