mirror of
https://github.com/stack-auth/stack.git
synced 2026-06-13 21:01:21 +08:00
Disallow kid audience
This commit is contained in:
parent
257ec46244
commit
0db15d63b0
@ -3,7 +3,7 @@ import elliptic from "elliptic";
|
||||
import * as jose from "jose";
|
||||
import { JOSEError } from "jose/errors";
|
||||
import { encodeBase64Url } from "./bytes";
|
||||
import { getEnvVariable } from "./env";
|
||||
import { StackAssertionError } from "./errors";
|
||||
import { globalVar } from "./globals";
|
||||
import { pick } from "./objects";
|
||||
|
||||
@ -112,6 +112,9 @@ export function getPerAudienceSecret(options: {
|
||||
audience: string,
|
||||
secret: string,
|
||||
}) {
|
||||
if (options.audience === "kid") {
|
||||
throw new StackAssertionError("You cannot use the 'kid' audience for a per-audience secret, see comment below in jwt.tsx");
|
||||
}
|
||||
return jose.base64url.encode(
|
||||
crypto
|
||||
.createHash('sha256')
|
||||
|
||||
Loading…
Reference in New Issue
Block a user