Documentation ¶
Index ¶
- Constants
- Variables
- func DH(priv *PrivKey, pub *PubKey) *[32]byte
- func DecryptAEAD(key, message, ad []byte) ([]byte, error)
- func EncryptAEAD(key, message, ad []byte) ([]byte, error)
- func GenerateNonce() (*[NonceSize]byte, error)
- func GenerateRegistrationId() uint64
- func HKDF(km, salt, info []byte, size int) []byte
- func KDF(dh ...[]byte) *derivedKeys
- func Sign(privateKey *[32]byte, message []byte, random [64]byte) *[64]byte
- func Verify(publicKey [32]byte, message []byte, signature *[64]byte) bool
- type Address
- type AliceMessage
- type BobPreKeyBundle
- type KeyPair
- type MemoryStore
- func (s *MemoryStore) GetIdentityKey(keyID uint32) (*[32]byte, error)
- func (s *MemoryStore) GetIdentityKeyPair() (*KeyPair, error)
- func (s *MemoryStore) GetLocalRegistrationID() (uint64, error)
- func (s *MemoryStore) GetPreKey(keyID uint32) (*PreKey, error)
- func (s *MemoryStore) GetSignedPreKey(keyID uint32) (*SignedPreKey, error)
- func (s *MemoryStore) PutIdentityKey(keyID uint32, identityKey *[32]byte) error
- func (s *MemoryStore) PutIdentityKeyPair(keyPair *KeyPair) error
- func (s *MemoryStore) PutLocalRegistrationID(id uint64) error
- func (s *MemoryStore) PutPreKey(keyID uint32, preKey *PreKey) error
- func (s *MemoryStore) PutSignedPreKey(keyID uint32, signedPreKey *SignedPreKey) error
- type PreKey
- type PrivKey
- type PubKey
- type ReceiverSession
- type SenderSession
- type SignedPreKey
- type Store
Constants ¶
View Source
const ( KeySize = 32 NonceSize = 24 )
Variables ¶
View Source
var (
NotFound error = fmt.Errorf("not found")
)
Functions ¶
func DecryptAEAD ¶
func EncryptAEAD ¶
func GenerateNonce ¶
GenerateNonce creates a new random nonce.
func GenerateRegistrationId ¶
func GenerateRegistrationId() uint64
Types ¶
type AliceMessage ¶
type AliceMessage struct {
// contains filtered or unexported fields
}
type BobPreKeyBundle ¶
type KeyPair ¶
func GenerateEphemeralKeyPair ¶
func GenerateEphemeralKeyPair() *KeyPair
func GenerateIdentityKeyPair ¶
func GenerateIdentityKeyPair() *KeyPair
func GenerateKeyPair ¶
func GenerateKeyPair() *KeyPair
type MemoryStore ¶
type MemoryStore struct {
// contains filtered or unexported fields
}
func NewMemoryStore ¶
func NewMemoryStore() *MemoryStore
func (*MemoryStore) GetIdentityKey ¶
func (s *MemoryStore) GetIdentityKey(keyID uint32) (*[32]byte, error)
func (*MemoryStore) GetIdentityKeyPair ¶
func (s *MemoryStore) GetIdentityKeyPair() (*KeyPair, error)
func (*MemoryStore) GetLocalRegistrationID ¶
func (s *MemoryStore) GetLocalRegistrationID() (uint64, error)
func (*MemoryStore) GetSignedPreKey ¶
func (s *MemoryStore) GetSignedPreKey(keyID uint32) (*SignedPreKey, error)
func (*MemoryStore) PutIdentityKey ¶
func (s *MemoryStore) PutIdentityKey(keyID uint32, identityKey *[32]byte) error
func (*MemoryStore) PutIdentityKeyPair ¶
func (s *MemoryStore) PutIdentityKeyPair(keyPair *KeyPair) error
func (*MemoryStore) PutLocalRegistrationID ¶
func (s *MemoryStore) PutLocalRegistrationID(id uint64) error
func (*MemoryStore) PutSignedPreKey ¶
func (s *MemoryStore) PutSignedPreKey(keyID uint32, signedPreKey *SignedPreKey) error
type PreKey ¶
func GeneratePreKey ¶
type ReceiverSession ¶
type ReceiverSession struct {
// contains filtered or unexported fields
}
func NewReceiverSession ¶
func NewReceiverSession(store Store, a *AliceMessage) (*ReceiverSession, error)
type SenderSession ¶
type SenderSession struct {
// contains filtered or unexported fields
}
func NewSenderSession ¶
func NewSenderSession(store Store, b *BobPreKeyBundle) (*SenderSession, error)
type SignedPreKey ¶
func GenerateSignedPreKey ¶
func GenerateSignedPreKey(identityKeyPair *KeyPair, keyID int64) *SignedPreKey
type Store ¶
type Store interface { GetIdentityKeyPair() (*KeyPair, error) PutIdentityKeyPair(keyPair *KeyPair) error GetLocalRegistrationID() (uint64, error) PutLocalRegistrationID(id uint64) error GetIdentityKey(keyID uint32) (*[32]byte, error) PutIdentityKey(keyID uint32, identityKey *[32]byte) error GetPreKey(keyID uint32) (*PreKey, error) PutPreKey(keyID uint32, preKey *PreKey) error GetSignedPreKey(keyID uint32) (*SignedPreKey, error) PutSignedPreKey(keyID uint32, signedPreKey *SignedPreKey) error }
Click to show internal directories.
Click to hide internal directories.