Documentation ¶
Index ¶
- type AnonymousIdentity
- type Ed25519Identity
- type Identity
- type Prime256v1Identity
- type Secp256k1Identity
- func NewRandomSecp256k1Identity() (*Secp256k1Identity, error)
- func NewSecp256k1Identity(privateKey *secp256k1.PrivateKey) (*Secp256k1Identity, error)
- func NewSecp256k1IdentityFromPEM(data []byte) (*Secp256k1Identity, error)
- func NewSecp256k1IdentityFromPEMWithoutParameters(data []byte) (*Secp256k1Identity, error)
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 ¶
func (id AnonymousIdentity) Sender() principal.Principal
Sender returns the principal of the identity.
func (AnonymousIdentity) Sign ¶
func (id AnonymousIdentity) Sign(_ []byte) []byte
Sign signs the given message.
func (AnonymousIdentity) ToPEM ¶ added in v0.4.0
func (id AnonymousIdentity) ToPEM() ([]byte, error)
ToPEM returns the PEM encoding of the public key.
func (AnonymousIdentity) Verify ¶ added in v0.4.0
func (id AnonymousIdentity) Verify(_, _ []byte) bool
Verify verifies the signature of 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 ¶ added in v0.2.0
func NewRandomEd25519Identity() (*Ed25519Identity, error)
NewRandomEd25519Identity creates a new identity with a random key pair.
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.
func (Ed25519Identity) Verify ¶ added in v0.4.0
func (id Ed25519Identity) Verify(msg, sig []byte) bool
Verify verifies the given signature.
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 // Verify verifies the signature of the given message. Verify(msg, sig []byte) bool // ToPEM returns the PEM representation of the identity. ToPEM() ([]byte, error) }
Identity is an identity that can sign messages.
type Prime256v1Identity ¶ added in v0.4.0
type Prime256v1Identity struct {
// contains filtered or unexported fields
}
Prime256v1Identity is an identity based on a P-256 key pair.
func NewPrime256v1Identity ¶ added in v0.4.0
func NewPrime256v1Identity(privateKey *ecdsa.PrivateKey) *Prime256v1Identity
NewPrime256v1Identity creates a new identity based on the given key pair.
func NewPrime256v1IdentityFromPEM ¶ added in v0.4.0
func NewPrime256v1IdentityFromPEM(data []byte) (*Prime256v1Identity, error)
NewPrime256v1IdentityFromPEM creates a new identity from the given PEM file.
func NewRandomPrime256v1Identity ¶ added in v0.4.0
func NewRandomPrime256v1Identity() (*Prime256v1Identity, error)
NewRandomPrime256v1Identity creates a new identity with a random key pair.
func (Prime256v1Identity) PublicKey ¶ added in v0.4.0
func (id Prime256v1Identity) PublicKey() []byte
PublicKey returns the public key of the identity.
func (Prime256v1Identity) Sender ¶ added in v0.4.0
func (id Prime256v1Identity) Sender() principal.Principal
Sender returns the principal of the identity.
func (Prime256v1Identity) Sign ¶ added in v0.4.0
func (id Prime256v1Identity) Sign(msg []byte) []byte
Sign signs the given message.
func (Prime256v1Identity) ToPEM ¶ added in v0.4.0
func (id Prime256v1Identity) ToPEM() ([]byte, error)
ToPEM returns the PEM encoding of the private key.
func (Prime256v1Identity) Verify ¶ added in v0.4.0
func (id Prime256v1Identity) Verify(msg, sig []byte) bool
Verify verifies the signature of the given message.
type Secp256k1Identity ¶ added in v0.2.0
type Secp256k1Identity struct {
// contains filtered or unexported fields
}
Secp256k1Identity is an identity based on a secp256k1 key pair.
func NewRandomSecp256k1Identity ¶ added in v0.2.0
func NewRandomSecp256k1Identity() (*Secp256k1Identity, error)
NewRandomSecp256k1Identity creates a new identity with a random key pair.
func NewSecp256k1Identity ¶ added in v0.2.0
func NewSecp256k1Identity(privateKey *secp256k1.PrivateKey) (*Secp256k1Identity, error)
NewSecp256k1Identity creates a new identity based on the given key pair.
func NewSecp256k1IdentityFromPEM ¶ added in v0.2.0
func NewSecp256k1IdentityFromPEM(data []byte) (*Secp256k1Identity, error)
NewSecp256k1IdentityFromPEM creates a new identity from the given PEM file.
func NewSecp256k1IdentityFromPEMWithoutParameters ¶ added in v0.4.0
func NewSecp256k1IdentityFromPEMWithoutParameters(data []byte) (*Secp256k1Identity, error)
NewSecp256k1IdentityFromPEMWithoutParameters creates a new identity from the given PEM file.
func (Secp256k1Identity) PublicKey ¶ added in v0.2.0
func (id Secp256k1Identity) PublicKey() []byte
PublicKey returns the public key of the identity.
func (Secp256k1Identity) Sender ¶ added in v0.2.0
func (id Secp256k1Identity) Sender() principal.Principal
Sender returns the principal of the identity.
func (Secp256k1Identity) Sign ¶ added in v0.2.0
func (id Secp256k1Identity) Sign(msg []byte) []byte
Sign signs the given message.
func (Secp256k1Identity) ToPEM ¶ added in v0.2.0
func (id Secp256k1Identity) ToPEM() ([]byte, error)
ToPEM returns the PEM encoding of the public key.
func (Secp256k1Identity) Verify ¶ added in v0.4.0
func (id Secp256k1Identity) Verify(msg, sig []byte) bool
Verify verifies the signature of the given message.