@better-auth/expo 1.3.5 → 1.3.6-beta.2
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/client.cjs +38 -4
- package/dist/client.mjs +38 -4
- package/package.json +3 -3
package/dist/client.cjs
CHANGED
|
@@ -25,19 +25,53 @@ const Constants__default = /*#__PURE__*/_interopDefaultCompat(Constants);
|
|
|
25
25
|
|
|
26
26
|
function parseSetCookieHeader(header) {
|
|
27
27
|
const cookieMap = /* @__PURE__ */ new Map();
|
|
28
|
-
const cookies = header
|
|
28
|
+
const cookies = splitSetCookieHeader(header);
|
|
29
29
|
cookies.forEach((cookie) => {
|
|
30
|
-
const
|
|
31
|
-
const [
|
|
30
|
+
const parts = cookie.split(";").map((p) => p.trim());
|
|
31
|
+
const [nameValue, ...attributes] = parts;
|
|
32
|
+
const [name, ...valueParts] = nameValue.split("=");
|
|
33
|
+
const value = valueParts.join("=");
|
|
32
34
|
const cookieObj = { value };
|
|
33
35
|
attributes.forEach((attr) => {
|
|
34
|
-
const [attrName,
|
|
36
|
+
const [attrName, ...attrValueParts] = attr.split("=");
|
|
37
|
+
const attrValue = attrValueParts.join("=");
|
|
35
38
|
cookieObj[attrName.toLowerCase()] = attrValue;
|
|
36
39
|
});
|
|
37
40
|
cookieMap.set(name, cookieObj);
|
|
38
41
|
});
|
|
39
42
|
return cookieMap;
|
|
40
43
|
}
|
|
44
|
+
function splitSetCookieHeader(setCookie) {
|
|
45
|
+
const parts = [];
|
|
46
|
+
let buffer = "";
|
|
47
|
+
let i = 0;
|
|
48
|
+
while (i < setCookie.length) {
|
|
49
|
+
const char = setCookie[i];
|
|
50
|
+
if (char === ",") {
|
|
51
|
+
const recent = buffer.toLowerCase();
|
|
52
|
+
const hasExpires = recent.includes("expires=");
|
|
53
|
+
const hasGmt = /gmt/i.test(recent);
|
|
54
|
+
if (hasExpires && !hasGmt) {
|
|
55
|
+
buffer += char;
|
|
56
|
+
i += 1;
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
59
|
+
if (buffer.trim().length > 0) {
|
|
60
|
+
parts.push(buffer.trim());
|
|
61
|
+
buffer = "";
|
|
62
|
+
}
|
|
63
|
+
i += 1;
|
|
64
|
+
if (setCookie[i] === " ") i += 1;
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
buffer += char;
|
|
68
|
+
i += 1;
|
|
69
|
+
}
|
|
70
|
+
if (buffer.trim().length > 0) {
|
|
71
|
+
parts.push(buffer.trim());
|
|
72
|
+
}
|
|
73
|
+
return parts;
|
|
74
|
+
}
|
|
41
75
|
function getSetCookie(header, prevCookie) {
|
|
42
76
|
const parsed = parseSetCookieHeader(header);
|
|
43
77
|
let toSetCookie = {};
|
package/dist/client.mjs
CHANGED
|
@@ -5,19 +5,53 @@ import Constants from 'expo-constants';
|
|
|
5
5
|
|
|
6
6
|
function parseSetCookieHeader(header) {
|
|
7
7
|
const cookieMap = /* @__PURE__ */ new Map();
|
|
8
|
-
const cookies = header
|
|
8
|
+
const cookies = splitSetCookieHeader(header);
|
|
9
9
|
cookies.forEach((cookie) => {
|
|
10
|
-
const
|
|
11
|
-
const [
|
|
10
|
+
const parts = cookie.split(";").map((p) => p.trim());
|
|
11
|
+
const [nameValue, ...attributes] = parts;
|
|
12
|
+
const [name, ...valueParts] = nameValue.split("=");
|
|
13
|
+
const value = valueParts.join("=");
|
|
12
14
|
const cookieObj = { value };
|
|
13
15
|
attributes.forEach((attr) => {
|
|
14
|
-
const [attrName,
|
|
16
|
+
const [attrName, ...attrValueParts] = attr.split("=");
|
|
17
|
+
const attrValue = attrValueParts.join("=");
|
|
15
18
|
cookieObj[attrName.toLowerCase()] = attrValue;
|
|
16
19
|
});
|
|
17
20
|
cookieMap.set(name, cookieObj);
|
|
18
21
|
});
|
|
19
22
|
return cookieMap;
|
|
20
23
|
}
|
|
24
|
+
function splitSetCookieHeader(setCookie) {
|
|
25
|
+
const parts = [];
|
|
26
|
+
let buffer = "";
|
|
27
|
+
let i = 0;
|
|
28
|
+
while (i < setCookie.length) {
|
|
29
|
+
const char = setCookie[i];
|
|
30
|
+
if (char === ",") {
|
|
31
|
+
const recent = buffer.toLowerCase();
|
|
32
|
+
const hasExpires = recent.includes("expires=");
|
|
33
|
+
const hasGmt = /gmt/i.test(recent);
|
|
34
|
+
if (hasExpires && !hasGmt) {
|
|
35
|
+
buffer += char;
|
|
36
|
+
i += 1;
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
if (buffer.trim().length > 0) {
|
|
40
|
+
parts.push(buffer.trim());
|
|
41
|
+
buffer = "";
|
|
42
|
+
}
|
|
43
|
+
i += 1;
|
|
44
|
+
if (setCookie[i] === " ") i += 1;
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
47
|
+
buffer += char;
|
|
48
|
+
i += 1;
|
|
49
|
+
}
|
|
50
|
+
if (buffer.trim().length > 0) {
|
|
51
|
+
parts.push(buffer.trim());
|
|
52
|
+
}
|
|
53
|
+
return parts;
|
|
54
|
+
}
|
|
21
55
|
function getSetCookie(header, prevCookie) {
|
|
22
56
|
const parsed = parseSetCookieHeader(header);
|
|
23
57
|
let toSetCookie = {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@better-auth/expo",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.6-beta.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -52,10 +52,10 @@
|
|
|
52
52
|
"expo-secure-store": "~14.0.1",
|
|
53
53
|
"expo-web-browser": "~14.0.2",
|
|
54
54
|
"unbuild": "^3.5.0",
|
|
55
|
-
"better-auth": "1.3.
|
|
55
|
+
"better-auth": "1.3.6-beta.2"
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
|
58
|
-
"better-auth": "1.3.
|
|
58
|
+
"better-auth": "1.3.6-beta.2"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
61
|
"@better-fetch/fetch": "^1.1.18",
|