sodium_libs 1.2.2 copy "sodium_libs: ^1.2.2" to clipboard
sodium_libs: ^1.2.2 copied to clipboard

outdated

Flutter companion package to sodium that provides the low-level libsodium binaries for easy use.

sodium_libs #

Continous Integration for package sodium_libs Pub Version

Flutter companion package to sodium that provides the low-level libsodium binaries for easy use.

Table of contents #

Table of contents generated with markdown-toc

Features #

  • Extends sodium for Flutter with binaries
  • Easy, effort-less initialization on all major flutter platforms (Android, iOS, Linux, Windows, macOS, Web)
  • Binaries are either directly included or automatically downloaded/built at compile time

Note: This package only handles the libsodium binaries for each supported platform and provides them to sodium. Check the documentation of that package for more details about the actual APIs.

Installation #

Simply add sodium_libs to your pubspec.yaml and run pub get (or flutter pub get).

Platform requirements #

In addition to installing the package, you will also have to install operating system specific tools for some platforms:

iOS

Currently, there is a Bug in the upstream Swift-Sodium package that prevents the library from beeing run on an iOs simulator with XCode 12 or higher. As a temporary workaround, you have to add the following snippet to your Podfile in order to make it work. This will overwrite the required settings in the dependencies until fixed upstream:

post_install do |installer|
  # You might already have code here. Keep that as is

  # Workaround for https://github.com/jedisct1/swift-sodium/issues/251
  installer.pods_project.build_configurations.each do |config|
    config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
  end
end

Linux

You have to install libsodium on your system. How you do this depends on your distribution:

  • Arch/Manjaro: [sudo] pacman -S libsodium
  • Ubuntu/Debian: [sudo] apt install libsodium-dev
  • ...

When bundeling the application for release, remember to also include the libsodium.so into the deployment package.

Windows

Since the plugin downloads the binaries at build time, it needs minisign to validate their integrity. The easiest way to install minisign is via Chocolatey:

choco install minisign

Web

The web setup differs slightly from the others. Instead of just installing some system library, you need to add sodium.js to each project. You can do this automatically by running the following command in every new project.

flutter pub run sodium_libs:update_web [--sumo]

The sumo parameter is optional. If specified, the Sumo-Variant of sodium.js will be downloaded. It is bigger in size, but contains all APIs. With the non-sumo version, some parts of the library will not work. All affected APIs are marked with a hint in the documentation.

Usage #

The API can be consumed in the excact same way as the sodium package. The only difference is, that sodium_libs simplifies the initialization of that package. To initialize it, simply do the following:

import 'package:sodium_libs/sodium_libs.dart';

final sodium = await SodiumInit.init();
// You now have a Sodium instance, see sodium package to continue

Documentation #

The documentation is available at https://pub.dev/documentation/sodium_libs/latest/. A full example can be found at https://pub.dev/packages/sodium_libs/example.

14
likes
0
pub points
88%
popularity

Publisher

verified publisherskycoder42.de

Flutter companion package to sodium that provides the low-level libsodium binaries for easy use.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter, flutter_web_plugins, js, meta, plugin_platform_interface, sodium, synchronized

More

Packages that depend on sodium_libs