@nuggetslife/vc 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Cargo.toml CHANGED
@@ -7,6 +7,7 @@ version = "0.0.0"
7
7
  crate-type = ["cdylib"]
8
8
 
9
9
  [dependencies]
10
+ # Default enable napi4 feature, see https://nodejs.org/api/n-api.html#node-api-version-matrix
10
11
  base64 = "0.22.1"
11
12
  bs58 = "0.5.1"
12
13
  # Default enable napi4 feature, see https://nodejs.org/api/n-api.html#node-api-version-matrix
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "@nuggetslife/vc",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "main": "index.js",
5
5
  "types": "index.d.ts",
6
6
  "napi": {
7
7
  "name": "vc",
8
8
  "triples": {
9
+ "defaults": false,
9
10
  "additional": [
10
11
  "aarch64-apple-darwin"
11
12
  ]
@@ -13,6 +14,8 @@
13
14
  },
14
15
  "license": "MIT",
15
16
  "devDependencies": {
17
+ "@napi-rs/cli": "^2.18.3",
18
+ "ava": "^6.0.1",
16
19
  "@mattrglobal/bls12381-key-pair": "^1.2.1",
17
20
  "@nuggetslife/ffi-bbs-signatures": "^1.3.6",
18
21
  "@types/node": "^20.14.9",
@@ -35,9 +38,6 @@
35
38
  },
36
39
  "packageManager": "yarn@4.3.1",
37
40
  "optionalDependencies": {
38
- "@nuggetslife/vc-win32-x64-msvc": "0.0.3",
39
- "@nuggetslife/vc-darwin-x64": "0.0.3",
40
- "@nuggetslife/vc-linux-x64-gnu": "0.0.3",
41
- "@nuggetslife/vc-darwin-arm64": "0.0.3"
41
+ "@nuggetslife/vc-darwin-arm64": "0.0.4"
42
42
  }
43
43
  }
package/README.md DELETED
@@ -1,9 +0,0 @@
1
- build
2
- ```bash
3
- napi build --platform --release
4
- ```
5
-
6
- test
7
- ```bash
8
- node test.mjs
9
- ```
package/test.mjs DELETED
@@ -1,46 +0,0 @@
1
- import test from 'node:test';
2
- import assert from 'node:assert';
3
- import { Bls12381G2KeyPair } from '@mattrglobal/bls12381-key-pair';
4
- import { Bls12381G2KeyPair as NewKeyPairClass } from './index.js'
5
- import bs58 from 'bs58'
6
- import bbs from '@nuggetslife/ffi-bbs-signatures'
7
-
8
- const seed = Buffer.alloc(32, 0)
9
- const address = '0x581510277Bc56802dE75BA021b66873437e0169f'
10
- const addressBase58 = bs58.encode(Buffer.from(address.slice(2), 'hex'))
11
-
12
- test('gen keypair for same seed', async () => {
13
- const mattr = await Bls12381G2KeyPair.generate({ seed, });
14
- const harry = await NewKeyPairClass.generate({ seed })
15
- const ffi = await bbs.generateBls12381G2KeyPair(seed)
16
- const ffi_sec_key = bs58.encode(Buffer.from(ffi.secretKey))
17
- const ffi_pub_key = bs58.encode(Buffer.from(ffi.publicKey))
18
-
19
- // private keys match
20
- assert.equal(mattr.privateKey, harry.privateKey)
21
- assert.equal(ffi_sec_key, harry.privateKey)
22
-
23
- // public keys match
24
- assert.equal(mattr.publicKey, harry.publicKey)
25
- assert.equal(ffi_pub_key, harry.publicKey)
26
- })
27
-
28
- test('keypair from keypair', async () => {
29
- const mattr = await Bls12381G2KeyPair.generate({
30
- id: `did:nuggets:${addressBase58}#bls12381g2`,
31
- controller: `did:nuggets:${addressBase58}`,
32
- seed,
33
- });
34
- const harry = await NewKeyPairClass.from({
35
- id: mattr.id,
36
- controller: mattr.controller,
37
- publicKeyBase58: mattr.publicKey,
38
- privateKeyBase58: mattr.privateKey,
39
- });
40
-
41
- assert.equal(mattr.id, harry.id)
42
- assert.equal(mattr.controller, harry.controller)
43
- assert.equal(mattr.privateKey, harry.privateKey)
44
- assert.equal(mattr.publicKey, harry.publicKey)
45
- })
46
-