Categorygithub.com/nuts-foundation/trustdidweb-go
modulepackage
0.3.0-alpha.2
Repository: https://github.com/nuts-foundation/trustdidweb-go.git
Documentation: pkg.go.dev

# README

trustdidweb-go

Go Reference

This repository contains a highly experimental and unstable implementation of the Trust DID Web DID-Method specification.

Its purpose now is to get some hands-on experience with the specification. If we find it useful, we might continue to develop it further into a more stable implementation.

Do not use this in production!

Example usage

signer, _ := NewSigner("eddsa-jcs-2022")
// create a new log
log := Create("did:tdw:{SCID}:example.com}", signer, nil)
// get the DID Document
doc, _ := log.Document()

// verify a log
if err := log.Verify(); err != nil {
    panic(err)
}

// update the document with a new service
doc["service"] = []interface{}{
    map[string]interface{}{
        "id":              "did:tdw:example.com:123456789abcdefghi#service-1",
        "type":            "Service",
        "serviceEndpoint": "https://example.com/service/1",
    },
}

// Update the log
log, _ = log.Update(LogParams{}, doc, signer)

// verify the log
if err := log.Verify(); err != nil {
    panic(err)
}

// get the updated document:
doc, err := log.Document()

// Marshal the log to a did-log-file which can be hosted on a n well-known endpoint
logFile, _ := log.MarshalText()

// read a log from a did-log-file
newLog := new(DIDLog)
err := newLog.UnmarshalText(logfile)
if err != nil {
    panic(err)
}

TODO

Following thing are still missing (not in a particular order):

  • Support for DID portability
  • Better test coverage
  • Add a resolver
  • Generation of a did:web document from a log
  • Cleanup of the code
  • Support for witness signatures

# Packages

No description provided by the author

# Functions

Create creates a new DIDLog with a single log entry It calculates the SCID of the first log entry and replaces the placeholder in the path template It signs the entry with the provided signer.
NewInitialParams returns the parameters for the first log entry https://bcgov.github.io/trustdidweb/#didtdw-did-method-parameters.
No description provided by the author
NewNextKeyHash takes a public key and generates the coresponding nextKeyHash.
NewSigner returns the signer of the configured crypto suite.
NewUpdateKey encodes a public key to a multiKey formatted updateKey.
No description provided by the author

# Constants

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Structs

No description provided by the author
LogParams represents the parameters of a log entry.
No description provided by the author

# Type aliases

No description provided by the author
No description provided by the author
No description provided by the author