Documentation
¶
Index ¶
- func DeriveVerificationMethod(id did.URL, v Verifier) did.VerificationMethod
- func DeriveVerifier(_ context.Context, mat did.VerificationMaterial) (ucan.Verifier, error)
- func FormatSigner(signer Signer) string
- func FormatVerifier(verifier Verifier) string
- func KeyDID(v Verifier) did.DID
- func NewIssuer(did did.DID, signer Signer) issuer
- func Register(code multicodec.Code, d Decoder)
- type Decoder
- type Issuer
- type Signer
- type Verifier
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeriveVerificationMethod ¶
func DeriveVerificationMethod(id did.URL, v Verifier) did.VerificationMethod
func DeriveVerifier ¶
DeriveVerifier produces a ucan.Verifier from Multikey did.VerificationMaterial.
func FormatSigner ¶
Format formats a multikey.Signer into a multibase encoded string (Base64pad).
func FormatVerifier ¶
Format formats a multikey.Verifier into a multibase encoded string (Base58BTC).
func KeyDID ¶
KeyDID returns the `did:key` DID corresponding to the given Verifier's public key. This may not be the same DID that is using this key in some particular context, but it's a DID that *can* use it, and is the only `did:key` DID that can use it. If this key was found on a `did:key` DID, then this is by definition the DID it was found on. If this key was found on, for example, a `did:web` DID, then this is not.
Types ¶
type Issuer ¶
Issuer is a ucan.Issuer whose signer is specifically a multikey Signer.
type Signer ¶
type Signer interface {
ucan.Signer
Code() multicodec.Code
// Bytes returns the private key bytes with multiformats prefix varint.
Bytes() []byte
// Raw returns the bytes of the private key without multiformats tags.
Raw() []byte
// PrivateKey returns the private key in whatever format the underlying
// implementation uses. Where possible, this should be a type that
// ["crypto/x509".MarshalPKCS8PrivateKey] supports.
PrivateKey() any
// PublicKey returns the public key in whatever format the underlying
// implementation uses. Where possible, this should be a type that
// ["crypto/x509".MarshalPKIXPublicKey] supports.
PublicKey() any
// KeyDID is a convenience for `Verifier().KeyDID()`.
KeyDID() did.DID
}
Signer is a multikey signer. It contains the private key bytes and can sign with them.
type Verifier ¶
type Verifier interface {
ucan.Verifier
Code() multicodec.Code
// Bytes returns the public key bytes with multiformats prefix varint.
Bytes() []byte
// Raw returns the bytes of the public key without multiformats tags.
Raw() []byte
// PublicKey returns the public key in whatever format the underlying
// implementation uses. Where possible, this should be a type that
// ["crypto/x509".MarshalPKIXPublicKey] supports.
PublicKey() any
// KeyDID returns the `did:key` DID corresponding to this Verifier's public
// key (which is not necessarily the same DID as the issuer of a token this
// Verifier can verify).
KeyDID() did.DID
}
Verifier is a multikey verifier. It contains the public key bytes and can verify signatures with them.