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

feat!: remove default instance #188

Merged
merged 2 commits into from
Aug 10, 2022

Conversation

alanshaw
Copy link

@alanshaw alanshaw commented Aug 9, 2022

In Cloudflare workers you cannot call some crypto functions outside of a request:

Error: Some functionality, such as asynchronous I/O (fetch, Cache API, KV), timeouts (setTimeout, setInterval), and generating random values (crypto.getRandomValues, crypto.subtle.generateKey), can only be performed while handling a request.

This error occurs when importing the module because a default instance is created up front (the NOISE export).

This PR removes the default NOISE export to allow folks to create an instance when needed.

BREAKING CHANGE: The default instance NOISE is not longer created or exported. Import Noise and use new Noise() in place of NOISE.

resolves #180

@alanshaw alanshaw requested a review from a team as a code owner August 9, 2022 14:51
@alanshaw alanshaw changed the title refactor: remove default instance feat: remove default instance Aug 9, 2022
Copy link
Member

@wemeetagain wemeetagain left a comment

Choose a reason for hiding this comment

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

LGTM

@mpetrunic mpetrunic changed the title feat: remove default instance feat!: remove default instance Aug 10, 2022
@mpetrunic mpetrunic merged commit 1358409 into ChainSafe:master Aug 10, 2022
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.

How to avoid creating the default Noise instance?
3 participants