Skip to content

[WIP] Add sample wasm-bindgen configuration #1

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

thibmeu
Copy link
Owner

@thibmeu thibmeu commented Jul 4, 2023

Wrap tlock_age methods with wasm-bindgen to allow for a use in JavaScript and TypeScript. This is done through an optional feature js.
Armoring is supported.

Methods use a Uint8Array containing the full source to encrypt or decrypt. Result is returned as Uint8Array.

Two targets have been tested

  • NodeJS wasm-pack build --target nodejs -- --features js. Then const tlock_age = require('./pkg')
  • Web wasm-pack build --target web -- --features js. You can then point your bundler to use ./pkg. Don't forget to call the default export init() to load the module in browser.

TODO

  • Add JS use examples
  • Add wasm-build documentation
  • Add lib_js.rs code comment
  • Add tests for JS methods

Wrap `tlock_age` methods with wasm-bindgen to allow for a use in JavaScript and TypeScript.
This is done through an optional feature `js`.
Armoring is supported.

Methods use a Uint8Array containing the full source to encrypt or decrypt. Result is returned as Uint8Array.

Two targets have been tested
- NodeJS `wasm-pack build --target nodejs -- --features js`. Then `const tlock_age = require('./pkg')`
- Web `wasm-pack build --target web -- --features js`. You can then point your bundler to use `./pkg`. Don't forget to call the default export `init()` to load the module in browser.
@thibmeu thibmeu added the enhancement New feature or request label Jul 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant