Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@0xcert/merkle

Package Overview
Dependencies
Maintainers
2
Versions
76
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@0xcert/merkle - npm Package Compare versions

Comparing version 0.0.0-alpha7 to 0.0.0-alpha8

4

CHANGELOG.json

@@ -5,4 +5,4 @@ {

{
"version": "0.0.0-alpha7",
"tag": "@0xcert/merkle_v0.0.0-alpha7",
"version": "0.0.0-alpha8",
"tag": "@0xcert/merkle_v0.0.0-alpha8",
"date": "Thu, 22 Nov 2018 00:51:03 GMT",

@@ -9,0 +9,0 @@ "comments": {}

@@ -5,3 +5,3 @@ # Change Log - @0xcert/merkle

## 0.0.0-alpha7
## 0.0.0-alpha8
Thu, 22 Nov 2018 00:51:03 GMT

@@ -8,0 +8,0 @@

{
"files": {
"packages/0xcert-merkle/CHANGELOG.json": "7549870ed5076c0d6f766d63e4c19a07f3b7c92f",
"packages/0xcert-merkle/CHANGELOG.md": "8040584d722ea5d0425576ace415b15926823ce7",
"packages/0xcert-merkle/README.md": "f6e5733c5260faa8370cd755dae8f5af2f38a3fc",
"packages/0xcert-merkle/CHANGELOG.json": "d0b02b92358dff434df34822dfa3bf03f78aa2e7",
"packages/0xcert-merkle/CHANGELOG.md": "722e0b5ddc22a02e7018e79d1920f7e1fbc172df",
"packages/0xcert-merkle/README.md": "a75ed7629b04dd0eeebe3b3f88b1bdfa90d1a61b",
"packages/0xcert-merkle/nodemon.json": "82b893373db9861f1df4b55d8ea68a5d37b118de",
"packages/0xcert-merkle/package.json": "870e3427ab43f3663baf3dcda6bc05f2d9480fa7",
"packages/0xcert-merkle/package.json": "dbd48810bae388c12c04b8dddacf8c67718db75d",
"packages/0xcert-merkle/src/core/merkle.ts": "4bf83b0caf30059846519987ff62587c37f34162",

@@ -15,5 +15,5 @@ "packages/0xcert-merkle/src/index.ts": "d6e89de6faec0b508d09239bf458d7a8a26e4775",

"packages/0xcert-merkle/tsconfig.json": "4aeac3c20e45b7e477e82012eb7788f7dbb11bf3",
"common/config/rush/npm-shrinkwrap.json": "b5af47441ed8345fd5cfe61bc37d9d7008283a33"
"common/config/rush/npm-shrinkwrap.json": "8f19ba9dbdefd16dc6af9aff055b174191c3e0b8"
},
"arguments": "npm run clean && npx tsc "
"arguments": "npx hayspec test "
}
{
"name": "@0xcert/merkle",
"version": "0.0.0-alpha7",
"description": "Merkle tree management tool.",
"version": "0.0.0-alpha8",
"description": "Implementation of basic functions of binary Merkle tree.",
"main": "./dist/index.js",

@@ -20,7 +20,40 @@ "types": "./dist/index.d.ts",

},
"repository": {
"type": "git",
"url": "git+https://github.com/0xcert/framework.git"
},
"bugs": {
"url": "https://github.com/0xcert/framework/issues"
},
"homepage": "https://github.com/0xcert/framework#readme",
"keywords": [
"0xcert",
"framework",
"protocol",
"asset",
"value",
"values",
"currency",
"token",
"non-fungible",
"fungible",
"erc-721",
"erc-20",
"blockchain",
"javascript",
"typescript",
"nodejs",
"vuejs",
"nuxtjs",
"npm",
"libraries",
"smart-contract",
"ethereum",
"zxc"
],
"license": "MIT",
"devDependencies": {
"@0xcert/utils": "0.0.0-alpha7",
"@hayspec/cli": "^0.7.6",
"@hayspec/spec": "^0.7.6",
"@0xcert/utils": "0.0.0-alpha8",
"@hayspec/cli": "^0.8.3",
"@hayspec/spec": "^0.8.3",
"ts-node": "^7.0.1",

@@ -27,0 +60,0 @@ "typescript": "^3.1.1"

@@ -0,13 +1,8 @@

<img src="https://github.com/0xcert/framework/raw/master/assets/cover-sub.png" />
## Getting started
> Implementation of basic functions of binary Merkle tree.
First, define an array with values.
This module handles binary trees like this:
```ts
const values = ['A', 'B', 'C', 'D'];
```
The evidence for this array of values is a simple binary merkle tree as shown below.
```ts
n0

@@ -33,27 +28,4 @@ |

A user can expose selected values from this tree by providing the evidence file that looks like this:
A user defines an array of values `['A', 'B', 'C', 'D']`. These values can be hached into an `imprint`, which is a root tree hash. A user can expose selected values to a third-party by providing the evidence file which consists of `values` and `nodes`. This file holds enough information for a third-party to recreate an imprint.
```ts
const recipe = {
values: [
{ index: 0, value: 'A' },
{ index: 1, value: 'B' },
{ index: 2, value: 'C' },
...
],
nodes: [
{ index: 0, hash: '0x...' }, // n0 (root)
{ index: 1, hash: '0x...' }, // n1
{ index: 2, hash: '0x...' }, // n2
...
],
};
```
Note, that the root hash is never part of the evidence object!
## Usage
Create an instance of a merkle tree.
```js

@@ -73,24 +45,4 @@ import { sha } from '@0xcert/utils';

## License (MIT)
The [0xcert Framework](https://docs.0xcert.org) is a free and open-source JavaScript library that provides tools for building powerful decentralized applications. Please refer to the [official documentation](https://docs.0xcert.org) for more details.
```
Copyright (c) 2018 Kristijan Sedlak <xpepermint@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated modelation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
```
This module is one of the bricks of the [0xcert Framework](https://docs.0xcert.org). It's written with [TypeScript](https://www.typescriptlang.org) and it's actively maintained. The source code is available on [GitHub](https://github.com/0xcert/framework) where you can also find our [issue tracker](https://github.com/0xcert/framework/issues).

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc