Interface IAuthKeysRepository

interface IAuthKeysRepository {
    deleteAll: (() => MaybePromise<void>);
    deleteByDc: ((dc: number) => MaybePromise<void>);
    get: ((dc: number) => MaybePromise<null | Uint8Array>);
    getTemp: ((dc: number, idx: number, now: number) => MaybePromise<null | Uint8Array>);
    set: ((dc: number, key: null | Uint8Array) => MaybePromise<void>);
    setTemp: ((dc: number, idx: number, key: null | Uint8Array, expires: number) => MaybePromise<void>);
}

Properties

deleteAll: (() => MaybePromise<void>)

Delete all stored auth keys, including both permanent and temp keys

MUST be applied immediately, without batching

deleteByDc: ((dc: number) => MaybePromise<void>)

Delete all stored auth keys for the given DC, including both permanent and temp keys

MUST be applied immediately, without batching

get: ((dc: number) => MaybePromise<null | Uint8Array>)

Get auth_key for the given DC

getTemp: ((dc: number, idx: number, now: number) => MaybePromise<null | Uint8Array>)

Given the DC id, idx and point in time (in seconds), return the temp_auth_key that should be used for the next request (such that now < key.expires), or null if no such key exists

set: ((dc: number, key: null | Uint8Array) => MaybePromise<void>)

Store auth_key for the given DC

If key is null, the key should be deleted instead

MUST be applied immediately, without batching

setTemp: ((dc: number, idx: number, key: null | Uint8Array, expires: number) => MaybePromise<void>)

Store temp_auth_key for the given DC and idx, along with its expiration date (in seconds)

If key is null, the key should be deleted instead

MUST be applied immediately, without batching