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

pauldron-clients

v0.6.1

Published

Clients for using different UMA/OAuth endpoints of a Pauldron Server

Readme

Pauldron Clients

Pauldron Clients provides functions to faciliate connecting with the Pauldron services.

Components

Policy

The get, add, and delete functions mounted in the Policy object can be used for calling the respective policy endpoints. Here are some examples:

const PauldronClient = require("pauldron-client");
const policyId = await PauldronClient.Policy.add(
            POLICY, 
            POLICY_ENDPOINT_URI, 
            POLICY_ENDPOINT_API_KEY);
const policy = await PauldronClient.Policy.get(
            policyId,
            POLICY_ENDPOINT_URI, 
            POLICY_ENDPOINT_API_KEY);
await PauldronClient.Policy.delete(
            policyId,
            POLICY_ENDPOINT_URI, 
            POLICY_ENDPOINT_API_KEY);

Permissions

The register function mounted in the Permissions object can be used to register a permission at the permission registration endpoint. Here is an example:

const PauldronClient = require("pauldron-client");

const permissions = [
	{
		resource_set_id: "res_id", 
		scopes: [
			{ key: "value1" }, 
			{ key: "value2" }
		]
	}
];
const ticket = await PauldronClient.Permissions.register(
            permissions,
            PERMISSION_ENDPOINT_URI`, 
            PROTECTION_ENDPOINT_API_KEY);

RPT

The get and introspect functions mounted in the RPT object can be used for calling the respective RPT endpoints. Here are some examples:

const PauldronClient = require("pauldron-client");
const rpt = await PauldronClient.RPT.get(
			ticket,
			[
				{
				  	format: "jwt",
				    token: CLAIMS_TOKEN
				}
			], //note that this is an array and each claims token should have a format.
			AUTHORIZATION_ENDPOINT_URI, 
			AUTH_ENDPOINT_API_KEY);

const grantedPermissions = await PauldronClient.RPT.introspect(
            rpt,
            INTROSPECTION_ENDPOINT_URI, 
            PROTECTION_ENDPOINT_API_KEY);

OAuth2 Token

The get and introspect functions mounted in the OAuth2Token object can be used to calling the respective OAuth2 Token endpoints. Here are some examples:

const PauldronClient = require("pauldron-client");

const permissions = [
	{
		resource_set_id: "res_id", 
		scopes: [
			{ key: "value1" }, 
			{ key: "value2" }
		]
	}
];

const token = await PauldronClient.OAuth2Token.get(
			permissions,
			CLAIMS_TOKEN, //note that this is a single JWT token and not an array. 
			OAUTH2_AUTHORIZATION_ENDPOINT_URI, 
			AUTH_ENDPOINT_API_KEY);

const grantedPermissions = await PauldronClient.OAuth2Token.introspect(
			token,
			INTROSPECTION_ENDPOINT_URI, 
			PROTECTION_ENDPOINT_API_KEY);

HTTP Client

This is a wrapper around the request library which enables a client to communicate with a resource server protected by Pauldron with minimal effort. The client needs to provide the required information to obtain authrorization, i.e. the requested scopes, a JWT claims token, the URL for the OAuth2 authorization endpoint, and the suitable API key for communicating with the this authorization endpoint. Note that this client is currently implemented only for the OAuth2 interface. The client wrapper will request a fresh OAuth2 Token and includes it in the request to the resource server, if a a Token is not provided or in case it has expired. It, then, returns the Token and the response from the resource server. Here is an example:

const PauldronClient = require("pauldron-client");

const permissions = [
	{
		resource_set_id: "res_id", 
		scopes: [
			{ key: "value1" }, 
			{ key: "value2" }
		]
	}
];

const options = {
	requestedScopes: permissions,
	claimsToken: CLAIMS_TOKEN, //note that this is a single JWT token and not an array. 
	authEndpointUrl: OAUTH2_AUTHORIZATION_ENDPOINT_URI,
	authApiKey: AUTH_ENDPOINT_API_KEY,
	method: "GET",
	json: true,
	uri: RESOURCE_SERVER_URL
};

const {token, response} = await PauldronClient.HTTP.OAuth2.request(options);

License

MIT