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

polyfills are correctly resolved now, but some crypto polyfill is not implemented yet #10

Closed
wants to merge 4 commits into from

Conversation

clangenb
Copy link
Contributor

@clangenb clangenb commented Apr 30, 2024

Blocker: unjs/unenv#177

Currently getting the following error during encryption:

 Error: Error during encryption. Original error: Error: [unenv] crypto.createHash is not implemented yet!

Workarounds:

@clangenb clangenb marked this pull request as draft April 30, 2024 13:53
package.json Outdated
"vite": "^5.2.10",
"vue": "^3.4.26",
"vue-router": "^4.3.2"
},
"dependencies": {
"@encointer/worker-api": "^0.12.4",
"@encointer/worker-api": "^0.12.5-alpha.0",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doesn't fix anything

@brenzi
Copy link
Contributor

brenzi commented Apr 30, 2024

there are so many "unimplented" calls in unenv node crypto that I fear this rabbit hole is deep. simply implementing crateHash will likely just lead us to the next missing piece

@brenzi
Copy link
Contributor

brenzi commented Apr 30, 2024

AFAIU, polkadot-api uses wasm for crypto stuff. They clearly implemented hashing and I geuss even RSA could we just use polkadot api to do the missing stuff?
https://www.npmjs.com/package/@polkadot/wasm-crypto

hint on RSA:
https://polkadot.study/tutorials/wallet-with-polkadot-js-and-react-with-typescript/step3#basic-concepts
but I couldn't find that.

A more involved option would be to replace RSA with NaCl:
https://github.com/polkadot-js/common/tree/master/packages/util-crypto/src/nacl
this might allow us to have an ed25519 key for asymmetric encryption (saw hints at this but no impl), but we'd need to touch the worker as well, a "breaks everything" change

@brenzi
Copy link
Contributor

brenzi commented May 1, 2024

better docs on NaCl asymmetric encryption:
https://pynacl.readthedocs.io/en/latest/public/

tracking issue: integritee-network/worker#1597

@clangenb
Copy link
Contributor Author

clangenb commented May 2, 2024

No longer needed, fixed crypto with #13

@clangenb clangenb closed this May 2, 2024
@clangenb clangenb deleted the cl/fix-polyfills branch May 4, 2024 08:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants