Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | import * as jose from 'jose' // const PUBLIC_KEY_DER_PREFIX = '302a300506032b6570032100' export default async function verifyJws( jws: string, cryptoAccountPublicKey: string ) { Iif (globalThis.crypto) throw new Error('Not supported in a browser environment') const crypto = await import('node:crypto') const publicKey = crypto.createPublicKey({ key: Buffer.from(cryptoAccountPublicKey, 'hex'), format: 'der', type: 'spki', }) return await jose.jwtVerify(jws, publicKey) } |