XPipe LogoXPipe Documentation

Encrypts a secret

For connections, the secrets are encrypted in json form. When creating connections in an automated fashion, secrets have to be first converted into the proper representation. To obtain the representation of a secret of an existing connection, use the decrypt endpoint. The secret encryption method depends on your vault setup. Without any vault user and passphrase, the secret will be encrypted with a generic vault key. If you have a vault user and custom passphrase set up, the secret will be encrypted with your passphrase key.

POST
/secret/encrypt

Authorization

AuthorizationRequiredBearer <token>

The bearer token used is the session token that you receive from the handshake exchange.

In: header

Request Body

application/jsonRequired
valueRequiredstring

The raw string value to encrypt

curl -X POST "http://localhost:21721/secret/encrypt" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "value": "123"
  }'

The request was successful. The secret was encrypted.

{
  "summary": "Encrypted representation",
  "value": {
    "encrypted": {
      "encryptedToken": {
        "token": "lX6JOtL-mKbuUBR4nYdhJsv3RzrXm+f+JLLKpkSAfg=="
      },
      "secret": {
        "encryptedValue": "VR1brTq1-i3p5fLcz5O58tmbnmDjRKL5IOmSkFaQag==",
        "type": "locked"
      }
    }
  }
}