This package contains functions to store Turnkey API public/private keys and arbitrary data within Telegram Cloud Storage. This package also handles stamping a Turnkey request with an API key. It is meant to be used with @turnkey/sdk-browser
.
Telegram Bot API >= 6.9
The Telegram Cloud Storage Stamper has a few different modes of operation, namely a classic stamper for stamping requests made to Turnkey’s API, and an interface for a Telegram Mini App built with Turnkey to interact with Telegram Cloud Storage. This provides the developer of the application utilities such as creating stamps on requests made by users, storing user API keys, storing temporary keys that are needed for decrypting credential bundles for activites like email auth or oauth, or storing arbitrary values that would be helpful to have saved for a user from session to session on device to device.
The Telegram Cloud Storage Stamper will, by default, store the API key used for signing in Telegram Cloud Storage under the key TURNKEY_API_KEY
. A Cloud Storage “key” is the index under which a value is stored in Telegram Cloud Storage. This can be changed when using the .create()
or .setSigningKey()
functions. An API key is stored within Cloud Storage as a JSON string of the following object:
The .create()
and .setSigningKey()
functions take one of the following 4 sets of arguments:
TURNKEY_API_KEY
and set that as the signing keyThe .getAPIKey()
and .setAPIKey()
functions operate in a similar manner taking an optional key
parameter that will be used to get
or set
the API key at that location if it is passed, or at the default location if it is not passed.
The following section will describe the usage of the helper functions provided for interfacing with Telegram Cloud Storage. These functions return null if there is no value when trying to retrieve an item from Cloud Storage.
Insert a new API key into Telegram Cloud Storage at the default API key location
Use an existing key that has been previously stored in Telegram Cloud Storage at the default API key location key location
View an entry in Telegram Cloud Storage without inserting an API key, note the usage difference between the new
and .create()
here. .create()
will do the work of getting/setting an API key in Cloud Storage whereas new
will not
Insert a new API key into Cloud Storage at a specified key. This is just storing an API key, without using .setSigningKey()
the key will not be used for signing.
Set a new API key as the signing key for the stamper at a specified key. This will also insert the API key to that location within Telegram CloudStorage. Any subsequent requests for stamping will sign with this API key. The API key and CloudStorage key can also be omitted and the API key at the default location TURNKEY_API_KEY
will be used. If an API key is omitted and a CloudStorage key is specified an API key at that location will be used. Refer to the argument-usage section for a full explanation. A stamper that was originally used to just view Cloud Storage values can later be used for signing by using the .setSigningKey()
function.
Set a new API key as the signing key for the stamper that previously had a different key set for the stamper.
This package contains functions to store Turnkey API public/private keys and arbitrary data within Telegram Cloud Storage. This package also handles stamping a Turnkey request with an API key. It is meant to be used with @turnkey/sdk-browser
.
Telegram Bot API >= 6.9
The Telegram Cloud Storage Stamper has a few different modes of operation, namely a classic stamper for stamping requests made to Turnkey’s API, and an interface for a Telegram Mini App built with Turnkey to interact with Telegram Cloud Storage. This provides the developer of the application utilities such as creating stamps on requests made by users, storing user API keys, storing temporary keys that are needed for decrypting credential bundles for activites like email auth or oauth, or storing arbitrary values that would be helpful to have saved for a user from session to session on device to device.
The Telegram Cloud Storage Stamper will, by default, store the API key used for signing in Telegram Cloud Storage under the key TURNKEY_API_KEY
. A Cloud Storage “key” is the index under which a value is stored in Telegram Cloud Storage. This can be changed when using the .create()
or .setSigningKey()
functions. An API key is stored within Cloud Storage as a JSON string of the following object:
The .create()
and .setSigningKey()
functions take one of the following 4 sets of arguments:
TURNKEY_API_KEY
and set that as the signing keyThe .getAPIKey()
and .setAPIKey()
functions operate in a similar manner taking an optional key
parameter that will be used to get
or set
the API key at that location if it is passed, or at the default location if it is not passed.
The following section will describe the usage of the helper functions provided for interfacing with Telegram Cloud Storage. These functions return null if there is no value when trying to retrieve an item from Cloud Storage.
Insert a new API key into Telegram Cloud Storage at the default API key location
Use an existing key that has been previously stored in Telegram Cloud Storage at the default API key location key location
View an entry in Telegram Cloud Storage without inserting an API key, note the usage difference between the new
and .create()
here. .create()
will do the work of getting/setting an API key in Cloud Storage whereas new
will not
Insert a new API key into Cloud Storage at a specified key. This is just storing an API key, without using .setSigningKey()
the key will not be used for signing.
Set a new API key as the signing key for the stamper at a specified key. This will also insert the API key to that location within Telegram CloudStorage. Any subsequent requests for stamping will sign with this API key. The API key and CloudStorage key can also be omitted and the API key at the default location TURNKEY_API_KEY
will be used. If an API key is omitted and a CloudStorage key is specified an API key at that location will be used. Refer to the argument-usage section for a full explanation. A stamper that was originally used to just view Cloud Storage values can later be used for signing by using the .setSigningKey()
function.
Set a new API key as the signing key for the stamper that previously had a different key set for the stamper.