(state: State, env: Env)
| 184 | } |
| 185 | |
| 186 | export async function encodeState(state: State, env: Env): Promise<{ jwt: string; hash: string }> { |
| 187 | const jwtSignature = await jwt.sign( |
| 188 | { ...state, exp: Math.floor(Date.now() / 1000) + 60 * 60 * 2 }, |
| 189 | // TODO: Remove JWT encoding and use something faster like just plain bas64 |
| 190 | "secret-doesnt-matter-anymore-we-are-using-jwt-for-encoding-state", |
| 191 | { |
| 192 | algorithm: "HS256", |
| 193 | }, |
| 194 | ); |
| 195 | |
| 196 | await env.REGISTRY.put(getRegistryUploadsPath(state), JSON.stringify({ jwt: jwtSignature })); |
| 197 | return { jwt: jwtSignature, hash: await getSHA256(jwtSignature, "") }; |
| 198 | } |
| 199 | |
| 200 | export const symlinkHeader = "X-Serverless-Registry-Symlink"; |
| 201 |
no test coverage detected