De lo secreto a lo simbólico
Cifra un secreto en un token utilizando un svault y un motor.
Endpoint: /api/svault/encode/{id_svault}/{id_engine}
En los ejemplos siguientes 3LSDubycNVWZHgA4
es el identificador de la cámara acorazada (bóveda) e EATIOznU1G5Q595
es el identificador del mecanismo (motorCloud ) con almacenamiento en (interno).
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);
});
Respuesta (con almacenamiento interno en el servicio)
{
"token": "95128058827"
}
Respuesta (para descarga y almacenamiento externo)
En este caso, se devuelve un contenido binario para que pueda ser almacenado en el entorno externo. Esto permitirá deshacer el proceso de tokenización. Véase Decodificar a partir de 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"
}