Skip to main content

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.

ParameterTypeDescription
plaintextstringThe plain text to encrypt
callback(Result:EncryptedDataResult) => voidReturns info about the currently running game

Usage Example

overwolf.cryptography.encryptForCurrentUser('test123',console.log)

decryptForCurrentUser(ciphertext, callback))

Version added: 0.160

Returns decrypted plaintext.

ParameterTypeDescription
ciphertextstringThe cipher text to decryptd
callback(Result:DecryptedDataResult) => voidReturns info about the currently running game

Usage Example

overwolf.cryptography.decryptForCurrentUser(`${paste hashed string here}`,console.log)

EncryptedDataResult Object

ParameterTypeDescription
successbooleaninherited from the "Result" Object
errorstringinherited from the "Result" Object
ciphertextstringThe 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

ParameterTypeDescription
successbooleaninherited from the "Result" Object
errorstringinherited from the "Result" Object
plaintextstringThe decrypted plaintext

Example data: Success

{"plaintext": "test123", "success": true}

Example data: Failure

{"plaintext": null, "success": false, "error": "Failed to decrypt"}