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: Increase webcrypto compatibility #767

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

richarddavison
Copy link
Contributor

@richarddavison richarddavison commented Jan 3, 2025

Issue # (if available)

#184

Description of changes

Increase compatibility. More supported algorithms and methods.

TODO:

  • Export JWK
  • Import JWK
  • Import Spki
  • Import PKCS8
  • Derive bits

Checklist

  • Created unit tests in tests/unit and/or in Rust for my feature if needed
  • Ran make fix to format JS and apply Clippy auto fixes
  • Made sure my code didn't add any additional warnings: make check
  • Added relevant type info in types/ directory
  • Updated documentation if needed (API.md/README.md/Other)

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@@ -250,6 +251,8 @@ impl ModuleDef for CryptoModule {
default.set(class_name, ctor)?;
}

let crypto: Object = ctx.globals().get("crypto")?;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Lets stop doing that, it is very annoying that the user of a given module is required to call the init function just because the module eval expect a global.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agree!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This needs to be addressed in all places. I will create a PR fixing this where we'll try getting from globals first and if not existing create a new object. This requires refactoring the object created in init to be moved to a method.

@richarddavison richarddavison marked this pull request as ready for review January 9, 2025 22:16
@richarddavison richarddavison changed the title WIP: feat: Increase webcrypto compatibility feat: Increase webcrypto compatibility Jan 9, 2025
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