indutny / elliptic

Fast Elliptic Curve Cryptography in plain javascript
1.68k stars 373 forks source link

How to create an ec.Signature instance from r,s in typescript #306

Open fauxbytes opened 1 year ago

fauxbytes commented 1 year ago

Trying to instantiate a Signature object, e.g. like it's done here.

import { ec } from "elliptic";
import Signature = ec.Signature;

console.log(new Signature({r: '00', s: '00'}))

test-elliptic.zip

Getting an error:

$ npm run typecheck

> test-elliptic@1.0.0 typecheck
> tsc --noEmit

src/index.ts:4:17 - error TS2693: 'Signature' only refers to a type, but is being used as a value here.

Could you guide me on how to achieve this? Many thanks