Skip to content
This repository has been archived by the owner on Mar 10, 2020. It is now read-only.

How can use the P2P API path to send private messages? #835

Closed
sorleone opened this issue Aug 15, 2018 · 4 comments
Closed

How can use the P2P API path to send private messages? #835

sorleone opened this issue Aug 15, 2018 · 4 comments

Comments

@sorleone
Copy link

sorleone commented Aug 15, 2018

js-ipfs-api does not seem to provide p2p commands. How can I access these commands? Can you explain how can I extend this library so that I can send encrypted private direct messages? Like sendTo of the ipfs-pubsub-room? They seem to use libp2p dial:

https://github.com/ipfs-shipyard/ipfs-pubsub-room/blob/8fa55b222f904166e6fb98714b078d623ee12d80/src/connection.js#L51

What about the HTTP API path /p2p/stream/dial or /p2p/listener/open?

Currently this is where I am:

const pkg = require('../package.json');
const sendRequest = require('ipfs-api/src/utils/send-request')({
  'api-path': '/api/v0/',
  'user-agent': `/node-${pkg.name}/${pkg.version}/`,
  host: 'localhost',
  port: '5001',
  protocol: 'http'
});

sendRequest({path: '/p2p/stream/dial'}, (err, result) => {
  console.log(result);
});

Another question I have is: does ipfs.util.crypto supports pipable/pullable crypto streams with AES like Node's createCipheriv, and if so how?

@noxonsu
Copy link

noxonsu commented Aug 15, 2018

encode your messages using aes

@magik6k
Copy link
Contributor

magik6k commented Aug 26, 2018

The API is getting refactored - ipfs/kubo#4929. There is a plan to expose separate interface to libp2p streams (ipfs/kubo#5341)

@daviddias daviddias added ready and removed backlog labels Dec 9, 2018
@zot
Copy link

zot commented Feb 5, 2020

I started a workaround for this that I talk about in https://github.com/ipfs/js-ipfs-http-client/issues/681#issuecomment-582620203

@achingbrain
Copy link
Collaborator

If you're still having problems accomplishing this, please ask a question on https://discuss.ipfs.io

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants