UNPKG

@apocentre/bc-ur

Version:

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

10 lines (8 loc) 294 B
const cbor = require('cbor-sync'); // const cbor = require('cbor-js'); export const cborEncode = (data: any): Buffer => { return cbor.encode(data); } export const cborDecode = (data: string | Buffer): any => { return cbor.decode(Buffer.isBuffer(data) ? data : Buffer.from(data, 'hex')); }