MCPcopy Create free account
hub / github.com/pollinations/pollinations / importSigningKey

Function importSigningKey

shared/github/app-auth.ts:121–132  ·  view source on GitHub ↗
(privateKey: string)

Source from the content-addressed store, hash-verified

119}
120
121async function importSigningKey(privateKey: string): Promise<CryptoKey> {
122 const pem = normalizePem(privateKey);
123 const der = pemToDer(pem);
124 const pkcs8 = /BEGIN RSA PRIVATE KEY/.test(pem) ? pkcs1ToPkcs8(der) : der;
125 return crypto.subtle.importKey(
126 "pkcs8",
127 pkcs8 as BufferSource,
128 { name: "RSASSA-PKCS1-v1_5", hash: "SHA-256" },
129 false,
130 ["sign"],
131 );
132}
133
134/** Mint a short-lived App JWT (valid ~9 min, iat backdated for clock skew). */
135async function mintAppJwt(creds: GithubAppCredentials): Promise<string> {

Callers 1

mintAppJwtFunction · 0.85

Calls 3

normalizePemFunction · 0.85
pemToDerFunction · 0.85
pkcs1ToPkcs8Function · 0.85

Tested by

no test coverage detected