This package has been deprecated

Author message:

Deprecated in favor of Ceramic: https://developers.ceramic.network

ipfs-did-document

1.2.3 • Public • Published

js-ipfs-did-document

This is a module for creating ipfs based DID Documents. The CID of the first document created will become the identifier of the DID. Any subsequent updates to a DID document will link back to the previous document CID. In order to create a complete DID Method this module needs to be paired with a revocation module that handles revocation and rotation of keys.

Install

Using npm:

$ npm install ipfs-did-document

API

DidDocument

A class for creating ipfs based DID Documents. Based on the DID spec: https://w3c-ccg.github.io/did-spec/

Kind: global class

new DidDocument(ipfs, method)

Create a new DID Document.

Param Type Description
ipfs Object An js-ipfs instance
method String The name of the DID Method

didDocument.addPublicKey(id, type, encoding, key, owner)

Add a new public key

Kind: instance method of DidDocument

Param Type Description
id String The id of the key, e.g. "key1"
type String The type of the key
encoding String The encoding of the key
key String The encoded public key
owner String The owner of the key (optional)

didDocument.removePublicKey(id)

Remove a public key

Kind: instance method of DidDocument

Param Type Description
id String The id of the key, e.g. "key1"

didDocument.addAuthentication(type, id)

Add a new authentication

Kind: instance method of DidDocument

Param Type Description
type String The type of the authentication
id String The id of the key to be used, e.g. "key1"

didDocument.removeAuthentication(id)

Remove an authentication

Kind: instance method of DidDocument

Param Type Description
id String The id of the key, e.g. "key1"

didDocument.addService(id, type, serviceEndpoint, additionalFields)

Add a new service

Kind: instance method of DidDocument

Param Type Description
id String The id of the key to be used, e.g. "key1"
type String The type of the service
serviceEndpoint String The endpoint of the service
additionalFields Object Any additional fields (optional)

didDocument.removeService(id)

Remove a service

Kind: instance method of DidDocument

Param Type Description
id String The id of the key, e.g. "key1"

didDocument.setRevocationMethod(methodDescriptor)

Set the revocationMethod. This can be of any js object and is determined by the implementer of a revocation module.

Kind: instance method of DidDocument

Param Type Description
methodDescriptor Object the object that defines the revocation method

didDocument.addCustomProperty(propName, propValue)

Add a new property

Kind: instance method of DidDocument

Param Type Description
propName String The name of the property
propValue Object The value of the property

didDocument.removeCustomProperty(propName)

Remove a property

Kind: instance method of DidDocument

Param Type Description
propName String The name of the property

didDocument.commit() ⇒ Promise.<CID>

Commit all changes and create a new ipfs dag object.

Kind: instance method of DidDocument
Returns: Promise.<CID> - The CID of the object

DidDocument.load(ipfs, documentCid) ⇒ Promise.<DidDocument>

Load an already existing DID Document.

Kind: static method of DidDocument
Returns: Promise.<DidDocument> - self

Param Type Description
ipfs Object An js-ipfs instance
documentCid String The CID of the document

DidDocument.cidToDocument(ipfs, documentCid) ⇒ Promise.<Object>

Returns the DID document of a document CID

Kind: static method of DidDocument
Returns: Promise.<Object> - The DID document as a js object

Param Type Description
ipfs Object An js-ipfs instance
documentCid String The CID of the document

Readme

Keywords

none

Package Sidebar

Install

npm i ipfs-did-document

Weekly Downloads

86

Version

1.2.3

License

MIT

Unpacked Size

25.5 kB

Total Files

6

Last publish

Collaborators

  • cb3box
  • oed
  • paul_lecam