pbt-js-alpha
TypeScript icon, indicating that this package has built-in type declarations

0.0.1 • Public • Published

TypeScript

About

This is a light-weight js lib that aims to make integration with Azuki PBT as seamless as possible. For more information on Azuki PBT please visit https://www.pbt.io/

Getting started

yarn add pbt-js

After installing you can import the relevant manufacturer's helpers

React example:

import { getPublicKeyFromScan, getSignatureFromScan } from 'pbt-js/kong';

const MyComponent = () => {
  const [keys, setKeys] = useState(null);

  return (
    <>
      <button
        onClick={() => {
          getPublicKeyFromScan({ rpId: '<host_of_current_site>' }).then((keys) => {
            setKeys(keys);
          });
        }}
      >
        Click Me To Initiate Scan
      </button>
      <button
        onClick={() => {
          getSignatureFromScan({
            rpId: '<host_of_current_site>',
            chipPublicKey: keys.primaryPublicKeyRaw,
            address: '<user_eth_address>',
            hash: '<blockhash>',
          }).then((sig) => {
            setSig(sig);
          });
        }}
      >
        Click Me To Sign EOA+blockhash w/ Chip
      </button>
    </>
  );
}

Documentation

This package exposes 2 functions for each chip manufacturer to support PBT flow

getPublicKeyFromScan

Parameter Type Description Required
rpId string string representing the domain the scan is being called on. For example a workflow hosted on azuki.com would pass in azuki.com yes

getSignatureFromScan

Parameter Type Description Required
rpId string string representing the domain the scan is being called on. For example a workflow hosted on azuki.com would pass in azuki.com yes
chipPublicKey string yes
address string yes
hash string yes

FAQ

Q: What manufacturers are currently supported?

A: There's currently only support for kongishcash chips

Contribution

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

Fork the project Create your feature branch (git checkout -b feature/AmazingFeature) Commit your changes (git commit -m 'Add some AmazingFeature') Push to the branch (git push origin feature/AmazingFeature) Open a pull request

License

Distributed under the MIT License.

Readme

Keywords

Package Sidebar

Install

npm i pbt-js-alpha

Weekly Downloads

1

Version

0.0.1

License

MIT

Unpacked Size

90.3 kB

Total Files

37

Last publish

Collaborators

  • ethtea