BotPairRequest bot.pair-request@1

Generated at from openvibe-contracts v0.97.0 and openvibe-sdk v0.26.0.

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

bot.pair-request@1: the body of POST /api/v1/pair on OpenVibe.Bot (and the fields of the pair frame on /device): a one-time pairing code (8 Crockford base32 characters, XXXX-XXXX) is its own credential and idempotency. robot narrows the code to one robot (wrong tries are then counted and lock the code); the rest is what the agent declares. With BOT_PAIRING_AUTHORITY=network the codes are Network's and this route answers 410 bot.pairing_moved.

Fields

FieldTypeRequiredDescriptionConstraints
codestringyes
  • pattern ^[0-9A-Za-z]{4}-?[0-9A-Za-z]{4}$
robotone of
agent_versionstring | null
  • maxLength 40
device_kindenum
  • one of "onboard", "bridge", "server"
driversarray of string
capabilitiesobject
namestring | null
  • maxLength 80

Examples

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

Valid: agent
{
  "code": "K7QM-3XRT",
  "robot": "rob_01J8Z4M2Q0R7T9YV3K6N8P1W2X",
  "agent_version": "0.1.2",
  "device_kind": "onboard",
  "drivers": [
    "pca9685",
    "ads7830"
  ],
  "capabilities": {
    "pca9685": {
      "channels": 16
    }
  },
  "name": "garage pi"
}
Valid: code-only
{
  "code": "K7QM3XRT"
}
Rejected: bad-kind
{
  "code": "K7QM-3XRT",
  "device_kind": "cloud"
}
Rejected: no-code
{
  "robot": "rob_01J8Z4M2Q0R7T9YV3K6N8P1W2X"
}

Validate

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