We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
With the new k1_recover intrinsics launching, I need a way to get uncompressed keys from @greymass/eosio
Seems recover and getPublic both compress the keys
Plus there is no uncompressed publickey type in eosio-core
The text was updated successfully, but these errors were encountered:
For now, worked around using:
import { Checksum256, Checksum256Type, Signature } from '@greymass/eosio' import { ec } from 'elliptic' const curves: {[type: string]: ec} = {} /** * Get curve for key type. * @internal */ export function getCurve(type: string): ec { let rv = curves[type] if (!rv) { if (type === 'K1') { rv = curves[type] = new ec('secp256k1') } else if (type === 'R1') { rv = curves[type] = new ec('p256') } else { throw new Error(`Unknown curve type: ${type}`) } } return rv } /** * Recover public key from signature and recovery id. * @internal */ export function recoverUncompressed(signature: Uint8Array, message: Uint8Array, type: string) { const curve = getCurve(type) const recid = signature[0] - 31 const r = signature.subarray(1, 33) const s = signature.subarray(33) const point = curve.recoverPubKey(message, {r, s}, recid) return new Uint8Array(point.encode()) } export function recoverUncompressedDigest(signature: Signature, digest: Checksum256Type) { digest = Checksum256.from(digest) const uncompressed = recoverUncompressed(signature.data.array, digest.array, signature.type) return uncompressed }
Sorry, something went wrong.
No branches or pull requests
With the new k1_recover intrinsics launching, I need a way to get uncompressed keys from @greymass/eosio
Seems recover and getPublic both compress the keys
Plus there is no uncompressed publickey type in eosio-core
The text was updated successfully, but these errors were encountered: