@gatwech/auth 1.0.0-beta.21 → 1.0.0-beta.22
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/dist/adapters/index.d.mts +1 -1
- package/dist/adapters/prisma-adapter/index.mjs +1 -1
- package/dist/{admin-BzUJL6tr.mjs → admin-rd-xHhnP.mjs} +1 -1
- package/dist/{anonymous-BjlTk4gl.mjs → anonymous-qSasVeIe.mjs} +1 -1
- package/dist/api/index.d.mts +1 -1
- package/dist/api/index.mjs +1 -1
- package/dist/{api-Dk8Yj_J5.mjs → api-BV65Y-Rk.mjs} +5 -0
- package/dist/{auth-BoEA9bN7.mjs → auth-DtOjarwu.mjs} +1 -1
- package/dist/client/index.d.mts +1 -1
- package/dist/client/plugins/index.d.mts +46 -46
- package/dist/client/react/index.d.mts +1 -1
- package/dist/{client-Da7tq8m6.d.mts → client-DO9MgP_0.d.mts} +1 -1
- package/dist/{client-B00gkznv.d.mts → client-ukvqpcbI.d.mts} +1 -1
- package/dist/cookies/index.d.mts +2 -2
- package/dist/db/index.d.mts +1 -1
- package/dist/{email-otp-Dw0DypjQ.mjs → email-otp-BmgAht1S.mjs} +1 -1
- package/dist/{generic-oauth-DFj27JY8.mjs → generic-oauth-C5_AXj2z.mjs} +1 -1
- package/dist/{haveibeenpwned-CzNda7Tn.mjs → haveibeenpwned-_3a5amT-.mjs} +1 -1
- package/dist/{index-BKy-8t2n.d.mts → index-AiKdOFSd.d.mts} +111 -112
- package/dist/{index-YeXSxzhX.d.mts → index-B4hJVVRn.d.mts} +19 -19
- package/dist/{index-Bhc37y9F.d.mts → index-BC0aAKsT.d.mts} +3 -3
- package/dist/{index-CpH-1sse.d.mts → index-BfLofiXO.d.mts} +9 -9
- package/dist/{index-CbBQdS-u.d.mts → index-BzzhaGLe.d.mts} +6 -6
- package/dist/{index-jEkJ2Zfk.d.mts → index-CBGNX7W1.d.mts} +6 -6
- package/dist/{index-Dt2I0G4X.d.mts → index-CRNh-5Tc.d.mts} +7 -7
- package/dist/{index-CMG4Pnen.d.mts → index-CRiKKdkb.d.mts} +6 -6
- package/dist/{index-VUyESU4p.d.mts → index-CTSeVJJB.d.mts} +1 -1
- package/dist/{index-iRoaTsOj.d.mts → index-CxhQu1HM.d.mts} +2 -2
- package/dist/{index-CM1rFdwV.d.mts → index-D-rjuF7p.d.mts} +7 -7
- package/dist/{index-IX1to9TB.d.mts → index-D3uQsW8T.d.mts} +33 -33
- package/dist/{index-CTqynuxm.d.mts → index-DKirx_GW.d.mts} +4 -4
- package/dist/{index-TrOnY3pM.d.mts → index-DSoiUc1C.d.mts} +169 -169
- package/dist/{index-oNlp4SvD.d.mts → index-Dkm27DLN.d.mts} +10 -10
- package/dist/{index-cPt-00xm.d.mts → index-Dl0bD1_6.d.mts} +6 -6
- package/dist/{index-C-IDh5yy.d.mts → index-DlS-HqZR.d.mts} +2 -2
- package/dist/{index-BjCQ3jmE.d.mts → index-DngQlUSI.d.mts} +118 -118
- package/dist/{index-D1OZ2e4m.d.mts → index-Do8AV4PF.d.mts} +13 -13
- package/dist/{index-WV7VzW2H.d.mts → index-SYRh5FW7.d.mts} +8 -8
- package/dist/{index-BECNG13R.d.mts → index-eOfQxlQV.d.mts} +13 -13
- package/dist/{index-BWYXZVsV.d.mts → index-hP8gvyp-.d.mts} +5 -5
- package/dist/{index-Bxive_YT.d.mts → index-pdl9MzQu.d.mts} +9 -9
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +2 -2
- package/dist/integrations/next-js.d.mts +4 -4
- package/dist/integrations/node.d.mts +1 -1
- package/dist/integrations/react-start.d.mts +4 -4
- package/dist/{jwt-DBN2mu0r.mjs → jwt-Czv-v097.mjs} +1 -1
- package/dist/{magic-link-D9Em1aOR.mjs → magic-link-CJgE0Ngn.mjs} +1 -1
- package/dist/{multi-session-Dno_8DxC.mjs → multi-session-bveCXtQW.mjs} +1 -1
- package/dist/{oauth-proxy-DW-zt8wv.mjs → oauth-proxy-69n1xA8L.mjs} +1 -1
- package/dist/oauth2/index.d.mts +1 -1
- package/dist/oauth2/index.mjs +1 -1
- package/dist/{one-tap-CodeyQb8.mjs → one-tap-Cm1eHuqi.mjs} +1 -1
- package/dist/{organization-D4QMpChF.mjs → organization-BK3ks97y.mjs} +1 -1
- package/dist/plugins/admin/index.d.mts +2 -2
- package/dist/plugins/admin/index.mjs +2 -2
- package/dist/plugins/anonymous/index.d.mts +2 -2
- package/dist/plugins/anonymous/index.mjs +2 -2
- package/dist/plugins/audit-log/client.d.mts +23 -23
- package/dist/plugins/audit-log/index.d.mts +22 -22
- package/dist/plugins/audit-log/index.mjs +1 -1
- package/dist/plugins/bearer/index.d.mts +1 -1
- package/dist/plugins/captcha/index.d.mts +1 -1
- package/dist/plugins/custom-session/index.d.mts +2 -2
- package/dist/plugins/custom-session/index.mjs +1 -1
- package/dist/plugins/device-authorization/index.d.mts +1 -1
- package/dist/plugins/email-otp/index.d.mts +1 -1
- package/dist/plugins/email-otp/index.mjs +2 -2
- package/dist/plugins/generic-oauth/index.d.mts +2 -2
- package/dist/plugins/generic-oauth/index.mjs +2 -2
- package/dist/plugins/haveibeenpwned/index.d.mts +1 -1
- package/dist/plugins/haveibeenpwned/index.mjs +2 -2
- package/dist/plugins/index.d.mts +22 -22
- package/dist/plugins/index.mjs +15 -15
- package/dist/plugins/jwt/index.d.mts +2 -2
- package/dist/plugins/jwt/index.mjs +2 -2
- package/dist/plugins/magic-link/index.d.mts +1 -1
- package/dist/plugins/magic-link/index.mjs +2 -2
- package/dist/plugins/multi-session/index.d.mts +1 -1
- package/dist/plugins/multi-session/index.mjs +2 -2
- package/dist/plugins/oauth-proxy/index.d.mts +1 -1
- package/dist/plugins/oauth-proxy/index.mjs +2 -2
- package/dist/plugins/one-tap/index.d.mts +1 -1
- package/dist/plugins/one-tap/index.mjs +2 -2
- package/dist/plugins/one-time-token/index.d.mts +2 -2
- package/dist/plugins/one-time-token/index.mjs +15 -15
- package/dist/plugins/organization/index.d.mts +2 -2
- package/dist/plugins/organization/index.mjs +2 -2
- package/dist/plugins/passkey/index.d.mts +2 -2
- package/dist/plugins/passkey/index.mjs +1 -1
- package/dist/plugins/phone-number/index.d.mts +2 -2
- package/dist/plugins/phone-number/index.mjs +1 -1
- package/dist/plugins/sentinel/client.d.mts +23 -23
- package/dist/plugins/sentinel/index.d.mts +22 -22
- package/dist/plugins/sentinel/index.mjs +3 -3
- package/dist/plugins/two-factor/index.d.mts +2 -2
- package/dist/plugins/two-factor/index.mjs +1 -1
- package/dist/plugins/username/index.d.mts +1 -1
- package/dist/plugins/username/index.mjs +2 -2
- package/dist/{plugins-yF8CFUDR.mjs → plugins-RSPSU3ro.mjs} +1 -1
- package/dist/{sentinel-B4Wo79HK.mjs → sentinel-B-2jmmZh.mjs} +30 -6
- package/dist/src/plugins/sentinel/geo.d.ts +11 -0
- package/dist/src/plugins/sentinel/index.d.ts +1 -3
- package/dist/test-utils/index.d.mts +1044 -1044
- package/dist/test-utils/index.mjs +16 -16
- package/dist/types/index.d.mts +1 -1
- package/dist/{username-BHNvcvsY.mjs → username-DCp6yugu.mjs} +1 -1
- package/package.json +3 -3
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
import "../../helper-BgOIGHsu.mjs";
|
|
2
|
-
import "../../index-
|
|
2
|
+
import "../../index-DngQlUSI.mjs";
|
|
3
3
|
import "../../types-DNQ9XQrB.mjs";
|
|
4
4
|
import "../../index-BL_t8cRp-C4QYBsac.mjs";
|
|
5
5
|
import "../../plugins-Dy_FrD4Y.mjs";
|
|
6
6
|
import "../../index-CxlWnL9c.mjs";
|
|
7
|
-
import "../../index-
|
|
8
|
-
import "../../index-
|
|
9
|
-
import "../../index-
|
|
10
|
-
import "../../index-
|
|
11
|
-
import "../../index-
|
|
12
|
-
import "../../index-
|
|
13
|
-
import "../../index-
|
|
14
|
-
import "../../index-
|
|
15
|
-
import "../../index-
|
|
16
|
-
import "../../index-
|
|
17
|
-
import "../../index-
|
|
18
|
-
import "../../index-
|
|
19
|
-
import "../../index-
|
|
20
|
-
import "../../index-
|
|
21
|
-
import "../../index-
|
|
22
|
-
import "../../index-
|
|
7
|
+
import "../../index-D3uQsW8T.mjs";
|
|
8
|
+
import "../../index-CRiKKdkb.mjs";
|
|
9
|
+
import "../../index-AiKdOFSd.mjs";
|
|
10
|
+
import "../../index-BzzhaGLe.mjs";
|
|
11
|
+
import "../../index-DlS-HqZR.mjs";
|
|
12
|
+
import "../../index-Dl0bD1_6.mjs";
|
|
13
|
+
import "../../index-CBGNX7W1.mjs";
|
|
14
|
+
import "../../index-Do8AV4PF.mjs";
|
|
15
|
+
import "../../index-SYRh5FW7.mjs";
|
|
16
|
+
import "../../index-BC0aAKsT.mjs";
|
|
17
|
+
import "../../index-D-rjuF7p.mjs";
|
|
18
|
+
import "../../index-DKirx_GW.mjs";
|
|
19
|
+
import "../../index-BfLofiXO.mjs";
|
|
20
|
+
import "../../index-Dkm27DLN.mjs";
|
|
21
|
+
import "../../index-CxhQu1HM.mjs";
|
|
22
|
+
import "../../index-hP8gvyp-.mjs";
|
|
23
23
|
import "../../index-QmocqGM-.mjs";
|
|
24
|
-
import "../../index-
|
|
25
|
-
import "../../index-
|
|
26
|
-
import "../../index-
|
|
27
|
-
import "../../index-
|
|
28
|
-
import "../../index-
|
|
29
|
-
import { t as sentinelClient } from "../../client-
|
|
24
|
+
import "../../index-DSoiUc1C.mjs";
|
|
25
|
+
import "../../index-CRNh-5Tc.mjs";
|
|
26
|
+
import "../../index-B4hJVVRn.mjs";
|
|
27
|
+
import "../../index-eOfQxlQV.mjs";
|
|
28
|
+
import "../../index-pdl9MzQu.mjs";
|
|
29
|
+
import { t as sentinelClient } from "../../client-DO9MgP_0.mjs";
|
|
30
30
|
export { sentinelClient };
|
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
import "../../helper-BgOIGHsu.mjs";
|
|
2
|
-
import "../../index-
|
|
2
|
+
import "../../index-DngQlUSI.mjs";
|
|
3
3
|
import "../../types-DNQ9XQrB.mjs";
|
|
4
4
|
import "../../index-BL_t8cRp-C4QYBsac.mjs";
|
|
5
5
|
import "../../plugins-Dy_FrD4Y.mjs";
|
|
6
6
|
import "../../index-CxlWnL9c.mjs";
|
|
7
|
-
import "../../index-
|
|
8
|
-
import "../../index-
|
|
9
|
-
import { S as SentinelOptions, _ as haversineDistanceKm, b as GeoLocation, c as sentinel, d as POW_SOLUTION_HEADER, f as createNonce, g as verifySolution, h as solveChallenge, l as POW_CHALLENGE_HEADER, m as parsePowHeader, p as hasLeadingZeroBits, u as POW_REASON_HEADER, v as normalizeEmail, x as SecurityAction, y as SENTINEL_ERROR_CODES } from "../../index-
|
|
10
|
-
import "../../index-
|
|
11
|
-
import "../../index-
|
|
12
|
-
import "../../index-
|
|
13
|
-
import "../../index-
|
|
14
|
-
import "../../index-
|
|
15
|
-
import "../../index-
|
|
16
|
-
import "../../index-
|
|
17
|
-
import "../../index-
|
|
18
|
-
import "../../index-
|
|
19
|
-
import "../../index-
|
|
20
|
-
import "../../index-
|
|
21
|
-
import "../../index-
|
|
22
|
-
import "../../index-
|
|
7
|
+
import "../../index-D3uQsW8T.mjs";
|
|
8
|
+
import "../../index-CRiKKdkb.mjs";
|
|
9
|
+
import { S as SentinelOptions, _ as haversineDistanceKm, b as GeoLocation, c as sentinel, d as POW_SOLUTION_HEADER, f as createNonce, g as verifySolution, h as solveChallenge, l as POW_CHALLENGE_HEADER, m as parsePowHeader, p as hasLeadingZeroBits, u as POW_REASON_HEADER, v as normalizeEmail, x as SecurityAction, y as SENTINEL_ERROR_CODES } from "../../index-AiKdOFSd.mjs";
|
|
10
|
+
import "../../index-BzzhaGLe.mjs";
|
|
11
|
+
import "../../index-DlS-HqZR.mjs";
|
|
12
|
+
import "../../index-Dl0bD1_6.mjs";
|
|
13
|
+
import "../../index-CBGNX7W1.mjs";
|
|
14
|
+
import "../../index-Do8AV4PF.mjs";
|
|
15
|
+
import "../../index-SYRh5FW7.mjs";
|
|
16
|
+
import "../../index-BC0aAKsT.mjs";
|
|
17
|
+
import "../../index-D-rjuF7p.mjs";
|
|
18
|
+
import "../../index-DKirx_GW.mjs";
|
|
19
|
+
import "../../index-BfLofiXO.mjs";
|
|
20
|
+
import "../../index-Dkm27DLN.mjs";
|
|
21
|
+
import "../../index-CxhQu1HM.mjs";
|
|
22
|
+
import "../../index-hP8gvyp-.mjs";
|
|
23
23
|
import "../../index-QmocqGM-.mjs";
|
|
24
|
-
import "../../index-
|
|
25
|
-
import "../../index-
|
|
26
|
-
import "../../index-
|
|
27
|
-
import "../../index-
|
|
28
|
-
import "../../index-
|
|
24
|
+
import "../../index-DSoiUc1C.mjs";
|
|
25
|
+
import "../../index-CRNh-5Tc.mjs";
|
|
26
|
+
import "../../index-B4hJVVRn.mjs";
|
|
27
|
+
import "../../index-eOfQxlQV.mjs";
|
|
28
|
+
import "../../index-pdl9MzQu.mjs";
|
|
29
29
|
export { GeoLocation, POW_CHALLENGE_HEADER, POW_REASON_HEADER, POW_SOLUTION_HEADER, SENTINEL_ERROR_CODES, SecurityAction, SentinelOptions, createNonce, hasLeadingZeroBits, haversineDistanceKm, normalizeEmail, parsePowHeader, sentinel, solveChallenge, verifySolution };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "../../utils-B03WRaGi.mjs";
|
|
2
2
|
import "../../url-VB2gAbTI.mjs";
|
|
3
|
-
import "../../api-
|
|
3
|
+
import "../../api-BV65Y-Rk.mjs";
|
|
4
4
|
import "../../get-request-ip-DSjrEpGo.mjs";
|
|
5
5
|
import "../../json-D0TBLy4q.mjs";
|
|
6
6
|
import "../../crypto-CCyta8xj.mjs";
|
|
@@ -15,8 +15,8 @@ import "../../types-DCPpFKUB.mjs";
|
|
|
15
15
|
import "../../misc-fKH4d5XQ.mjs";
|
|
16
16
|
import "../../session-BB3oqApE.mjs";
|
|
17
17
|
import "../../registry-CqG_3Qnx.mjs";
|
|
18
|
-
import "../../haveibeenpwned-
|
|
18
|
+
import "../../haveibeenpwned-_3a5amT-.mjs";
|
|
19
19
|
import { a as hasLeadingZeroBits, c as verifySolution, i as createNonce, n as POW_REASON_HEADER, o as parsePowHeader, r as POW_SOLUTION_HEADER, s as solveChallenge, t as POW_CHALLENGE_HEADER } from "../../pow-DvkUopsK.mjs";
|
|
20
|
-
import { i as SENTINEL_ERROR_CODES, n as haversineDistanceKm, r as normalizeEmail, t as sentinel } from "../../sentinel-
|
|
20
|
+
import { i as SENTINEL_ERROR_CODES, n as haversineDistanceKm, r as normalizeEmail, t as sentinel } from "../../sentinel-B-2jmmZh.mjs";
|
|
21
21
|
|
|
22
22
|
export { POW_CHALLENGE_HEADER, POW_REASON_HEADER, POW_SOLUTION_HEADER, SENTINEL_ERROR_CODES, createNonce, hasLeadingZeroBits, haversineDistanceKm, normalizeEmail, parsePowHeader, sentinel, solveChallenge, verifySolution };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "../../helper-BgOIGHsu.mjs";
|
|
2
|
-
import "../../index-
|
|
2
|
+
import "../../index-DngQlUSI.mjs";
|
|
3
3
|
import "../../types-DNQ9XQrB.mjs";
|
|
4
4
|
import "../../index-BL_t8cRp-C4QYBsac.mjs";
|
|
5
5
|
import "../../plugins-Dy_FrD4Y.mjs";
|
|
6
|
-
import { a as TwoFactorProvider, i as TwoFactorOptions, n as twoFactorClient, o as TwoFactorTable, r as TWO_FACTOR_ERROR_CODES, s as UserWithTwoFactor, t as twoFactor } from "../../index-
|
|
6
|
+
import { a as TwoFactorProvider, i as TwoFactorOptions, n as twoFactorClient, o as TwoFactorTable, r as TWO_FACTOR_ERROR_CODES, s as UserWithTwoFactor, t as twoFactor } from "../../index-B4hJVVRn.mjs";
|
|
7
7
|
export { TWO_FACTOR_ERROR_CODES, TwoFactorOptions, TwoFactorProvider, TwoFactorTable, UserWithTwoFactor, twoFactor, twoFactorClient };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import "../../helper-BgOIGHsu.mjs";
|
|
2
2
|
import "../../plugins-Dy_FrD4Y.mjs";
|
|
3
|
-
import { n as username, r as USERNAME_ERROR_CODES, t as UsernameOptions } from "../../index-
|
|
3
|
+
import { n as username, r as USERNAME_ERROR_CODES, t as UsernameOptions } from "../../index-pdl9MzQu.mjs";
|
|
4
4
|
export { USERNAME_ERROR_CODES, UsernameOptions, username };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "../../utils-B03WRaGi.mjs";
|
|
2
2
|
import "../../url-VB2gAbTI.mjs";
|
|
3
|
-
import "../../api-
|
|
3
|
+
import "../../api-BV65Y-Rk.mjs";
|
|
4
4
|
import "../../get-request-ip-DSjrEpGo.mjs";
|
|
5
5
|
import "../../json-D0TBLy4q.mjs";
|
|
6
6
|
import "../../crypto-CCyta8xj.mjs";
|
|
@@ -14,6 +14,6 @@ import "../../get-tables-CKvSyDST.mjs";
|
|
|
14
14
|
import "../../types-DCPpFKUB.mjs";
|
|
15
15
|
import "../../misc-fKH4d5XQ.mjs";
|
|
16
16
|
import "../../session-BB3oqApE.mjs";
|
|
17
|
-
import { n as USERNAME_ERROR_CODES, t as username } from "../../username-
|
|
17
|
+
import { n as USERNAME_ERROR_CODES, t as username } from "../../username-DCp6yugu.mjs";
|
|
18
18
|
|
|
19
19
|
export { USERNAME_ERROR_CODES, username };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as APIError } from "./api-
|
|
1
|
+
import { t as APIError } from "./api-BV65Y-Rk.mjs";
|
|
2
2
|
import { t as getIp } from "./get-request-ip-DSjrEpGo.mjs";
|
|
3
3
|
import { t as safeJSONParse } from "./json-D0TBLy4q.mjs";
|
|
4
4
|
import { t as generateRandomString } from "./random-32E3cU5o.mjs";
|
|
@@ -3,7 +3,7 @@ import { t as safeJSONParse } from "./json-D0TBLy4q.mjs";
|
|
|
3
3
|
import { n as deleteSessionCookie } from "./cookies-BuvlgcA-.mjs";
|
|
4
4
|
import { n as mergeSchema } from "./date-CMr04reD.mjs";
|
|
5
5
|
import { a as CREDENTIAL_SIGN_IN_PATHS, c as SIGN_IN_PATHS, l as VERIFICATION_PATHS, s as SECURITY_EVENT_TYPES, t as getAuditRecorder } from "./registry-CqG_3Qnx.mjs";
|
|
6
|
-
import { t as getPasswordBreachCount } from "./haveibeenpwned-
|
|
6
|
+
import { t as getPasswordBreachCount } from "./haveibeenpwned-_3a5amT-.mjs";
|
|
7
7
|
import { c as verifySolution, i as createNonce, n as POW_REASON_HEADER, o as parsePowHeader, r as POW_SOLUTION_HEADER, t as POW_CHALLENGE_HEADER } from "./pow-DvkUopsK.mjs";
|
|
8
8
|
import { env } from "@gatwech/core/env";
|
|
9
9
|
import { PayvoAuthError } from "@gatwech/core/error";
|
|
@@ -285,6 +285,28 @@ function looksGenerated(email) {
|
|
|
285
285
|
//#region src/plugins/sentinel/geo.ts
|
|
286
286
|
const EARTH_RADIUS_KM = 6371;
|
|
287
287
|
const toRadians = (degrees) => degrees * Math.PI / 180;
|
|
288
|
+
/** Stored coordinates are whole numbers of millionths of a degree */
|
|
289
|
+
const COORDINATE_SCALE = 1e6;
|
|
290
|
+
/** The largest whole-degree value, which tells an older, unscaled row apart */
|
|
291
|
+
const MAX_DEGREES = 360;
|
|
292
|
+
/**
|
|
293
|
+
* A coordinate as stored. The database column is an integer (the schema has
|
|
294
|
+
* no float type), so degrees are scaled to millionths of a degree, which is
|
|
295
|
+
* about 11 cm.
|
|
296
|
+
*/
|
|
297
|
+
function toStoredCoordinate(degrees) {
|
|
298
|
+
if (degrees == null) return null;
|
|
299
|
+
const scaled = Math.round(degrees * COORDINATE_SCALE);
|
|
300
|
+
return scaled !== 0 && Math.abs(scaled) <= MAX_DEGREES ? Math.sign(scaled) * (MAX_DEGREES + 1) : scaled;
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* A stored coordinate in degrees. Rows written before coordinates were scaled
|
|
304
|
+
* hold whole degrees, which are never more than 360 in size.
|
|
305
|
+
*/
|
|
306
|
+
function fromStoredCoordinate(stored) {
|
|
307
|
+
if (stored == null) return null;
|
|
308
|
+
return Math.abs(stored) <= MAX_DEGREES ? stored : stored / COORDINATE_SCALE;
|
|
309
|
+
}
|
|
288
310
|
/** Great-circle distance between two coordinates, in kilometres */
|
|
289
311
|
function haversineDistanceKm(from, to) {
|
|
290
312
|
const dLat = toRadians(to.latitude - from.latitude);
|
|
@@ -1143,10 +1165,12 @@ const sentinel = (options) => {
|
|
|
1143
1165
|
}
|
|
1144
1166
|
/** The travel speed from the previous sign-in, when both have coordinates */
|
|
1145
1167
|
function travel(previous, geo) {
|
|
1146
|
-
|
|
1168
|
+
const previousLatitude = fromStoredCoordinate(previous?.latitude);
|
|
1169
|
+
const previousLongitude = fromStoredCoordinate(previous?.longitude);
|
|
1170
|
+
if (!previous || previousLatitude == null || previousLongitude == null || geo?.latitude == null || geo.longitude == null) return null;
|
|
1147
1171
|
const speedKmh = travelSpeedKmh({
|
|
1148
|
-
latitude:
|
|
1149
|
-
longitude:
|
|
1172
|
+
latitude: previousLatitude,
|
|
1173
|
+
longitude: previousLongitude,
|
|
1150
1174
|
at: new Date(previous.createdAt)
|
|
1151
1175
|
}, {
|
|
1152
1176
|
latitude: geo.latitude,
|
|
@@ -1599,8 +1623,8 @@ const sentinel = (options) => {
|
|
|
1599
1623
|
userAgent: details.userAgent,
|
|
1600
1624
|
country: geo?.country ?? null,
|
|
1601
1625
|
city: geo?.city ?? null,
|
|
1602
|
-
latitude: geo?.latitude
|
|
1603
|
-
longitude: geo?.longitude
|
|
1626
|
+
latitude: toStoredCoordinate(geo?.latitude),
|
|
1627
|
+
longitude: toStoredCoordinate(geo?.longitude),
|
|
1604
1628
|
createdAt: /* @__PURE__ */ new Date()
|
|
1605
1629
|
}
|
|
1606
1630
|
});
|
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A coordinate as stored. The database column is an integer (the schema has
|
|
3
|
+
* no float type), so degrees are scaled to millionths of a degree, which is
|
|
4
|
+
* about 11 cm.
|
|
5
|
+
*/
|
|
6
|
+
export declare function toStoredCoordinate(degrees: number | null | undefined): number | null;
|
|
7
|
+
/**
|
|
8
|
+
* A stored coordinate in degrees. Rows written before coordinates were scaled
|
|
9
|
+
* hold whole degrees, which are never more than 360 in size.
|
|
10
|
+
*/
|
|
11
|
+
export declare function fromStoredCoordinate(stored: number | null | undefined): number | null;
|
|
1
12
|
/** Great-circle distance between two coordinates, in kilometres */
|
|
2
13
|
export declare function haversineDistanceKm(from: {
|
|
3
14
|
latitude: number;
|
|
@@ -255,9 +255,7 @@ export declare const sentinel: (options?: SentinelOptions | undefined) => {
|
|
|
255
255
|
credentialStuffing?: {
|
|
256
256
|
enabled: boolean;
|
|
257
257
|
action?: SecurityAction | undefined;
|
|
258
|
-
thresholds
|
|
259
|
-
/** Checked with the identification service, rather than taken as sent */
|
|
260
|
-
? /** Checked with the identification service, rather than taken as sent */: {
|
|
258
|
+
thresholds?: {
|
|
261
259
|
challenge: number;
|
|
262
260
|
block: number;
|
|
263
261
|
} | undefined;
|