1.0.0 • Published 2 years ago

jurischain-node v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

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.