Socket
Socket
Sign inDemoInstall

chained-obj

Package Overview
Dependencies
82
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    chained-obj

create multipart on-chain objects


Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

chained-obj

Builder and parser for objects stored by Tradle on chain. Currently uses multipart to store arbitrary JSON data + attachments. These objects are later encrypted and put on-chain.

this module is used by Tradle

Usage

var ChainedObj = require('chained-obj')
var Builder = ChainedObj.Builder
var Parser = ChainedObj.Parser
var b = new Builder()
  // required
  .data({
    some: 'json'
  })
  // optional
  .attach([
    { name: 'headshot', path: './path/to/attachment1' },
    { name: 'passport', path: './path/to/attachment2' }
  ])
  // optional
  .signWith(key) // a key from [kiki](https://npmjs.org/package/kiki) or a key conforming to its API
  .build(function (err, result) {
    // result consists of the form and the multipart boundary used
    // {
    //   form: Buffer,
    //   boundary: String
    // }
  })
  
var p = new Parser()
  // optional
  .verifyWith(key) // a key from [kiki](https://npmjs.org/package/kiki) or a key   
  .parse(formBuf, function (err, parsed) {
    // parsed consists of the data and attachments
    // {
    //   data: Buffer,
    //   attachments: [
    //     {
    //       name: String,
    //       path: String,
    //       contentType: String
    //     }
    //   ]
    // }
  })

Keywords

FAQs

Last updated on 06 Nov 2015

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc