identity

package
v0.386.2 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2024 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 Certificate added in v0.376.0

type Certificate struct {
	SignedData
}

func NewCertificate added in v0.376.0

func NewCertificate(cert *ftlv1.Certificate) (Certificate, error)

func (Certificate) String added in v0.376.0

func (c Certificate) String() string

type CertificateData added in v0.376.0

type CertificateData struct {
	ID            Identity
	NodePublicKey PublicKey
}

func (CertificateData) String added in v0.376.0

func (c CertificateData) String() string

type CertifiedSignedData added in v0.376.0

type CertifiedSignedData struct {
	Certificate Certificate
	SignedData  SignedData
}

CertifiedSignedData is sent by a node and proves identity based on a certificate.

func (CertifiedSignedData) String added in v0.376.0

func (c CertifiedSignedData) String() string

func (CertifiedSignedData) Verify added in v0.376.0

func (c CertifiedSignedData) Verify(caVerifier Verifier) (Identity, []byte, error)

Verify against the CA and then the node certificate. Only return the data if both are valid.

type Controller added in v0.376.0

type Controller struct{}

func NewController added in v0.376.0

func NewController() Controller

func (Controller) String added in v0.376.0

func (c Controller) String() string

type Identity added in v0.376.0

type Identity interface {
	String() string
}

func Parse added in v0.376.0

func Parse(s string) (Identity, error)

type KeyPair

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

func GenerateKeyPair added in v0.376.0

func GenerateKeyPair() (KeyPair, error)

GenerateKeyPair creates a new key pair using Tink's ED25519 key template

func NewKeyPair added in v0.376.0

func NewKeyPair(handle keyset.Handle) KeyPair

func (KeyPair) Handle added in v0.376.0

func (t KeyPair) Handle() keyset.Handle

func (KeyPair) Public

func (t KeyPair) Public() (PublicKey, error)

func (KeyPair) Signer

func (t KeyPair) Signer() (Signer, error)

func (KeyPair) Verifier

func (t KeyPair) Verifier() (Verifier, error)

type PublicKey added in v0.376.0

type PublicKey struct {
	Bytes []byte
}

func NewPublicKey added in v0.376.0

func NewPublicKey(b []byte) PublicKey

func (PublicKey) Decode added in v0.376.0

func (pk PublicKey) Decode(ctx *kong.DecodeContext) error

type Runner added in v0.376.0

type Runner struct {
	Key    model.RunnerKey
	Module string
}

Runner identity TODO: Maybe use KeyType[T any, TP keyPayloadConstraint[T]]?

func NewRunner added in v0.376.0

func NewRunner(key model.RunnerKey, module string) Runner

func (Runner) String added in v0.376.0

func (r Runner) String() string

type SignedData

type SignedData struct {
	Signature []byte
	// contains filtered or unexported fields
}

func NewSignedData added in v0.376.0

func NewSignedData(verifier Verifier, data, signature []byte) (SignedData, error)

NewSignedData ensures that the data is signed correctly.

type Signer

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

func (Signer) Public

func (k Signer) Public() (PublicKey, error)

func (Signer) Sign

func (k Signer) Sign(data []byte) (SignedData, error)

type Store added in v0.376.0

type Store struct {
	Identity           Identity
	KeyPair            KeyPair
	Signer             Signer
	Certificate        optional.Option[Certificate]
	ControllerVerifier optional.Option[Verifier]
}

Store is held by a node and contains the node's identity, key pair, signer, and certificate.

func NewStoreNewKeys added in v0.376.0

func NewStoreNewKeys(identity Identity) (*Store, error)

func (*Store) CertifiedSign added in v0.376.0

func (s *Store) CertifiedSign(data []byte) (CertifiedSignedData, error)

func (*Store) NewGetCertificateRequest added in v0.376.0

func (s *Store) NewGetCertificateRequest() (v1.GetCertificationRequest, error)

func (*Store) SetCertificate added in v0.376.0

func (s *Store) SetCertificate(cert Certificate, controllerVerifier Verifier) error

func (*Store) SignCertificateRequest added in v0.376.0

func (s *Store) SignCertificateRequest(req *v1.GetCertificationRequest) (Certificate, error)

type Verifier

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

func NewVerifier added in v0.376.0

func NewVerifier(publicKey PublicKey) (Verifier, error)

func (Verifier) Verify

func (k Verifier) Verify(signedData SignedData) ([]byte, error)

Jump to

Keyboard shortcuts

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