UNPKG

707 BPlain TextView Raw
1import type { Signer } from '../JWT.js'
2import { hexToBytes } from '../util.js'
3import { ES256KSigner } from './ES256KSigner.js'
4
5/**
6 * @deprecated Please use ES256KSigner
7 * The EllipticSigner returns a configured function for signing data.
8 *
9 * @example
10 * ```typescript
11 * const signer = EllipticSigner(process.env.PRIVATE_KEY)
12 * signer(data).then( (signature: string) => {
13 * ...
14 * })
15 * ```
16 *
17 * @param {String} hexPrivateKey a hex encoded private key
18 * @return {Function} a configured signer function
19 */
20function EllipticSigner(hexPrivateKey: string): Signer {
21 return ES256KSigner(hexToBytes(hexPrivateKey))
22}
23
24export default EllipticSigner