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 22 23 24 25 26 | 1x 289x 289x 3x 1x 2x 1x 1x 1x 289x | import {secp256k1} from '@noble/curves/secp256k1.js'
import {p256} from '@noble/curves/nist.js'
import type {ECDSA} from '@noble/curves/abstract/weierstrass.js'
const curves: {[type: string]: ECDSA} = {}
/**
* Get curve for key type.
* @internal
*/
export function getCurve(type: string): ECDSA {
let rv = curves[type]
if (!rv) {
if (type === 'K1') {
rv = curves[type] = secp256k1
} else if (type === 'R1') {
rv = curves[type] = p256
} else if (type === 'WA') {
rv = curves[type] = p256
} else {
Ethrow new Error(`Unknown curve type: ${type}`)
}
}
return rv
}
|