holepunchto / hypercore

Hypercore is a secure, distributed append-only log.

Home Page:https://docs.holepunch.to

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

(Maybe) Replication using sodium-javascript not working

sce9sc opened this issue · comments

Hi, I am not sure that this is totally correct but, I was trying to make hypercore work on a device (termux) that did not have a prebuild version of sodium-native so I had the idea of copying the sodium-javascript (expept from package.json) after installing everything onto the sodium-native folder.

The results were that I could write a hypercore but I could not replicate it.

I don't know if that hack should have worked

The error once copying or changing the sodium-universal to sodium-javascript is

replication stream error (initiator): Error: Noise handshake failed
/Users/sce9sc/Documents/Work/test-hyperdrive/node_modules/hypercore/index.js:863
        peer.extension(name, buffer)
             ^

TypeError: Cannot read properties of undefined (reading 'extension')
    at Object.send (/Users/sce9sc/Documents/Work/test-hls-hyperdrive/node_modules/hypercore/index.js:863:14)
    at main (/Users/sce9sc/Documents/Work/test-hls-hyperdrive/testHyperFile.js:214:10)

I need to point that I am using hypercore extension

i think you need native. just build it for termux, its should be straight forward (install build deps and reinstall)

Thank you for responding so fast.

I tried to install but I get the bellow error

gyp info spawn args ]                             
gyp: Call to 'node deps/bin.js --print-include' returned exit status 1 while in binding.gyp. while trying to load binding.gyp                                        
   gyp ERR! configure error ify:sodium-native: timing reif gyp ERR! stack Error: `gyp` failed with exit code: 1   
 gyp ERR! stack     at ChildProcess.onCpExit (/data/data/com.termux/files/usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:325:16) 
gyp ERR! stack     at ChildProcess.emit (node:events:513:28)                                                    gyp 
ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:293:12)                          gyp 
ERR! System Linux 4.19.157-perf-g61dd92dde17b       gyp ERR! command 
"/data/data/com.termux/files/usr/bin/node" "/data/data/com.termux/files/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" 
 gyp ERR! cwd 
/data/data/com.termux/files/home/work/test-nodemules/node_modules/sodium-native                    gyp ERR! node -v v19.4.0                                
gyp ERR! node-gyp -v v9.3.0        
  gyp ERR! not ok                                        
 npm ERR! code 1                                       
  npm ERR! path /data/data/com.termux/files/home/work/test-nodemules/node_modules/sodium-native     
npm ERR! command failed

The think is, that even thought the above is not working copying the sodium-javascript into the sodium-universal should have. Or not? It seems that secret stream is not working with the JavaScript version of sodium-universal.

Thank you, and for the excellent project

@sce9sc oh super interesting, thanks! We’ll look into that