Security News
CISA Brings KEV Data to GitHub
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.
This is the Javascript client for interacting with the PDK auth and panel APIs.
This may be helpful as a guide even if you don't use Javascript. The APIs use a REST style HTTP JSON interface that is simple to use from nearly any lanugage with an intelligent HTTP library.
The src/
directory contains the client library. In src/examples/
find examples for using the API for various tasks.
If you're not using a transpiler for async
/await
then just use the Promise
that is returned by async functions.
import pdk from 'pdk';
pdk.authenticate(client_id, client_secret).then(tokenset => {
// use tokenset here
});
vs
import { authenticate } from 'pdk';
const tokenset = await authenticate(client_id, client_secret);
Once calling authenticate
to get an authentication context, use makesession
to create a session with the API.
import { makesession } from 'pdk';
const session = await makesession(tokenset.token_id);
This session
function is a thin facade around got that allows easily making authenticated requests, options are passed on to got.
// `mine` is the ID for the authenticated user's default organization
let response = await session('ous/mine');
The response
is a Javascript object representing the response body documented in the API docs.
const tokenset = function *authenticate* ( // This launches a user's browser and retrieves an authentication token _clientId_: The oAuth client id issued for use, _clientSecret_: The oAuth client secret issued, _issuer_ (optional): The OpenID Connect provider to auth against, ); const session = functionn *makesession* ( // This creates a session that allows making requests to the API endpoints _tokenId_: The `token_id` from the tokenset retrieved from `authenticate`, };
If you just want to use the client without messing with the guts, just add this module as an npm dependency and import pdk from 'pdk';
(or const pdk = require('pdk');
if you must.
This project uses babel to translate a couple features that haven't hitten Javascript yet, mainly async
/await
.
The if changes are made to src/
then npm run build
needs to be run to create the output in lib/
that can be run by node.
FAQs
ProdataKey pdk.io API Client Library for Javascript
The npm package pdk-client receives a total of 0 weekly downloads. As such, pdk-client popularity was classified as not popular.
We found that pdk-client demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.
Security News
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.