Skip to content

Get, generate, or save a Wireguard key for a virtual network

Request

Manages the X25519 Wireguard private key for a virtual network interface.

  • get — returns the current public key as a JWK
  • generate — generates a new private key, saves it, and returns the public key
  • save — saves the provided base64-encoded 32-byte private key and returns the public key

Requires nodes::service:vpn-key or nodes::remote-execute permission.

Security
JWTAuthorizer
Path
nodeIDstringrequired

Node ID

Query
waitinteger

Pass 1 to block until the node responds and return its output.

Value:1
Bodyapplication/jsonrequired
actionstring

Key operation to perform

Default:"get"
Enum:"get""generate""save"
networkstringrequired

Virtual network name

Example:"virtual-network"
keystring

Base64-encoded 32-byte X25519 private key. Required when action=save.

Example:"dGhpcyBpcyBhIDMyLWJ5dGUgcHJpdmF0ZSBrZXk="
curl -i -X POST \
  'https://apidocs.trustgrid.io/_mock/node/{nodeID}/trigger/vpn-key?wait=1' \
  -H 'Authorization: Bearer <YOUR_JWT_HERE>' \
  -H 'Content-Type: application/json' \
  -d '{
    "action": "get",
    "network": "virtual-network",
    "key": "dGhpcyBpcyBhIDMyLWJ5dGUgcHJpdmF0ZSBrZXk="
  }'

Responses

OK

Bodyapplication/json
outputobject

JWK (JSON Web Key) representing the X25519 public key

Response
{ "output": { "kid": "string", "kty": "EC", "crv": "X25519", "x": "string" } }