This repository has been archived by the owner on Apr 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add js-sys as a dependency * Use js-sys Error when returning errors in wasm-bindgen functions * Improve error handling * Error handling for mnemonic to pair * Comments * Re-build npm package * Use same version of this-error as we use elsewhere to avoid conflicts * Use release version of x25519-dalek * Rebuild * Zeroize buffer in derive_static_secret * Rebuild
- Loading branch information
Showing
7 changed files
with
273 additions
and
155 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,24 +2,28 @@ | |
name = "x25519-chacha20poly1305" | ||
version = "0.1.0" | ||
edition = "2021" | ||
authors = [ "John Sahhar <[email protected]>" ] | ||
authors = ["John Sahhar <[email protected]>"] | ||
license = "MIT OR Apache-2.0" | ||
description = "x25519 & chacha20poly1305" | ||
repository = "https://github.com/entropyxyz/x25519-chacha20poly1305" | ||
|
||
[dependencies] | ||
hex = "*" | ||
bip39 ={ git="https://github.com/infincia/bip39-rs.git", tag="v0.6.0-beta.1" } | ||
bip39 = { git = "https://github.com/infincia/bip39-rs.git", tag = "v0.6.0-beta.1" } | ||
wasm-bindgen = "0.2.83" | ||
x25519-dalek = { version = "2.0.0-rc.2", features = ["static_secrets"] } | ||
serde ={ version="1.0", features=["derive"] } | ||
serde_json ="1.0" | ||
blake2 ="0.10.4" | ||
chacha20poly1305="0.10.1" | ||
sp-core ="6.0.0" | ||
generic-array ="0.14.6" | ||
x25519-dalek = { version = "2.0.0", features = ["static_secrets"] } | ||
serde = { version = "1.0", features = ["derive"] } | ||
serde_json = "1.0" | ||
blake2 = "0.10.4" | ||
chacha20poly1305 = "0.10.1" | ||
sp-core = "6.0.0" | ||
generic-array = "0.14.6" | ||
rand_core = { version = "0.6.4", features = ["getrandom"] } | ||
getrandom = { version = "0.2", features = ["js"] } | ||
schnorrkel = "0.9.1" | ||
js-sys = "0.3.64" | ||
thiserror = "1.0.47" | ||
zeroize = "1.5.7" | ||
|
||
[lib] | ||
crate-type = ["cdylib", "rlib"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,49 @@ | ||
### x25519-chacha20poly1305 | ||
|
||
--- | ||
**WARNING: This code has not been audited and is not yet suitable for production. Use at your own risk.** | ||
|
||
--- | ||
|
||
> NOTE: make sure you have your C archiver and compiler env vars set, or `secp256k1-sys` will fail to build | ||
> | ||
> e.g. | ||
> `AR=/opt/homebrew/opt/llvm/bin/llvm-ar` | ||
> `CC=/opt/homebrew/opt/llvm/bin/clang` | ||
Nodejs package for x25519 key exchange and chacha20poly1305 encryption, written in Rust compiled to WASM. | ||
|
||
## Development process | ||
|
||
### Install dependencies | ||
|
||
Requires `wasm-pack` which can be installed with `cargo install wasm-pack`. | ||
See `example/ci-test.sh` for example of how to install both rust and javascript dependencies. | ||
|
||
### Compile | ||
|
||
Compile a nodejs/wasm library from the Rust source. | ||
|
||
```sh | ||
make | ||
``` | ||
|
||
### Link | ||
|
||
Link the nodejs/wasm library locally. | ||
|
||
```sh | ||
make link | ||
``` | ||
|
||
### Test | ||
|
||
After compiling and linking, run: | ||
|
||
```sh | ||
ts-node example/test.ts | ||
``` | ||
|
||
### NPM | ||
|
||
link to package on npm: https://www.npmjs.com/package/x25519 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.