package exchange

Import Path (on

Dependency Relation
	imports 16 packages, and imported by 2 packages

Involved Source Files client.go client_flow.go errors.go Package exchange contains Telegram key exchange algorithm flows. See generator.go key.go proto.go server.go server_flow.go
Package-Level Type Names (total 13, in which 10 are exported)
/* sort exporteds by: | */
ClientExchange is a client-side key exchange flow. Run runs client-side flow. func Exchanger.Client(keys []PublicKey) ClientExchange
ClientExchangeResult contains client part of key exchange result. AuthKey crypto.AuthKey ServerSalt int64 SessionID int64 func ClientExchange.Run(ctx context.Context) (ClientExchangeResult, error)
Exchanger is builder for key exchangers. Client creates new ClientExchange using parameters from Exchanger. Server creates new ServerExchange using parameters from Exchanger. WithClock sets exchange flow clock. WithLogger sets exchange flow logger. WithRand sets exchange flow random source. WithTimeout sets write/read deadline of every exchange request. func NewExchanger(conn transport.Conn, dc int) Exchanger func Exchanger.WithClock(c clock.Clock) Exchanger func Exchanger.WithLogger(log *zap.Logger) Exchanger func Exchanger.WithRand(reader io.Reader) Exchanger func Exchanger.WithTimeout(timeout time.Duration) Exchanger
PrivateKey is a private Telegram server key. RSA private key. Fingerprint computes key fingerprint. Public returns PublicKey of this PrivateKey pair. Zero denotes that current PublicKey is zero value. func Exchanger.Server(key PrivateKey) ServerExchange
PublicKey is a public Telegram server key. RSA public key. Fingerprint computes key fingerprint. Zero denotes that current PublicKey is zero value. func PrivateKey.Public() PublicKey func Exchanger.Client(keys []PublicKey) ClientExchange
ServerExchange is a server-side key exchange flow. Run runs server-side flow. If b parameter is not nil, it will be used as first read message. Otherwise, it will be read from connection. func Exchanger.Server(key PrivateKey) ServerExchange
ServerExchangeError is returned when exchange fails due to some security or validation checks. Code int32 Err error Error implements error. Unwrap implements error wrapper interface. *ServerExchangeError : *ServerExchangeError : error
ServerExchangeResult contains server part of key exchange result. Key crypto.AuthKey ServerSalt int64 func ServerExchange.Run(ctx context.Context) (ServerExchangeResult, error)
ServerRNG is server-side random number generator. ( ServerRNG) DhPrime() (p *big.Int, err error) ( ServerRNG) GA(g int, dhPrime *big.Int) (a, ga *big.Int, err error) ( ServerRNG) PQ() (pq *big.Int, err error) TestServerRNG
TestServerRNG implements testing-only ServerRNG. DhPrime always returns testing dh_prime. GA returns testing a and g_a params. PQ always returns testing pq value. nolint:unparam TestServerRNG : ServerRNG
Package-Level Functions (total 2, in which 1 is exported)
NewExchanger creates new Exchanger.
Package-Level Variables (only one, which is exported)
ErrKeyFingerprintNotFound is returned when client can't find keys by fingerprints provided by server during key exchange.
Package-Level Constants (only one, which is exported)
DefaultTimeout is default WithTimeout parameter value.