Comments (6)
My bad, looks like I have a "tunnel vision"- I was always thinking about obtaining "Sodium" instance, and not "SodiumSumo".
Sorry for that, now I get it where I was wrong. And thanks a lot for your help!
from libsodium_dart_bindings.
Please refer to the official libsodium documentation on how to use certain APIs.
This library mimics those APIs, so all you need to do is follow the README for sodium (or sodium_libs when using flutter) and then translate the original C-Calls to dart by replacing _ with . and camelCasing. There is also the dart documentation
For the simple example of using crypto_scalarmult
, it would look something like this:
final sodium = // See READMEs on how to obtain an instance. You will need the sumo variant, as documented in the README
final secretKey = // obtain secret key
final publicKey = // obtain public key
final result = sodium.crypto.scalarmult(secretKey, publicKey);
You can also have a look at the scalarmult integration test case for a full example: https://github.com/Skycoder42/libsodium_dart_bindings/blob/main/packages/sodium/test/integration/cases/scalarmult_test_case.dart
from libsodium_dart_bindings.
Thanks for the quick reply!
I've tried different approaches, but the sculurmult is
not accessible from crypto, box or secretBox.
Pls check the screenshot
from libsodium_dart_bindings.
As stated before, you need to use the sumo variant of the library. Change your initialization to
final sod = await SodiumSumoInit.init();
from libsodium_dart_bindings.
Tried with SodiumSumo as well, not working.
![Screenshot 2023-10-29 at 13 25 49](https://private-user-images.githubusercontent.com/149055539/278870409-54f46e20-ded6-4fea-8791-67cffc1544a6.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMzODQzOTgsIm5iZiI6MTcyMzM4NDA5OCwicGF0aCI6Ii8xNDkwNTU1MzkvMjc4ODcwNDA5LTU0ZjQ2ZTIwLWRlZDYtNGZlYS04NzkxLTY3Y2ZmYzE1NDRhNi5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwODExJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDgxMVQxMzQ4MThaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT05ZGMxZGVkNDAwMDViYzFmMTJjMDc3ZmVmMmQ1YmNhZTMyMzU0NmM3N2Y4YmEyNzJhNDYyMmNlODhiNTkzMzVjJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.taTSAl1cXxJrrL14bceZk-CU77kOsenuDNkyilv_QrE)
from libsodium_dart_bindings.
Well, if you cast it to a Sodium instance, of cause it won't work. Change sd.Sodium
to final
and dart will auto detect the correct type. Optionally you can set the type to sd.SodiumSumo
to make it explicit. Again, simply check the documentation of these methods!
from libsodium_dart_bindings.
Related Issues (20)
- 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
- Implement cryptoSignEd25519SkToSeed (crypto_sign_ed25519_sk_to_seed) HOT 8
- 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
- Fails to build on Fedora HOT 5
- iOS: Failed to lookup symbol 'sodium_init' HOT 5
- SecretStream Push Decryption HOT 1
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.