identity

package
v0.0.0-...-2b55dbc Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2026 License: Apache-2.0, MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeSignerFromPEM

func DecodeSignerFromPEM(pemData []byte) (multikey.Signer, error)

DecodeSignerFromPEM loads a private key from a PKCS#8 PEM as a signer. Currently, only Ed25519 keys are supported.

func EncodeSignerToPEM

func EncodeSignerToPEM(signer multikey.Signer) ([]byte, error)

EncodeSignerToPEM encodes a signer to a PKCS#8 PEM format. The signer's key should be of a type supported by ["crypto/x509".MarshalPKCS8PrivateKey].

Types

type Identity

type Identity struct {
	multikey.Issuer
}

Identity holds a service's cryptographic identity. It's intended to be held by the service itself. This is the source of its DID document, can then be published (eg, to the web). Other services should use normal DID resolution to find the document.

func New

func New(privateKeyBase64 string, serviceDID string) (Identity, error)

New creates a new identity. If privateKeyBase64 is empty, generates a new key. If serviceDID is empty, uses the key DID derived from the key.

func NewFromPEMFile

func NewFromPEMFile(keyFilePath string) (Identity, error)

NewFromPEMFile creates a new identity from an Ed25519 PEM key file.

func NewFromPEMFileWithDID

func NewFromPEMFileWithDID(keyFilePath string, serviceDID string) (Identity, error)

NewFromPEMFileWithDID creates a new identity from an Ed25519 PEM key file. When serviceDID is provided (e.g., "did:web:upload"), the identity will use that DID. Otherwise, it will use the key DID derived from the key.

func (Identity) DIDDocument

func (i Identity) DIDDocument() (did.Document, error)

DIDDocument returns the identity's DID document. This should be available for other services performing did:web resolution. This enables other services to verify signatures from this service.

Jump to

Keyboard shortcuts

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