grempe/secrets.js

share(): Error: Invalid hex character

ShabeehFatima opened this issue · 2 comments

I have a project of an end-to-end verifiable online voting system. I generated the private key for encryption using the node-seal library available online. I was trying to split the private key into multiple shares using Shamir's threshold secret sharing scheme. The secret key i generated is in base64string format. When trying to split the key I had to first covert it into hex which went fine but when I tried to split the key I got the following error:

> Error: Invalid hex character.
at hex2bin (/home/shabeeh/node_modules/secrets.js/secrets.js:458:10)
at Object.exports.share (/home/shabeeh/node_modules/secrets.js/secrets.js:229:17)
at /home/shabeeh/iMatter/iMatter-Web/server/SplitKey.js:75:30 Error: Invalid hex character.
at hex2bin (/home/shabeeh/node_modules/secrets.js/secrets.js:458:10)
at Object.exports.share (/home/shabeeh/node_modules/secrets.js/secrets.js:229:17)
at /home/shabeeh/iMatter/iMatter-Web/server/SplitKey.js:75:30
/home/shabeeh/iMatter/iMatter-Web/node_modules/node-seal/dist/seal.node.js:1

!function(A,I){if("object"==typeof exports&&"object"==typeof module)module.exports=I();else if("function"==typeof define&&define.amd)define([],I);else{var g=I();for(var C in g)("object"==typeof exports?exports:A)[C]=g[C]}}("undefined"!=typeof self?self:this,(function(){return function(A){var I={};function g(C){if(I[C])return I[C].exports;var B=I[C]={i:C,l:!1,exports:{}};return A[C].call(B.exports,B,B.exports,g),B.l=!0,B.exports}return g.m=A,g.c=I,g.d=function(A,I,C){g.o(A,I)||Object.defineProperty(A,I,{enumerable:!0,get:C})},g.r=function(A){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(A,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(A,"__esModule",{value:!0})},g.t=function(A,I){if(1&I&&(A=g(A)),8&I)return A;if(4&I&&"object"==typeof A&&A&&A.__esModule)return A;var C=Object.create(null);if(g.r(C),Object.defineProperty(C,"default",{enumerable:!0,value:A}),2&I&&"string"!=typeof A)for(var B in A)g.d(

RuntimeError: abort(Error: Invalid hex character.). Build with -s ASSERTIONS=1 for more info.
at process.IA (/home/shabeeh/iMatter/iMatter-Web/node_modules/node-seal/dist/seal.node.js:1:5494)
at process.emit (events.js:198:13)
at emitPromiseRejectionWarnings (internal/process/promises.js:140:18)
at process._tickCallback (internal/process/next_tick.js:69:34)

I am unable to understand where the problem occurred because the string was converted to hex form, i verified it using console.log().

I am new to nodejs and I am extremely sorry if the question is dumb but I am stuck at it and would appreciate any help

Sorry you had an issue. Please provide a sample of a failing base64 key and the converted hex version of that key you are trying to use.

Please also provide some sample code showing the fail if you can.

Thankyou for the support Sir. It appears I had installed the secrets.js at multiple locations and hence I was facing error during the splitting function. Its fixed now but thankyou so much.