nacl_win 0.1.0 copy "nacl_win: ^0.1.0" to clipboard
nacl_win: ^0.1.0 copied to clipboard

A flutter plugin for Windows for generating Ed25519 keys and signing messages.

nacl_win #

A flutter plugin for Windows for generating Ed25519 keys and signing messages. It uses a Rust code and a generated .dll file. The flutter_rust_bridge plugin connects the Rust code to the Dart one.

Available methods: #

  • generateKey() - generates a EdKeyPair. It is a struct that contains base64 strings of public and private Ed25519 keys.
  • signMessage(String message, String key) - Signs provided message with provided Ed25519 key.

Exceptions: #

  • If the sodium library fails to initialize, the plugin throws a InitializationFailedException. Most likely the fault of this exception would be on the Rust crate side and it may not be related to plugin.
  • If the key provided to signMessage method is incorrect (too short, not base64, etc), the plugin will throw KeyDecodingFailedException as the Rust code fails to decode the key from base64 to vector.
  • If somehow the key decoding succeeds, but the Rust fails to transform the key from vector to sodium's SecretKey, the plugin will throw KeyTransformingFailedException.

Usage: #

var key = await NaclWin.generateKey();
var sig = await NaclWin.signMessage('message', key.privKey);

For complete example see example/lib/main.dart

0
likes
110
pub points
0%
popularity

Publisher

verified publisherhumancolossus.org

A flutter plugin for Windows for generating Ed25519 keys and signing messages.

Repository (GitHub)
View/report issues

Documentation

API reference

License

EUPL-1.2 (LICENSE)

Dependencies

ffi, flutter, flutter_rust_bridge, meta, plugin_platform_interface

More

Packages that depend on nacl_win