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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@zedeid-sdk/zedeid-did-siop-lib

v1.0.0

Published

## Overview ## This implements _Self Issued OpenId Connect Provider (SIOP)_ for _Decentralized Identities (DIDs)_. The library contains two components, **RP (Relying Party)** and **Provider**. Provider is intended to be used inside any piece of software w

Downloads

28

Readme

zedeid-did-siop

Also available via: https://cdn.jsdelivr.net/npm/@zedeid-sdk/zedeid-did-siop-lib/dist/browser/did-siop.js

Overview

This implements Self Issued OpenId Connect Provider (SIOP) for Decentralized Identities (DIDs). The library contains two components, RP (Relying Party) and Provider. Provider is intended to be used inside any piece of software which will provide DID SIOP authentication and RP can be used by relying parties (client apps) to utilize DID SIOP authentication. This library can be used in both client-side (browser) and server-side (Node.js) applications.

Following are the primary specifications followed by this implementation.

Additionally this library can be used in authentication code flow

Usage (Implicit flow)

RP

import {RP} from "@zedeid-sdk/zedeid-did-siop-lib"

//create a RP instance
const relyingParty = new RP(redirect_uri,did,kid,privateKey);

//before calling any other methods initialise the object (async method)
await relyingParty.init();

//generate the request
const request = await relyingParty.generateRequest();

//send the request to a provider and receive the response
//response - {response_type:'id_token', id_token: 'value':}

//validate a response token from the provider
const decodedResponse = await relyingParty.validateResponse(response.id_token);
console.log(decodedResponse) //{success: boolean, data: decodedResponse}

Provider

import {SIOProvider} from "@zedeid-sdk/zedeid-did-siop-lib";


//create a Provider instance
const provider = new SIOProvider(did, kid, privateKey);

//before calling any other methods initialise the object (async method)
await provider.init();

//validate the request from RP
const decodedRequest = await provider.validateRequest(request);

//generate response to the previously sent request by the RP
const res = await provider.generateResponse(decodedRequest, request, [expiresIn]);
console.log(res) //{response_type:'id_token', id_token: 'id_token_value'}             

Usage (Authorization code flow)

RP

import {RP} from "@zedeid-sdk/zedeid-did-siop-lib"

//create a RP instance
const relyingParty = new RP(redirect_uri,did,kid,privateKey);

//before calling any other methods initialise the object (async method)
await relyingParty.init();

//generate the first request
const request = await relyingParty.generateRequest({response_type:'code'}, {response_type:'code'});

//send the request to a provider and receive the response
//response - {response_type:'code', code:code_value}

//generate the second request using the first response
const secondRequest = await relyingParty.generateRequest({response_type:'id_token', grant_type:'authorization_code', code: 'code_received_above'}, {response_type:'code'});
//send the request to a provider and receive the response            
//response - {response_type:'id_token', id_token:idToken, refresh_token: refreshToken}

//generate a token refresh request
const tokenRefreshReq = relyingParty.generateTokenRefreshRequest(id_token, refresh_token);

//validate a response token from the provider
const decodedResponse = await relyingParty.validateResponse(response.id_token);
console.log(decodedResponse) //{success: boolean, data: decodedResponse}

Provider

import {SIOProvider} from "@zedeid-sdk/zedeid-did-siop-lib"

//create a Provider instance
const provider = new SIOProvider(did, kid, privateKey);

//before calling any other methods initialise the object (async method)
await provider.init();

if the environment is not a browser; set a storage with the interface of Window.localstorage for getting and setting items. (ex: react-native : react-native-async-storage)

provider.setStorage(new StorageAdapter());
// firstRequest received from a RP
const decodedRequest = await provider.validateRequest(firstRequest);
const firstResponse = await provider.generateResponse(decodedRequest, firstRequest);
//response - {response_type:'code', code:code_value}

//send the response to redirect_uri and receive second request

const decodedRequestSecond = await provider.validateRequest(secondRequest);           
const secondResponse = await provider.generateResponse(decodedRequestSecond, secondRequest);            
//response - {response_type:'id_token', id_token:idToken, refresh_token: refreshToken}

//refresh a token
const decodedTokenRefreshReq = await provider.validateRequest(tokenRefreshReq);           
const response = await provider.generateResponse(decodedTokenRefreshReq, tokenRefreshReq);            
//response - {response_type:'id_token', id_token:idToken, refresh_token: refreshToken}