{"id":20293075,"url":"https://github.com/mingderwang/ockam-network-did","last_synced_at":"2025-09-22T03:35:38.748Z","repository":{"id":66841428,"uuid":"307279181","full_name":"mingderwang/ockam-network-did","owner":"mingderwang","description":"fork from ockam-network/did","archived":false,"fork":false,"pushed_at":"2020-10-26T06:23:43.000Z","size":46,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-04T05:15:49.149Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mingderwang.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-10-26T06:23:03.000Z","updated_at":"2023-10-27T13:32:19.000Z","dependencies_parsed_at":"2023-02-21T06:16:37.126Z","dependency_job_id":null,"html_url":"https://github.com/mingderwang/ockam-network-did","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/mingderwang/ockam-network-did","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mingderwang%2Fockam-network-did","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mingderwang%2Fockam-network-did/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mingderwang%2Fockam-network-did/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mingderwang%2Fockam-network-did/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mingderwang","download_url":"https://codeload.github.com/mingderwang/ockam-network-did/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mingderwang%2Fockam-network-did/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":276341948,"owners_count":25625576,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-22T02:00:08.972Z","response_time":79,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-14T15:21:17.678Z","updated_at":"2025-09-22T03:35:38.710Z","avatar_url":"https://github.com/mingderwang.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# did\n\n[![Build Status](https://dev.azure.com/ockam-network/ockam-network-open-source/_apis/build/status/ockam-network.did)](https://dev.azure.com/ockam-network/ockam-network-open-source/_build/latest?definitionId=7)\n[![Go Report Card](https://goreportcard.com/badge/github.com/ockam-network/did)](https://goreportcard.com/report/github.com/ockam-network/did)\n[![cover.run](https://cover.run/go/github.com/ockam-network/did.svg?tag=golang-1.10)](https://cover.run/go?tag=golang-1.10\u0026repo=github.com%2Fockam-network%2Fdid)\n[![GoDoc](https://img.shields.io/badge/godoc-reference-blue.svg?style=flat-square)](https://godoc.org/github.com/ockam-network/did)\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg?style=flat-square)](LICENSE)\n\n`did` is a Go package that provides tools to work with\n[Decentralized Identifiers (DIDs)](https://w3c-ccg.github.io/did-spec).\n\n## Install\n\n```\ngo get github.com/ockam-network/did\n```\n\n## Example\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"log\"\n\n\t\"github.com/ockam-network/did\"\n)\n\nfunc main() {\n\td, err := did.Parse(\"did:example:q7ckgxeq1lxmra0r\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tfmt.Printf(\"%#v\", d)\n}\n```\n\nThe above example parses the input string according to the rules defined in the [DID Grammar](did.abnf) and prints the\nfollowing value of DID type.\n\n```go\n\u0026did.DID{\n\tMethod:\"example\",\n\tID:\"q7ckgxeq1lxmra0r\",\n\tIDStrings:[]string{\"q7ckgxeq1lxmra0r\"},\n\tPath:\"\",\n\tPathSegments:[]string(nil),\n\tQuery:\"\",\n\tFragment:\"\"\n}\n```\n\nThe input string may also be a [DID Reference](https://w3c-ccg.github.io/did-spec/#dfn-did-reference) with a\n[DID Path](https://w3c-ccg.github.io/did-spec/#dfn-did-path):\n\n```go\nd, err := did.Parse(\"did:example:q7ckgxeq1lxmra0r/abc/pqr\")\n```\n\nwhich would result in:\n\n```go\n\u0026did.DID{\n\tMethod:\"example\",\n\tID:\"q7ckgxeq1lxmra0r\",\n\tIDStrings:[]string{\"q7ckgxeq1lxmra0r\"},\n\tPath:\"abc/pqr\",\n\tPathSegments:[]string{\"abc\", \"pqr\"},\n\tQuery:\"\",\n\tFragment:\"\"\n}\n```\n\nor a [DID Reference](https://w3c-ccg.github.io/did-spec/#dfn-did-reference) with a\n[DID Path](https://w3c-ccg.github.io/did-spec/#dfn-did-path) and a DID Query:\n\n```go\nd, err := did.Parse(\"did:example:q7ckgxeq1lxmra0r/abc/pqr?xyz\")\nfmt.Println(d.Query)\n// Output: xyz\n```\n\nor a [DID Reference](https://w3c-ccg.github.io/did-spec/#dfn-did-reference) with a\n[DID Fragment](https://w3c-ccg.github.io/did-spec/#dfn-did-fragment):\n\n```go\nd, err := did.Parse(\"did:example:q7ckgxeq1lxmra0r#keys-1\")\nfmt.Println(d.Fragment)\n// Output: keys-1\n```\n\nThis package also implements the [Stringer](https://golang.org/pkg/fmt/#Stringer) interface for the DID type. It is\neasy to convert DID type structures into valid DID strings:\n\n```go\nd := \u0026did.DID{Method: \"example\", ID: \"q7ckgxeq1lxmra0r\"}\nfmt.Println(d.String())\n// Output: did:example:q7ckgxeq1lxmra0r\n```\n\nor with a refence with a fragment:\n\n```go\nd := \u0026did.DID{Method: \"example\", ID: \"q7ckgxeq1lxmra0r\", Fragment: \"keys-1\"}\nfmt.Println(d.String())\n// Output: did:example:q7ckgxeq1lxmra0r#keys-1\n```\n\nFor more documentation and examples, please see [godoc](https://godoc.org/github.com/ockam-network/did).\n\n## Build\n\nTo compile the code in this repository, run:\n\n```\ngo build\n```\n\n## Test\n\nThis repository includes a comprehensive [suite of tests](did_test.go) that check for various edge cases within\nthe [DID Grammar](did.abnf).\n\nTo run the tests, run:\n\n```\ngo test -v -cover\n```\n\n## Benchmark\n\nWe haven't spent any time tuning the performance of the parser, however this repository includes some\n[benchmarks](benchmark_test.go) that compare the speed of `did.Parse` against Go's `url.Parse` with inputs\nof similar length, this is intended as a sanity check to ensure that `did.Parse` is at least comparable in performance\nto `url.Parse`\n\n```\ngo test -bench=.\n```\n\n`did.Parse` included in this package:\n\n```\nBenchmarkParse-8                  \t 5000000\t       365 ns/op\nBenchmarkParseWithPath-8          \t 3000000\t       500 ns/op\nBenchmarkParseWithQuery-8         \t 3000000\t       558 ns/op\nBenchmarkParseWithFragment-8      \t 3000000\t       552 ns/op\n```\n\nGo's `url.Parse`:\n\n```\nBenchmarkUrlParse-8               \t 3000000\t       475 ns/op\nBenchmarkUrlParseWithPath-8       \t 3000000\t       505 ns/op\nBenchmarkUrlParseWithQuery-8      \t 5000000\t       294 ns/op\nBenchmarkUrlParseWithFragment-8   \t 5000000\t       369 ns/op\n```\n\n## Contributing\n\nThis package is early in its development and we welcome all contributions from the DID community. Please open issues\nand send pull requests.\n\nWe follow the conventions specified in [Conventional Commits](https://www.conventionalcommits.org/) for our commit\nmessages.\n\n## License\n\nThis package is licensed under [Apache License 2.0](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmingderwang%2Fockam-network-did","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmingderwang%2Fockam-network-did","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmingderwang%2Fockam-network-did/lists"}