Skip to content

Commit

Permalink
Some optimizations and emsdk updates
Browse files Browse the repository at this point in the history
  • Loading branch information
fuzzc0re committed Aug 5, 2023
1 parent e55c575 commit a47009f
Show file tree
Hide file tree
Showing 13 changed files with 886 additions and 1,098 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
uses: mymindstorm/setup-emsdk@v11
with:
# Make sure to set a version number!
version: 3.1.42
version: 3.1.44
# This is the name of the cache folder.
# The cache folder will be placed in the build directory,
# so make sure it doesn't conflict with anything!
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
uses: mymindstorm/setup-emsdk@v11
with:
# Make sure to set a version number!
version: 3.1.42
version: 3.1.44
# This is the name of the cache folder.
# The cache folder will be placed in the build directory,
# so make sure it doesn't conflict with anything!
Expand Down
1,489 changes: 844 additions & 645 deletions package-lock.json

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@deliberative/crypto",
"description": "Libsodium and Shamir secret sharing wasm module for nodejs and the browser.",
"version": "0.9.3",
"description": "Libsodium, Merkle trees, Shamir secret sharing wasm module for nodejs and the browser.",
"version": "1.0.0",
"repository": {
"type": "git",
"url": "https://github.com/deliberative/crypto.git"
Expand Down Expand Up @@ -93,8 +93,8 @@
"@rollup/plugin-url": "^8.0.0",
"@types/emscripten": "^1.39.6",
"@types/jest": "^29.0.0",
"@typescript-eslint/eslint-plugin": "^5.9.0",
"@typescript-eslint/parser": "^5.9.0",
"@typescript-eslint/eslint-plugin": "^6.1.0",
"@typescript-eslint/parser": "^6.1.0",
"cross-env": "^7.0.3",
"eslint": "^8.6.0",
"eslint-config-prettier": "^8.3.0",
Expand All @@ -106,7 +106,7 @@
"jest-environment-jsdom": "^29.0.0",
"nanobench": "^3.0.0",
"npm-run-all": "^4.1.5",
"prettier": "^2.3.1",
"prettier": "^3.0.0",
"rollup": "^3.1.0",
"rollup-plugin-analyzer": "^4.0.0",
"rollup-plugin-copy": "^3.4.0",
Expand Down
26 changes: 26 additions & 0 deletions scripts/dcryptoMethodsModule.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,32 @@ export interface DCryptoMethodsModule extends EmscriptenModule {
root: number, // Uint8Array.byteOffset
proof: number, // Uint8Array.byteOffset
): number;

_generate_commitment_details(
IDENTITIES_LEN: number,
NONCE_LEN: number,
nonces: number,
public_keys: number,
secret_keys: number,
reversible_details: number,
irreversible_details: number,
): number;
_generate_ownership_proof(
PROOF_LEN: number,
IDENTITIES_LEN: number,
NONCE_LEN: number,
commitment: number,
previousCommit: number,
nonces: number,
public_keys: number,
secret_key: number,
proof: number,
): number;
_verify_ownership_proof(
PROOF_LEN: number,
commitment: number, // Uint8Array.byteOffset
proof: number, // Uint8Array.byteOffset
): number;
}

declare const dcryptoMethodsModule: EmscriptenModuleFactory<DCryptoMethodsModule>;
Expand Down
4 changes: 2 additions & 2 deletions src/asymmetric/keyPair.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const newKeyPair = async (
? module.wasmMemory
: dcryptoMemory.newKeyPairMemory();

const dcryptoModule = await dcryptoMethodsModule({ wasmMemory });
const dcryptoModule = module || (await dcryptoMethodsModule({ wasmMemory }));

const ptr1 = dcryptoModule._malloc(crypto_sign_ed25519_PUBLICKEYBYTES);
const publicKey = new Uint8Array(
Expand Down Expand Up @@ -143,7 +143,7 @@ const keyPairFromSecretKey = async (
? module.wasmMemory
: dcryptoMemory.keyPairFromSecretKeyMemory();

const dcryptoModule = await dcryptoMethodsModule({ wasmMemory });
const dcryptoModule = module || (await dcryptoMethodsModule({ wasmMemory }));

const ptr1 = dcryptoModule._malloc(crypto_sign_ed25519_PUBLICKEYBYTES);
const pk = new Uint8Array(
Expand Down
2 changes: 1 addition & 1 deletion src/asymmetric/verify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const verify = async (
? module.wasmMemory
: dcryptoMemory.verifyMemory(len);

const dcryptoModule = await dcryptoMethodsModule({ wasmMemory });
const dcryptoModule = module || (await dcryptoMethodsModule({ wasmMemory }));

const ptr1 = dcryptoModule._malloc(len * Uint8Array.BYTES_PER_ELEMENT);
const dataArray = new Uint8Array(
Expand Down
143 changes: 0 additions & 143 deletions src/c/commitment/generate_commit_details.c

This file was deleted.

90 changes: 0 additions & 90 deletions src/c/commitment/irreversible_commit.c

This file was deleted.

Loading

0 comments on commit a47009f

Please sign in to comment.