Documentation ¶
Overview ¶
Package identity defines an identity key.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Key ¶
type Key struct {
// contains filtered or unexported fields
}
Key represents a public identity key.
type KeyPair ¶
type KeyPair struct {
// contains filtered or unexported fields
}
KeyPair represents a public/private identity key pair.
func GenerateKeyPair ¶
GenerateKeyPair generates an identity key pair using the given random reader.
It is recommended to use a cryptographic random reader. If random is `nil`, then crypto/rand.Reader is used.
func NewKeyPair ¶
func NewKeyPair(privateKey curve.PrivateKey, identityKey Key) KeyPair
NewKeyPair returns an identity key pair based on the given public and private keys.
func (KeyPair) IdentityKey ¶
IdentityKey returns the key pair's public identity key.
func (KeyPair) PrivateKey ¶
func (k KeyPair) PrivateKey() curve.PrivateKey
PrivateKey returns the key pair's private key.
type Store ¶
type Store interface { // KeyPair returns the associated identity key pair. KeyPair(ctx context.Context) KeyPair // LocalRegistrationID returns the associated registration ID. LocalRegistrationID(ctx context.Context) uint32 // Load loads the identity key associated with the remote address. Load(ctx context.Context, address address.Address) (Key, bool, error) // Store stores the identity key associated with the remote address and returns // "true" if there is already an entry for the address which is overwritten // with a new identity key. // // Storing the identity key for the remote address implies the identity key // is trusted for the given address. Store(ctx context.Context, address address.Address, identity Key) (bool, error) // Clear removes all items from the store. Clear() error // IsTrustedIdentity returns "true" if the given identity key for the given address is already trusted. // // If there is no entry for the given address, the given identity key is trusted. IsTrustedIdentity(ctx context.Context, address address.Address, identity Key, direction direction.Direction) (bool, error) }
Store defines an identity key store.
An identity key store is associated with a local identity key pair and registration ID.
func NewInMemStore ¶
NewInMemStore creates a new in-memory identity key store.