import { sm2Curve } from './curve'; export const getPublicKeyFromPublicKeyJwk = (publicKeyJwk: any) => { const uncompressed = Buffer.concat([ Buffer.from('04', 'hex'), Buffer.from( Buffer.from(publicKeyJwk.x, 'base64') .toString('hex') .padStart(64, '0'), 'hex' ), Buffer.from( Buffer.from(publicKeyJwk.y, 'base64') .toString('hex') .padStart(64, '0'), 'hex' ), ]); return (sm2Curve.ProjectivePoint.fromHex(uncompressed) as any).toRawBytes(true); };