UNPKG

@gandlaf21/bc-ur

Version:

A JS implementation of the Uniform Resources (UR) specification from Blockchain Commons

10 lines (8 loc) 307 B
import { Buffer } from "buffer"; import {encode, decode} from "cborg"; export const cborEncode = (data: any): Buffer => { return Buffer.from(encode(data)); } export const cborDecode = (data: string | Buffer): any => { return decode(Buffer.isBuffer(data) ? data : Buffer.from(data as string, 'hex')); }