Giter Club home page Giter Club logo

nrfcloud-location-services-tests-js's Introduction

nRF Cloud Location Services tests npm version

GitHub Actions semantic-release Renovate @commitlint/config-conventional

Tests the nRF Cloud Location services

Configure these environment variables:

  • API_HOST (optional, endpoint to run the tests against)
  • TEAM_ID
  • LOCATION_SERVICES_SERVICE_KEY

Then run:

npm ci
npm run test

Authentication using Evaluation Token

For evaluation purposes, users can generate an evaluation token (see the nRF Cloud Location Services documentation for further information.)

evaluation-token-authentication.spec.ts demonstrates the usage of an evaluation token to authenticate requests.

For this test you need to configure the environment variable EVALUATION_TOKEN, which contains your nRF Cloud Location Service Evaluation Token.

Device Token Authentication

โš ๏ธ Using REST with JWT on a cellular device is not recommended because this protocol (REST using TLS with JWT authentication) has a very large overhead. MQTT is recommended for cellular devices.

device-token-authentication.spec.ts demonstrates the usage of per-device tokens to authenticate requests.

The tests register a private key for a virtual device and use that key to sign a JWT.

For this test you need to configure the environment variable API_KEY, which contains your nRF Cloud REST API key.

nrfcloud-location-services-tests-js's People

Contributors

coderbyheart avatar pudkrong avatar renovate-bot avatar renovate[bot] avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

nrfcloud-location-services-tests-js's Issues

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Repository problems

These problems occurred while renovating this repository. View logs.

  • WARN: Fallback to renovate.json file as a preset is deprecated, please use a default.json file instead.

This repository currently has no open or pending branches.

Detected dependencies

github-actions
.github/workflows/api-tests.yaml
  • actions/checkout v4@b4ffde65f46336ab88eb53be808477a3936bae11
  • actions/setup-node v4
  • actions/checkout v4@b4ffde65f46336ab88eb53be808477a3936bae11
  • actions/setup-node v4
  • actions/checkout v4@b4ffde65f46336ab88eb53be808477a3936bae11
  • actions/setup-node v4
  • actions/checkout v4@b4ffde65f46336ab88eb53be808477a3936bae11
  • actions/setup-node v4
  • actions/checkout v4@b4ffde65f46336ab88eb53be808477a3936bae11
  • actions/setup-node v4
  • ubuntu 22.04
  • ubuntu 22.04
  • ubuntu 22.04
  • ubuntu 22.04
  • ubuntu 22.04
.github/workflows/npm-prerelease.yaml
  • actions/checkout v4@b4ffde65f46336ab88eb53be808477a3936bae11
  • actions/setup-node v4
  • ubuntu 22.04
.github/workflows/sync-issue-labels.yaml
  • actions/checkout v4@b4ffde65f46336ab88eb53be808477a3936bae11
  • ubuntu 22.04
.github/workflows/test-and-release.yaml
  • actions/checkout v4@b4ffde65f46336ab88eb53be808477a3936bae11
  • actions/setup-node v4
  • ubuntu 22.04
.github/workflows/update-repo-info.yaml
  • actions/checkout v4@b4ffde65f46336ab88eb53be808477a3936bae11
  • ubuntu 22.04
npm
package.json
  • jsonwebtoken 9.0.2
  • @bifravst/eslint-config-typescript 6.0.22
  • @bifravst/prettier-config 1.0.0
  • @commitlint/config-conventional 19.2.2
  • @types/jsonwebtoken 9.0.6
  • @types/node 20.12.7
  • husky 9.0.11
  • ts-loader 9.5.1
  • tsx 4.7.2
  • node >=20
  • npm >=9

  • Check this box to trigger a request for Renovate to run again on this repository

Implement Device Key based authentication for evaluation

For evaluation purposes customers can use Device Keys to authenticate against the API without needing to go into a "special business agreement with Nordic Semiconductor", as mentioned in the Getting Started Steps.

In order to acquire the Device Key, users have to register a public key for one device. The process is described here, and the individual steps are:

  1. acquire the API key nrfcloud.com account dashboard
  2. generate a device ID (e.g. a UUIDv4)
  3. generate a key pair (e.g. using OpenSSL)
  4. create a CSV file that contains the device ID and the public key
  5. upload the CSV file to the https://api.nrfcloud.com/v1/devices/public-keys endpoint using the users API key

The private key then can be used to create the JWT with the payload {"sub": "<device id>"} needed to call the Location Service endpoints that required JWT authentication, e.g. GetPositionFromCellTowers.

  • extend the implementation in this project to also use device ID + private key for interacting with the API instead of the team ID: #15

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.