Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

Does not work with native bindings #332

Closed
novemberborn opened this issue Mar 28, 2018 · 3 comments
Closed

Does not work with native bindings #332

novemberborn opened this issue Mar 28, 2018 · 3 comments
Labels

Comments

@novemberborn
Copy link
Contributor

I'm trying to import https://github.com/cryptocoinjs/secp256k1-node. It exports bindings against a native module: https://github.com/cryptocoinjs/secp256k1-node/blob/master/bindings.js. Something goes wrong though when trying to call its exported methods.

With test.js:

import crypto from 'crypto'
import secp256k1 from 'secp256k1'

secp256k1.privateKeyVerify(crypto.randomBytes(32))

And node -r esm test.js I get a TypeError: Illegal invocation.

It works fine if I use require() instead.

@jdalton jdalton added the bug label Mar 28, 2018
@jdalton
Copy link
Member

jdalton commented Mar 28, 2018

Thanks @novemberborn!

I found the issue. It was related to how we detect native methods. I have it fixed locally.

@novemberborn
Copy link
Contributor Author

@jdalton great! I've installed a Git checkout and that seemed to work. Let me know when this is released and I'll double-check with the npm release. Thanks for the quick response!

@novemberborn
Copy link
Contributor Author

Works with v3.0.14 👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

No branches or pull requests

2 participants