identity

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AnonymousIdentity

type AnonymousIdentity struct{}

AnonymousIdentity is an identity that does not sign messages.

func (AnonymousIdentity) PublicKey

func (id AnonymousIdentity) PublicKey() []byte

PublicKey returns the public key of the identity.

func (AnonymousIdentity) Sender

Sender returns the principal of the identity.

func (AnonymousIdentity) Sign

func (id AnonymousIdentity) Sign(_ []byte) []byte

Sign signs the given message.

type Ed25519Identity

type Ed25519Identity struct {
	// contains filtered or unexported fields
}

Ed25519Identity is an identity based on an Ed25519 key pair.

func NewEd25519Identity

func NewEd25519Identity(publicKey ed25519.PublicKey, privateKey ed25519.PrivateKey) (*Ed25519Identity, error)

NewEd25519Identity creates a new identity based on the given key pair.

func NewEd25519IdentityFromPEM

func NewEd25519IdentityFromPEM(data []byte) (*Ed25519Identity, error)

NewEd25519IdentityFromPEM creates a new identity from the given PEM file.

func NewRandomEd25519Identity

func NewRandomEd25519Identity() (*Ed25519Identity, error)

func (Ed25519Identity) PublicKey

func (id Ed25519Identity) PublicKey() []byte

PublicKey returns the public key of the identity.

func (Ed25519Identity) Sender

func (id Ed25519Identity) Sender() principal.Principal

Sender returns the principal of the identity.

func (Ed25519Identity) Sign

func (id Ed25519Identity) Sign(data []byte) []byte

Sign signs the given message.

func (Ed25519Identity) ToPEM

func (id Ed25519Identity) ToPEM() ([]byte, error)

ToPEM returns the PEM representation of the identity.

type Identity

type Identity interface {
	// Sender returns the principal of the identity.
	Sender() principal.Principal
	// Sign signs the given message.
	Sign(msg []byte) []byte
	// PublicKey returns the public key of the identity.
	PublicKey() []byte
}

Identity is an identity that can sign messages.

type Secp256k1Identity

type Secp256k1Identity struct {
	// contains filtered or unexported fields
}

func NewRandomSecp256k1Identity

func NewRandomSecp256k1Identity() (*Secp256k1Identity, error)

func NewSecp256k1Identity

func NewSecp256k1Identity(privateKey *secp256k1.PrivateKey) (*Secp256k1Identity, error)

func NewSecp256k1IdentityFromPEM

func NewSecp256k1IdentityFromPEM(data []byte) (*Secp256k1Identity, error)

func (Secp256k1Identity) PublicKey

func (id Secp256k1Identity) PublicKey() []byte

func (Secp256k1Identity) Sender

func (Secp256k1Identity) Sign

func (id Secp256k1Identity) Sign(msg []byte) []byte

func (Secp256k1Identity) ToPEM

func (id Secp256k1Identity) ToPEM() ([]byte, error)

Jump to

Keyboard shortcuts

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