MCPcopy Create free account
hub / github.com/bewcloud/bewcloud / generateKey

Function generateKey

lib/auth.ts:29–30  ·  view source on GitHub ↗
(key: string)

Source from the content-addressed store, hash-verified

27export const dataToText = (data: Uint8Array) => new TextDecoder().decode(data);
28
29export const generateKey = async (key: string): Promise<CryptoKey> =>
30 await crypto.subtle.importKey('raw', textToData(key), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign', 'verify']);
31
32async function signAuthJwt<T = JwtData>(key: CryptoKey, data: T): Promise<string> {
33 const payload = encodeBase64Url(textToData(JSON.stringify({ alg: 'HS256', typ: 'JWT' }))) + '.' +

Callers 4

getDataFromCookieMethod · 0.90
getDataFromCookieMethod · 0.90
getDataFromCookieFunction · 0.85
generateTokenFunction · 0.85

Calls 1

textToDataFunction · 0.85

Tested by

no test coverage detected