casper
Casper is an opinionated symmetric cipher library which offers ChaCha20-Poly1305 via Erlang or Node.
Note: the javascript
target will not work in a browser environment. The bun
and deno
runtimes are not supported.
gleam add casper@2
import casper
pub fn main() -> Nil {
let key = casper.new_key()
let encrypted = casper.encrypt(<<"casper">>, key)
let assert Ok(decrypted) = casper.decrypt(encrypted, key)
// ...
}
Further documentation can be found at https://hexdocs.pm/casper.
Development
gleam run # Run the project
gleam test # Run the tests on Erlang
gleam test -t javascript # Run the tests on Node