Assisted-claiming cloud calls.

Both routes live on the deployment's main API and are IAM-authorized like their neighbours, so they go through ESPSigV4APIManager and are SigV4-signed against baseUrl. A Cognito JWT is rejected there with 403 Invalid key=value pair (missing equal-sign) in Authorization header.

Both calls are independently retryable: initiate is idempotent per device and caller, and verify replaces the device's certificate rather than duplicating the node.

Constructors

Methods

  • Assigns a node ID to the device's MAC address.

    POST /v1/claim/initiate — 201 for a new reservation, 200 when one already existed, returning the same node ID either way. That idempotency is what lets a factory-erased device come back as the same node.

    Parameters

    • macAddress: string

      Device MAC, normalized before sending

    • devicePayload: Record<string, unknown> = {}

      The device's claim-start payload, forwarded whole

    • claimId: string = ""

      Correlation id for this claim attempt

    Returns Promise<ClaimInitiateResponse>

    The assigned node ID and any attestation challenge

    ESPClaimError when the MAC is invalid or the call fails

  • Normalizes a device MAC: separators stripped and upper-cased, so every spelling of one address resolves to the same reservation.

    Parameters

    • raw: string

      MAC as reported by the device

    Returns string

    Normalized MAC

    ESPClaimError when the value is not 12 or 16 hex characters

  • Reduces a broker endpoint to the bare host the device stores. The device keeps host and port separately, so a scheme, path or :port would be persisted verbatim into the factory partition and fail to resolve.

    Parameters

    • raw: string

      Broker endpoint in any form

    Returns string

    Host only, or "" when nothing usable remains

  • Exchanges the device's CSR for a signed certificate.

    POST /v1/claim/verify — the CSR's subject is ignored; the certificate's Common Name comes from the reservation. Called again after a factory erase, it issues a new certificate and deactivates the previous one, node ID unchanged.

    Parameters

    • macAddress: string

      Same device MAC as initiate

    • devicePayload: ClaimDevicePayload

      The device's claim payload, forwarded whole

    • OptionalclaimCapability: CAMERA_CLAIM

      Optional capability, mapped to extra IoT policies

    • claimId: string = ""

      Correlation id for this claim attempt

    Returns Promise<ClaimVerifyResponse>

    The claim response, with mqtt_host resolved for the device

    ESPClaimError when the call fails or no certificate is returned