Files
mautrix-telegram/pkg/gotd/crypto/cipher.go
T
2025-06-27 20:03:37 -07:00

25 lines
524 B
Go

package crypto
import "io"
// Cipher is message encryption utility struct.
type Cipher struct {
rand io.Reader
encryptSide Side
}
// Rand returns random generator.
func (c Cipher) Rand() io.Reader {
return c.rand
}
// NewClientCipher creates new client-side Cipher.
func NewClientCipher(rand io.Reader) Cipher {
return Cipher{rand: rand, encryptSide: Client}
}
// NewServerCipher creates new server-side Cipher.
func NewServerCipher(rand io.Reader) Cipher {
return Cipher{rand: rand, encryptSide: Server}
}