npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@forgerock/device-client

v2.3.0

Published

Device profile client for the Ping JavaScript SDK

Downloads

767

Readme

Device Client API

The deviceClient API provides a structured interface for managing various types of devices including OATH devices, PUSH devices, WebAuthn devices, bound devices, and device profiles. This API leverages Redux Toolkit Query (RTK Query) for efficient data fetching and state management.

Table of Contents

  1. Overview

  2. Installation

  3. Configuration

  4. API Methods

  5. Example Usage

  6. Error Handling

  7. License

Overview

The deviceClient function initializes the API client with the provided configuration options and sets up the Redux store with the necessary middleware and reducers.

Installation

To install the necessary dependencies for using the deviceClient, run:

npm install @forgerock/device-client --save

Configuration

To configure the deviceClient, you need to provide a ConfigOptions object that includes the base URL for the server and the realm path.

import { deviceClient } from '@forgerock/device-client';
import type { ConfigOptions } from '@forgerock/device-client/types';

const config: ConfigOptions = {
  serverConfig: {
    baseUrl: 'https://api.example.com',
  },
  realmPath: '/your-realm-path',
};

If there is no realmPath or you wish to override the value, you can do so in the api call itself where you pass in the query.

const apiClient = deviceClient(config);

API Methods

OATH Management

Methods

  • get(query: RetrieveOathQuery): Promise<OathDevice[] | { error: unknown }>

  • Retrieves Oath devices based on the specified query.

  • delete(query: RetrieveOathQuery & { device: OathDevice }): Promise<null | { error: unknown }>

  • Deletes an Oath device based on the provided query and device information.

PUSH Management

Methods

  • get(query: PushDeviceQuery): Promise<PushDevice[] | { error: unknown }>

  • Retrieves Push devices based on the specified query.

  • delete(query: DeleteDeviceQuery): Promise<null | { error: unknown }>

  • Deletes a Push device based on the provided query.

WebAuthn Management

Methods

  • get(query: WebAuthnQuery): Promise<WebAuthnDevice[] | { error: unknown }>

  • Retrieves WebAuthn devices based on the specified query.

  • update(query: WebAuthnQuery & { device: WebAuthnDevice }): Promise<UpdatedWebAuthnDevice | { error: unknown }>

  • Updates the name of a WebAuthn device based on the provided query and body.

  • delete(query: WebAuthnQuery & { device: WebAuthnDevice | UpdatedWebAuthnDevice }): Promise<null | { error: unknown }>

  • Deletes a WebAuthn device based on the provided query and body.

Bound Devices Management

Methods

  • get(query: GetBoundDevicesQuery): Promise<Device[] | { error: unknown }>

  • Retrieves bound devices based on the specified query.

  • update(query: BoundDeviceQuery): Promise<Device | { error: unknown }>

  • Updates the name of a bound device based on the provided query.

  • delete(query: BoundDeviceQuery): Promise<null | { error: unknown }>

  • Deletes a bound device based on the provided query.

Device Profiling Management

Methods

  • get(query: GetProfileDevices): Promise<ProfileDevice[] | { error: unknown }>

  • Retrieves device profiles based on the specified query.

  • update(query: ProfileDevicesQuery): Promise<ProfileDevice | { error: unknown }>

  • Updates the name of a device profile based on the provided query.

  • delete(query: ProfileDevicesQuery): Promise<null | { error: unknown }>

  • Deletes a device profile based on the provided query.

Example Usage

OATH Management Example

const oathQuery: RetrieveOathQuery = {
  /* your query parameters */
};

const getResponse = await apiClient.oath.get(oathQuery);
console.log('Oath Devices:', getResponse);

const deleteOathQuery: RetrieveOathQuery & { device: OathDevice } = {
  /* your delete query */
};

const deleteResponse = await apiClient.oath.delete(deleteOathQuery);
console.log('Deleted Oath Device:', deleteResponse);

PUSH Management Example

const pushQuery: PushDeviceQuery = {
  /* your query parameters */
};

const getResponse = await apiClient.push.get(pushQuery);
console.log('Push Devices:', getResponse);

const deletePushQuery: DeleteDeviceQuery = {
  /* your delete query */
};

const deleteResponse = await apiClient.push.delete(deletePushQuery);
console.log('Deleted Push Device:', deleteResponse);

WebAuthn Management Example

const webAuthnQuery: WebAuthnQuery = {
  /* your query parameters */
};

const getResponse = await apiClient.webAuthn.get(webAuthnQuery);
console.log('WebAuthn Devices:', getResponse);

const updateWebAuthnQuery: WebAuthnQuery & { device: WebAuthnDevice } = {
  /* your update query */
};

const updateResponse = await apiClient.webAuthn.update(updateWebAuthnQuery);
console.log('Updated WebAuthn Device:', updateResponse);

const deleteWebAuthnQuery: WebAuthnQuery & { device: WebAuthnDevice | UpdatedWebAuthnDevice } = {
  /* your delete query */
};

const deleteResponse = await apiClient.webAuthn.delete(deleteWebAuthnQuery);
console.log('Deleted WebAuthn Device:', deleteResponse);

Bound Devices Management Example

const bindingQuery: GetBoundDevicesQuery = {
  /* your query parameters */
};

const getResponse = await apiClient.bound.get(bindingQuery);
console.log('Bound Devices:', getResponse);

const updateBindingQuery: BoundDeviceQuery = {
  /* your update query */
};

const updateResponse = await apiClient.bound.update(updateBindingQuery);
console.log('Updated Bound Device:', updateResponse);

const deleteBindingQuery: BoundDeviceQuery = {
  /* your delete query */
};

const deleteResponse = await apiClient.bound.delete(deleteBindingQuery);
console.log('Deleted Bound Device:', deleteResponse);

Device Profiling Management Example

const profileQuery: GetProfileDevices = {
  /* your query parameters */
};

const getResponse = await apiClient.profile.get(profileQuery);
console.log('Device Profiles:', getResponse);

const updateProfileQuery: ProfileDevicesQuery = {
  /* your update query */
};

const updateResponse = await apiClient.profile.update(updateProfileQuery);
console.log('Updated Device Profile:', updateResponse);

const deleteProfileQuery: ProfileDevicesQuery = {
  /* your delete query */
};

const deleteResponse = await apiClient.profile.delete(deleteProfileQuery);
console.log('Deleted Device Profile:', deleteResponse);

Error Handling

When a device client method makes a request to the server and the response is not valid, it will return a promise that resolves to an error object { error: unknown }. For example, to handle WebAuthn device management errors:

const getResponse = await apiClient.webAuthn.get(query);
if (!Array.isArray(getResponse) || 'error' in getResponse) {
  // handle get device error
}

const updateResponse = await apiClient.webAuthn.update(query);
if ('error' in updateResponse) {
  // handle update device error
}

const deleteResponse = await apiClient.webAuthn.delete(query);
if (deleteResponse !== null && 'error' in deleteResponse) {
  // handle delete device error
}

License

This project is licensed under the MIT License. See the LICENSE file for details.