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

authonomysdk

v0.0.3

Published

authonomy sdk for authonomy service

Downloads

2

Readme

AuthonomySDK

npm version

AuthonomySDK is a JavaScript library providing easy integration with the Authonomy service for web applications. It simplifies user authentication and authorization processes, leveraging Authonomy's secure backend.

Features

  • User Sign-up and Authentication
  • Access Token Generation
  • Access List Retrieval
  • Access Verification

Installation

To install AuthonomySDK, use npm:

npm install authonomysdk

Usage

Here's a quick example to get you started:

import { AuthonomySDK } from 'authonomysdk';

const sdk = new AuthonomySDK({
  appDid: "your_app_did",
  appSecret: "your_app_secret",
  serviceUrl: "http://localhost:8081"
});

// Sign up or authenticate a user
sdk.signUp((data) => {
  console.log("User data:", data);
});

// Fetch access token
sdk.getAccessToken("your_oauth_credential", "your_policy_credential", (error, data) => {
  if (error) {
    console.error("Error:", error);
  } else {
    console.log("Access token:", data.access_token);
  }
});

// Verify access
// Developer can use it as a middleware too
// response: "true" / "false" 
sdk.verifyAccess(accessToken, attribute, (error, data) => {
    if (error) {
        console.error('Failed to verify access:', error);
        return;
    }
    console.log('Access verification:', data);
});


// Get access list
// example response:
// {
//   "application_policy": {
//     "id": "did:key:z6MkmrniEq3Cg7bv21BVbX8qkgJUPsAT6yPcBXoMKBvYtMAu",
//     "roles": [
//       {
//         "permissions": [
//           "create_user",
//           "delete_user",
//           "edit_settings"
//         ],
//         "roleName": "admin"
//       },
//       {
//         "permissions": [
//           "view_content",
//           "comment"
//         ],
//         "roleName": "user"
//       }
//     ]
//   },
//   "user_access_list": {
//     "id": "did:key:z6Mkqw8Lz1UVwx9U12CUJ9gQdo7Xsuf75YeM9Zkc52hSw2Xn",
//     "roles": [
//       {
//         "permissions": [
//           "view_content",
//           "comment"
//         ],
//         "roleName": "user"
//       }
//     ]
//   }
// }
sdk.getAccessList(accessToken, (error, data) => {
    if (error) {
        console.error('Failed to get access list:', error);
        return;
    }
    console.log('Access list:', data);
});