Git Product home page Git Product logo

Comments (14)

ranisalt avatar ranisalt commented on August 15, 2024

Please follow the promised branch to check the work.

from node-argon2.

ranisalt avatar ranisalt commented on August 15, 2024

By the lack of feedback I'll be completely ditching the old callback API for a new Promise API in a short time.

from node-argon2.

divmgl avatar divmgl commented on August 15, 2024

+1 on this and thanks for taking the time to update the repo. I think that using the promise API is the right way to go. Do you need any additional help moving the API to promises?

from node-argon2.

dhax avatar dhax commented on August 15, 2024

What's the status on this? The following results in 'undefined' hash value and I can't figure out why:
var hash = await argon2.hash('password', await argon2.generateSalt(), options);

Just to test I have wrapped it in an async function like this:

async function testArgon2 (password) {
  let passwordHash
  try {
    passwordHash = await argon2.hash(password, await argon2.generateSalt(), argon2.defaults)
    console.log('Hash result:', passwordHash)
  } catch (err) {
    console.log('Hash error', err)
  }
  try {
    const result = await argon2.verify(passwordHash, 'password123')
    console.log('Verify result:', result)
  } catch (err) {
    console.log('Verify error', err)
  }
}
testArgon2('password')

passwordHash and result are both logged as 'undefined'.

from node-argon2.

ranisalt avatar ranisalt commented on August 15, 2024

That is probably related to Nan not being up to date with v8. I'm currently trying to fix this issue. Did you test the version in npm or you used the one in this repo?

from node-argon2.

dhax avatar dhax commented on August 15, 2024

I have npm's version 0.8.0 installed, tried it with global node-gyp installed and without (which also compiles without error).
node: 5.6.0
npm: 3.6.0

As a note, replacing hash and verify with their hashSync and verifySync versions in above code gives the expected result.

from node-argon2.

dhax avatar dhax commented on August 15, 2024

trying to install directly from this repo I get this:

> node-gyp rebuild

make: *** No rule to make target `Release/obj.target/libargon2/argon2/src/argon2.o', needed by `Release/argon2.a'.  Stop.
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Users/barnaba/.nvm/versions/node/v5.6.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23)
gyp ERR! stack     at emitTwo (events.js:100:13)
gyp ERR! stack     at ChildProcess.emit (events.js:185:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Darwin 15.3.0
gyp ERR! command "/Users/barnaba/.nvm/versions/node/v5.6.0/bin/node" "/Users/barnaba/.nvm/versions/node/v5.6.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/barnaba/codeBase/node/templates/koa2-boilerplate/node_modules/argon2
gyp ERR! node -v v5.6.0
gyp ERR! node-gyp -v v3.2.1
gyp ERR! not ok
npm ERR! Darwin 15.3.0
�```

from node-argon2.

ranisalt avatar ranisalt commented on August 15, 2024

As a note, replacing hash and verify with their hashSync and verifySync versions in above code gives the expected result.

Because they are synchronous so await does nothing, but it is not running asynchronously.

I think I fixed it, I'm going to add some ES2015 tests and merge it later.

from node-argon2.

cgmb avatar cgmb commented on August 15, 2024

trying to install directly from this repo I get this:

@DiknT I believe that's the error you get if you haven't initialized the submodule. git submodule update --init should fix it.

from node-argon2.

ranisalt avatar ranisalt commented on August 15, 2024

This is definitely fixed in the fix-deprecations branch, but Travis is bitching and not working properly on Node 4.0~4.3 so I will wait to merge it. It should probably be merged and released at v0.10

from node-argon2.

ranisalt avatar ranisalt commented on August 15, 2024

Should be fine with 0.9.0, please try and report any issues.

from node-argon2.

dhax avatar dhax commented on August 15, 2024

unfortunately I can't install anymore. getting this error:

> node-gyp rebuild

  CC(target) Release/obj.target/libargon2/argon2/src/argon2.o
  CC(target) Release/obj.target/libargon2/argon2/src/core.o
  CC(target) Release/obj.target/libargon2/argon2/src/blake2/blake2b.o
  CC(target) Release/obj.target/libargon2/argon2/src/thread.o
  CC(target) Release/obj.target/libargon2/argon2/src/encoding.o
  CC(target) Release/obj.target/libargon2/argon2/src/opt.o
  LIBTOOL-STATIC Release/argon2.a
  CXX(target) Release/obj.target/argon2/src/argon2_node.o
In file included from ../src/argon2_node.cpp:8:
../src/argon2_node.h:28:10: error: no type named 'unique_ptr' in namespace 'std'
    std::unique_ptr<char[]> output;
    ~~~~~^
../src/argon2_node.h:28:20: error: expected member name or ';' after declaration specifiers
    std::unique_ptr<char[]> output;
    ~~~~~~~~~~~~~~~^
../src/argon2_node.cpp:22:16: error: no member named 'ceil' in namespace 'std'
    using std::ceil;
          ~~~~~^
../src/argon2_node.cpp:24:35: error: use of undeclared identifier 'ceil'
    return static_cast<size_type>(ceil(length / 3.0)) * 4;
                                  ^
../src/argon2_node.cpp:20:21: error: no return statement in constexpr function
constexpr size_type base64Length(size_type length)
                    ^
../src/argon2_node.cpp:30:16: error: no member named 'to_string' in namespace 'std'
    using std::to_string;
          ~~~~~^
../src/argon2_node.cpp:34:32: error: use of undeclared identifier 'to_string'
            memoryCostLength = to_string(log(ARGON2_MAX_MEMORY)).size(),
                               ^
../src/argon2_node.cpp:35:30: error: use of undeclared identifier 'to_string'
            timeCostLength = to_string(ARGON2_MAX_TIME).size(),
                             ^
../src/argon2_node.cpp:36:33: error: use of undeclared identifier 'to_string'
            parallelismLength = to_string(ARGON2_MAX_LANES).size();
                                ^
../src/argon2_node.cpp:47:69: error: member initializer 'output' does not name a non-static data member or base class
    memory_cost{memory_cost}, parallelism{parallelism}, type{type}, output{}
                                                                    ^~~~~~~~
../src/argon2_node.cpp:53:5: error: use of undeclared identifier 'output'
    output.reset(new char[ENCODED_LEN]);
    ^
../src/argon2_node.cpp:57:23: error: use of undeclared identifier 'output'
            HASH_LEN, output.get(), ENCODED_LEN, type);
                      ^
../src/argon2_node.cpp:74:34: error: use of undeclared identifier 'output'
    promise->Resolve(Nan::Encode(output.get(), strlen(output.get())));
                                 ^
../src/argon2_node.cpp:74:55: error: use of undeclared identifier 'output'
    promise->Resolve(Nan::Encode(output.get(), strlen(output.get())));
                                                      ^
../src/argon2_node.cpp:141:24: error: no member named 'unique_ptr' in namespace 'std'
    auto output = std::unique_ptr<char[]>{new char[ENCODED_LEN]};
                  ~~~~~^
../src/argon2_node.cpp:141:39: error: expected '(' for function-style cast or type construction
    auto output = std::unique_ptr<char[]>{new char[ENCODED_LEN]};
                                  ~~~~^
../src/argon2_node.cpp:251:34: warning: implicit conversion from 'unsigned long long' to 'uint32_t' (aka 'unsigned int') changes value
      from 4294967296 to 0 [-Wconstant-conversion]
            Nan::New<Number>(log(ARGON2_MAX_MEMORY)));
                             ~~~ ^~~~~~~~~~~~~~~~~
../src/../argon2/include/argon2.h:58:50: note: expanded from macro 'ARGON2_MAX_MEMORY'
    ARGON2_MIN(UINT32_C(0xFFFFFFFF), UINT64_C(1) << ARGON2_MAX_MEMORY_BITS)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
../src/../argon2/include/argon2.h:53:46: note: expanded from macro 'ARGON2_MIN'
#define ARGON2_MIN(a, b) ((a) < (b) ? (a) : (b))
                                             ^
1 warning and 16 errors generated.
make: *** [Release/obj.target/argon2/src/argon2_node.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Users/barnaba/.nvm/versions/node/v5.7.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23)
gyp ERR! stack     at emitTwo (events.js:100:13)
gyp ERR! stack     at ChildProcess.emit (events.js:185:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Darwin 15.3.0
gyp ERR! command "/Users/barnaba/.nvm/versions/node/v5.7.0/bin/node" "/Users/barnaba/.nvm/versions/node/v5.7.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/barnaba/codeBase/node/templates/koa2-boilerplate/node_modules/argon2
gyp ERR! node -v v5.7.0
gyp ERR! node-gyp -v v3.2.1
gyp ERR! not ok
npm ERR! Darwin 15.3.0
npm ERR! argv "/Users/barnaba/.nvm/versions/node/v5.7.0/bin/node" "/Users/barnaba/.nvm/versions/node/v5.7.0/bin/npm" "i" "-S" "argon2"
npm ERR! node v5.7.0
npm ERR! npm  v3.7.3
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1

from node-argon2.

ranisalt avatar ranisalt commented on August 15, 2024

Your compiler is too old. Upgrade to g++4.8 or higher, or clang 3.3 or higher.

from node-argon2.

dhax avatar dhax commented on August 15, 2024

That fixed it, thanks a lot!

from node-argon2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.