-
Notifications
You must be signed in to change notification settings - Fork 14
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
Feature download encryption #71
Conversation
…ed with node own pub key) for the encryption of the file
btw, i forgot the private key thing (from config).. will address that in the meantime |
still wip. got so far: client: alx@ubuntu:/ocean/ocean-node$ npm run client
> nodes-play@1.0.0 client
> mkdir -p ./dist/helpers/scripts/output && node dist/helpers/scripts/clientExample.js
secp256k1 unavailable, reverting to browser version
Got response from server... 200
Echo command status: OK
url http://127.0.0.1:8000/getP2pPeer
target id 16Uiu2HAkuYfgjXoGcSSLSpRPD6XtUgV71t5RqmTmcqdbmrWY9MJo
Got data from server: null
file:///ocean/ocean-node/dist/helpers/scripts/clientExample.js:153
nodeId: data.id,
^
TypeError: Cannot read properties of null (reading 'id')
at getPeerDetails (file:///ocean/ocean-node/dist/helpers/scripts/clientExample.js:153:22)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async testEncryptionFlow (file:///ocean/ocean-node/dist/helpers/scripts/clientExample.js:171:25)
at async file:///ocean/ocean-node/dist/helpers/scripts/clientExample.js:190:1
Node.js v20.9.0
alx@ubuntu:/ocean/ocean-node$ node1: lx@ubuntu:/ocean/ocean-node$ npm run start
> nodes-play@1.0.0 start
> node --trace-warnings --experimental-specifier-resolution=node dist/index.js
secp256k1 unavailable, reverting to browser version
{
level: 'info',
message: '✅ [CONFIG] => Starting node with peerID:16Uiu2HAmUWwsSj39eAfi3GG9U2niNKi3FVxh3eTwyRxbs8cwCq72',
component: 'CONFIG',
timestamp: '2023-11-06 10:34:54'
}
{
level: 'info',
message: '[HTTP] => HTTP port: 8000',
component: 'HTTP',
timestamp: '2023-11-06 10:34:54'
}
{
level: 'info',
message: '[P2P] => Incoming direct command for peer self',
component: 'P2P',
timestamp: '2023-11-06 10:39:02'
}
{
level: 'info',
message: '[P2P] => Performing task: {"command":"echo","url":"http://example.com"}',
component: 'P2P',
timestamp: '2023-11-06 10:39:02'
} i will retry |
Hi @alexcos20 ,
(node id will be : 16Uiu2HAkuYfgjXoGcSSLSpRPD6XtUgV71t5RqmTmcqdbmrWY9MJo) Node B:
(will generate node Id: 16Uiu2HAmQU8YmsACkFjkaFqEECLN3Csu6JgoU3hw9EsPmk7i9TFL) I had those values before on the clientExample.ts as well, for reference, but i removed them after your requests :-) ..
|
simple fix. in https://github.com/oceanprotocol/ocean-node/blob/feature-download-encryption/src/helpers/scripts/clientExample.ts#L347 from const url = `http://127.0.0.1:${nodeHttpPort}/getP2pPeer` changed to const url = `http://127.0.0.1:${nodeHttpPort}/getP2PPeer` now we have output.. still debugging. ile download complete
Stream Ended! Saved file to path: ./dist/helpers/scripts/output/received_out_
real 4m0.020s
user 0m1.650s
sys 2m10.446s |
you're using the same example file? |
yeah, most likely. cpu was 5% , download rate was 1Mb/s.. |
ok, analyzed the outputs, they are looking good, no diff between the 4 files. nicely done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, still some merge conflicts
should we move src/components/p2p/downloadHandler.ts to src/components/core/downloadHandler.ts ? because downloadURL is a "core" feature |
|
Fixes #38
Changes proposed in this PR:
downloadURL
command with encryption following Implement encryption for downloadURL command #38Some Notes:
On the
directCommand
request, the command/data itself is not all encrypted, only the AES secret key/init vector needed for the file encryption. If we we really want to encrypt also the entire command (all the params), that is also easy to change, but at least thenode
parameter (if present) must be visible, and we probably need to change a bit the payload (so the node knows if the command params need to be decrypted first)Under
src/helpers/scripts
there is aclientExample.ts
to test the flowTo run them:
Notes: regarding #79 there is a separate PR https://github.com/oceanprotocol/ocean-node/pull/80
It is set to run with node 20, most issue were related with module resolution. Seems the only way to get rid of all errors is to just use file extensions (they are mandatory on nodeJS) when importing local stuff from relative paths