NetworkGrantChangedPayload network.grant.changed@1

Generated at from openvibe-contracts v0.51.0 and openvibe-sdk v0.11.0.

Version
1.0.0
Owner
network
Visibility
first-party
Status
active
Compatibility
backward
Schema
https://openvibe.network/contracts/events/payloads/network.grant.changed.v1.json

network.grant.changed v1 (OpenVibe.Network server/developer/store.js grantEvent; ADR-014). A developer app's capability grant changed state: requested, approved, denied or revoked. Written through Network's developer event relay beside the project audit row. OpenVibe.Events stops an app's subscriptions at once when its events.app.subscribe grant leaves approved. Envelope: subject { type: app, id: <app_…> }, visibility internal. (A first-party service principal's grant is network.principal_grant.changed.)

Fields

FieldTypeRequiredDescriptionConstraints
project_idstringyes
  • pattern ^prj_[0-9A-HJKMNP-TV-Z]{26}$
capabilitystringyes
  • pattern ^[a-z][a-z0-9_]*\.[a-z][a-z0-9_*]*(\.[a-z][a-z0-9_*]*)?$
audiencestringyes
  • maxLength 200
fromenumyes
  • one of "none", "requested", "approved", "denied", "revoked"
toenumyes
  • one of "requested", "approved", "denied", "revoked"

Examples

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

Valid: revoked
{
  "project_id": "prj_01JAB2C3D4E5F6G7H8J9K0MNPQ",
  "capability": "events.app.subscribe",
  "audience": "openvibe.events",
  "from": "approved",
  "to": "revoked"
}
Rejected: bad-to
{
  "project_id": "prj_01JAB2C3D4E5F6G7H8J9K0MNPQ",
  "capability": "events.app.subscribe",
  "audience": "openvibe.events",
  "from": "none",
  "to": "granted"
}

Validate

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