Decrypt data¶
Decrypts what encrypt data produced, or what a client encrypted with encryptionAlgorithmFETransfer and secretFETransfer of the secret, and gives the original value back.
| Method | POST |
| URL | /api/system-api/admin/decrypt-data : admin is the user path of your account |
| Body | { data, algorithm?, pass? } |
| Answer | data : the decrypted value, parsed as JSON when it is JSON |
| From code | g.sys.system.decrypt |
The call¶
Answer
{ "success": true, "statusCode": 200, "data": { "name": "Joseph", "card": "4111 1111 1111 1111" } }
algorithmandpasswork as on encrypt data : give the same ones the text was encrypted with.- A text which does not decrypt with the key answers
data: null.
From code¶
encryptedText := g.Req.Body().String("encrypted")
value, err := g.Sys.System.Decrypt(encryptedText) // with the transfer key of the secret
if err != nil {
return nil, err
}
mine, err := g.Sys.System.DecryptWith(encryptedText, "AES", "my-own-key") // with the algorithm and the key given
if err != nil {
return nil, err
}
let encrypted_text = g.req.body()["encrypted"].as_str().unwrap_or_default().to_owned();
let value = g.sys.system.decrypt(&encrypted_text)?; // with the transfer key of the secret
let mine = g.sys.system.decrypt_with(&encrypted_text, "AES", Some("my-own-key"))?; // with the algorithm and the key given
Access, headers and errors¶
- Over HTTP, a system API answers only once its settings open it :
TOKEN_ACCESS(the token of an API user whose group grants this system API) orIS_PUBLIC. Without settings it isNO_ACCESS: only your code (g.sys) and the admin panel reach it. - The settings can also keep the answer in the cache, or ask for the token of a person (
authProviders). Pre and post hooks run around it, as around any API. - It takes the request headers and answers the envelope.
401: no valid token, or the API isNO_ACCESS.403: no group grants it.400: the body is wrong, and the message names the key.
Related : All APIs · System API settings · System APIs from code