@kagamidigital/salt-sdk-mirror
    Preparing search index...

    Class RoboHost

    A RoboHost represents the server-side record for an organisation's robos. It provides the credentials and hosting parameters needed to provision the actual compute instances (via setup script or AWS CloudFormation) that will connect and act as robo signers: Use listenToSetup for progress updates, waitUntilOnline for the readiness signal, then activate your robos.

    Index

    Properties

    active: boolean

    Whether this host has completed 2FA activation, as of when this record was fetched. Activate via activate.

    id: string

    The robo ID

    name: string | null

    The robo name

    organisationId: string

    The ID of the organisation these robos belong to

    otp: string | null

    The setup OTP shown during robo-guardian setup, or null once activation has consumed it. Used to provision the host (generateSetupScript / generateCloudFormationUrl) and to activate it (activate).

    ownerAddress: string | null

    The owner's address

    signers: string[]

    The robo signers' addresses (empty until the host is provisioned)

    version: string | null

    The salt-sdk version this host reported on its last boot, or null if it has never reported one.

    null on a host that has registered its signers means it last booted on a build that predates version reporting.

    Methods

    • Complete 2FA activation for this host, flipping it from inactive to active. This is what makes a robo host usable, and it consumes the setup OTP.

      The natural next step once waitUntilOnline resolves. Signed by the owner, whose signed message must carry this host's OTP verbatim — so activation is a deliberate confirmation that the code the owner is looking at matches the one the host was provisioned with.

      Parameters

      Returns Promise<RoboHost>

      A fresh RoboHost, now active and with its OTP consumed

      ValidationError if this host record carries no setup OTP (otp is null) — activation has already consumed it

      const onlineHost = await onlineHost.waitUntilOnline();
      const activeHost = await activeHost.activate(wallet);
      console.log(activeHost.active); // true
    • Build an AWS CloudFormation quick-create console URL that provisions a robo host from Salt's launch template, pre-filled with the robo's setup OTP and the owner's public key. Opening it in a browser signed in to AWS launches the stack; the host then runs the same setup as generateSetupScript.

      Parameters

      Returns string

      The CloudFormation quick-create URL

      ValidationError if this host record carries no setup OTP (otp is null). Hosts returned by Salt.createRoboHost always carry it; hosts fetched with Salt.getRoboHost carry it until activation consumes it

      const url = host.generateCloudFormationUrl({
      publicKey: ownerPublicKey,
      stackName: 'my-org-robos',
      });
      console.log(`Open to launch: ${url}`);
    • Build the install-robos.sh setup script for a self-hosted robo, targeting this instance's environment. Run as root on an Ubuntu/Debian host, the script installs Docker, generates a seed on the host, encrypts it to the owner's public key, uploads the encrypted backup to Salt, and starts the robo container with an automatic updater. The plaintext seed never leaves the host.

      Parameters

      Returns string

      The setup script contents

      ValidationError if this host record carries no setup OTP (otp is null). Hosts returned by Salt.createRoboHost always carry it; hosts fetched with Salt.getRoboHost carry it until activation consumes it

      const script = host.generateSetupScript({ publicKey: ownerPublicKey });
      fs.writeFileSync('install-robos.sh', script);
    • Start listening for this host's setup-progress updates. Connects the session's websocket if it is not already up, so there is no need to call Salt.connect first.

      Progress is advisory — see RoboSetupListener. Nothing it emits establishes that the host is ready; waitUntilOnline does that.

      Returns Promise<RoboSetupListener>

      A listener that is already subscribed. Call disableSetupListener() when you are done listening.

      SocketError if the socket cannot be opened

      const setup = await host.listenToSetup();
      setup.on('setupUpdate', ({ step, description }) => {
      console.log(`${step}: ${description}`);
      });
    • Wait until every one of this host's robo guardians has connected to Salt, then return a freshly fetched host record.

      The only truthful measure that provisioning completed successfully.

      activate is the owner's next step after this resolves.

      Parameters

      Returns Promise<RoboHost>

      A fresh RoboHost whose signers are all online

      RoboHostTimeoutError if they are not all online in time. The error carries the last presence snapshot, which distinguishes "the script never registered its signers" from "some guardians connected and others did not"

      const online = await host.waitUntilOnline({ timeoutMs: 20 * 60_000 });
      const active = await online.activate(wallet);