sst 3.0.1-25 → 3.0.1-27
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/auth/session.js +5 -5
- package/package.json +1 -1
package/dist/auth/session.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { importSPKI, jwtVerify } from "jose";
|
|
2
2
|
import { Resource } from "../resource.js";
|
|
3
3
|
export function createSessionBuilder() {
|
|
4
|
-
const auth = Object.values(Resource).find((value) => value.auth === true && value.publicKey);
|
|
5
|
-
if (!auth) {
|
|
6
|
-
throw new Error("No auth resource found");
|
|
7
|
-
}
|
|
8
|
-
const publicKey = auth.publicKey;
|
|
9
4
|
return {
|
|
10
5
|
async verify(token) {
|
|
6
|
+
const auth = Object.values(Resource).find((value) => value.auth === true && value.publicKey);
|
|
7
|
+
if (!auth) {
|
|
8
|
+
throw new Error("No auth resource found");
|
|
9
|
+
}
|
|
10
|
+
const publicKey = auth.publicKey;
|
|
11
11
|
const result = await jwtVerify(token, await importSPKI(publicKey, "RS512"));
|
|
12
12
|
return result.payload;
|
|
13
13
|
},
|