https://github.com/nuts-foundation/trustdidweb-go
Implementation of the Trust DID Web specification in Go
https://github.com/nuts-foundation/trustdidweb-go
Last synced: 4 months ago
JSON representation
Implementation of the Trust DID Web specification in Go
- Host: GitHub
- URL: https://github.com/nuts-foundation/trustdidweb-go
- Owner: nuts-foundation
- License: mit
- Created: 2024-08-07T12:34:14.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-11-19T13:58:40.000Z (over 1 year ago)
- Last Synced: 2025-12-17T14:59:11.601Z (7 months ago)
- Language: Go
- Size: 188 KB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# trustdidweb-go
[](https://pkg.go.dev/github.com/nuts-foundation/trustdidweb-go)
This repository contains a highly experimental and unstable implementation of the [Trust DID Web DID-Method specification](https://identity.foundation/trustdidweb).
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
```go
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 things 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