Skip to content
An Node.js ID4me Relying Party library implemented according to the official guide
TypeScript JavaScript
Branch: master
Clone or download

README.md

npm

node-id4me-rp

An Node.js ID4me Relying Party library implemented according to the official guide
Demo Application

Installation

npm install id4me-rp
or
yarn add id4me-rp

(Temporary) Documentation

Methods available

Discovery

Registration

ApplicationStorageAdapter: Used to replace the default method of storing the credentials for applications registered at different Identity Authorities. All provided functions are expected to return a promise.

  const adapter = new id4me.ApplicationStorageAdapter(
    async (identifier, data) => {
      // Save credentials
    },
    async identifier => {
      // Get and return credentials
    },
    async identifier => {
      // Delete credentials
      // Return boolean indicating success
    }
  );

Authentication

Claims

  • async getClaims(iss: string, token: string): ClaimsOverview
  • async getDistributedClaim(claims: ClaimsOverview, name: string): string | number | null

ClaimsClient: Used to cut down on duplicate code when requesting multiple claims

  const claimsClient = new id4me.ClaimsClient(identityAuthority, access_token);
  await claimsClient.loadClaims();
  const email = await claimsClient.getClaim('email');

All methods can be required/imported from the package directly.
For now I recommend you also take a look at the example code to see how the methods are used.
While the library and the example app are written in TypeScript you can also use them with regular JavaScript without any problems.\

TODO

  • Simplify general usage
  • Support for encryption (Looking for help)
  • Fix HTTPS requests failing due to bad certificates
  • Create more automated tests
You can’t perform that action at this time.