Skip to content

intelliot/payid-core

Repository files navigation

payid-core

Simple PayID utility functions

Installation

$ yarn add payid-core

or with npm:

$ npm install payid-core

payid-core API Reference

Functions

parsePayId(payId)PayIdComponents | undefined

Parse a PayID into PayIdComponents.

isValidPayId(payId)boolean

Check whether a string is syntactically a valid PayID.

resolvePayId(payId, [options])Promise

Retrieve one or more addresses associated with a PayID.

By default, this retrieves all of a PayID's addresses by passing the payid network in the header of the request.

To retrieve an address for a particular payment network, set options.network to the desired PaymentNetwork.

parsePayId(payId) ⇒ PayIdComponents | undefined

Parse a PayID into PayIdComponents.

Kind: global function
Returns: PayIdComponents | undefined - the PayIdComponents if the PayID is syntactically valid, otherwise undefined

Param Type Description
payId string the PayID to parse

isValidPayId(payId) ⇒ boolean

Check whether a string is syntactically a valid PayID.

Kind: global function
Returns: boolean - true if the PayID is valid, otherwise false

Param Type Description
payId string the PayID to check

resolvePayId(payId, [options]) ⇒ Promise

Retrieve one or more addresses associated with a PayID.

By default, this retrieves all of a PayID's addresses by passing the payid network in the header of the request.

To retrieve an address for a particular payment network, set options.network to the desired PaymentNetwork.

Kind: global function
Returns: Promise - Promise resolves to PaymentInformation. If useInsecureHttp was set, then usedInsecureHttp: true will be set
Throws:

  • Error 'Invalid PayID' if payId is syntactically invalid; ${status} ${statusText} ${text} if the response is not successful (status in the range 200-299)
Param Type Description
payId string The PayID to resolve for one or more addresses
[options] Object Options object
[options.network] PaymentNetwork The network to retrieve an address for
[options.useInsecureHttp] boolean If true, http will be used. Use for testing purposes only. Defaults to false

Development Environment

  • Node.js LTS
  • Yarn
  • TypeScript
  • Linting with eslint
  • Testing with Jest
  • Code coverage

Scripts

  • compile
    • Runs typescript (tsc) and outputs to ./dist
  • lint
    • Runs eslint (use --fix to automatically fix issues)
  • test
    • Runs jest testing framework
  • coverage
    • Collects code coverage information and outputs to ./coverage
  • docs
    • Generate README.md (from README.hbs and jsdoc2md) and ./docs (with typedoc)

About

Simple PayID utility functions in JavaScript/TypeScript

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published