@turnkey/telegram-cloud-storage-stamper
@turnkey/sdk-browser.
Preqrequisites
Telegram Bot API >= 6.9About
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 keyTURNKEY_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:
Argument Usage
The.create() and .setSigningKey() functions take one of the following 4 sets of arguments:
- No arguments: Use an API key at the default location within Telegram Cloud Storage
TURNKEY_API_KEYand set that as the signing key - Just an API key: Store the passed in API key at the default Telegram Cloud Storage location and set that as the signing key
- Just a Cloud Storage key: Use an API key stored at the specified Telegram Cloud Storage key location and set that as the signing key
- Both an API key and a Cloud Storage key: Store the passed API key at the specified Telegram Cloud Storage key location and set that as the signing key
.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.
Usage
Insert a new API key into Telegram Cloud Storage at the default API key locationnew and .create() here. .create() will do the work of getting/setting an API key in Cloud Storage whereas new will not
.setSigningKey() the key will not be used for signing.
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.