-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
TypeError: Cannot read properties of undefined (reading 'importKey') #6485
Comments
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. If you believe this was a mistake, please comment. |
So I suggest just to give the user a clear error message indicating that |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. If you believe this was a mistake, please comment. |
I agree with you |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. If you believe this was a mistake, please comment. |
I totally agree with you my friend |
Description
Unclear error is thrown when calling
encrypt
fromweb3-eth-accounts
in an in-secured environment. This could happen when using the library with a remote website withhttp
(and nothttps
).However, I checked this using Jest with
jsdom
; And in this case it is also an in-secured environment. So, this issue was detected usingjsdom
but it applies to other scenarios (remote http websites).It also worth noting that it could be implemented for jsdom later, and there are polyfiles for it, see this issue for more: jsdom/jsdom#1612
Expected behavior
To throw a meaningful error in case some functionality is not available.
Actual behavior
Throws:
TypeError: Cannot read properties of undefined (reading 'importKey')
Steps to reproduce the behavior
test/unit/account.test.ts
inside the packageweb3-eth-accounts
:TextEncoder
before the imports:describe('encrypt', () => {
and replace with:describe.only('encrypt', () => {
cd packages/web3-eth-accounts && yarn test account.test.ts
Logs
The text was updated successfully, but these errors were encountered: