@berty/api
TypeScript icon, indicating that this package has built-in type declarations

2.420.1 • Public • Published

@berty/api

Berty protobuf codegen

Setup

Yarn

yarn add @berty/api

NPM

npm install @berty/api

Usage

NodeJS

const beapi = require("@berty/api")

const accountInterface = { displayName: "Alice" }

console.log("as interface:", accountInterface)

const accountBytes = beapi.messenger.Account.encode(accountInterface).finish()

console.log("as bytes:", accountBytes)

const accountObject = beapi.messenger.Account.decode(accountBytes)

console.log("as decoded object:", accountObject)

Output

❯ node .
as interface: { displayName: 'Alice' }
as bytes: <Buffer 12 05 41 6c 69 63 65>
as decoded object: Account { serviceTokens: [], displayName: 'Alice' }

Readme

Keywords

none

Package Sidebar

Install

npm i @berty/api

Weekly Downloads

5

Version

2.420.1

License

MIT

Unpacked Size

1.25 MB

Total Files

6

Last publish

Collaborators

  • d4ryl00
  • iuriberty
  • berty-staff
  • m42am