From secret to token
Encrypts a secret in a token using a svault and an engine.
Endpoint: /api/svault/encode/{id_svault}/{id_engine}
In the examples below 3LSDubycNVWZHgA4
is the id of the vault (vault) e EATIOznU1G5Q595
is the id of the mechanism (engine) with Cloud storage (internal).
API_TOKEN="Place here your API Token"
curl --location --request POST 'https://service.dinamonetworks.io/api/svault/encode/3LSDubycNVWZHgA4/EATIOznU1G5Q595' \
--header 'Content-Type: application/json' \
--header "X-Api-Key: ${API_TOKEN}" \
--data-raw '{
"value": "12345678"
}'
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"value\": \"12345678\",\n \"persist\": true\n}");
Request request = new Request.Builder()
.url("https://service.dinamonetworks.io/api/svault/encode/3LSDubycNVWZHgA4/EATIOznU1G5Q595")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.addHeader("X-Api-Key", "Place here your API Token")
.build();
Response response = client.newCall(request).execute();
var client = new RestClient("https://service.dinamonetworks.io/api/svault/encode/3LSDubycNVWZHgA4/EATIOznU1G5Q595");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("X-Api-Key", "Place here your API Token");
var body = @"{" + "\n" +
@" ""value"": ""12345678""," + "\n" +
@"}";
request.AddParameter("application/json", body, ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://service.dinamonetworks.io/api/svault/encode/3LSDubycNVWZHgA4/EATIOznU1G5Q595"
method := "POST"
payload := strings.NewReader(`{
"value": "12345678"
}`)
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/json")
req.Header.Add("X-Api-Key", "Place here your API Token")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
var settings = {
"url": "https://service.dinamonetworks.io/api/svault/encode/3LSDubycNVWZHgA4/EATIOznU1G5Q595",
"method": "POST",
"timeout": 0,
"headers": {
"Content-Type": "application/json",
"X-Api-Key": "Place here your API Token"
},
"data": JSON.stringify({
"value": "12345678"
}),
};
$.ajax(settings).done(function (response) {
console.log(response);
});
Response (with internal storage in the service)
{
"token": "95128058827"
}
Response (for download and external storage)
In this case, a binary content is returned so that it can be stored in the external environment. This will allow the tokenization process to be undone. See Decode from blob.
{
"token": "110340701546151",
"encoded_value": "/R/lkkyZRjIiOdasQEzC4vivXqRwBNJ/2efLI0xREUXMkH0uSQOL+T5ZJWiTUWCgFVdPriFC4xynXQHDYGnwp5NrRrxl+Al0EbSKtXF3ehkRMaINi10OzefJWn1Cr+bj9hs80P9dYFdZm3gkZoc63fc9LEL23O064D4H+/5IOOznDTLnQUPy3WzxJ0aAKtnazTw10AASa7GWcn8pv+4a1lEVCO9sROG500iPSD6KtBGPdFXIXtsJsj7/RgUaNledWi5NzpXP2ay2tb93efrxIUIh3bBFctlOorAXD9SjRJXJvC/lpLR4oLxPgtH4uTCgnrroM6XBaT1tyA2uNVREkan0PoEuyzP22mBLfWSIcCWgJ396uBewuxCNi83zbPI9DdYPJ7J+CiXDWv8+CHYjdmnfpsawfOLav3D9VFpzd9DSYY7xAso02S9mwZGMHUCDWOR0N4KDuFzvB998HmQU8MbksheXzukNDChEe5IxOOcbGdp9TJQ0Z/UmgC0gAedaE4ZjOIJRl2/diO/MoMhV60qJmrIRsZvVBV3xaHKnKXLU0aoU+7I1g7Xxi7gHPQIloecl+KnBZAmwQpYr84qjlNhPIw8Io8gFVcu8XnC/lF3KM2WNAwFIsWnsma/wyrI8UwX+4Ys2sCGXtZYRv4wB9dgp+CDVG/ZEqbo1OKXPahuioEmXAAAa8yJZPWhs4hpyczV3tNS8DXSMz5EEpEP2K9/1xP8BMTEwMzQwNzAxNTQ2MTUx"
}