Conversation
This uses crypto-browserify with a patched browserify-aes library that supports aes-ccm as we need using npm override. The tests are copied from CryptoNode and validate it basically working. I decided for an own package for now because crypto-browserify is using a lot of outdated dependencies, so these messages should not infect matter.js main package for now and can be used when needed.
This adds some more libraries and a bt of handling to web tests. ...
|
When I get the error in https://github.com/project-chip/matter.js/actions/runs/9555385608/job/26338682930#step:5:309 right then it refers to https://github.com/browserify/randombytes/blob/b4eb4126fccc503e375853ca7b3e96aaa34af9e6/browser.js#L15 ... is then globalThis not defined? |
|
The version of randombytes in NPM does not appear to use globalThis, it uses an undefined variable called "global", presumably expecting a bundler to define it for the browser. There are a few ways to fix:
|
|
I just remembered you guys were targeting react native... I checked and it looks like react-native-quick-crypto supports AES-CCM. That might be worth exploring. Then sticking with the Node API could be an advantage as I'm not sure if they've even implemented enough of CryptoSubtle for that to be viable. |
To experiment around with it better and also for react-native here is an intermediate Pure-JS Crypto. It bases on crypto-browserify with a patched aes-ccm lib based on browserify/browserify-aes#57
It is done as an own packge because is uses several deprecated packages which generate several warnings and we might not need to "Infec"T the main matter.js package with that. It can be used here if needed.
@lauckhart tests work with CJS and ESM already, just web has issues and tell about "global not found" ... where can I tweak that in?
Still TODOs: