Skip to content

Buffer dWeb Keys

Jared Rice Sr edited this page Jun 28, 2018 · 1 revision

Installation

npm install @dwebs/buffer-key
yarn add @dwebs/buffer-key

This library might return a dWeb key in a buffered format.

  • valid string/buffer: Returns a dWeb key as a buffer
  • invalid string: Throws error
  • null: Returns null

Check out @dwebs/convert-key to get keys as strings or buffers!

Usage

var dWebBufferKey = require('@dwebs/buffer-key')

var dWebKey = dWebBufferKey(process.argv[2])

try {
  console.log('maybe a key: key valid or null', dWebBufferKey(dWebKey))
} catch (e) {
  console.log('key not valid')
}
Clone this wiki locally