jurischain-node
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

Jurischain Node

A Node extension written in C++ to use the Jurischain solution, which is a proof of work library.

TL-DR

npm install jurischain-node
import Jurischain from 'jurischain-node'

const jurischain = new Jurischain(10, 'simple-seed');
if (jurischain.challengeResponse(req['challenge-response'])) {
    // grant
} else {
    // deny
}

API

The Jurischain class exposes the following API:

constructor(difficult: number, seed: string)

Constructs a new Jurischain instance with the given difficult and seed.

challengeResponse(response: string): boolean

Challenges the response and returns a boolean indicating whether the response is correct.

readChallenge(): string

Reads the challenge and returns it as a string.

solveStep(): boolean

Solves one step of the proof of work and returns a boolean indicating whether the solution is correct.

verify(): boolean

Verifies the proof of work and returns a boolean indicating whether the verification was successful.

Package Sidebar

Install

npm i jurischain-node

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

5.56 kB

Total Files

6

Last publish

Collaborators

  • lfamorim