pamoja for TypeScript - v0.2.0
    Preparing search index...

    Class Updater

    A device's slots, and the rules applied to what is offered for them.

    Index
    • Creates an updater for a device with slotCount slots of slotCapacity bytes each, trusting anchorPublicKey as the root of every decision about who may update it.

      Parameters

      • vendorId: Buffer
      • classId: Buffer
      • anchorPublicKey: Buffer
      • slotCount: number
      • slotCapacity: number

      Returns Updater

    • get delegation(): Delegation | null

      The delegation this updater currently honors, or null when releases must be signed by the anchor itself.

      Returns Delegation | null

    • get installedSequence(): number

      The highest sequence number the device already holds.

      Returns number

    • get slotCount(): number

      How many slots this device has.

      Returns number

    • Adopts a delegation, so releases signed by the key it names are accepted.

      Parameters

      • envelope: Buffer
      • Optionalnow: number | null

      Returns Delegation

    • Checks a manifest and opens the slot it names for a transfer in pieces.

      Every check that can be made without the image runs here, so a release that is not for this device, would roll it back, or does not fit is refused before a byte of it is accepted. The envelope is remembered until finish, and every call after this one checks it again, so a release overtaken or expired while it arrives stops arriving. The hash of what has arrived is carried from one call to the next, so an image taken in many small pieces costs no more than one taken whole.

      Parameters

      • envelope: Buffer
      • Optionalnow: number | null

      Returns number

    • Confirms the pending image, so it will be run from now on.

      Returns number

    • Finishes an opened image and marks the slot bootable if it matched.

      Returns the slot now holding a staged image.

      Returns number

    • Decides what to run, and records that decision before returning it.

      Call this once per boot, before jumping to an image. A staged image becomes pending here, so a device that resets before confirming reverts on the next call rather than trying a broken image forever.

      Returns Boot

    • Records that a slot already holds a confirmed image at a sequence number.

      This is how a device that shipped with firmware says what it is running, so the rollback rule has something to compare against.

      Parameters

      • slot: number
      • sequence: number

      Returns void

    • Fails the pending image and goes back to the confirmed one.

      Returns number

    • Checks a manifest and stages an image that is already held whole.

      Returns the slot the image was staged into.

      Parameters

      • envelope: Buffer
      • image: Buffer
      • Optionalnow: number | null

      Returns number

    • Takes the next piece of an image opened with begin.

      Parameters

      • chunk: Buffer

      Returns void