Encrypts a string, a number, an object or an array and answers the encrypted text. By default it uses encryptionAlgorithmFETransfer and secretFETransfer of the default secret : the key you share with your frontend or mobile app, so the two sides can exchange encrypted data.
Method
POST
URL
/api/system-api/admin/encrypt-data : admin is the user path of your account
consttext=awaitg.sys.system.encrypt({name:'Joseph'});// with the transfer key of the secretconstmine=awaitg.sys.system.encrypt('hello',T.EEncryptionAlgorithm.AES,'my-own-key');// with the algorithm and the key given
text=awaitg.sys.system.encrypt({'name':'Joseph'})# with the transfer key of the secretmine=awaitg.sys.system.encrypt_with('hello','AES','my-own-key')# with the algorithm and the key given
$text = $g->sys->system->encrypt(['name' => 'Joseph']); // with the transfer key of the secret$mine = $g->sys->system->encryptWith('hello', 'AES', 'my-own-key'); // with the algorithm and the key given
vartext=awaitg.Sys.System.Encrypt(new{name="Joseph"});// with the transfer key of the secretvarmine=awaitg.Sys.System.EncryptWith("hello","AES","my-own-key");// with the algorithm and the key given
text,err:=g.Sys.System.Encrypt(am.M{"name":"Joseph"})// with the transfer key of the secretiferr!=nil{returnnil,err}mine,err:=g.Sys.System.EncryptWith("hello","AES","my-own-key")// with the algorithm and the key giveniferr!=nil{returnnil,err}
lettext=g.sys.system.encrypt(json!({"name":"Joseph"}))?;// with the transfer key of the secretletmine=g.sys.system.encrypt_with("hello","AES",Some("my-own-key"))?;// with the algorithm and the key given
Stringtext=g.sys.system.encrypt(Map.of("name","Joseph"));// with the transfer key of the secretStringmine=g.sys.system.encryptWith("hello","AES","my-own-key");// with the algorithm and the key given
valtext=g.sys.system.encrypt(mapOf("name"to"Joseph"))// with the transfer key of the secretvalmine=g.sys.system.encryptWith("hello","AES","my-own-key")// with the algorithm and the key given
Over HTTP, a system API answers once its settings give it apiAccessType: TOKEN_ACCESS (the token of an API user whose group grants this system API, in x-am-authorization) or IS_PUBLIC. Without settings it is NO_ACCESS : your code calls it through g.sys, the admin panel tests it, and an HTTP call is refused.
The settings can also cache the answer or require person tokens (authProviders) ; pre and post hooks run around it like around any API.
The request headers apply : x-am-response-case, x-am-content-type-response, x-am-internationalization, x-am-tenant-username…