lazysecret 1.0.3 copy "lazysecret: ^1.0.3" to clipboard
lazysecret: ^1.0.3 copied to clipboard

Lazysecret is a comprehensive Flutter implementation of the libsodium using secret_box library.

lazysecret #

Lazysecret is a comprehensive Flutter implementation of the libsodium using secret_box library.

Usage #

  • pubspec.yml
dependencies:
  lazysecret: ^1.0.2
  • Dart
final lazysecret = LazySecret.instance;

Function #

  Future<Uint8List> randomBytesBuf(int size)

  Future<String> toHex(Uint8List bytes)

  Future<Uint8List> toBin(String hexString)

  Future<String> cryptoBoxBeforeNm(KeyPair keyPair)

  Future<String> cryptoSecretBoxEasy(String plaintext, String nonce, String key)

  Future<String> cryptoSecretBoxOpenEasy(String ciphertext, String nonce, String key)

  Future<KeyPair> cryptoKxKeyPair()

  Future<int> cryptoSecretBoxKeyBytes()

  Future<int> cryptoSecretBoxNonceBytes()

  Future<int> cryptoSecretBoxMacBytes()

Android #

  • proguard-rules.pro
-keep class com.sun.jna.** { *; }
-keep class * implements com.sun.jna.** { *; }
-dontwarn java.awt.*
-keepclassmembers class * extends com.sun.jna.* { public *; }
-keepclassmembers class * extends com.sun.jna.** {
    <fields>;
    <methods>;
}

Web #

  1. Download the sodium.js file

https://raw.githubusercontent.com/jedisct1/libsodium.js/master/dist/browsers-sumo/sodium.js

  1. Add sodium.js to web directory
.
└── web
    ├── ...
    └── sodium.js  <- here
  1. Add script in web/index.html
<script src="sodium.js"></script>
  1. Add LazySecret.init() in main.dart
void main() async {
  WidgetsFlutterBinding.ensureInitialized();

  await LazySecret.init();

  runApp(const MyApp());
}

Documentation #

https://libsodium.gitbook.io/doc/secret-key_cryptography/secretbox

Sodium is a modern, easy-to-use software library for encryption, decryption, signatures, password hashing, and more.

3
likes
140
pub points
41%
popularity

Publisher

verified publisherwachasit.com

Lazysecret is a comprehensive Flutter implementation of the libsodium using secret_box library.

Repository (GitHub)
View/report issues

Documentation

API reference

License

Apache-2.0 (license)

Dependencies

flutter, flutter_web_plugins, js

More

Packages that depend on lazysecret