@stridge/pay-sdk 0.1.0-alpha.0 → 0.1.0-alpha.1
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/cjs/_internal/coordinator.cjs +16 -8
- package/dist/cjs/_internal/coordinator.cjs.map +1 -1
- package/dist/cjs/_internal/coordinator.d.cts +12 -9
- package/dist/cjs/{guards-CYx283Oo.d.cts → guards-CQWGp5eP.d.cts} +12 -2
- package/dist/cjs/{guards-VkTvdL1L.cjs → guards-r1nnLHLD.cjs} +23 -1
- package/dist/cjs/guards-r1nnLHLD.cjs.map +1 -0
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/index.d.cts +1 -1
- package/dist/esm/_internal/coordinator.d.ts +12 -9
- package/dist/esm/_internal/coordinator.js +15 -9
- package/dist/esm/_internal/coordinator.js.map +1 -1
- package/dist/esm/{guards-CYx283Oo.d.ts → guards-CQWGp5eP.d.ts} +12 -2
- package/dist/esm/{guards-Cb0lVKgT.js → guards-CukG42GQ.js} +12 -2
- package/dist/esm/guards-CukG42GQ.js.map +1 -0
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +1 -1
- package/package.json +1 -1
- package/dist/cjs/guards-VkTvdL1L.cjs.map +0 -1
- package/dist/esm/guards-Cb0lVKgT.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_guards = require("../guards-
|
|
2
|
+
const require_guards = require("../guards-r1nnLHLD.cjs");
|
|
3
3
|
//#region src/client/constants.ts
|
|
4
4
|
/**
|
|
5
5
|
* The path prefix of the sign-in routes and every route that needs a session.
|
|
@@ -1152,7 +1152,11 @@ const SESSION = { kind: "session" };
|
|
|
1152
1152
|
* The header names only the transport writes, from a route's {@link RouteCredentials}. A route header naming one is a
|
|
1153
1153
|
* programming error.
|
|
1154
1154
|
*/
|
|
1155
|
-
const CREDENTIAL_HEADERS = /* @__PURE__ */ new Set([
|
|
1155
|
+
const CREDENTIAL_HEADERS = /* @__PURE__ */ new Set([
|
|
1156
|
+
CSRF_HEADER.toLowerCase(),
|
|
1157
|
+
require_guards.GUEST_COOKIE_ACCESS_HEADER.toLowerCase(),
|
|
1158
|
+
require_guards.SESSION_HEADER.toLowerCase()
|
|
1159
|
+
]);
|
|
1156
1160
|
/**
|
|
1157
1161
|
* A transaction hash as `POST /wallet/v1/routes/{id}/source` takes it: `0x` and 32 bytes of hex, either case.
|
|
1158
1162
|
*/
|
|
@@ -1953,12 +1957,13 @@ function normaliseBaseUrl(baseUrl) {
|
|
|
1953
1957
|
* its answer is read.
|
|
1954
1958
|
*
|
|
1955
1959
|
* The route's {@link RouteCredentials} are written after every other header. A session call with `omitCredentials`
|
|
1956
|
-
* goes out with `credentials: "
|
|
1957
|
-
*
|
|
1958
|
-
* the
|
|
1960
|
+
* goes out with `credentials: "include"`, `X-Stridge-Session: omit` and no `X-CSRF-Token`, and the token is not read:
|
|
1961
|
+
* the hub proxy drops the session cookie on such a request, and the token only proves the session that cookie names.
|
|
1962
|
+
* The browser still stores the cookies the answer sets, such as an email round's binder cookie. Only a session call
|
|
1963
|
+
* ever reads the stored token.
|
|
1959
1964
|
*
|
|
1960
|
-
* @throws {TypeError} when a route header names `X-CSRF-Token
|
|
1961
|
-
* credentials write.
|
|
1965
|
+
* @throws {TypeError} when a route header names `X-CSRF-Token`, `X-Stridge-Cookie-Access` or `X-Stridge-Session`,
|
|
1966
|
+
* which only the credentials write.
|
|
1962
1967
|
*/
|
|
1963
1968
|
function createTransport(baseUrl, appId, csrf, fetchFn, onServerTime) {
|
|
1964
1969
|
return { async send(call) {
|
|
@@ -1972,6 +1977,7 @@ function createTransport(baseUrl, appId, csrf, fetchFn, onServerTime) {
|
|
|
1972
1977
|
for (const name of Object.keys(call.headers)) if (CREDENTIAL_HEADERS.has(name.toLowerCase())) throw new TypeError(`a route header may not name ${name}`);
|
|
1973
1978
|
Object.assign(headers, call.headers);
|
|
1974
1979
|
}
|
|
1980
|
+
if (omitCredentials) headers[require_guards.SESSION_HEADER] = require_guards.SESSION_HEADER_OMIT;
|
|
1975
1981
|
if (credentials.kind === "session" && call.method !== "GET" && !omitCredentials) {
|
|
1976
1982
|
const token = await csrf.get();
|
|
1977
1983
|
if (typeof token === "string" && token !== "") headers[CSRF_HEADER] = token;
|
|
@@ -1982,7 +1988,7 @@ function createTransport(baseUrl, appId, csrf, fetchFn, onServerTime) {
|
|
|
1982
1988
|
const init = {
|
|
1983
1989
|
method: call.method,
|
|
1984
1990
|
headers,
|
|
1985
|
-
credentials:
|
|
1991
|
+
credentials: "include"
|
|
1986
1992
|
};
|
|
1987
1993
|
if (call.body !== void 0) init.body = JSON.stringify(call.body);
|
|
1988
1994
|
if (signal !== void 0) init.signal = signal;
|
|
@@ -3752,6 +3758,8 @@ exports.SERVER_CLOCK_AGREEMENT_MS = SERVER_CLOCK_AGREEMENT_MS;
|
|
|
3752
3758
|
exports.SERVER_CLOCK_MAX_ROUND_TRIP_MS = SERVER_CLOCK_MAX_ROUND_TRIP_MS;
|
|
3753
3759
|
exports.SERVER_CLOCK_MIN_OFFSET_MS = SERVER_CLOCK_MIN_OFFSET_MS;
|
|
3754
3760
|
exports.SERVER_CLOCK_WINDOW = SERVER_CLOCK_WINDOW;
|
|
3761
|
+
exports.SESSION_HEADER = require_guards.SESSION_HEADER;
|
|
3762
|
+
exports.SESSION_HEADER_OMIT = require_guards.SESSION_HEADER_OMIT;
|
|
3755
3763
|
exports.SIGNATURE_ALGORITHM = SIGNATURE_ALGORITHM;
|
|
3756
3764
|
exports.STAMP_HEADER_NAME = STAMP_HEADER_NAME;
|
|
3757
3765
|
exports.STAMP_LOGIN_ACTIVITY_TYPE = STAMP_LOGIN_ACTIVITY_TYPE;
|