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

    Class DeviceIdentity

    A device's private signing identity.

    A reading that drives a health or billing decision has to be provably from the device that claims to have sent it, and provably unaltered on the way. Sign it here, and any holder of publicKey can check it with verify.

    const device = DeviceIdentity.fromSeed(seed)
    const signature = device.sign('21.5')
    verify(device.publicKey(), '21.5', signature) // true
    Index
    • Creates an identity from a provisioned 32-byte secret seed.

      Parameters

      • seed: Uint8Array

        The device's 32-byte secret, held on the device only.

      Returns DeviceIdentity

    • Returns the short hex fingerprint of this identity, for logs and displays.

      Returns string

      A 16-character lowercase hex label.

    • Returns the public key matching this identity, which is safe to share.

      Returns Buffer

      The 32-byte public key.

    • Signs a payload.

      Parameters

      • payload: Payload

        The bytes to cover; strings are encoded as UTF-8.

      Returns Buffer

      The 64-byte detached signature.

    • Signs a payload and returns one message carrying both.

      The message is the signature followed by the payload, which is usually what goes on a link: one blob to send, rather than a payload and a detached signature to keep together and split correctly at the far end. verifyMessage reverses it.

      Parameters

      • payload: Payload

        The bytes to cover; strings are encoded as UTF-8.

      Returns Buffer

      The signature followed by the payload.

    • Creates an identity from a provisioned 32-byte secret seed.

      Parameters

      • seed: Uint8Array

        The device's 32-byte secret, held on the device only.

      Returns DeviceIdentity

      The identity that seed determines.