ipfs-shipyard / js-did-ipid

The IPID DID method implementation in JavaScript
MIT License
21 stars 9 forks source link

Unable to create did document in my local IPFS instance #18

Closed thecipherBlock closed 4 years ago

thecipherBlock commented 4 years ago

Hi, i would like create an DID document in my local IPFS instance. here is my code to achieve this

    const ipfsClient = require('ipfs-http-client');
    const ipfs = ipfsClient({ host: 'localhost', port: '5001', protocol: 'http' });
    const ipid = require('did-ipid');
    const createIpid = ipid.default;
    const _ipid = await createIpid(ipfs);
    const didDocument = await _ipid.create(< privateKey_in_pem_format >, (document) => {
            document.addPublicKey({
                id: 'idm-master',
                type: 'RsaVerificationKey2018',
                publicKeyPem: <public_key>
            });
      });

while doing so, getting below error:

{ HTTPError: 404 page not found
    at processTicksAndRejections (internal/process/task_queues.js:86:5)
  name: 'HTTPError',
  response:
   Response {
     size: 0,
     timeout: 0,
     [Symbol(Body internals)]: { body: [PassThrough], disturbed: true, error: null },
     [Symbol(Response internals)]:
      { url:
         'http://localhost:5001/api/v0/key/import?arg=js-ipid-vnor04wt66n&pem=-----BEGIN+PRIVATE+KEY-----%0A<private_key_in_pem>%0A-----END+PRIVATE+KEY-----%0A',
        status: 404,
        statusText: 'Not Found',
        headers: [Headers],
        counter: undefined } } }

for some reason %0A characters have been added.

Please help me out in fixing this by telling what went wrong

thecipherBlock commented 4 years ago

DID of did method ipid will use ipns while creating DID document , so it needs swarm/bootstrap nodes connected to it