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

tap-protocol-helper

v0.1.4

Published

Helper scripts for creating signed authority inscriptions for Tap Protocol

Downloads

5

Readme

TAP Protocol helper library

Helper functions for signing TAP Protocol inscriptions.

Description

npm version

This package provides a set of helper scripts designed to facilitate the creation of signed authority inscriptions for the TAP Protocol. It includes functionality for signing privilege authority messages, token authority, and token redemption using various cryptographic protocols.

The library has been implemented using references from TAP Protocol specs and TAP Protocol authority boiler plate

Installation

To install the package, run the following command:

yarn add tap-protocol-helper

or

npm install tap-protocol-helper

Usage

To use the Tap Helper functions, you can import the Tap and Utils modules into your project as follows:

const { Tap, Utils } = require("tap-protocol-helper");
const { ECPair } = require("tap-protocol-helper/dist/core");

Optionals:

const { bitcoin, ecc } = require("tap-protocol-helper/dist/core");
const { toXOnly } = require("bitcoinjs-lib/src/psbt/bip371");

1. Signing a privilege-auth inscription

Use the signAuth function to sign a privilege-auth message:

const keypair = ECPair.makeRandom(); // Replace with your keypair generation method
const msgKey = "auth";
const message = { name: "tap-protocol-privilege-auth-000" };
const salt = Math.random(); // Optional: Provide your own salt value

const priv_auth = Tap.signAuth(keypair.privateKey, keypair.publicKey, msgKey, message, salt);

Example output:

{
    test: {
        valid: true,
        pub: "0282984730b88570f86c56d475d90258d1ca9755373e18fabc130791923f9e0f4a",
        pubRecovered: "0282984730b88570f86c56d475d90258d1ca9755373e18fabc130791923f9e0f4a"
    },
    result: '{"p":"tap","op":"privilege-auth","sig":{"v":"0","r":"16305713734998215074335603060711813150048114674529647022075032070990566113517","s":"40018336075309720814901490213864323243237297900828141635735508366496148314591"},"hash":"8fa604b40f239c27995d58c773eb846c9122cc77541d1a0ac770ba4a52f4abcc","salt":"0.4840164898423085","auth":{"name":"tap-protocol-privilege-auth-000"}}'
}

The result field in the output above is the signed inscription text to be inscribed:

{
    "p": "tap",
    "op": "privilege-auth",
    "sig": {
        "v": "0",
        "r": "16305713734998215074335603060711813150048114674529647022075032070990566113517",
        "s": "40018336075309720814901490213864323243237297900828141635735508366496148314591"
    },
    "hash": "8fa604b40f239c27995d58c773eb846c9122cc77541d1a0ac770ba4a52f4abcc",
    "salt": "0.4840164898423085",
    "auth": { "name": "tap-protocol-privilege-auth-000" }
}

2. Signing a token-mint inscription

Use signMint to create a token-mint inscription text

const keypair = ECPair.makeRandom(); // Replace with your keypair generation method
const ticker = "tap-token-auth";
const amount = 1000;
const salt = Math.random(); // Optional: Provide your own salt value
const minter = 'tb1p96fnzkff6af94z0zpaahqws45rjcw5fd6wk3pe2w7cqz279wl6rqzw0k37'

const mint_auth = signMint(keypair.privateKey, keypair.publicKey, ticker, amount, minter, salt);

Example output:

{
    test: {
        valid: true,
        pub: "02801d73a46adffac2a0bc9bddce670a64b99e97df87a1c86aa38dab8f642cdcdd",
        pubRecovered: "02801d73a46adffac2a0bc9bddce670a64b99e97df87a1c86aa38dab8f642cdcdd"
    },
    result: '{"p":"tap","op":"token-mint","tick":"tap-token-auth","amt":1000,"prv":{"sig":{"v":"0","r":"28840735240323581642649166158114847033326200650757009309461520982937724983138","s":"43031653986158326967040449621257596604714194318555432467794807862498111678116"},"hash":"b117c449ebba4b9f033ad46daa55a1004369463cdc757bd98a27ac05317e7165","address":"tb1p96fnzkff6af94z0zpaahqws45rjcw5fd6wk3pe2w7cqz279wl6rqzw0k37","salt":"0.4840164898423085"}}'
}

The inscription text to be inscribed:

{
    "p": "tap",
    "op": "token-mint",
    "tick": "tap-token-auth",
    "amt": 1000,
    "prv": {
        "sig": {
            "v": "0",
            "r": "28840735240323581642649166158114847033326200650757009309461520982937724983138",
            "s": "43031653986158326967040449621257596604714194318555432467794807862498111678116"
        },
        "hash": "b117c449ebba4b9f033ad46daa55a1004369463cdc757bd98a27ac05317e7165",
        "address": "tb1p96fnzkff6af94z0zpaahqws45rjcw5fd6wk3pe2w7cqz279wl6rqzw0k37",
        "salt": "0.4840164898423085"
    }
}

To be continue...