Maybe? fix signature handling
This commit is contained in:
parent
d8bf398ed4
commit
b97bfa9f26
@ -5,7 +5,7 @@ export async function onRequestGet(context: RequestContext) {
|
|||||||
).toString()}`;
|
).toString()}`;
|
||||||
const signingKey = await crypto.subtle.importKey(
|
const signingKey = await crypto.subtle.importKey(
|
||||||
"raw",
|
"raw",
|
||||||
new TextEncoder().encode(atob(context.env.URL_SIGNING_KEY)),
|
Uint8Array.from(atob(context.env.URL_SIGNING_KEY), (c) => c.charCodeAt(0)),
|
||||||
{ hash: "SHA-1", name: "HMAC" },
|
{ hash: "SHA-1", name: "HMAC" },
|
||||||
false,
|
false,
|
||||||
["sign"],
|
["sign"],
|
||||||
@ -17,7 +17,10 @@ export async function onRequestGet(context: RequestContext) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
return Response.redirect(
|
return Response.redirect(
|
||||||
`${unsignedURL}&Signature=${btoa(new TextDecoder().decode(signature))
|
`${unsignedURL}&Signature=${btoa(
|
||||||
|
// @ts-expect-error
|
||||||
|
String.fromCodePoint(...signature),
|
||||||
|
)
|
||||||
.replaceAll("+", "-")
|
.replaceAll("+", "-")
|
||||||
.replaceAll("/", "_")
|
.replaceAll("/", "_")
|
||||||
.replaceAll("=", "")}`,
|
.replaceAll("=", "")}`,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user