Git Product home page Git Product logo

Comments (6)

taras-neotiv avatar taras-neotiv commented on August 11, 2024 1

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.

Skycoder42 avatar Skycoder42 commented on August 11, 2024

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.

taras-neotiv avatar taras-neotiv commented on August 11, 2024

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
Screenshot 2023-10-27 at 12 28 53

from libsodium_dart_bindings.

Skycoder42 avatar Skycoder42 commented on August 11, 2024

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.

taras-neotiv avatar taras-neotiv commented on August 11, 2024

Tried with SodiumSumo as well, not working.

Screenshot 2023-10-29 at 13 25 49

from libsodium_dart_bindings.

Skycoder42 avatar Skycoder42 commented on August 11, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.