API

ClaimrClient

The ClaimrClient object maintains the connection with the API.

constructor(options): <ClaimrClient>

Parameters

  • options: <Object>

    • apiKey: string (required)

    The API key to use when sending requests to the ClaimR API. You can get one at the ClaimR Dashboard.

Returns

ClaimrClient

useLazyVerifiedLocation

The useLazyVerifiedLocation hook is used to verify a user's location. As it's lazy, the user needs to manually invoke it to send the request to the ClaimR API. This can be done by calling the submit function once its defined by the hook.

The hook tracks its state using the following state machine: State machine

The machine is initially in the registeringListener state, when it successfully registers the listener it will switch to the listening state. Once enough raw GNSS data has been collected, it will move to ready. In every state which has an outgoing edge with submit you can request the location to get verified.

An iteractive version of the state machine can be explored here.

Parameters

  • options: <Object>
    • client: <ClaimrClient> (required)

Returns

PropertyTypeDescription
stateStatesThe current state of this location verification hook.
submit() => void | undefinedCallback to submit the location verification request to the ClaimR API. It will be undefined until sufficient raw GNSS data has been collected.
claim PointClaim | undefinedContains the validated location results from the ClaimR API. Only available after submit has been invoked and the location was in fact successfully validated.
jwtstring | undefinedSimilar to claim, however now stored as a cryptographically secured JSON Web Token (JWT).
messagestring | undefinedAn optional message returned from the ClaimR API. Only used to retrieve the error message.
Last updated on by Adriaan Knapen