Fluree Cryptography
A collection of Javascript cryptography functions for Fluree
npm install fluree-cryptography
API
Generate Keys
Returns a hex string of a public and private key pair.
; const publicKey privateKey = ;
Get Auth ID from Public Key
Returns the _auth/id
that accompanies a given public key.
; const publicKey = ;const authId = ;
Sign Transaction
signTransaction returns an object with the keys: sig, cmd, which should then be sent in the body of a request to the /command
endpoint.
; const publicKey privateKey = ;const authId = ; const db = "test/one";const expire = Date + 1000;const fuel = 100000;const nonce = 1; // Deps is an optional parameter - it is a array of _tx/ids that must have succeeded// for the current transaction to be accepted.const deps = null; const tx = JSON const command = const fetchOpts = method: 'POST' headers: 'Content-Type': 'application/json' body: JSON ; const fullURI = `https://localhost:8090/fdb//command`;
Sign Query
signQuery returns an object with the keys: header, method, body, which should then be sent to any of the query endpoints (/query
, /multi-query
, history
, block
).
; const privateKey = ;const authId = ; const param = JSON;const db = "test/one";const host = "localhost";const queryType = "query"; const fetchOpts = const fullURI = `https://localhost:8090/fdb//query`;