Giter Site home page Giter Site logo

pokt-network / pocket-aat-js Goto Github PK

View Code? Open in Web Editor NEW
5.0 7.0 1.0 2.78 MB

Application Authentication Token SDK

License: MIT License

TypeScript 65.61% HTML 0.96% JavaScript 33.43%
pocket pokt blockchain dis descentralized-infrastructure js javascript ts typescript aat

pocket-aat-js's Introduction

Pocket-AAT-JS

Generate to-spec AAT tokens for your Pocket JavaScript applications easily using this SDK. Current supported version of the AAT specification supported by this library: 0.0.1. For more details, please reference the AAT documentation.

Overview


Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Requirements

You should have at least have a basic knowledge of blockchain technology and know your way around JavaScript. You will also need to install the NPM tool.

Installation

npm install --save @pokt-network/aat-js

Documentation

// First require the PocketAAT class
const PocketAAT = require('@pokt-network/aat-js');

// Define the arguments needed to build an AAT
const clientPublicKey = 'b70382156da53d4274f655961e8b1aa0950aa7f4';
const applicationPublicKey = 'a85f3577dcfe59bfed60b3ed013c739ac875237f98a98735dfa13733b0ced42d';
const applicationPrivateKey = 'f70196f8f9246c957e4947c1be09da98c405aebc1a4e2...';

(async () => {
  try {
      // Create a new PocketAAT instance
      var pocketAAT = await PocketAAT.from('0.0.1', clientPublicKey, applicationPublicKey, applicationPrivateKey);
      
      // Example JSON output
      console.log(JSON.stringify(pocketAAT));
  } catch (e) {
      console.log(e);
  }
})();

Running the tests

npm run test

Contributing

Please read CONTRIBUTING.md for details on contributions and the process of submitting pull requests.

Support & Contact

License

This project is licensed under the MIT License; see the LICENSE.md file for details.

pocket-aat-js's People

Contributors

luyzdeleon avatar nymd avatar pabelnl avatar wgarcia4190 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

pocket-aat-js's Issues

Installing as a NPM package doesn't include any javascript files.

Describe the bug
When installed as a NPM package, the resulting installed package doesn't include any source files to be imported by the project.

To Reproduce
Steps to reproduce the behavior:

  1. npm install pokt-network/pocket-aat-js#staging
  2. Go into the node_modules/pocket-aat-js directory of the project
  3. Inspect the files to see that the source files or the dist files are missing.

Expected behavior

  1. npm install pokt-network/pocket-aat-js#staging
  2. Go into the node_modules/pocket-aat-js directory of the project
  3. Inspect the files to see that the source files or the dist javascript files are present.
  4. Import the pocket-aat-js dependency in the code succesfully.

Documentation updates

Describe the solution you'd like
Update the repository documentation and issue templates to match Organization standards.

V0.1.2 release

The new release includes:

  • Dependency alert changes.
  • Supported Node version update.

Add unit tests

Add proper test for initializing the instance, failing to initialize, hashing and signing.

Package can't be installed from github

Describe the bug
Package can't be installed from github

To Reproduce
npm install --save pokt-network/pocket-aat-js#staging

Expected behavior
The package must be correctly installed.

Test

This is just a test for Discourse integration.

Replace actual ed25519 dependency

Actual ed25519 dependency only works with node versions equals or below 10.19. Replace with our own fork of the library that supports node v12.15.

@pokt-network/ed25519

Change testing framework to Chai

Describe the solution you'd like
In order to make it consistent with the rest of the organization Typescript/Javascript projects, the testing framework should be Chai.

Additional context
Currently Jest is being used.

Refactor PocketAAT interface

Change the PocketAAT constructor to handle signature creation during instantiation.
Expose all of PocketAAT properties as public.

Add CLI

Add a CLI to manually generate AAT's via CLI.

Add validation to all of the PocketAAT attributes

Describe the solution you'd like
Currently the PocketAAT class doesn't validate it's 4 core attributes for validity:

  • version: Should be checked against the supported versions by the library.
  • clientPublicKey: Should be checked against length and format (currently hex only is supported)
  • applicationPublicKey: Should be checked against length and format (currently hex only is supported)
  • applicationSignature: Should be checked against length and format (currently hex only is supported), also it should be checked against the applicationPublicKey to make sure the signature belongs to that applicationPublicKey.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.