<< Click to Display Table of Contents >> Navigation: 3. Script Language > AI - Artificial Intelligence Commands > DLT. - DeepL-Translate > DLT. - DeepL Translate |
MiniRobotLanguage (MRL)
DLT.Save Key
Save DeepL-API Key encrypted to a file
Intention
The DLT.Save Key Command is an essential tool for developers venturing into the world of DeepL.
It acts as a secure vault, allowing you to store your API Key in an encrypted format within a file.
This not only bolsters security but also streamlines the process of utilizing the key across various scripts.
To employ the `Save Key Command`, you need to invoke the DLT.Save_Key function.
Pass your API Key as the primary argument.
Additionally, you can specify a file path to determine where the encrypted key should be stored, while this optional.
DLT.Save_Key <YOUR_API_KEY>[|OPTIONAL_FILE_PATH]
In the event that a file path is not specified, the command will default to saving the file in the directory where the script or executable is situated.
The default path is "?exeloc\DLT_License_Key.dat"
The encrypted file is conventionally named `DLT_License_Key.dat`.
This standard naming practice ensures easy identification.
If a file path is omitted, the file will be created in the directory denoted by `?exeloc\`, which corresponds to the location of the script or executable.
Using the `DLT.Save Key` Command to store the API Key in an encrypted file is highly advisable. This approach significantly reduces the risk of unintentional exposure and provides a convenient method for reusing the key in different scripts.
The `Save Key Command` is a powerful and indispensable tool for safeguarding your API Key. By storing it in an encrypted file, you ensure its protection and facilitate its use across your DeepL projects.
' Script 1: Save the Key to the file "DLT_License_Key.dat".
' IMPORTANT: This API-Key is a phantasy API-Key it must be replaced with your API-Key.
$$KEY=sk-abcdefghijklmnopqrstuvwxyz123456
' Here we save the Keyfile at the default path, that is:
' ?exeloc\AIC_License_Key.dat
DLT.Save_Key|$$KEY
ENR.
' Script 2; Using the crypted API-Keyfile
' Test if we are online, AI-Commands will only work if you are online.
NOL.
GTO.enx
EIF.
' Set DeepL.com API-Key from the saved File
DLT.SetKey|from_File
DLT.translate Text|$$TXT|$$RET|en|de
DBP.$$RET
:enx
ENR.
Syntax
DLT.SaveKey|P1[|P2]
DLT.Svk|P1[|P2]
Parameter Explanation
P1 - Your DeepL.com API Key
P2 - (optional) Filepath for the API-Key to save
Example
'*****************************************************
' EXAMPLE 1: DLT.-Commands
'*****************************************************
' Script 1: Save the Key to the file "DLT_License_Key.dat".
' IMPORTANT: This API-Key is a phantasy API-Key it must be replaced with your API-Key.
$$KEY=abcdefghijklmnopqrstuvwxyz123456
' Here we save the Keyfile at the default path, that is:
' ?exeloc\DLT_License_Key.dat
DLT.Save_Key|$$KEY
ENR.
Remarks
-
Limitations:
Embarking on a quest through the enchanted forests of DeepL?
Before you mount your steed, there’s a sacred artifact you must secure - the illustrious API Key.
This key is not just a string of characters; it’s the heart of your adventure, the magic that unlocks the kingdom’s secrets.
Ah, you seek to protect your treasure by locking it within an enchanted file.
Wise as it may seem, remember, even the mightiest spells have their counters. The encryption wards off common thieves, but against a sorcerer with the dark SPR arts, it may falter.
Distributing your encrypted key is akin to leaving your treasure chest in the dragon’s lair. Any rogue with an SPR spellbook can break the enchantment.
The treasure within - your API Key - is bound to your very essence, your account. In the wrong hands, it can unleash storms and deplete your resources.
Fear not, for there is a spell to shield your treasure further.
Within the hallowed halls of OpenAI’s website, you can weave a spell to set limits on your API Key’s powers.
This incantation ensures that even if your key is seized, its magic is bound, and the havoc it can wreak is contained.
1. **Guard the Key**: Never let your API Key, even if enchanted in a file, sail on uncharted waters.
2. **Summon Guardians**: Create a mystical barrier through a backend service. Let this guardian use the API Key in the shadows, far from prying eyes.
3. **Eternal Vigilance**: Watch over your domain. Keep an eagle’s eye on the usage of your API Key.
Remember, brave knight, with great power comes great responsibility.
Your API Key is the magic that courses through the veins of your quests.
Guard it, protect it, and let it guide you through countless adventures in the realm of DeepL.
Onward, to glory! 🚀
See also:
•