docknetwork / crypto-wasm Goto Github PK
View Code? Open in Web Editor NEWWASM wrapper over the crypto library
License: Apache License 2.0
WASM wrapper over the crypto library
License: Apache License 2.0
Hello,
I'm facing some issues while running the bbs-signatures-sample-browser. Despite following the guide, some modules cannot be found "Module not found: Error: Can't resolve '../../lib' in crypto-wasm/sample/browser". I noticed that also the tests provided in "tests/js" import functions from "../../lib". However, I cannot find the lib directory in your project.
When importing crypto-wasm-ts
code as follows:
import {
BBSPlusBlindedCredentialRequestBuilder,
CredentialSchema,
initializeWasm,
SUBJECT_STR,
} from "@docknetwork/crypto-wasm-ts";
and running tsc
, I get the following errors:
➜ front git:(main) ✗ pnpm build
> [email protected] build /home/nicobao/zkorum/zkorum/services/front
> tsc && vite build
node_modules/.pnpm/@[email protected]/node_modules/@docknetwork/crypto-wasm/lib/types/PSPoKSigProof.ts:1:10 - error TS1484: 'PSSig' is a type and must be imported using a type-only import when 'verbatimModuleSyntax' is enabled.
1 import { PSSig } from "./PSSig";
~~~~~
node_modules/.pnpm/@[email protected]/node_modules/@docknetwork/crypto-wasm/lib/types/PSPoKSigProtocol.ts:1:10 - error TS1484: 'PSSig' is a type and must be imported using a type-only import when 'verbatimModuleSyntax' is enabled.
1 import { PSSig } from "./PSSig";
~~~~~
node_modules/.pnpm/@[email protected]/node_modules/@docknetwork/crypto-wasm/lib/types/index.ts:14:10 - error TS1205: Re-exporting a type when 'verbatimModuleSyntax' is enabled requires using 'export type'.
14 export { BbsPlusSigParams } from "./BbsPlusSigParams";
~~~~~~~~~~~~~~~~
node_modules/.pnpm/@[email protected]/node_modules/@docknetwork/crypto-wasm/lib/types/index.ts:15:10 - error TS1205: Re-exporting a type when 'verbatimModuleSyntax' is enabled requires using 'export type'.
15 export { BbsPlusSig } from "./BbsPlusSig";
~~~~~~~~~~
node_modules/.pnpm/@[email protected]/node_modules/@docknetwork/crypto-wasm/lib/types/index.ts:16:10 - error TS1205: Re-exporting a type when 'verbatimModuleSyntax' is enabled requires using 'export type'.
16 export { BbsPlusPoKSigProtocol } from "./BbsPlusPoKSigProtocol";
~~~~~~~~~~~~~~~~~~~~~
node_modules/.pnpm/@[email protected]/node_modules/@docknetwork/crypto-wasm/lib/types/index.ts:17:10 - error TS1205: Re-exporting a type when 'verbatimModuleSyntax' is enabled requires using 'export type'.
17 export { BbsPlusPoKSigProof } from "./BbsPlusPoKSigProof";
~~~~~~~~~~~~~~~~~~
node_modules/.pnpm/@[email protected]/node_modules/@docknetwork/crypto-wasm/lib/types/index.ts:18:10 - error TS1205: Re-exporting a type when 'verbatimModuleSyntax' is enabled requires using 'export type'.
18 export { BbsSigParams } from "./BbsSigParams";
~~~~~~~~~~~~
node_modules/.pnpm/@[email protected]/node_modules/@docknetwork/crypto-wasm/lib/types/index.ts:19:10 - error TS1205: Re-exporting a type when 'verbatimModuleSyntax' is enabled requires using 'export type'.
19 export { BbsSig } from "./BbsSig";
~~~~~~
node_modules/.pnpm/@[email protected]/node_modules/@docknetwork/crypto-wasm/lib/types/index.ts:20:10 - error TS1205: Re-exporting a type when 'verbatimModuleSyntax' is enabled requires using 'export type'.
20 export { BbsPoKSigProtocol } from "./BbsPoKSigProtocol";
~~~~~~~~~~~~~~~~~
node_modules/.pnpm/@[email protected]/node_modules/@docknetwork/crypto-wasm/lib/types/index.ts:21:10 - error TS1205: Re-exporting a type when 'verbatimModuleSyntax' is enabled requires using 'export type'.
21 export { BbsPoKSigProof } from "./BbsPoKSigProof";
~~~~~~~~~~~~~~
node_modules/.pnpm/@[email protected]/node_modules/@docknetwork/crypto-wasm/lib/types/index.ts:22:10 - error TS1205: Re-exporting a type when 'verbatimModuleSyntax' is enabled requires using 'export type'.
22 export { PSCommitmentOrMessage } from "./PSCommitmentOrMessage";
~~~~~~~~~~~~~~~~~~~~~
node_modules/.pnpm/@[email protected]/node_modules/@docknetwork/crypto-wasm/lib/types/index.ts:23:10 - error TS1205: Re-exporting a type when 'verbatimModuleSyntax' is enabled requires using 'export type'.
23 export { PSSigParams } from "./PSSigParams";
~~~~~~~~~~~
node_modules/.pnpm/@[email protected]/node_modules/@docknetwork/crypto-wasm/lib/types/index.ts:24:10 - error TS1205: Re-exporting a type when 'verbatimModuleSyntax' is enabled requires using 'export type'.
24 export { PSSig } from "./PSSig";
~~~~~
node_modules/.pnpm/@[email protected]/node_modules/@docknetwork/crypto-wasm/lib/types/index.ts:25:10 - error TS1205: Re-exporting a type when 'verbatimModuleSyntax' is enabled requires using 'export type'.
25 export { PSPoKSigProtocol } from "./PSPoKSigProtocol";
~~~~~~~~~~~~~~~~
node_modules/.pnpm/@[email protected]/node_modules/@docknetwork/crypto-wasm/lib/types/index.ts:26:10 - error TS1205: Re-exporting a type when 'verbatimModuleSyntax' is enabled requires using 'export type'.
26 export { PSPoKSigProof } from "./PSPoKSigProof";
~~~~~~~~~~~~~
node_modules/.pnpm/@[email protected]/node_modules/@docknetwork/crypto-wasm/lib/types/index.ts:27:10 - error TS1205: Re-exporting a type when 'verbatimModuleSyntax' is enabled requires using 'export type'.
27 export { IKeypair } from "./IKeypair";
~~~~~~~~
node_modules/.pnpm/@[email protected]/node_modules/@docknetwork/crypto-wasm/lib/types/index.ts:28:10 - error TS1205: Re-exporting a type when 'verbatimModuleSyntax' is enabled requires using 'export type'.
28 export { VerifyResult } from "./VerifyResult";
~~~~~~~~~~~~
node_modules/.pnpm/@[email protected]/node_modules/@docknetwork/crypto-wasm/lib/types/index.ts:29:10 - error TS1205: Re-exporting a type when 'verbatimModuleSyntax' is enabled requires using 'export type'.
29 export { IUniversalAccumulator } from "./IUniversalAccumulator";
~~~~~~~~~~~~~~~~~~~~~
node_modules/.pnpm/@[email protected]/node_modules/@docknetwork/crypto-wasm/lib/types/index.ts:30:10 - error TS1205: Re-exporting a type when 'verbatimModuleSyntax' is enabled requires using 'export type'.
30 export { INonMembershipWitness } from "./INonMembershipWitness";
~~~~~~~~~~~~~~~~~~~~~
node_modules/.pnpm/@[email protected]/node_modules/@docknetwork/crypto-wasm/lib/types/index.ts:31:10 - error TS1205: Re-exporting a type when 'verbatimModuleSyntax' is enabled requires using 'export type'.
31 export { LCTerm, LC, Constraint, R1CS } from "./R1CS";
~~~~~~
node_modules/.pnpm/@[email protected]/node_modules/@docknetwork/crypto-wasm/lib/types/index.ts:31:18 - error TS1205: Re-exporting a type when 'verbatimModuleSyntax' is enabled requires using 'export type'.
31 export { LCTerm, LC, Constraint, R1CS } from "./R1CS";
~~
node_modules/.pnpm/@[email protected]/node_modules/@docknetwork/crypto-wasm/lib/types/index.ts:31:22 - error TS1205: Re-exporting a type when 'verbatimModuleSyntax' is enabled requires using 'export type'.
31 export { LCTerm, LC, Constraint, R1CS } from "./R1CS";
~~~~~~~~~~
node_modules/.pnpm/@[email protected]/node_modules/@docknetwork/crypto-wasm/lib/types/index.ts:31:34 - error TS1205: Re-exporting a type when 'verbatimModuleSyntax' is enabled requires using 'export type'.
31 export { LCTerm, LC, Constraint, R1CS } from "./R1CS";
~~~~
src/credential/credential.ts:9:10 - error TS2305: Module '"../api"' has no exported member 'CredentialCreateOrGetEmailCredentialsPost200Response'.
9 type CredentialCreateOrGetEmailCredentialsPost200Response,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Found 24 errors in 4 files.
Errors Files
1 node_modules/.pnpm/@[email protected]/node_modules/@docknetwork/crypto-wasm/lib/types/PSPoKSigProof.ts:1
1 node_modules/.pnpm/@[email protected]/node_modules/@docknetwork/crypto-wasm/lib/types/PSPoKSigProtocol.ts:1
21 node_modules/.pnpm/@[email protected]/node_modules/@docknetwork/crypto-wasm/lib/types/index.ts:14
1 src/credential/credential.ts:9
tsconfig.json
:
{
"compilerOptions": {
"target": "ES2020",
"useDefineForClassFields": true,
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"module": "ESNext",
"skipLibCheck": true,
/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
// "isolatedModules": true, // // causes errors in crypto-wasm ....!! and if true, redundant with verbatimModuleSyntax, was true by default with vite
// https://vitejs.dev/guide/features.html#transpile-only
"verbatimModuleSyntax": true, // causes isolatedModules: true by default which causes issues with crypto-wasm...
"noEmit": true,
"jsx": "react-jsx",
/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true,
"forceConsistentCasingInFileNames": true,
"maxNodeModuleJsDepth": 0,
"types": ["vite-plugin-svgr/client"]
},
"include": ["src"],
"references": [{ "path": "./tsconfig.node.json" }]
}
I checked and the error is caused by "isolatedModules": true which is set automatically by "verbattimModuleSyntax": true
Vite requires setting "isolatedModules": true
I tried using skipLibCheck
, but for some reasons it works for the other libraries, and not for this one! No idea why, it's driving me crazy!
If you may, I will send a small PR to use export type
instead of export
when adequate.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.