For Advanced

Lesson 6/10

Hidden Credentials

Providing any credentials in plain text in your code is not reasonable, to say at least. It would be great to mask this data somehow — or better store it in a safe place and retrieve it when necessary without revealing it.

G1ANT.Robot provides such a safe storage for all sensitive information: Credential Container is a tool for entering and storing data that shouldn’t be visible to everyone, who has an access to a robot script.

  1. Select Credential Container from the Tools menu.
  2. Click Add in the Credential Container window and enter key and its value in the resulting Credential window. The key must be provided in the ContainerName:key format — for example, you can add gmail:login and gmail:password keys and their values to be used by the script from the previous lessons.
  3. When you finish adding credentials, click Close to close the Credential Container.

Now you can retrieve the information stored in the Credential Container using the ♥credential special variable and a key as an index:

Time to alter the script to use these credentials:

♥login = ♥credential⟦gmail:login⟧
♥password = ♥credential⟦gmail:password⟧

mail.imap imap.gmail.com login ♥login password ♥password sincedate ♥date onlyunreadmessages true ignorecertificateerrors true result ♥list 

foreach ♥element in ♥list
  dialog ♥element⟦content⟧
end

Alternatively, you can delete the first two lines altogether and insert both ♥credential variables directly into the mail.imap command, replacing the ♥login and the ♥password variables.

Next lesson: how to cheat in games :).