Documentation
¶
Index ¶
Constants ¶
const ( MethodJWK = "jwk" TypeJsonWebKey2020 = "JsonWebKey2020" )
const ( MethodKey = "key" TypeEd25519VerificationKey2020 = "Ed25519VerificationKey2020" TypeEcdsaSecp256k1VerificationKey2019 = "EcdsaSecp256k1VerificationKey2019" )
const (
MethodWeb = "web"
)
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Doc ¶
type Doc struct {
ID string
VerificationMethod []VerificationMethod
}
Doc represents a DID Document.
type DocResolution ¶
type DocResolution struct {
DIDDocument *Doc
}
DocResolution contains the result of resolving a DID.
type JWKVDR ¶
type JWKVDR struct{}
JWKVDR resolves did:jwk DIDs by decoding the JWK from the DID string.
func (*JWKVDR) Read ¶
func (j *JWKVDR) Read(didStr string) (*DocResolution, error)
Read resolves a did:jwk DID. Format: did:jwk:<base64url-encoded-jwk> See https://github.com/quartzjer/did-jwk/blob/main/spec.md
type KeyVDR ¶
type KeyVDR struct{}
KeyVDR resolves did:key DIDs by decoding the multibase/multicodec key.
func (*KeyVDR) Read ¶
func (k *KeyVDR) Read(didStr string) (*DocResolution, error)
Read resolves a did:key DID. Format: did:key:<multibase-encoded-multicodec-key> See https://w3c-ccg.github.io/did-method-key/
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry resolves DIDs by delegating to the appropriate VDR.
func NewRegistry ¶
func NewRegistry(opts ...RegistryOpt) *Registry
NewRegistry creates a new DID resolution registry with the given options.
type RegistryOpt ¶
type RegistryOpt func(*Registry)
RegistryOpt is a functional option for configuring a Registry.
type VDR ¶
type VDR interface {
// Accept returns true if this resolver handles the given DID method.
Accept(method string) bool
// Read resolves a DID and returns the DID document.
Read(did string) (*DocResolution, error)
}
VDR is the interface for a DID method resolver.
type VerificationMethod ¶
type VerificationMethod struct {
ID string
Type string
Controller string
Value []byte
// contains filtered or unexported fields
}
VerificationMethod represents a verification method in a DID document.
func NewVerificationMethodFromBytes ¶
func NewVerificationMethodFromBytes(id, vmType, controller string, value []byte) *VerificationMethod
NewVerificationMethodFromBytes creates a VerificationMethod from raw key bytes.
func NewVerificationMethodFromJWK ¶
func NewVerificationMethodFromJWK(id, vmType, controller string, key jwk.Key) (*VerificationMethod, error)
NewVerificationMethodFromJWK creates a VerificationMethod from a JWK key.
func (*VerificationMethod) JSONWebKey ¶
func (vm *VerificationMethod) JSONWebKey() jwk.Key
JSONWebKey returns the JWK representation of this verification method's key, or nil.
type WebVDR ¶
WebVDR resolves did:web DIDs by fetching the DID document over HTTPS.
func (*WebVDR) Read ¶
func (w *WebVDR) Read(didStr string) (*DocResolution, error)
Read resolves a did:web DID by fetching the DID document from the web. See https://w3c-ccg.github.io/did-method-web/