libdave

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrGenericEncryptionFailure = errors.New("failed to encrypt frame")
	ErrGenericDecryptionFailure = errors.New("failed to decrypt frame")
	ErrMissingKeyRatchet        = errors.New("missing key ratchet")
	ErrInvalidNonce             = errors.New("invalid nonce")
	ErrMissingCryptor           = errors.New("missing cryptor")
	ErrTooManyAttempts          = errors.New("too many attempts to encrypt the frame failed")
)

Functions

func MaxSupportedProtocolVersion

func MaxSupportedProtocolVersion() uint16

MaxSupportedProtocolVersion returns the maximum supported libdave protocol version.

func SetDefaultLogLoggerLevel

func SetDefaultLogLoggerLevel(level slog.Level) (oldLevel slog.Level)

SetDefaultLogLoggerLevel sets the log level for libdave logs. By default, the level is set to slog.LevelError. It returns the previous log level.

func SetDefaultLogger

func SetDefaultLogger(logger *slog.Logger)

SetDefaultLogger sets the default logger used by libdave.

Types

type Codec

type Codec int
const (
	CodecUnknown Codec = iota
	CodecOpus
	CodecVP8
	CodecVP9
	CodecH264
	CodecH265
	CodecAV1
)

type CommitResult

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

func (*CommitResult) GetRosterMemberIDs

func (r *CommitResult) GetRosterMemberIDs() []uint64

func (*CommitResult) GetRosterMemberSignature

func (r *CommitResult) GetRosterMemberSignature(rosterID uint64) []byte

func (*CommitResult) IsFailed

func (r *CommitResult) IsFailed() bool

func (*CommitResult) IsIgnored

func (r *CommitResult) IsIgnored() bool

type Decryptor

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

func NewDecryptor

func NewDecryptor() *Decryptor

func (*Decryptor) Decrypt

func (d *Decryptor) Decrypt(mediaType MediaType, frame []byte, decryptedFrame []byte) (int, error)

func (*Decryptor) GetMaxPlaintextByteSize

func (d *Decryptor) GetMaxPlaintextByteSize(mediaType MediaType, encryptedFrameSize int) int

func (*Decryptor) GetStats

func (d *Decryptor) GetStats(mediaType MediaType) *DecryptorStats

func (*Decryptor) TransitionToKeyRatchet

func (d *Decryptor) TransitionToKeyRatchet(keyRatchet *KeyRatchet)

func (*Decryptor) TransitionToPassthroughMode

func (d *Decryptor) TransitionToPassthroughMode(passthroughMode bool)

type DecryptorStats

type DecryptorStats struct {
	PassthroughCount         uint64
	DecryptSuccessCount      uint64
	DecryptFailureCount      uint64
	DecryptDuration          uint64
	DecryptAttempts          uint64
	DecryptMissingKeyCount   uint64
	DecryptInvalidNonceCount uint64
}

type Encryptor

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

func NewEncryptor

func NewEncryptor() *Encryptor

func (*Encryptor) AssignSsrcToCodec

func (e *Encryptor) AssignSsrcToCodec(ssrc uint32, codec Codec)

func (*Encryptor) Encrypt

func (e *Encryptor) Encrypt(mediaType MediaType, ssrc uint32, frame []byte, encryptedFrame []byte) (int, error)

func (*Encryptor) GetMaxCiphertextByteSize

func (e *Encryptor) GetMaxCiphertextByteSize(mediaType MediaType, frameSize int) int

func (*Encryptor) GetProtocolVersion

func (e *Encryptor) GetProtocolVersion() uint16

func (*Encryptor) GetStats

func (e *Encryptor) GetStats(mediaType MediaType) *EncryptorStats

func (*Encryptor) HasKeyRatchet

func (e *Encryptor) HasKeyRatchet() bool

func (*Encryptor) IsPassthroughMode

func (e *Encryptor) IsPassthroughMode() bool

func (*Encryptor) SetKeyRatchet

func (e *Encryptor) SetKeyRatchet(keyRatchet *KeyRatchet)

func (*Encryptor) SetPassthroughMode

func (e *Encryptor) SetPassthroughMode(passthroughMode bool)

type EncryptorStats

type EncryptorStats struct {
	PassthroughCount       uint64
	EncryptSuccessCount    uint64
	EncryptFailureCount    uint64
	EncryptDuration        uint64
	EncryptAttempts        uint64
	EncryptMaxAttempts     uint64
	EncryptMissingKeyCount uint64
}

type KeyRatchet

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

type MediaType

type MediaType int
const (
	MediaTypeAudio MediaType = iota
	MediaTypeVideo
)

type Session

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

func NewSession

func NewSession(context string, authSessionID string) *Session

func (*Session) GetKeyRatchet

func (s *Session) GetKeyRatchet(userID string) *KeyRatchet

func (*Session) GetLastEpochAuthenticator

func (s *Session) GetLastEpochAuthenticator() []byte

func (*Session) GetMarshalledKeyPackage

func (s *Session) GetMarshalledKeyPackage() []byte

func (*Session) GetPairwiseFingerprint

func (s *Session) GetPairwiseFingerprint(version uint16, userID string) []byte

func (*Session) GetProtocolVersion

func (s *Session) GetProtocolVersion() uint16

func (*Session) Init

func (s *Session) Init(version uint16, channelID uint64, selfUserID string)

func (*Session) ProcessCommit

func (s *Session) ProcessCommit(commit []byte) *CommitResult

func (*Session) ProcessProposals

func (s *Session) ProcessProposals(proposals []byte, recognizedUserIDs []string) []byte

func (*Session) ProcessWelcome

func (s *Session) ProcessWelcome(welcome []byte, recognizedUserIDs []string) *WelcomeResult

func (*Session) Reset

func (s *Session) Reset()

func (*Session) SetExternalSender

func (s *Session) SetExternalSender(externalSender []byte)

func (*Session) SetProtocolVersion

func (s *Session) SetProtocolVersion(version uint16)

type WelcomeResult

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

func (*WelcomeResult) GetRosterMemberIDs

func (w *WelcomeResult) GetRosterMemberIDs() []uint64

func (*WelcomeResult) GetRosterMemberSignature

func (w *WelcomeResult) GetRosterMemberSignature(rosterID uint64) []byte

Jump to

Keyboard shortcuts

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