overwolf.cryptography API
Use this API to encrypt and decrypt ciphertext and secure app data and variables. e.g., localStorage that stores auth-tokens, etc.
Methods Reference
Types Reference
encryptForCurrentUser(plaintext, callback))
Version added: 0.160
Returns encrypted ciphertext.
Note that the generated hash is unique per Windows current user.
Parameter | Type | Description |
---|---|---|
plaintext | string | The plain text to encrypt |
callback | (Result:EncryptedDataResult) => void | Returns info about the currently running game |
Usage Example
overwolf.cryptography.encryptForCurrentUser('test123',console.log)
decryptForCurrentUser(ciphertext, callback))
Version added: 0.160
Returns decrypted plaintext.
Parameter | Type | Description |
---|---|---|
ciphertext | string | The cipher text to decryptd |
callback | (Result:DecryptedDataResult) => void | Returns info about the currently running game |
Usage Example
overwolf.cryptography.decryptForCurrentUser(`${paste hashed string here}`,console.log)
EncryptedDataResult Object
Parameter | Type | Description |
---|---|---|
success | boolean | inherited from the "Result" Object |
error | string | inherited from the "Result" Object |
ciphertext | string | The encrypted ciphertext |
Example data: Success
{
"success":true,
"ciphertext": "AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAALUGXOFJUAE+tTxx0B2…FNYoUDbjKgdMDGuYhZbyfdGBkmGoaIxZk4qybUWBpu0iX4xM="
}
Example data: Failure
{"ciphertext": null, "success": false, "error": "Failed to encrypt"}
DecryptedDataResult Object
Parameter | Type | Description |
---|---|---|
success | boolean | inherited from the "Result" Object |
error | string | inherited from the "Result" Object |
plaintext | string | The decrypted plaintext |
Example data: Success
{"plaintext": "test123", "success": true}
Example data: Failure
{"plaintext": null, "success": false, "error": "Failed to decrypt"}