Skip to content
New issue

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

Newbie question on using the factory #55

Open
teamimx opened this issue Nov 5, 2019 · 0 comments
Open

Newbie question on using the factory #55

teamimx opened this issue Nov 5, 2019 · 0 comments

Comments

@teamimx
Copy link

teamimx commented Nov 5, 2019

I would like to use js-nacl in a Quasar/Vue project but struggle a bit with the factory callback instantiation. What I would like to do is:

createHashHex: function (myString) {
  var naclFactory = require('js-nacl')
  var nacl
  naclFactory.instantiate(function (naclInstance) {
    nacl = naclInstance
  })
  let pwHashArray = nacl.crypto_hash_string(myString)
  let pwHashHex = nacl.to_hex(pwHashArray)
  return pwHashHex
}

But that does not work. How do I correctly instantiate the stuff without using the inline notation in the docs?

Cheers,
Michael

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant