Last updated:
0 purchases
lazysecret
lazysecret #
Lazysecret is a comprehensive Flutter implementation of the libsodium using secret_box library.
Usage #
pubspec.yml
dependencies:
lazysecret: ^1.0.2
copied to clipboard
Dart
final lazysecret = LazySecret.instance;
copied to clipboard
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()
copied to clipboard
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>;
}
copied to clipboard
Web #
Download the sodium.js file
https://raw.githubusercontent.com/jedisct1/libsodium.js/master/dist/browsers-sumo/sodium.js
Add sodium.js to web directory
.
└── web
├── ...
└── sodium.js <- here
copied to clipboard
Add script in web/index.html
<script src="sodium.js"></script>
copied to clipboard
Add LazySecret.init() in main.dart
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await LazySecret.init();
runApp(const MyApp());
}
copied to clipboard
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.
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.