Socket
Socket
Sign inDemoInstall

rlp-kind

Package Overview
Dependencies
1
Maintainers
2
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    rlp-kind

Bindings for Kind's implementation of RLP encoding.


Version published
Maintainers
2
Created

Readme

Source

rlp-kind

Node.js wrapper for the RLP Encoding library written in Kind.

We provide a proof to ensure that all encoded RLPs will be correctly decoded in the underlying implementation.

DEMO.

Install

npm install --save rlp-kind
yarn add rlp-kind

Install globally if you want to use the CLI:

npm install -g rlp-kind
yarn global add rlp-kind

Usage

API

import * as assert from 'assert'
import * as rlp from 'rlp-kind'

const nestedList = [[], [[]], [[], [[]]]]
const encoded = rlp.encode(nestedList)
const decoded = rlp.decode(encoded)
assert.deepEqual(nestedList, decoded)
encode

encode(input: InputTree): Buffer

RLP encodes a tree of data (Buffers, Strings etc) and returns a Buffer.

decode

decode(input: Input): BufferTree

Decodes an RLP encoded Buffer, String etc and returns a tree of Buffers.

The input will be converted to a buffer.

Types
type Input =
  | Buffer
  | string
  | number
  | bigint
  | Uint8Array
  | BN
  | null

type InputTree =
  | InputTree[]
  | Input
type BufferTree = Buffer | BufferTree[]

CLI

$ rlp encode '[ 5 ]'
c105
$ rlp decode '0xc105'
[ '05' ]

Keywords

FAQs

Last updated on 23 Dec 2021

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