Documentation ¶
Index ¶
Constants ¶
const (
// Prefix did:key prefix
Prefix = "did:key"
)
Variables ¶
This section is empty.
Functions ¶
func GetSupportedDIDKeyTypes ¶
func IsSupportedDIDKeyType ¶
Types ¶
type DIDKey ¶
type DIDKey string
func CreateDIDKey ¶
CreateDIDKey constructs a did:key from a specific key type and its corresponding public key This method does not attempt to validate that the provided public key is of the specified key type. A safer method is `GenerateDIDKey` which handles key generation based on the provided key type.
func GenerateDIDKey ¶
GenerateDIDKey takes in a key type value that this library supports and constructs a conformant did:key identifier. The function returns the associated private key value cast to the generic golang crypto.PrivateKey interface. To use the private key, it is recommended to re-cast to the associated type. For example, called with the input for a secp256k1 key: privKey, didKey, err := GenerateDIDKey(SECP256k1) if err != nil { ... } // where secp is an import alias to the secp256k1 library we use "github.com/decred/dcrd/dcrec/secp256k1/v4" secpPrivKey, ok := privKey.(secp.PrivateKey) if !ok { ... }
func (DIDKey) Decode ¶
Decode takes a did:key and returns the underlying public key value as bytes, the LD key type, and a possible error
type Resolver ¶
type Resolver struct{}
func (Resolver) Resolve ¶
func (Resolver) Resolve(_ context.Context, id string, _ ...resolution.ResolutionOption) (*resolution.ResolutionResult, error)