11import { arc4 , bytes , Bytes , Ecdsa , gtxn , internal , VrfVerify } from '@algorandfoundation/algorand-typescript'
2- import { ec } from 'elliptic'
2+ import elliptic from 'elliptic'
33import { sha256 as js_sha256 } from 'js-sha256'
44import { keccak256 as js_keccak256 , sha3_256 as js_sha3_256 } from 'js-sha3'
55import { sha512_256 as js_sha512_256 } from 'js-sha512'
@@ -84,7 +84,7 @@ export const ecdsaVerify = (
8484 . concat ( pubkeyXBytes )
8585 . concat ( pubkeyYBytes )
8686
87- const ecdsa = new ec ( curveMap [ v ] )
87+ const ecdsa = new elliptic . ec ( curveMap [ v ] )
8888 const keyPair = ecdsa . keyFromPublic ( publicKey . asUint8Array ( ) )
8989 return keyPair . verify ( dataBytes . asUint8Array ( ) , { r : sigRBytes . asUint8Array ( ) , s : sigSBytes . asUint8Array ( ) } )
9090}
@@ -104,7 +104,7 @@ export const ecdsaPkRecover = (
104104 const sBytes = internal . primitives . BytesCls . fromCompat ( d )
105105 const recoveryId = internal . primitives . Uint64Cls . fromCompat ( b )
106106
107- const ecdsa = new ec ( curveMap [ v ] )
107+ const ecdsa = new elliptic . ec ( curveMap [ v ] )
108108 const pubKey = ecdsa . recoverPubKey (
109109 dataBytes . asUint8Array ( ) ,
110110 { r : rBytes . asUint8Array ( ) , s : sBytes . asUint8Array ( ) } ,
@@ -119,7 +119,7 @@ export const ecdsaPkRecover = (
119119export const ecdsaPkDecompress = ( v : Ecdsa , a : internal . primitives . StubBytesCompat ) : readonly [ bytes , bytes ] => {
120120 const bytesA = internal . primitives . BytesCls . fromCompat ( a )
121121
122- const ecdsa = new ec ( curveMap [ v ] )
122+ const ecdsa = new elliptic . ec ( curveMap [ v ] )
123123 const keyPair = ecdsa . keyFromPublic ( bytesA . asUint8Array ( ) )
124124 const pubKey = keyPair . getPublic ( )
125125
0 commit comments