SecretUseResult network.secret-use-result@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-result.v1.json

network.secret-use-result@1 (ADR-056): POST /internal/secrets/use's answer — the secret's name and version with the HMAC-SHA256 signature (sign) or the value (reveal). Sent with Cache-Control: no-store; a caller keeps a revealed value only as long as the request it is for.

Fields

FieldTypeRequiredDescriptionConstraints
namestringyes
  • pattern ^[a-z][a-z0-9_-]{0,63}$
versionintegeryes
  • minimum 1
purposeenumyes
  • one of "sign", "reveal"
signaturestringsign: the lowercase hex HMAC-SHA256 of the message under the secret.
  • pattern ^[0-9a-f]{64}$
valuestringreveal: the value.
  • minLength 1
  • maxLength 8192

Examples

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

Valid: signature
{
  "name": "webhook-signing",
  "version": 2,
  "purpose": "sign",
  "signature": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
}
Valid: value
{
  "name": "api_token",
  "version": 1,
  "purpose": "reveal",
  "value": "kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk"
}
Rejected: short-signature
{
  "name": "webhook-signing",
  "version": 2,
  "purpose": "sign",
  "signature": "abc"
}
Rejected: sign-with-value
{
  "name": "webhook-signing",
  "version": 2,
  "purpose": "sign",
  "signature": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "value": "x"
}

Validate

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