@stackframe/stack-shared 2.4.5 → 2.4.7
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.
|
@@ -134,7 +134,6 @@ export declare class StackClientInterface {
|
|
|
134
134
|
readonly options: ClientInterfaceOptions;
|
|
135
135
|
constructor(options: ClientInterfaceOptions);
|
|
136
136
|
get projectId(): string;
|
|
137
|
-
getSessionCookieName(): string;
|
|
138
137
|
getApiUrl(): string;
|
|
139
138
|
protected refreshAccessToken(tokenStore: TokenStore): Promise<void>;
|
|
140
139
|
protected sendClientRequest(path: string, requestOptions: RequestInit, tokenStoreOrNull: TokenStore | null, requestType?: "client" | "server" | "admin"): Promise<Response & {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as oauth from 'oauth4webapi';
|
|
2
|
-
import crypto from "crypto-browserify";
|
|
3
2
|
import { Result } from "../utils/results";
|
|
4
3
|
import { AsyncStore } from '../utils/stores';
|
|
5
4
|
import { KnownError, KnownErrors } from '../known-errors';
|
|
@@ -24,9 +23,6 @@ export function toStandardProvider(provider) {
|
|
|
24
23
|
export function toSharedProvider(provider) {
|
|
25
24
|
return "shared-" + provider;
|
|
26
25
|
}
|
|
27
|
-
function getSessionCookieName(projectId) {
|
|
28
|
-
return "__stack-token-" + crypto.createHash("sha256").update(projectId).digest("hex");
|
|
29
|
-
}
|
|
30
26
|
export class StackClientInterface {
|
|
31
27
|
options;
|
|
32
28
|
constructor(options) {
|
|
@@ -36,9 +32,6 @@ export class StackClientInterface {
|
|
|
36
32
|
get projectId() {
|
|
37
33
|
return this.options.projectId;
|
|
38
34
|
}
|
|
39
|
-
getSessionCookieName() {
|
|
40
|
-
return getSessionCookieName(this.projectId);
|
|
41
|
-
}
|
|
42
35
|
getApiUrl() {
|
|
43
36
|
return this.options.baseUrl + "/api/v1";
|
|
44
37
|
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns the first argument passed to it, but compilers won't be able to optimize it out. This is useful in some cases where compiler warnings go awry; for example, when importing things that may not exist (but are guaranteed to exist at runtime).
|
|
3
|
+
*/
|
|
4
|
+
export declare function scrambleDuringCompileTime<T>(t: T): T;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns the first argument passed to it, but compilers won't be able to optimize it out. This is useful in some cases where compiler warnings go awry; for example, when importing things that may not exist (but are guaranteed to exist at runtime).
|
|
3
|
+
*/
|
|
4
|
+
export function scrambleDuringCompileTime(t) {
|
|
5
|
+
return t;
|
|
6
|
+
}
|
package/dist/utils/crypto.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import crypto from "crypto-browserify";
|
|
2
1
|
import { encodeBase32 } from "./bytes";
|
|
3
2
|
/**
|
|
4
3
|
* Generates a secure alphanumeric string using the system's cryptographically secure
|
|
@@ -7,7 +6,7 @@ import { encodeBase32 } from "./bytes";
|
|
|
7
6
|
export function generateSecureRandomString(minBitsOfEntropy = 224) {
|
|
8
7
|
const base32CharactersCount = Math.ceil(minBitsOfEntropy / 5);
|
|
9
8
|
const bytesCount = Math.ceil(base32CharactersCount * 5 / 8);
|
|
10
|
-
const randomBytes = crypto.
|
|
9
|
+
const randomBytes = globalThis.crypto.getRandomValues(new Uint8Array(bytesCount));
|
|
11
10
|
const str = encodeBase32(randomBytes);
|
|
12
11
|
return str.slice(str.length - base32CharactersCount).toLowerCase();
|
|
13
12
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stackframe/stack-shared",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.7",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -24,8 +24,7 @@
|
|
|
24
24
|
"jose": "^5.2.2",
|
|
25
25
|
"oauth4webapi": "^2.10.3",
|
|
26
26
|
"uuid": "^9.0.1",
|
|
27
|
-
"
|
|
28
|
-
"@stackframe/stack-sc": "1.5.2"
|
|
27
|
+
"@stackframe/stack-sc": "1.5.3"
|
|
29
28
|
},
|
|
30
29
|
"devDependencies": {
|
|
31
30
|
"@types/bcrypt": "^5.0.2",
|