|
<< Click to Display Table of Contents >> Navigation: »No topics above this level« AIG. - AI Google Gemini Integration |
MiniRobotLanguage (MRL)
AIG.Save Key
Save Google Generative AI API Key Encrypted to a File
Intention
SaveKey Command: Securing Your API Key
The SaveKey command provides a secure method to store your Google Generative AI API key in an encrypted file.
This enhances security and simplifies key management across your scripts.
It’s part of the API Key Management suite within AIG.
The SaveKey command encrypts your Google API key and saves it to a specified file or a default location.
It takes your API key as the first parameter and an optional file path as the second. If no path is provided, it defaults to ?exeloc\AIG_License_Key.dat.
Using the SaveKey command is critical for:
•Security: Encrypts your API key to prevent accidental exposure.
•Convenience: Allows reuse of the key across multiple scripts without hardcoding.
•Management: Centralizes key storage for easy updates or retrieval.
Invoke this command with your Google API key to encrypt and save it.
Optionally specify a file path; otherwise, it uses the default location relative to your script or executable directory.
Example Usage
' Save the Google API key to the default file
$$KEY=your-google-api-key-here
AIG.Save Key|$$KEY
DBP.Key saved to: ?exeloc\AIG_License_Key.dat
' Save the key to a custom file path
AIG.Save Key|$$KEY|C:\MyKeys\GoogleKey.dat
The first example saves to the default ?exeloc\AIG_License_Key.dat, while the second specifies a custom location.
Illustration
┌─────────────────────────────┐
│ File Path │
├─────────────────────────────┤
│ ?exeloc\AIG_License_Key.dat │
└─────────────────────────────┘
Default file path when no custom path is specified.
Syntax
AIG.SaveKey|P1[|P2]
AIG.Save Key|P1[|P2]
Parameter Explanation
P1 - The Google Generative AI API key to be encrypted and saved.
P2 - (Optional) The file path where the encrypted key will be stored. If omitted, defaults to ?exeloc\AIG_License_Key.dat.
Example
' Save a fictional Google API key for demonstration
$$KEY=gsk-xyz1234567890abcdef
AIG.Save Key|$$KEY
ENR.
Remarks
- The API key must be valid for the Google Generative AI API.
- Use AIG.Set Key with 'from_File' to load the saved key.
Limitations
- Encryption provides basic protection; advanced threats may require additional safeguards.
- The default file path depends on the executable location (?exeloc).
See also:
• AIG.Ask