Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Asm support #22

Merged
merged 3 commits into from
Nov 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
!.yarn/sdks
build/
build-cjs/
build-asm/
build-wasm/
cc-test-reporter
coverage/
node_modules/
Expand All @@ -21,3 +23,6 @@ yarn-debug.log*
yarn-error.log*
target/
pkg/

binaryen/
bindgen/
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@
"packages/*"
],
"bin": {
"build:wasm": "scripts/build-wasm.js"
"build-wasm": "scripts/build-wasm.js",
"install-build-deps": "scripts/install-build-deps.js"
},
"scripts": {
"build": "zcloak-dev-build-ts",
"build:release": "zcloak-ci-ghact-build",
"build:wasm": "install-build-deps && build-wasm",
"clean": "zcloak-dev-clean-build",
"lint": "zcloak-dev-run-lint && zcloak-dev-lint-dependencies",
"postinstall": "zcloak-dev-yarn-only",
Expand All @@ -34,7 +36,8 @@
},
"devDependencies": {
"@types/jest": "^27.4.0",
"@zcloak/dev": "^0.6.5"
"@zcloak/dev": "^0.6.5",
"fs-extra": "^10.1.0"
},
"resolutions": {
"typescript": "^4.8.4"
Expand Down
2 changes: 1 addition & 1 deletion packages/crypto/src/initCrypto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ import { initWasm as initPolkadotWasm } from '@polkadot/wasm-crypto/initWasmAsm'
import { initWasm } from '@zcloak/wasm';

export function initCrypto() {
return Promise.all([initWasm(), initPolkadotWasm()]);
return Promise.all([initWasm(false), initPolkadotWasm()]);
}
6 changes: 6 additions & 0 deletions packages/did/src/did/details.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ export abstract class DidDetails extends DidKeyring implements IDidDetails {
this.service = service;
}

/**
* Get the first key by `key`
*/
public getKeyUrl(key: DidKeys): DidUrl {
const didUrl = Array.from(this[key] ?? [])[0];

Expand All @@ -74,6 +77,9 @@ export abstract class DidDetails extends DidKeyring implements IDidDetails {
return didUrl;
}

/**
* Get [[KeyRelationship]] by `id`
*/
public get(id: DidUrl): KeyRelationship {
const method = this.keyRelationship.get(id);

Expand Down
101 changes: 4 additions & 97 deletions packages/wasm/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/wasm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ version = "0.0.0"
crate-type = ["cdylib"]

[dependencies]
rescue = {git = "https://github.com/zCloak-Network/rescue-hash", branch = "dev", default-features = false}
rescue = {git = "https://github.com/zCloak-Network/rescue-hash", branch = "main", default-features = false}
wasm-bindgen = "=0.2.83"
wee_alloc = "0.4.3"

Expand Down
4 changes: 4 additions & 0 deletions packages/wasm/src/asm.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// Copyright 2021-2022 zcloak authors & contributors
// SPDX-License-Identifier: Apache-2.0

export default asm = any;
Loading