Comments (8)
Thanks for the quick reply @Skycoder42 , This resolved my issue
from libsodium_dart_bindings.
Thanks for your help @Skycoder42 ,
It worked for sodium sumo too after replacing package:sodium/sodium.dart
with package:sodium/sodium_sumo.dart
from libsodium_dart_bindings.
Hi. These methods are indeed implemented in the packages. However, the are part of the "Sumo" variant, as those APIs are not available in the standard sodium.js bindings. However, when working with the dart-vm, they are always available. Here are some docs you can read more about that:
- Overview of the provided APIs and differences between standard and sumo: https://github.com/Skycoder42/libsodium_dart_bindings/tree/main/packages/sodium#api-status
- DartDoc of the SignSumo class: https://pub.dev/documentation/sodium/latest/sodium_sumo/SignSumo-class.html
- Usage example on how to load the sumo variant of the library, to get access to the APIs: https://github.com/Skycoder42/libsodium_dart_bindings/tree/main/packages/sodium_libs#usage
Currently, the dart APIs only allow you to access the default implementations/algorithms of the different cryptographic concepts. However, the naming closely follows the official names. In your example, after loading the sumo variant of sodium, you can access the crypto_sign_ed25519_sk_to_seed method as follows:
final sodium = await SodiumSumoInit.init();
// ...
final seed = sodium.crypto.sign.skToSeed(secureKey)
The ed25519 part is omitted.
from libsodium_dart_bindings.
@Skycoder42 When i try to init SodiumSumo on mac m1, i am getting the below errors.
LateInitializationError: Field '_instance@154288322' has not been initialized.
package:sodium_libs/src/sodium_platform.dart SodiumPlatform._instance
sodium_platform.dart:1
SodiumPlatform.instance
sodium_platform.dart:23
SodiumSumoInit.init.<fn>
sodium_sumo_init.dart:38
BasicLock.synchronized
basic_lock.dart:31
SodiumSumoInit.init
sodium_sumo_init.dart:33
SodiumUtilsImpl.init
sodium_utils_io.dart:10
SodiumUtils.init
sodium_utils.dart:13
This is the code i am trying to run
await SodiumSumoInit.init()
Let me know if any other details you need for the issues
from libsodium_dart_bindings.
This looks like you did not initialize the widget bindings. Make sure to call WidgetsFlutterBinding.ensureInitialized();
when using the library before flutter has rendered the first frame
from libsodium_dart_bindings.
I am calling it from one of the test cases and it's dart project.
Also tried calling it with WidgetsFlutterBinding.ensureInitialized();
still getting the same error
setUpAll(() async {
sodium = await SodiumSumoInit.init();
});
from libsodium_dart_bindings.
Ah, I see. That is expected behavior - the library does not automatically load the native libraries in unit tests, only in integration tests. This is dictated by flutter and nothing I have control over. You should mock it in your tests, using for example mocktail.
If you do not want to mock it for whatever reason, you can import sodium/sodium.dart
instead and load the library manually for your test cases. On macOS, you need install libsodium from homebrew and then reference the distributed dylib. See https://github.com/Skycoder42/libsodium_dart_bindings/tree/main/packages/sodium#vm---loading-the-dynamic-library
from libsodium_dart_bindings.
Ok got it, This seems to work, now the issue is the below code give me sodium instance how can i get SodiumSumo, to use the crypto_sign_ed25519_sk_to_seed, i cannot find the same init2 function in SodiumSumoInit
await SodiumInit.init2(() => DynamicLibrary.open("/usr/local/lib/libsodium.dylib"))
from libsodium_dart_bindings.
Related Issues (20)
- iOS: Failed to lookup symbol 'sodium_init' HOT 5
- SecretStream Push Decryption HOT 1
- Cannot read properties of undefined (reading 'then') HOT 2
- please update ffi HOT 2
- sodium.js - Cannot read properties of undefined (reading 'then') HOT 5
- Speed of sodium.crypto.secretBox.easy() etc... HOT 4
- Implement crypto_stream_xchacha20 HOT 1
- FFI failure or SodiumInit timing problem? HOT 9
- Flutter_test Failed to lookup symbol 'sodium_init' HOT 9
- Create `Sodium.runIsolated` method to easily run computation heavy cryptographic operations in an isolate HOT 12
- How does one use AES-GCM? HOT 12
- Request for SecretStream encryption/decryption example HOT 7
- Sodium.runIsolated breaking flutter run build HOT 2
- build failure: libsodium.so not found on latest update HOT 4
- Use chacha20poly1305 instead of xchacha20poly1305_ietf HOT 2
- Secret stream state initialization; Continue interrupted upload of encrypted stream; HOT 3
- How update flutter_sodium 0.2.0 to sodium_libs? HOT 3
- How to create a shared secret using Scalarmult? HOT 6
- Fails to build on Fedora HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libsodium_dart_bindings.