sst 2.43.1 → 2.43.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.
@@ -28,6 +28,18 @@ declare function create<T extends keyof SessionTypes>(input: {
28
28
  properties: SessionTypes[T];
29
29
  options?: Partial<SignerOptions>;
30
30
  }): string;
31
+ /**
32
+ * Verifies a session token and returns the session data
33
+ *
34
+ * @example
35
+ * ```js
36
+ * Session.verify()
37
+ * ```
38
+ */
39
+ declare function verify<T = SessionValue>(token: string): T | {
40
+ type: string;
41
+ properties: {};
42
+ };
31
43
  /**
32
44
  * Returns a 302 redirect with an auth-token cookie set with the provided session information
33
45
  *
@@ -70,6 +82,7 @@ export declare function parameter<T extends keyof SessionTypes>(input: {
70
82
  }): APIGatewayProxyStructuredResultV2;
71
83
  export declare const Session: {
72
84
  create: typeof create;
85
+ verify: typeof verify;
73
86
  cookie: typeof cookie;
74
87
  parameter: typeof parameter;
75
88
  };
@@ -23,11 +23,7 @@ const SessionMemo = /* @__PURE__ */ Context.memo(() => {
23
23
  if (wsProtocol)
24
24
  token = wsProtocol.split(",")[0].trim();
25
25
  if (token) {
26
- const jwt = createVerifier({
27
- algorithms: ["RS512"],
28
- key: getPublicKey(),
29
- })(token);
30
- return jwt;
26
+ return Session.verify(token);
31
27
  }
32
28
  return {
33
29
  type: "public",
@@ -64,6 +60,30 @@ function create(input) {
64
60
  });
65
61
  return token;
66
62
  }
63
+ /**
64
+ * Verifies a session token and returns the session data
65
+ *
66
+ * @example
67
+ * ```js
68
+ * Session.verify()
69
+ * ```
70
+ */
71
+ function verify(token) {
72
+ if (token) {
73
+ try {
74
+ const jwt = createVerifier({
75
+ algorithms: ["RS512"],
76
+ key: getPublicKey(),
77
+ })(token);
78
+ return jwt;
79
+ }
80
+ catch (e) { }
81
+ }
82
+ return {
83
+ type: "public",
84
+ properties: {},
85
+ };
86
+ }
67
87
  /**
68
88
  * Returns a 302 redirect with an auth-token cookie set with the provided session information
69
89
  *
@@ -116,6 +136,7 @@ export function parameter(input) {
116
136
  }
117
137
  export const Session = {
118
138
  create,
139
+ verify,
119
140
  cookie,
120
141
  parameter,
121
142
  };
@@ -1,6 +1,4 @@
1
- export interface AuthResources {
2
- }
3
- export declare const Auth: AuthResources;
1
+ export * from "./proxy.js";
4
2
  export * from "./adapter/oidc.js";
5
3
  export * from "./adapter/google.js";
6
4
  export * from "./adapter/link.js";
@@ -1,5 +1,4 @@
1
- import { createProxy } from "../../util/index.js";
2
- export const Auth = /* @__PURE__ */ createProxy("Auth");
1
+ export * from "./proxy.js";
3
2
  export * from "./adapter/oidc.js";
4
3
  export * from "./adapter/google.js";
5
4
  export * from "./adapter/link.js";
@@ -0,0 +1,3 @@
1
+ export interface AuthResources {
2
+ }
3
+ export declare const Auth: AuthResources;
@@ -0,0 +1,2 @@
1
+ import { createProxy } from "../../util/index.js";
2
+ export const Auth = /* @__PURE__ */ createProxy("Auth");
@@ -1,7 +1,7 @@
1
1
  import { createSigner, createVerifier } from "fast-jwt";
2
2
  import { Context } from "../../../context/context2.js";
3
3
  import { useCookie, useHeader } from "../../api/index.js";
4
- import { Auth } from "../../auth/index.js";
4
+ import { Auth } from "./proxy.js";
5
5
  import { Config } from "../../config/index.js";
6
6
  import { useContextType } from "../../../context/handler.js";
7
7
  const SessionMemo = /* @__PURE__ */ Context.memo(() => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "sideEffects": false,
3
3
  "name": "sst",
4
- "version": "2.43.1",
4
+ "version": "2.43.2",
5
5
  "bin": {
6
6
  "sst": "cli/sst.js"
7
7
  },
@@ -118,7 +118,7 @@
118
118
  "@types/ws": "^8.5.3",
119
119
  "@types/yargs": "^17.0.13",
120
120
  "archiver": "^5.3.1",
121
- "astro-sst": "2.43.1",
121
+ "astro-sst": "2.43.2",
122
122
  "async": "^3.2.4",
123
123
  "tsx": "^3.12.1",
124
124
  "typescript": "^5.2.2",
@@ -211,6 +211,7 @@ export const useNodeHandler = () => {
211
211
  "--platform=linux",
212
212
  "--omit=dev",
213
213
  "--no-optional",
214
+ "--force",
214
215
  input.props.architecture === "arm_64"
215
216
  ? "--arch=arm64"
216
217
  : "--arch=x64",