UNPKG

@practicaloptimism/uniplexer

Version:

A multiplexer for 3rd party service providers and application protocols

17 lines (12 loc) 479 B
import { curve } from '../variables' import { CRYPTOGRAPHY_KEY_ALGORITHM } from '../constants/asymmetric-cryptography' function verifyMessage (message: Buffer, signature: any, publicKey: string): boolean { if (publicKey.indexOf(CRYPTOGRAPHY_KEY_ALGORITHM) >= 0) { publicKey = publicKey.split(`${CRYPTOGRAPHY_KEY_ALGORITHM}:`)[1] } const keyPair = curve.keyFromPublic(publicKey, 'hex') return curve.verify(message, signature, keyPair) } export { verifyMessage }