SecretUseRequest network.secret-use-request@1

Generated at from openvibe-contracts v0.177.0 and openvibe-sdk v0.44.0.

Version
1.0.0
Owner
network
Visibility
first-party
Status
active
Compatibility
backward
Decision
ADR-056
Schema
https://openvibe.network/contracts/network/secret-use-request.v1.json

network.secret-use-request@1 (ADR-056): what a first-party service sends to POST /internal/secrets/use with network.secret.use. sign asks for HMAC-SHA256 of message under the secret (the value never leaves Network); reveal asks for the value, to send to origin. Either needs a grant of that secret to the calling service for that purpose (and origin).

Fields

FieldTypeRequiredDescriptionConstraints
project_idstringyes
  • pattern ^prj_[0-9A-HJKMNP-TV-Z]{26}$
environmentenumyes
  • one of "sandbox", "production"
namestringyes
  • pattern ^[a-z][a-z0-9_-]{0,63}$
purposeenumyes
  • one of "sign", "reveal"
messagestringsign: the exact text to sign (for a webhook delivery, "<timestamp>.<raw body>"). Not allowed with reveal.
  • maxLength 1048576
originstringreveal: the https origin the value will be sent to; the grant must list it. Not allowed with sign.
  • pattern ^https://[a-z0-9.-]+(:[0-9]{1,5})?$

Examples

From the contract's own test fixtures: valid ones validate, rejected ones must fail.

Valid: reveal
{
  "project_id": "prj_01M4XE52PGJDVR1KZ1AG9VYW3Q",
  "environment": "sandbox",
  "name": "api_token",
  "purpose": "reveal",
  "origin": "https://api.example.com"
}
Valid: sign
{
  "project_id": "prj_01M4XE52PGJDVR1KZ1AG9VYW3Q",
  "environment": "production",
  "name": "webhook-signing",
  "purpose": "sign",
  "message": "1760504400.{\"state\":\"succeeded\"}"
}
Rejected: reveal-with-message
{
  "project_id": "prj_01M4XE52PGJDVR1KZ1AG9VYW3Q",
  "environment": "production",
  "name": "api_token",
  "purpose": "reveal",
  "origin": "https://api.example.com",
  "message": "x"
}
Rejected: reveal-without-origin
{
  "project_id": "prj_01M4XE52PGJDVR1KZ1AG9VYW3Q",
  "environment": "production",
  "name": "api_token",
  "purpose": "reveal"
}
Rejected: sign-without-message
{
  "project_id": "prj_01M4XE52PGJDVR1KZ1AG9VYW3Q",
  "environment": "production",
  "name": "webhook-signing",
  "purpose": "sign"
}

Validate

const contracts = require('openvibe-contracts');
contracts.validate('network.secret-use-request@1', value);   // { valid, errors: [{ path, message }] }