js-ipfs icon indicating copy to clipboard operation
js-ipfs copied to clipboard

HTTPError: file argument 'key' is required when using go-ipfs node with ipfs-http-client

Open SahidMiller opened this issue 4 years ago • 5 comments

Version information:

go-ipfs version: 0.7.0 Repo version: 10 System version: amd64/windows Golang version: go1.14.4

Description:

There's an incompatibility with ipfs-http-client key import using pem and password resulting in an HTTPError: file argument 'key' is required

Steps to reproduce the error:

    const ipfsClient = require('ipfs-http-client')
    const ipfs = ipfsClient(await ipfsClient({
	url: __REMOTE_API_ADDRESS__, //Connect with go-ipfs node
	agent: ...
    })
    const key = await crypto.keys.generateKeyPair('rsa', 2048)
    const pem = await key.export("temppassword")
    const { id } = await ipfs.key.import(keyName, pem, "temppassword")

SahidMiller avatar Jan 23 '21 18:01 SahidMiller

Thank you for submitting your first issue to this repository! A maintainer will be here shortly to triage and review. In the meantime, please double-check that you have provided all the necessary information to make this process easy! Any information that can help save additional round trips is useful! We currently aim to give initial feedback within two business days. If this does not happen, feel free to leave a comment. Please keep an eye on how this issue will be labeled, as labels give an overview of priorities, assignments and additional actions requested by the maintainers:

  • "Priority" labels will show how urgent this is for the team.
  • "Status" labels will show if this is ready to be worked on, blocked, or in progress.
  • "Need" labels will indicate if additional input or analysis is required.

Finally, remember to use https://discuss.ipfs.io if you just need general support.

welcome[bot] avatar Feb 12 '21 18:02 welcome[bot]

This appears to be an incompatibility between the js-ipfs HTTP API and the go-ipfs HTTP API.

Stebalien avatar Feb 12 '21 18:02 Stebalien

In a bit more detail, js-IPFS accepts the key as a query string argument, go-IPFS accepts it in the body of the POST request.

The http client sends it in the query string as I think it may have been done in js-IPFS first as the interface tests for the import operation are skipped for go-IPFS, the note says 'TODO not implemented in go-ipfs yet'.

It looks like it's been implemented, and implemented differently - js-IPFS should probably align with go-IPFS here.

achingbrain avatar Feb 19 '21 10:02 achingbrain

When this gets picked up, we should be using POST per verbal conversation on 2021-03-22 with @Stebalien and @achingbrain .

BigLep avatar Mar 22 '21 14:03 BigLep

Are there any updates regarding this issue? It has been over a year

Rinse12 avatar Apr 16 '22 20:04 Rinse12

js-ipfs is being deprecated in favor of Helia. You can https://github.com/ipfs/js-ipfs/issues/4336 and read the migration guide.

Please feel to reopen with any comments by 2023-06-02. We will do a final pass on reopened issues afterward (see https://github.com/ipfs/js-ipfs/issues/4336).

We won't be addressing this issue in ipfs-http-client, but you should look at kubo-rpc-client for handling this.

SgtPooki avatar May 26 '23 19:05 SgtPooki