ehn-sign-verify-javascript-trivial
ehn-sign-verify-javascript-trivial copied to clipboard
Issue with npm run verify
Hi,
I followed the steps described in your README and could installed the project successfully on Linux:
$ npm install
> [email protected] preinstall /home/lallement/Projects/ehn-sign-verify-javascript-trivial/node_modules/cbor
> node .checkVersion
> [email protected] preinstall /home/lallement/Projects/ehn-sign-verify-javascript-trivial/node_modules/aes-ccm
> true
> [email protected] install /home/lallement/Projects/ehn-sign-verify-javascript-trivial/node_modules/aes-ccm
> node-pre-gyp install --fallback-to-build
node-pre-gyp WARN Using request for node-pre-gyp https download
[aes-ccm] Success: "/home/lallement/Projects/ehn-sign-verify-javascript-trivial/node_modules/aes-ccm/build/Release/aes_ccm.node" is installed via remote
npm WARN [email protected] No repository field.
npm WARN [email protected] license should be a valid SPDX license expression
added 160 packages from 76 contributors and audited 160 packages in 3.561s
29 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
I generated the CSCA and DSC with ./gen-csca-dsc.sh
:
$ ./gen-csca-dsc.sh
Signature ok
subject=CN = DSC number 1 of Friesland, C = FR
Getting CA Private Key
Signature ok
subject=CN = DSC number 2 of Friesland, C = FR
Getting CA Private Key
Signature ok
subject=CN = DSC number 3 of Friesland, C = FR
Getting CA Private Key
Signature ok
subject=CN = DSC number 4 of Friesland, C = FR
Getting CA Private Key
Signature ok
subject=CN = DSC number worker of Friesland, C = FR
Getting CA Private Key
But when I run the command echo "{'A': 1234}" | npm run sign | npm run verify
I got the following issue:
$ echo '{"A": 1234}' | npm run sign | npm run verify
> [email protected] verify /home/lallement/Projects/ehn-sign-verify-javascript-trivial
> node cose_verify.js
/home/lallement/Projects/ehn-sign-verify-javascript-trivial/node_modules/base45-js/lib/base45-js.js:46
throw new Error('Base45 decode: unknown character');
^
Please note that npm run sign
gives the following result:
$ echo '{"A": 1234}' | npm run sign
> [email protected] sign /home/lallement/Projects/ehn-sign-verify-javascript-trivial
> node cose_sign.js
6BFV70U30FFWTWGSLKC 4BA9R-29B7.3KC-7 -8CDCE73SQQC58YZF*+MKK7HZU0:7Y1J:4OZ MCZSC8W8DPLVHOEL*3HM/LG:HN7DJMO+3NT2I24P2GW8FPR$7JE6KL2L/60F1UCG87D%+F+%ENX845
That's strange, it works when I put the result of sign in a file:
$ echo '{"A": 1234}' | npm run sign | tail -1 > test.b45
lallement@Apollon:~/Projects/ehn-sign-verify-javascript-trivial$ cat test.b45 | npm run verify
> [email protected] verify /home/lallement/Projects/ehn-sign-verify-javascript-trivial
> node cose_verify.js
{
"A": 1234
}
Hi @raziel057, I have the same problem. Any news about this?
Hi, I think I am running in a same (or similar issue). I am on a macOS Big Sur, npm 6.14.5. When I do a npm install, I get some warnings:
node-pre-gyp WARN Using needle for node-pre-gyp https download
node-pre-gyp WARN Tried to download(404): https://github.com/erdtman/aes-ccm/releases/download/1.0.10/aes_ccm-v1.0.10-node-v79-darwin-x64.tar.gz
node-pre-gyp WARN Pre-built binaries not found for [email protected] and [email protected] (node-v79 ABI, unknown) (falling back to source compile with node-gyp)
Then, if I try to run echo '{"A": 1234}' | npm run sign | npm run verify
, I get some errors, probably misconfigured or missing modules:
❯ echo '{"A": 1234}' | npm run sign | npm run verify
> [email protected] verify /Users/Nacho/Downloads/ehn-sign-verify-javascript-trivial-main
> node cose_verify.js
internal/modules/cjs/loader.js:621
throw e;
^
Error: No valid exports main found for '/Users/Nacho/Downloads/ehn-sign-verify-javascript-trivial-main/node_modules/pako'
at resolveExportsTarget (internal/modules/cjs/loader.js:618:9)
at applyExports (internal/modules/cjs/loader.js:499:14)
at resolveExports (internal/modules/cjs/loader.js:548:12)
at Function.Module._findPath (internal/modules/cjs/loader.js:650:22)
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:948:27)
at Function.Module._load (internal/modules/cjs/loader.js:854:27)
at Module.require (internal/modules/cjs/loader.js:1023:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object.<anonymous> (/Users/Nacho/Downloads/ehn-sign-verify-javascript-trivial-main/cose_sign.js:6:14)
at Module._compile (internal/modules/cjs/loader.js:1128:30) {
code: 'MODULE_NOT_FOUND'
}
internal/modules/cjs/loader.js:621
throw e;
^
Error: No valid exports main found for '/Users/Nacho/Downloads/ehn-sign-verify-javascript-trivial-main/node_modules/pako'
at resolveExportsTarget (internal/modules/cjs/loader.js:618:9)
at applyExports (internal/modules/cjs/loader.js:499:14)
at resolveExports (internal/modules/cjs/loader.js:548:12)
at Function.Module._findPath (internal/modules/cjs/loader.js:650:22)
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:948:27)
at Function.Module._load (internal/modules/cjs/loader.js:854:27)
at Module.require (internal/modules/cjs/loader.js:1023:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object.<anonymous> (/Users/Nacho/Downloads/ehn-sign-verify-javascript-trivial-main/cose_verify.js:6:14)
at Module._compile (internal/modules/cjs/loader.js:1128:30) {
code: 'MODULE_NOT_FOUND'
}
npmnpm ERR! code ELIFECYCLE
ERR! npmcode ELIFECYCLE
ERR! errno 1
npm ERR! errno 1
npm ERR! [email protected] sign: `node cose_sign.js`
npm ERR! Exit status 1
npm ERR!npm
npm ERR!ERR! Failed at the [email protected] sign script.
npm ERR! [email protected] verify: `node cose_verify.js`
This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] verify script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm
ERR! /Users/Nacho/.npm/_logs/2021-07-29T17_43_09_599Z-debug.log
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/Nacho/.npm/_logs/2021-07-29T17_43_09_598Z-debug.log
This seems a problem with euvac?
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] sign: `node cose_sign.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] sign script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/Nacho/.npm/_logs/2021-07-29T17_44_13_170Z-debug.log