MCPcopy Create free account
hub / github.com/code-with-antonio/nightcode / decodeState

Function decodeState

packages/cli/src/lib/oauth.ts:24–31  ·  view source on GitHub ↗
(state: string)

Source from the content-addressed store, hash-verified

22}
23
24function decodeState(state: string) {
25 const [encoded] = state.split(".");
26 if (!encoded) {
27 throw new Error("Invalid state");
28 }
29
30 return JSON.parse(Buffer.from(encoded, "base64url").toString()) as OAuthState;
31}
32
33function getErrorMessage(error: unknown) {
34 return error instanceof Error ? error.message : String(error);

Callers 1

fetchFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected