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