UNPKG

merkle-reference

Version:

This is a TS library implementing [merkle reference] specification.

18 lines (13 loc) 383 B
import * as Tag from './tag.js' const True = new Uint8Array([1]) const False = new Uint8Array([0]) export const tag = Tag.for('merkle-structure:boolean/byte') /** * @param {boolean} value */ export const toBytes = (value) => (value ? True : False) /** * @param {boolean} value * @return {import('./tree.js').Branch} */ export const toTree = (value) => [tag, toBytes(value)]