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

@kevinejohn/atfinder

v2.0.1

Published

Paymail Client

Downloads

81

Readme

AtFinder

Paymail Client

The code is hosted on GitHub and the package is available through NPM.

Installation

npm i atfinder

Example Usage

const atfinder = require('atfinder')
const paymail = '[email protected]'

// Get the bsvalias config file for the domain host
await atfinder.getServerConfig(paymail)

// Get the name and photo URL
await atfinder.getNameAndPhotoURL(paymail)

// Request transaction outputs
const satoshis = 1337
await atfinder.requestOutputsForP2PTransaction(paymail, satoshis)

// Submit an SPV transaction
// Note that the envelope contains the reference number
await atfinder.submitSPVTransaction(paymail, envelope)

API

Table of Contents

getServerConfig

Use this function to get the well-known bsvalias configuration object for the server that hosts a handle.

This is a low-level utility.

Parameters

  • paymail String the handle of the target

  • config Object? optional configuration options (optional, default {})

    • config.dohServer String DNS-over-HTTPS resolver (optional, default https://dns.google.com/resolve)
  • Throws any appropriate errors if the request did not succeed

Returns Promise<Object> response from the Paymail server

getNameAndPhotoURL

Use this function to get the name nad avatar photo URL of a handle.

Parameters

  • paymail String the handle of the target

  • config Object? optional configuration options

    • config.dohServer String DNS-over-HTTPS resolver (optional, default https://dns.google.com/resolve)
  • Throws any appropriate errors if the request did not succeed

Returns Promise<Object> response from the Paymail server

requestOutputsForP2PTransaction

Use this function to get a payment invoice for a P2P or SPV transaction

Parameters

  • paymail String the handle of the target

  • satoshis Number the amount of satoshis to send

  • config Object? optional configuration options

    • config.dohServer String DNS-over-HTTPS resolver (optional, default https://dns.google.com/resolve)
  • Throws any appropriate errors if the request did not succeed

Returns Promise<Object> response from the Paymail server

submitSPVTransaction

Use this function to submit an SPV transaction to a Paymail server.

Note that hashwrap can be used to create SPV envelopes.

Parameters

  • paymail String the handle of the recipient

  • envelope Object the SPV envelope containing the transaction, which must include all specified envelope fields in addition to those listed

    • envelope.reference String the reference number provided by requestOutputsForP2PTransaction

    • envelope.metadata Object? optional information about the payment

      • envelope.metadata.note String? a human-readable note about the payment
      • envelope.metadata.sender String? the handle of the sender
      • envelope.metadata.pubkey String? an identity key of the sender
      • envelope.metadata.signature String? a signature on the TXID from the provided identity key
  • config Object? optional configuration options

    • config.dohServer String DNS-over-HTTPS resolver (optional, default https://dns.google.com/resolve)
  • Throws any appropriate errors if the request did not succeed

Returns Promise<Object> response from the Paymail server

deprecatedSubmitP2PTransaction

Use this function to submit a P2P transaction to a Paymail server.

As of July 2021, this is how MoneyButton and HandCash handle P2P transactions. However, it is deprecated in favor of using submitSPVTransaction instead where possible.

Note that hashwrap can be used to create SPV envelopes.

Parameters

  • paymail String the handle of the recipient

  • reference String the reference number provided by requestOutputsForP2PTransaction

  • hex String the signed Bitcoin transaction

  • metadata Object? optional information about the payment

    • metadata.note String? a human-readable note about the payment
    • metadata.sender String? the handle of the sender
    • metadata.pubkey String? an identity key of the sender
    • metadata.signature String? a signature on the TXID from the provided identity key
  • config Object? optional configuration options

    • config.dohServer String DNS-over-HTTPS resolver (optional, default https://dns.google.com/resolve)
  • Throws any appropriate errors if the request did not succeed

Returns Promise<Object> response from the Paymail server

verifyPublicKeyForPaymail

Use this function to verify that a given identity key belongs to a handle.

Parameters

  • paymail String the handle of the target

  • publicKey String the DER-encoded public key to verify

  • config Object? optional configuration options

    • config.dohServer String DNS-over-HTTPS resolver (optional, default https://dns.google.com/resolve)
  • Throws any appropriate errors if the request did not succeed

Returns Promise<Object> response from the Paymail server

getIdentityKeyForPaymail

Use this function to get the identity key of a handle.

Parameters

  • paymail String the handle of the target

  • config Object? optional configuration options

    • config.dohServer String DNS-over-HTTPS resolver (optional, default https://dns.google.com/resolve)
  • Throws any appropriate errors if the request did not succeed

Returns Promise<Object> response from the Paymail server

getCertifiedKey

Use this function to get the Authrite type-42 certified key for a Paymail handle. Requires an initialized Authrite client as a parameter.

Parameters

  • paymail String the handle of the target

  • authriteClient Object the initialized Authrite client to use

  • config Object? optional configuration options

    • config.dohServer String DNS-over-HTTPS resolver (optional, default https://dns.google.com/resolve)
  • Throws any appropriate errors if the request did not succeed

Returns Promise<Object> response from the Paymail server

submitType42Payment

Use this function to submit a type-42 payment to a Paymail server.

Note that hashwrap can be used to create SPV envelopes.

Parameters

  • paymail String the handle of the recipient

  • body Object the body of the request, including protocol and transactions fields

  • authriteClient Object an initialized Authrite client to use

  • config Object? optional configuration options

    • config.dohServer String DNS-over-HTTPS resolver (optional, default https://dns.google.com/resolve)
  • Throws any appropriate errors if the request did not succeed

Returns Promise<Object> response from the Paymail server

License

The license for the code in this repository is the Open BSV License.