didkey

package
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 1, 2024 License: Apache-2.0, MIT Imports: 8 Imported by: 1

Documentation

Overview

Package didkey implements the did:key method. A DID Method for Static Cryptographic Keys. From the w3c draft spec https://w3c-ccg.github.io/did-method-key/

Index

Constants

View Source
const (
	// KeyPrefix indicates a decentralized identifier that uses the key method
	KeyPrefix = "did:key"
	// MulticodecKindRSAPubKey rsa-x509-pub https://github.com/multiformats/multicodec/pull/226
	MulticodecKindRSAPubKey = 0x1205
	// MulticodecKindEd25519PubKey ed25519-pub
	MulticodecKindEd25519PubKey = 0xed
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ID

type ID struct {
	crypto.PubKey
}

ID is a DID:key identifier

func NewID

func NewID(pub crypto.PubKey) (ID, error)

NewID constructs an Identifier from a public key

func Parse

func Parse(keystr string) (ID, error)

Parse turns a string into a key method ID

func (ID) MulticodecType

func (id ID) MulticodecType() uint64

MulticodecType indicates the type for this multicodec

func (ID) String

func (id ID) String() string

String returns this did:key formatted as a string

func (ID) VerifyKey

func (id ID) VerifyKey() (interface{}, error)

VerifyKey returns the backing implementation for a public key, one of: *rsa.PublicKey, ed25519.PublicKey

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL