/api/v0/key/import

Import a key and prints imported key id

Arguments

  • arg [string]: name to associate with key in keychain Required: yes.

  • ipns-base [string]: Encoding used for keys: Can either be a multibase encoded CID or a base58btc encoded multihash. Takes {b58mh|base36|k|base32|b...}. Default: base36. Required: no.

  • format [string]: The format of the private key to import, libp2p-protobuf-cleartext or pem-pkcs8-cleartext. Default: libp2p-protobuf-cleartext. Required: no.

  • allow-any-key-type [bool]: Allow importing any key type. Default: false. Required: no.

Request Body

Argument key is of file type. This endpoint expects one or several files (depending on the command) in the body of the request as 'multipart/form-data'.

Response

On success, the call to this endpoint will return with 200 and the following body:

{
  "Id": "<string>",
  "Name": "<string>"
}

cURL Example

curl -X POST -F file=@myfile "http://127.0.0.1:5001/api/v0/key/import?arg=<name>&ipns-base=base36&format=libp2p-protobuf-cleartext&allow-any-key-type=false"

Last updated