Versions in this module Expand all Collapse all v0 v0.1.2 Jun 20, 2024 Changes in this version + const SharedKeySizeBytes + var ErrInvalidPrivateKey = errors.New("invalid private key") + var ErrInvalidPublicKey = newError(errCodeBadParameter, "invalid public key") + var ErrMetadataFieldTooLong = errors.New("metadata fields can't be more than 255 bytes long") + type Dispatcher struct + func (d *Dispatcher) Connect(verifierId []byte, sessionInfo *signatures.SessionInfo) (*Signer, error) + func (d *Dispatcher) ConnectAuthenticated(verifierId, challenge, encodedSessionInfo, tag []byte) (*Signer, error) + type ECDHPrivateKey interface + Exchange func(remotePublicBytes []byte) (Session, error) + PublicBytes func() []byte + func LoadExternalECDHKey(filename string) (ECDHPrivateKey, error) + func NewECDHPrivateKey(rng io.Reader) (ECDHPrivateKey, error) + func UnmarshalECDHPrivateKey(privateScalar []byte) ECDHPrivateKey + type Error struct + Code universal.MessageFault_E + Info string + func (e Error) Error() string + type InvalidSignatureError struct + Code universal.MessageFault_E + EncodedInfo []byte + Tag []byte + func (e *InvalidSignatureError) Error() string + type NativeECDHKey struct + func (n *NativeECDHKey) Exchange(publicBytes []byte) (Session, error) + func (n *NativeECDHKey) Public() *ecdsa.PublicKey + func (n *NativeECDHKey) PublicBytes() []byte + type NativeSession struct + func (b *NativeSession) Decrypt(nonce, ciphertext, associatedData, tag []byte) (plaintext []byte, err error) + func (b *NativeSession) Encrypt(plaintext, associatedData []byte) (nonce, ciphertext, tag []byte, err error) + func (b *NativeSession) LocalPublicBytes() []byte + func (b *NativeSession) NewHMAC(label string) hash.Hash + func (b *NativeSession) SessionInfoHMAC(id, challenge, encodedInfo []byte) ([]byte, error) + type Peer struct + type Session interface + Decrypt func(nonce, ciphertext, associatedData, tag []byte) (plaintext []byte, err error) + Encrypt func(plaintext, associatedData []byte) (nonce, ciphertext, tag []byte, err error) + LocalPublicBytes func() []byte + NewHMAC func(label string) hash.Hash + SessionInfoHMAC func(id, challenge, encodedInfo []byte) ([]byte, error) + type Signer struct + func ImportSessionInfo(private ECDHPrivateKey, verifierName, encodedInfo []byte, ...) (*Signer, error) + func NewAuthenticatedSigner(private ECDHPrivateKey, verifierName, challenge, encodedInfo, tag []byte) (*Signer, error) + func NewSigner(private ECDHPrivateKey, verifierName []byte, ...) (*Signer, error) + func (s *Signer) AuthorizeHMAC(message *universal.RoutableMessage, expiresIn time.Duration) error + func (s *Signer) Encrypt(message *universal.RoutableMessage, expiresIn time.Duration) error + func (s *Signer) ExportSessionInfo() ([]byte, error) + func (s *Signer) RemotePublicKeyBytes() []byte + func (s *Signer) UpdateSessionInfo(info *signatures.SessionInfo) error + func (s *Signer) UpdateSignedSessionInfo(challenge, encodedInfo, tag []byte) error + type Verifier struct + func NewVerifier(private ECDHPrivateKey, id []byte, domain universal.Domain, ...) (*Verifier, error) + func (v *Verifier) SessionInfo() (*signatures.SessionInfo, error) + func (v *Verifier) SetSessionInfo(challenge []byte, message *universal.RoutableMessage) error + func (v *Verifier) SignedSessionInfo(challenge []byte) (encodedInfo, tag []byte, err error) + func (v *Verifier) Verify(message *universal.RoutableMessage) (plaintext []byte, err error)