Comparing version 0.2.0 to 0.3.0
@@ -16,2 +16,3 @@ <!-- Generated by documentation.js. Update this documentation by updating the source code. --> | ||
- [idSetInt](#idsetint) | ||
- [idImportFromInt](#idimportfromint) | ||
- [sign](#sign) | ||
@@ -37,3 +38,3 @@ - [verify](#verify) | ||
[index.js:13-20](https://github.com/wanderer/bls-lib/blob/0e97e39f3b15ac41e2d87017b73dcad5b6950276/index.js#L13-L20 "Source code on GitHub") | ||
[index.js:14-21](https://github.com/wanderer/bls-lib/blob/63a2cdafe199f883855c63bd361a125a6b8b464a/index.js#L14-L21 "Source code on GitHub") | ||
@@ -48,3 +49,3 @@ takes a callback that is called once the module is setup | ||
[index.js:25-25](https://github.com/wanderer/bls-lib/blob/0e97e39f3b15ac41e2d87017b73dcad5b6950276/index.js#L25-L25 "Source code on GitHub") | ||
[index.js:26-26](https://github.com/wanderer/bls-lib/blob/63a2cdafe199f883855c63bd361a125a6b8b464a/index.js#L26-L26 "Source code on GitHub") | ||
@@ -55,3 +56,3 @@ the FP254BNB curve | ||
[index.js:30-30](https://github.com/wanderer/bls-lib/blob/0e97e39f3b15ac41e2d87017b73dcad5b6950276/index.js#L30-L30 "Source code on GitHub") | ||
[index.js:31-31](https://github.com/wanderer/bls-lib/blob/63a2cdafe199f883855c63bd361a125a6b8b464a/index.js#L31-L31 "Source code on GitHub") | ||
@@ -62,3 +63,3 @@ the FP382_1 curve | ||
[index.js:35-35](https://github.com/wanderer/bls-lib/blob/0e97e39f3b15ac41e2d87017b73dcad5b6950276/index.js#L35-L35 "Source code on GitHub") | ||
[index.js:36-36](https://github.com/wanderer/bls-lib/blob/63a2cdafe199f883855c63bd361a125a6b8b464a/index.js#L36-L36 "Source code on GitHub") | ||
@@ -69,3 +70,3 @@ the FP382_2 curve | ||
[index.js:52-54](https://github.com/wanderer/bls-lib/blob/0e97e39f3b15ac41e2d87017b73dcad5b6950276/index.js#L52-L54 "Source code on GitHub") | ||
[index.js:53-55](https://github.com/wanderer/bls-lib/blob/63a2cdafe199f883855c63bd361a125a6b8b464a/index.js#L53-L55 "Source code on GitHub") | ||
@@ -80,3 +81,3 @@ intailizes the libary to use a given curve | ||
[index.js:60-62](https://github.com/wanderer/bls-lib/blob/0e97e39f3b15ac41e2d87017b73dcad5b6950276/index.js#L60-L62 "Source code on GitHub") | ||
[index.js:61-63](https://github.com/wanderer/bls-lib/blob/63a2cdafe199f883855c63bd361a125a6b8b464a/index.js#L61-L63 "Source code on GitHub") | ||
@@ -89,3 +90,3 @@ allocates a secret key | ||
[index.js:68-70](https://github.com/wanderer/bls-lib/blob/0e97e39f3b15ac41e2d87017b73dcad5b6950276/index.js#L68-L70 "Source code on GitHub") | ||
[index.js:69-71](https://github.com/wanderer/bls-lib/blob/63a2cdafe199f883855c63bd361a125a6b8b464a/index.js#L69-L71 "Source code on GitHub") | ||
@@ -98,3 +99,3 @@ allocates a secret key | ||
[index.js:76-78](https://github.com/wanderer/bls-lib/blob/0e97e39f3b15ac41e2d87017b73dcad5b6950276/index.js#L76-L78 "Source code on GitHub") | ||
[index.js:77-79](https://github.com/wanderer/bls-lib/blob/63a2cdafe199f883855c63bd361a125a6b8b464a/index.js#L77-L79 "Source code on GitHub") | ||
@@ -107,3 +108,3 @@ allocates a signature | ||
[index.js:83-85](https://github.com/wanderer/bls-lib/blob/0e97e39f3b15ac41e2d87017b73dcad5b6950276/index.js#L83-L85 "Source code on GitHub") | ||
[index.js:84-86](https://github.com/wanderer/bls-lib/blob/63a2cdafe199f883855c63bd361a125a6b8b464a/index.js#L84-L86 "Source code on GitHub") | ||
@@ -118,3 +119,3 @@ frees a pointer | ||
[index.js:90-92](https://github.com/wanderer/bls-lib/blob/0e97e39f3b15ac41e2d87017b73dcad5b6950276/index.js#L90-L92 "Source code on GitHub") | ||
[index.js:91-93](https://github.com/wanderer/bls-lib/blob/63a2cdafe199f883855c63bd361a125a6b8b464a/index.js#L91-L93 "Source code on GitHub") | ||
@@ -129,5 +130,5 @@ frees an array of pointers | ||
[index.js:99-104](https://github.com/wanderer/bls-lib/blob/0e97e39f3b15ac41e2d87017b73dcad5b6950276/index.js#L99-L104 "Source code on GitHub") | ||
[index.js:100-105](https://github.com/wanderer/bls-lib/blob/63a2cdafe199f883855c63bd361a125a6b8b464a/index.js#L100-L105 "Source code on GitHub") | ||
creates an ID to use in with threshold groups | ||
creates an ID from an int to use in with threshold groups | ||
@@ -139,5 +140,17 @@ **Parameters** | ||
## idImportFromInt | ||
[index.js:112-116](https://github.com/wanderer/bls-lib/blob/63a2cdafe199f883855c63bd361a125a6b8b464a/index.js#L112-L116 "Source code on GitHub") | ||
creates an ID from an int and returns a pointer to it | ||
**Parameters** | ||
- `n` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** a int repsenting the ID. n cannot be zero. | ||
Returns **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** | ||
## sign | ||
[index.js:112-112](https://github.com/wanderer/bls-lib/blob/0e97e39f3b15ac41e2d87017b73dcad5b6950276/index.js#L112-L112 "Source code on GitHub") | ||
[index.js:124-124](https://github.com/wanderer/bls-lib/blob/63a2cdafe199f883855c63bd361a125a6b8b464a/index.js#L124-L124 "Source code on GitHub") | ||
@@ -154,3 +167,3 @@ signs a message | ||
[index.js:120-120](https://github.com/wanderer/bls-lib/blob/0e97e39f3b15ac41e2d87017b73dcad5b6950276/index.js#L120-L120 "Source code on GitHub") | ||
[index.js:132-132](https://github.com/wanderer/bls-lib/blob/63a2cdafe199f883855c63bd361a125a6b8b464a/index.js#L132-L132 "Source code on GitHub") | ||
@@ -167,3 +180,3 @@ verifies a signature | ||
[index.js:127-127](https://github.com/wanderer/bls-lib/blob/0e97e39f3b15ac41e2d87017b73dcad5b6950276/index.js#L127-L127 "Source code on GitHub") | ||
[index.js:139-139](https://github.com/wanderer/bls-lib/blob/63a2cdafe199f883855c63bd361a125a6b8b464a/index.js#L139-L139 "Source code on GitHub") | ||
@@ -180,3 +193,3 @@ given a pointer to a public key this returns 64 byte Int8Array containing the key | ||
[index.js:134-134](https://github.com/wanderer/bls-lib/blob/0e97e39f3b15ac41e2d87017b73dcad5b6950276/index.js#L134-L134 "Source code on GitHub") | ||
[index.js:146-146](https://github.com/wanderer/bls-lib/blob/63a2cdafe199f883855c63bd361a125a6b8b464a/index.js#L146-L146 "Source code on GitHub") | ||
@@ -193,3 +206,3 @@ given a pointer to a secret key this returns 32 byte Int8Array containing the key | ||
[index.js:141-141](https://github.com/wanderer/bls-lib/blob/0e97e39f3b15ac41e2d87017b73dcad5b6950276/index.js#L141-L141 "Source code on GitHub") | ||
[index.js:153-153](https://github.com/wanderer/bls-lib/blob/63a2cdafe199f883855c63bd361a125a6b8b464a/index.js#L153-L153 "Source code on GitHub") | ||
@@ -206,3 +219,3 @@ given a pointer to a signature this returns 32 byte Int8Array containing the signature | ||
[index.js:148-148](https://github.com/wanderer/bls-lib/blob/0e97e39f3b15ac41e2d87017b73dcad5b6950276/index.js#L148-L148 "Source code on GitHub") | ||
[index.js:160-160](https://github.com/wanderer/bls-lib/blob/63a2cdafe199f883855c63bd361a125a6b8b464a/index.js#L160-L160 "Source code on GitHub") | ||
@@ -218,3 +231,3 @@ generates a secret key given a seed phrase. | ||
[index.js:155-155](https://github.com/wanderer/bls-lib/blob/0e97e39f3b15ac41e2d87017b73dcad5b6950276/index.js#L155-L155 "Source code on GitHub") | ||
[index.js:167-167](https://github.com/wanderer/bls-lib/blob/63a2cdafe199f883855c63bd361a125a6b8b464a/index.js#L167-L167 "Source code on GitHub") | ||
@@ -230,3 +243,3 @@ write a secretKey to memory | ||
[index.js:163-167](https://github.com/wanderer/bls-lib/blob/0e97e39f3b15ac41e2d87017b73dcad5b6950276/index.js#L163-L167 "Source code on GitHub") | ||
[index.js:175-179](https://github.com/wanderer/bls-lib/blob/63a2cdafe199f883855c63bd361a125a6b8b464a/index.js#L175-L179 "Source code on GitHub") | ||
@@ -245,3 +258,3 @@ write a secretKey to memory and returns a pointer to it | ||
[index.js:174-174](https://github.com/wanderer/bls-lib/blob/0e97e39f3b15ac41e2d87017b73dcad5b6950276/index.js#L174-L174 "Source code on GitHub") | ||
[index.js:186-186](https://github.com/wanderer/bls-lib/blob/63a2cdafe199f883855c63bd361a125a6b8b464a/index.js#L186-L186 "Source code on GitHub") | ||
@@ -257,3 +270,3 @@ write a publicKey to memory | ||
[index.js:181-185](https://github.com/wanderer/bls-lib/blob/0e97e39f3b15ac41e2d87017b73dcad5b6950276/index.js#L181-L185 "Source code on GitHub") | ||
[index.js:193-197](https://github.com/wanderer/bls-lib/blob/63a2cdafe199f883855c63bd361a125a6b8b464a/index.js#L193-L197 "Source code on GitHub") | ||
@@ -271,3 +284,3 @@ write a publicKey to memory and returns a pointer to it | ||
[index.js:192-192](https://github.com/wanderer/bls-lib/blob/0e97e39f3b15ac41e2d87017b73dcad5b6950276/index.js#L192-L192 "Source code on GitHub") | ||
[index.js:204-204](https://github.com/wanderer/bls-lib/blob/63a2cdafe199f883855c63bd361a125a6b8b464a/index.js#L204-L204 "Source code on GitHub") | ||
@@ -283,3 +296,3 @@ write a signature to memory | ||
[index.js:199-203](https://github.com/wanderer/bls-lib/blob/0e97e39f3b15ac41e2d87017b73dcad5b6950276/index.js#L199-L203 "Source code on GitHub") | ||
[index.js:211-215](https://github.com/wanderer/bls-lib/blob/63a2cdafe199f883855c63bd361a125a6b8b464a/index.js#L211-L215 "Source code on GitHub") | ||
@@ -297,3 +310,3 @@ write a signature to memory and returns a pointer to it | ||
[index.js:211-211](https://github.com/wanderer/bls-lib/blob/0e97e39f3b15ac41e2d87017b73dcad5b6950276/index.js#L211-L211 "Source code on GitHub") | ||
[index.js:223-223](https://github.com/wanderer/bls-lib/blob/63a2cdafe199f883855c63bd361a125a6b8b464a/index.js#L223-L223 "Source code on GitHub") | ||
@@ -310,3 +323,3 @@ Recovers a secret key for a group given the groups secret keys shares and the groups ids | ||
[index.js:219-219](https://github.com/wanderer/bls-lib/blob/0e97e39f3b15ac41e2d87017b73dcad5b6950276/index.js#L219-L219 "Source code on GitHub") | ||
[index.js:231-231](https://github.com/wanderer/bls-lib/blob/63a2cdafe199f883855c63bd361a125a6b8b464a/index.js#L231-L231 "Source code on GitHub") | ||
@@ -323,3 +336,3 @@ Recovers a public key for a group given the groups public keys shares and the groups ids | ||
[index.js:227-227](https://github.com/wanderer/bls-lib/blob/0e97e39f3b15ac41e2d87017b73dcad5b6950276/index.js#L227-L227 "Source code on GitHub") | ||
[index.js:239-239](https://github.com/wanderer/bls-lib/blob/63a2cdafe199f883855c63bd361a125a6b8b464a/index.js#L239-L239 "Source code on GitHub") | ||
@@ -336,3 +349,3 @@ Recovers a signature for a group given the groups public keys shares and the groups ids | ||
[index.js:235-235](https://github.com/wanderer/bls-lib/blob/0e97e39f3b15ac41e2d87017b73dcad5b6950276/index.js#L235-L235 "Source code on GitHub") | ||
[index.js:247-247](https://github.com/wanderer/bls-lib/blob/63a2cdafe199f883855c63bd361a125a6b8b464a/index.js#L247-L247 "Source code on GitHub") | ||
@@ -349,3 +362,3 @@ Creates a secket key share for a group member given the groups members id (which is a the secret key) and array of master secret keys | ||
[index.js:243-243](https://github.com/wanderer/bls-lib/blob/0e97e39f3b15ac41e2d87017b73dcad5b6950276/index.js#L243-L243 "Source code on GitHub") | ||
[index.js:255-255](https://github.com/wanderer/bls-lib/blob/63a2cdafe199f883855c63bd361a125a6b8b464a/index.js#L255-L255 "Source code on GitHub") | ||
@@ -352,0 +365,0 @@ Creates a public key share for a group member given the groups members id (which is a the secret key) and array of master public keys |
16
index.js
@@ -0,1 +1,2 @@ | ||
const nop = require('nop') | ||
const mod = require('./build/bls_lib.js') | ||
@@ -7,3 +8,3 @@ const exportedFuncs = require('./exportedFuncs.json') | ||
let init = false | ||
let initCb | ||
let initCb = nop | ||
@@ -96,3 +97,3 @@ /** | ||
/** | ||
* creates an ID to use in with threshold groups | ||
* creates an ID from an int to use in with threshold groups | ||
* @param {number} sk - a pointer to the secret key, secret key stuct is used to hold the id | ||
@@ -109,2 +110,13 @@ * @param {number} n - a int repsenting the ID. n cannot be zero. | ||
/** | ||
* creates an ID from an int and returns a pointer to it | ||
* @param {number} n - a int repsenting the ID. n cannot be zero. | ||
* @return {number} | ||
*/ | ||
exports.idImportFromInt = function (n) { | ||
const sk = exports.secretKey() | ||
exports.idSetInt(sk, n) | ||
return sk | ||
} | ||
/** | ||
* signs a message | ||
@@ -111,0 +123,0 @@ * @param {number} sig - a pointer to the a signature |
{ | ||
"name": "bls-lib", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"description": "this libary provides primitives for creating and verify BLS threshold signatures", | ||
@@ -49,3 +49,6 @@ "main": "index.js", | ||
] | ||
}, | ||
"dependencies": { | ||
"nop": "^1.0.0" | ||
} | ||
} |
# SYNOPSIS | ||
[![NPM Package](https://img.shields.io/npm/v/bls-lib.svg?style=flat-square)](https://www.npmjs.org/package/bls-lib) | ||
@@ -4,0 +3,0 @@ [![Build Status](https://img.shields.io/travis/wanderer/bls-lib.svg?branch=master&style=flat-square)](https://travis-ci.org/wanderer/bls-lib) |
@@ -204,4 +204,3 @@ const tape = require('tape') | ||
t.plan(2) | ||
const sec = bls.secretKey() | ||
bls.idSetInt(sec, 7) | ||
const sec = bls.idImportFromInt(7) | ||
@@ -208,0 +207,0 @@ const secKey = bls.secretKeyExport(sec) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
29265712
8646
1
55
59
+ Addednop@^1.0.0
+ Addednop@1.0.0(transitive)