@drawnagency/primitives 0.1.54 → 0.1.55
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/index.js
CHANGED
|
@@ -19,7 +19,7 @@ async function signSessionToken(session) {
|
|
|
19
19
|
async function verifySessionToken(token) {
|
|
20
20
|
const secret = requireSessionSecret();
|
|
21
21
|
try {
|
|
22
|
-
const { payload } = await jose.jwtVerify(token, secret);
|
|
22
|
+
const { payload } = await jose.jwtVerify(token, secret, { algorithms: ["HS256"] });
|
|
23
23
|
const role = payload.role;
|
|
24
24
|
if (role !== "owner" && role !== "editor") return null;
|
|
25
25
|
return {
|
|
@@ -38,7 +38,7 @@ async function signAudienceToken(audience) {
|
|
|
38
38
|
async function verifyAudienceToken(token) {
|
|
39
39
|
const secret = requireSessionSecret();
|
|
40
40
|
try {
|
|
41
|
-
const { payload } = await jose.jwtVerify(token, secret);
|
|
41
|
+
const { payload } = await jose.jwtVerify(token, secret, { algorithms: ["HS256"] });
|
|
42
42
|
const audience = payload.audience;
|
|
43
43
|
return typeof audience === "string" && audience !== "" ? audience : null;
|
|
44
44
|
} catch {
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
package/src/auth/cookies.ts
CHANGED
|
@@ -23,7 +23,7 @@ export async function signSessionToken(session: Session): Promise<string> {
|
|
|
23
23
|
export async function verifySessionToken(token: string): Promise<Session | null> {
|
|
24
24
|
const secret = requireSessionSecret(); // throws on misconfiguration, before try
|
|
25
25
|
try {
|
|
26
|
-
const { payload } = await jose.jwtVerify(token, secret);
|
|
26
|
+
const { payload } = await jose.jwtVerify(token, secret, { algorithms: ["HS256"] });
|
|
27
27
|
const role = payload.role;
|
|
28
28
|
if (role !== "owner" && role !== "editor") return null;
|
|
29
29
|
return {
|
|
@@ -52,7 +52,7 @@ export async function signAudienceToken(audience: string): Promise<string> {
|
|
|
52
52
|
export async function verifyAudienceToken(token: string): Promise<string | null> {
|
|
53
53
|
const secret = requireSessionSecret(); // throws on misconfiguration, before try
|
|
54
54
|
try {
|
|
55
|
-
const { payload } = await jose.jwtVerify(token, secret);
|
|
55
|
+
const { payload } = await jose.jwtVerify(token, secret, { algorithms: ["HS256"] });
|
|
56
56
|
const audience = payload.audience;
|
|
57
57
|
return typeof audience === "string" && audience !== "" ? audience : null;
|
|
58
58
|
} catch {
|
|
@@ -444,7 +444,7 @@ export default function EditorShell({
|
|
|
444
444
|
if (restoredContent) {
|
|
445
445
|
return {
|
|
446
446
|
section: { id, ...restoredContent },
|
|
447
|
-
meta: restoredIndex.sections[id] ?? existing?.meta ?? { type: restoredContent.type, status: "draft", access: [
|
|
447
|
+
meta: restoredIndex.sections[id] ?? existing?.meta ?? { type: restoredContent.type, status: "draft", access: [] },
|
|
448
448
|
};
|
|
449
449
|
}
|
|
450
450
|
if (existing) {
|