Flutter bindings for libsodium

Overview

flutter_sodium

With flutter_sodium you get access to the modern, easy-to-use libsodium crypto library in your Flutter apps. One set of crypto APIs supporting both Android and iOS.

Pub

Getting Started

In your flutter project add the dependency:

dependencies:
  ...
  flutter_sodium: ^0.2.0

Import the plugin and initialize it. Sodium.init() initializes the plugin and should be called before any other function provided by flutter_sodium.

import 'package:flutter_sodium/flutter_sodium.dart';

// initialize sodium
Sodium.init();

Usage example

// Password hashing (using Argon)
final password = 'my password';
final str = PasswordHash.hashStringStorage(password);

print(str);

// verify hash str
final valid = PasswordHash.verifyStorage(str, password);

assert(valid);

This project includes an extensive example app with runnable code samples. Be sure to check it out!

API coverage

The flutter_sodium plugin implements the following libsodium APIs:

  • crypto_aead
  • crypto_auth
  • crypto_box
  • crypto_generichash
  • crypto_hash
  • crypto_kdf
  • crypto_kx
  • crypto_onetimeauth
  • crypto_pwhash
  • crypto_scalarmult
  • crypto_secretbox
  • crypto_secretstream
  • crypto_shorthash
  • crypto_sign
  • crypto_stream
  • randombytes
  • sodium_version

API coverage is not 100% complete, track the progress in issue #61

Dart APIs

The plugin includes a core API that maps native libsodium functions 1:1 to Dart equivalents. The core API is available in the class Sodium. Dart naming conventions are used for core API function names. A native libsodium function such as crypto_pwhash_str, is available in flutter as Sodium.cryptoPwhashStr.

Also included in flutter_sodium is a high-level, opinionated API providing access to libsodium in a Dart friendly manner. The various functions are available in separate Dart classes. Password hashing for example is available in the PasswordHash class. The high-level API depends on the core API to get things done.

Migrating to fluttter_sodium FFI

The FFI implementation of flutter_sodium is backwards incompatible with the previous platform channel implementation. The list of changes:

  • the entire FFI API is now synchronous, while the previous implementation was entirely asynchronous
  • all hardcoded libsodium constants are now available as properties on the Sodium class.
  • in the platform channel versions the Android and iOS implementations were not in sync. Some functions were available only in iOS, others only in Android. With the FFI implementation, there is a single API covering both platforms.

Background threads

Since the entire FFI API is synchronous, you'll need to do some extra work to execute long running crypto function on a background thread. Luckily this is very easy with Flutter's compute function.

The following code snippet demonstrates running a password hash on the background thread.

final pw = 'hello world';
final str = await compute(PasswordHash.hashStringStorageModerate, pw);

print(str);
Comments
  • Missing libsodiumjni APIs (Android)

    Missing libsodiumjni APIs (Android)

    IMPORTANT NOTE I'm currently porting flutter_sodium to FFI. The goal is to achieve 100% API coverage with FFI. The platform channel implementation is still maintained, but there are no plans to fix the missing APIs.

    Several APIs are not available on Android. This is the complete list of libsodiumjni APIs that are missing or malfunctioning:

    • [x] ~~crypto_aead_chacha20poly1305_encrypt_detached~~
    • [x] ~~crypto_aead_chacha20poly1305_decrypt_detached~~
    • [x] ~~crypto_aead_chacha20poly1305_keygen~~
    • [x] ~~crypto_aead_chacha20poly1305_ietf_encrypt_detached~~
    • [x] ~~crypto_aead_chacha20poly1305_ietf_decrypt_detached~~
    • [x] ~~crypto_aead_chacha20poly1305_ietf_keygen~~
    • [x] ~~crypto_aead_xchacha20poly1305_ietf_encrypt~~
    • [x] ~~crypto_aead_xchacha20poly1305_ietf_decrypt~~
    • [x] ~~crypto_aead_xchacha20poly1305_ietf_encrypt_detached~~
    • [x] ~~crypto_aead_xchacha20poly1305_ietf_decrypt_detached~~
    • [x] ~~crypto_aead_xchacha20poly1305_ietf_keygen~~
    • [ ] crypto_auth_keygen (randombytes_buf fallback)
    • [ ] crypto_generichash_keygen (randombytes_buf fallback)
    • [x] crypto_kdf_keygen
    • [x] crypto_kdf_derive_from_key
    • [ ] crypto_onetimeauth_keygen (randombytes_buf fallback)
    • [ ] crypto_pwhash_str_needs_rehash
    • [ ] crypto_secretbox_keygen (randombytes_buf fallback)
    • [ ] crypto_shorthash_keygen (randombytes_buf fallback)
    • [ ] crypto_sign_init
    • [ ] crypto_sign_update
    • [ ] crypto_sign_final_create
    • [ ] crypto_sign_final_verify
    • [ ] randombytes_buf_deterministic
    • [ ] sodium_version_string (this one is available but throws)
    bug 
    opened by kozw 17
  • Failed to lookup symbol (dlsym(RTLD_DEFAULT, crypto_box_seedbytes): symbol not found)

    Failed to lookup symbol (dlsym(RTLD_DEFAULT, crypto_box_seedbytes): symbol not found)

    [VERBOSE-2:ui_dart_state.cc(166)] Unhandled Exception: Invalid argument(s): Failed to lookup symbol (dlsym(RTLD_DEFAULT, crypto_box_seedbytes): symbol not found) #0 DynamicLibrary.lookup (dart:ffi-patch/ffi_dynamic_library_patch.dart:31:29) #1 Bindings.lookupSizet (package:flutter_sodium/src/bindings/libsodium.dart:29:14) #2 new CryptoBoxBindings (package:flutter_sodium/src/bindings/crypto_box_bindings.dart:9:17) #3 Sodium._cryptoBox (package:flutter_sodium/src/sodium.dart:35:29) #4 Sodium._cryptoBox (package:flutter_sodium/src/sodium.dart) #5 Sodium.cryptoBoxPublickeybytes (package:flutter_sodium/src/sodium.dart:190:7) #6 Sodium.cryptoBoxKeypair (package:flutter_sodium/src/sodium.dart:226:40) #7 CryptoBox.randomKeys (package:flutter_sodium/src/crypto_box.dart:10:41) #8 generateKeys (package:vlow/screens/onboarding_screen.dart:171:36) #9 _OnboardingState.create (package:vlow/screens/onboarding_screen.dart:47:28) #10 GestureRecognizer.invokeCallbac<…>

    Flutter (Channel stable, 1.20.2, on Mac OS X 10.15.6 19G73, locale en-GB)

    bug 
    opened by nailkhasipov 13
  • Rewrite flutter_sodium using FFI

    Rewrite flutter_sodium using FFI

    The FFI implementation has recently been started in the ffi branch. Tracking progress of the entire libsodium API (725 symbols):

    • [ ] argon2_ctx
    • [ ] argon2_decode_string
    • [ ] argon2_encode_string
    • [ ] argon2_fill_memory_blocks
    • [ ] argon2_fill_segment_avx2
    • [ ] argon2_fill_segment_avx512f
    • [ ] argon2_fill_segment_ref
    • [ ] argon2_fill_segment_ssse3
    • [ ] argon2_finalize
    • [ ] argon2_hash
    • [ ] argon2_initialize
    • [ ] argon2_validate_inputs
    • [ ] argon2_verify
    • [ ] argon2i_hash_encoded
    • [ ] argon2i_hash_raw
    • [ ] argon2i_verify
    • [ ] argon2id_hash_encoded
    • [ ] argon2id_hash_raw
    • [ ] argon2id_verify
    • [ ] blake2b
    • [ ] blake2b_compress_avx2
    • [ ] blake2b_compress_ref
    • [ ] blake2b_compress_sse41
    • [ ] blake2b_compress_ssse3
    • [ ] blake2b_final
    • [ ] blake2b_init
    • [ ] blake2b_init_key
    • [ ] blake2b_init_key_salt_personal
    • [ ] blake2b_init_param
    • [ ] blake2b_init_salt_personal
    • [ ] blake2b_long
    • [ ] blake2b_pick_best_implementation
    • [ ] blake2b_salt_personal
    • [ ] blake2b_update
    • [ ] crypto_aead_aegis128l_abytes
    • [ ] crypto_aead_aegis128l_decrypt
    • [ ] crypto_aead_aegis128l_decrypt_detached
    • [ ] crypto_aead_aegis128l_encrypt
    • [ ] crypto_aead_aegis128l_encrypt_detached
    • [ ] crypto_aead_aegis128l_is_available
    • [ ] crypto_aead_aegis128l_keybytes
    • [ ] crypto_aead_aegis128l_keygen
    • [ ] crypto_aead_aegis128l_messagebytes_max
    • [ ] crypto_aead_aegis128l_npubbytes
    • [ ] crypto_aead_aegis128l_nsecbytes
    • [ ] crypto_aead_aegis256_abytes
    • [ ] crypto_aead_aegis256_decrypt
    • [ ] crypto_aead_aegis256_decrypt_detached
    • [ ] crypto_aead_aegis256_encrypt
    • [ ] crypto_aead_aegis256_encrypt_detached
    • [ ] crypto_aead_aegis256_is_available
    • [ ] crypto_aead_aegis256_keybytes
    • [ ] crypto_aead_aegis256_keygen
    • [ ] crypto_aead_aegis256_messagebytes_max
    • [ ] crypto_aead_aegis256_npubbytes
    • [ ] crypto_aead_aegis256_nsecbytes
    • [ ] crypto_aead_aes256gcm_abytes
    • [ ] crypto_aead_aes256gcm_beforenm
    • [ ] crypto_aead_aes256gcm_decrypt
    • [ ] crypto_aead_aes256gcm_decrypt_afternm
    • [ ] crypto_aead_aes256gcm_decrypt_detached
    • [ ] crypto_aead_aes256gcm_decrypt_detached_afternm
    • [ ] crypto_aead_aes256gcm_encrypt
    • [ ] crypto_aead_aes256gcm_encrypt_afternm
    • [ ] crypto_aead_aes256gcm_encrypt_detached
    • [ ] crypto_aead_aes256gcm_encrypt_detached_afternm
    • [ ] crypto_aead_aes256gcm_is_available
    • [ ] crypto_aead_aes256gcm_keybytes
    • [ ] crypto_aead_aes256gcm_keygen
    • [ ] crypto_aead_aes256gcm_messagebytes_max
    • [ ] crypto_aead_aes256gcm_npubbytes
    • [ ] crypto_aead_aes256gcm_nsecbytes
    • [ ] crypto_aead_aes256gcm_statebytes
    • [x] crypto_aead_chacha20poly1305_abytes
    • [x] crypto_aead_chacha20poly1305_decrypt
    • [x] crypto_aead_chacha20poly1305_decrypt_detached
    • [x] crypto_aead_chacha20poly1305_encrypt
    • [x] crypto_aead_chacha20poly1305_encrypt_detached
    • [x] crypto_aead_chacha20poly1305_ietf_abytes
    • [x] crypto_aead_chacha20poly1305_ietf_decrypt
    • [x] crypto_aead_chacha20poly1305_ietf_decrypt_detached
    • [x] crypto_aead_chacha20poly1305_ietf_encrypt
    • [x] crypto_aead_chacha20poly1305_ietf_encrypt_detached
    • [x] crypto_aead_chacha20poly1305_ietf_keybytes
    • [x] crypto_aead_chacha20poly1305_ietf_keygen
    • [x] crypto_aead_chacha20poly1305_ietf_messagebytes_max
    • [x] crypto_aead_chacha20poly1305_ietf_npubbytes
    • [x] crypto_aead_chacha20poly1305_ietf_nsecbytes
    • [x] crypto_aead_chacha20poly1305_keybytes
    • [x] crypto_aead_chacha20poly1305_keygen
    • [x] crypto_aead_chacha20poly1305_messagebytes_max
    • [x] crypto_aead_chacha20poly1305_npubbytes
    • [x] crypto_aead_chacha20poly1305_nsecbytes
    • [x] crypto_aead_xchacha20poly1305_ietf_abytes
    • [x] crypto_aead_xchacha20poly1305_ietf_decrypt
    • [x] crypto_aead_xchacha20poly1305_ietf_decrypt_detached
    • [x] crypto_aead_xchacha20poly1305_ietf_encrypt
    • [x] crypto_aead_xchacha20poly1305_ietf_encrypt_detached
    • [x] crypto_aead_xchacha20poly1305_ietf_keybytes
    • [x] crypto_aead_xchacha20poly1305_ietf_keygen
    • [x] crypto_aead_xchacha20poly1305_ietf_messagebytes_max
    • [x] crypto_aead_xchacha20poly1305_ietf_npubbytes
    • [x] crypto_aead_xchacha20poly1305_ietf_nsecbytes
    • [x] crypto_auth
    • [x] crypto_auth_bytes
    • [ ] crypto_auth_hmacsha256
    • [ ] crypto_auth_hmacsha256_bytes
    • [ ] crypto_auth_hmacsha256_final
    • [ ] crypto_auth_hmacsha256_init
    • [ ] crypto_auth_hmacsha256_keybytes
    • [ ] crypto_auth_hmacsha256_keygen
    • [ ] crypto_auth_hmacsha256_statebytes
    • [ ] crypto_auth_hmacsha256_update
    • [ ] crypto_auth_hmacsha256_verify
    • [ ] crypto_auth_hmacsha512
    • [ ] crypto_auth_hmacsha512256
    • [ ] crypto_auth_hmacsha512256_bytes
    • [ ] crypto_auth_hmacsha512256_final
    • [ ] crypto_auth_hmacsha512256_init
    • [ ] crypto_auth_hmacsha512256_keybytes
    • [ ] crypto_auth_hmacsha512256_keygen
    • [ ] crypto_auth_hmacsha512256_statebytes
    • [ ] crypto_auth_hmacsha512256_update
    • [ ] crypto_auth_hmacsha512256_verify
    • [ ] crypto_auth_hmacsha512_bytes
    • [ ] crypto_auth_hmacsha512_final
    • [ ] crypto_auth_hmacsha512_init
    • [ ] crypto_auth_hmacsha512_keybytes
    • [ ] crypto_auth_hmacsha512_keygen
    • [ ] crypto_auth_hmacsha512_statebytes
    • [ ] crypto_auth_hmacsha512_update
    • [ ] crypto_auth_hmacsha512_verify
    • [x] crypto_auth_keybytes
    • [x] crypto_auth_keygen
    • [x] crypto_auth_primitive
    • [x] crypto_auth_verify
    • [x] crypto_box
    • [ ] crypto_box_afternm
    • [x] crypto_box_beforenm
    • [x] crypto_box_beforenmbytes
    • [ ] crypto_box_boxzerobytes
    • [ ] crypto_box_curve25519xchacha20poly1305_beforenm
    • [ ] crypto_box_curve25519xchacha20poly1305_beforenmbytes
    • [ ] crypto_box_curve25519xchacha20poly1305_detached
    • [ ] crypto_box_curve25519xchacha20poly1305_detached_afternm
    • [ ] crypto_box_curve25519xchacha20poly1305_easy
    • [ ] crypto_box_curve25519xchacha20poly1305_easy_afternm
    • [ ] crypto_box_curve25519xchacha20poly1305_keypair
    • [ ] crypto_box_curve25519xchacha20poly1305_macbytes
    • [ ] crypto_box_curve25519xchacha20poly1305_messagebytes_max
    • [ ] crypto_box_curve25519xchacha20poly1305_noncebytes
    • [ ] crypto_box_curve25519xchacha20poly1305_open_detached
    • [ ] crypto_box_curve25519xchacha20poly1305_open_detached_afternm
    • [ ] crypto_box_curve25519xchacha20poly1305_open_easy
    • [ ] crypto_box_curve25519xchacha20poly1305_open_easy_afternm
    • [ ] crypto_box_curve25519xchacha20poly1305_publickeybytes
    • [ ] crypto_box_curve25519xchacha20poly1305_seal
    • [ ] crypto_box_curve25519xchacha20poly1305_seal_open
    • [ ] crypto_box_curve25519xchacha20poly1305_sealbytes
    • [ ] crypto_box_curve25519xchacha20poly1305_secretkeybytes
    • [ ] crypto_box_curve25519xchacha20poly1305_seed_keypair
    • [ ] crypto_box_curve25519xchacha20poly1305_seedbytes
    • [ ] crypto_box_curve25519xsalsa20poly1305
    • [ ] crypto_box_curve25519xsalsa20poly1305_afternm
    • [ ] crypto_box_curve25519xsalsa20poly1305_beforenm
    • [ ] crypto_box_curve25519xsalsa20poly1305_beforenmbytes
    • [ ] crypto_box_curve25519xsalsa20poly1305_boxzerobytes
    • [ ] crypto_box_curve25519xsalsa20poly1305_keypair
    • [ ] crypto_box_curve25519xsalsa20poly1305_macbytes
    • [ ] crypto_box_curve25519xsalsa20poly1305_messagebytes_max
    • [ ] crypto_box_curve25519xsalsa20poly1305_noncebytes
    • [ ] crypto_box_curve25519xsalsa20poly1305_open
    • [ ] crypto_box_curve25519xsalsa20poly1305_open_afternm
    • [ ] crypto_box_curve25519xsalsa20poly1305_publickeybytes
    • [ ] crypto_box_curve25519xsalsa20poly1305_secretkeybytes
    • [ ] crypto_box_curve25519xsalsa20poly1305_seed_keypair
    • [ ] crypto_box_curve25519xsalsa20poly1305_seedbytes
    • [ ] crypto_box_curve25519xsalsa20poly1305_zerobytes
    • [x] crypto_box_detached
    • [x] crypto_box_detached_afternm
    • [x] crypto_box_easy
    • [x] crypto_box_easy_afternm
    • [x] crypto_box_keypair
    • [x] crypto_box_macbytes
    • [x] crypto_box_messagebytes_max
    • [x] crypto_box_noncebytes
    • [x] crypto_box_open
    • [ ] crypto_box_open_afternm
    • [x] crypto_box_open_detached
    • [x] crypto_box_open_detached_afternm
    • [x] crypto_box_open_easy
    • [x] crypto_box_open_easy_afternm
    • [x] crypto_box_primitive
    • [x] crypto_box_publickeybytes
    • [x] crypto_box_seal
    • [x] crypto_box_seal_open
    • [x] crypto_box_sealbytes
    • [x] crypto_box_secretkeybytes
    • [x] crypto_box_seed_keypair
    • [x] crypto_box_seedbytes
    • [ ] crypto_box_zerobytes
    • [ ] crypto_core_ed25519_add
    • [ ] crypto_core_ed25519_bytes
    • [ ] crypto_core_ed25519_from_string
    • [ ] crypto_core_ed25519_from_string_ro
    • [ ] crypto_core_ed25519_from_uniform
    • [ ] crypto_core_ed25519_hashbytes
    • [ ] crypto_core_ed25519_is_valid_point
    • [ ] crypto_core_ed25519_nonreducedscalarbytes
    • [ ] crypto_core_ed25519_random
    • [ ] crypto_core_ed25519_scalar_add
    • [ ] crypto_core_ed25519_scalar_complement
    • [ ] crypto_core_ed25519_scalar_invert
    • [ ] crypto_core_ed25519_scalar_is_canonical
    • [ ] crypto_core_ed25519_scalar_mul
    • [ ] crypto_core_ed25519_scalar_negate
    • [ ] crypto_core_ed25519_scalar_random
    • [ ] crypto_core_ed25519_scalar_reduce
    • [ ] crypto_core_ed25519_scalar_sub
    • [ ] crypto_core_ed25519_scalarbytes
    • [ ] crypto_core_ed25519_sub
    • [ ] crypto_core_ed25519_uniformbytes
    • [ ] crypto_core_hchacha20
    • [ ] crypto_core_hchacha20_constbytes
    • [ ] crypto_core_hchacha20_inputbytes
    • [ ] crypto_core_hchacha20_keybytes
    • [ ] crypto_core_hchacha20_outputbytes
    • [ ] crypto_core_hsalsa20
    • [ ] crypto_core_hsalsa20_constbytes
    • [ ] crypto_core_hsalsa20_inputbytes
    • [ ] crypto_core_hsalsa20_keybytes
    • [ ] crypto_core_hsalsa20_outputbytes
    • [ ] crypto_core_ristretto255_add
    • [ ] crypto_core_ristretto255_bytes
    • [ ] crypto_core_ristretto255_from_hash
    • [ ] crypto_core_ristretto255_hashbytes
    • [ ] crypto_core_ristretto255_is_valid_point
    • [ ] crypto_core_ristretto255_nonreducedscalarbytes
    • [ ] crypto_core_ristretto255_random
    • [ ] crypto_core_ristretto255_scalar_add
    • [ ] crypto_core_ristretto255_scalar_complement
    • [ ] crypto_core_ristretto255_scalar_invert
    • [ ] crypto_core_ristretto255_scalar_is_canonical
    • [ ] crypto_core_ristretto255_scalar_mul
    • [ ] crypto_core_ristretto255_scalar_negate
    • [ ] crypto_core_ristretto255_scalar_random
    • [ ] crypto_core_ristretto255_scalar_reduce
    • [ ] crypto_core_ristretto255_scalar_sub
    • [ ] crypto_core_ristretto255_scalarbytes
    • [ ] crypto_core_ristretto255_sub
    • [ ] crypto_core_salsa20
    • [ ] crypto_core_salsa2012
    • [ ] crypto_core_salsa2012_constbytes
    • [ ] crypto_core_salsa2012_inputbytes
    • [ ] crypto_core_salsa2012_keybytes
    • [ ] crypto_core_salsa2012_outputbytes
    • [ ] crypto_core_salsa208
    • [ ] crypto_core_salsa208_constbytes
    • [ ] crypto_core_salsa208_inputbytes
    • [ ] crypto_core_salsa208_keybytes
    • [ ] crypto_core_salsa208_outputbytes
    • [ ] crypto_core_salsa20_constbytes
    • [ ] crypto_core_salsa20_inputbytes
    • [ ] crypto_core_salsa20_keybytes
    • [ ] crypto_core_salsa20_outputbytes
    • [x] crypto_generichash
    • [ ] crypto_generichash_blake2b
    • [ ] crypto_generichash_blake2b_bytes
    • [ ] crypto_generichash_blake2b_bytes_max
    • [ ] crypto_generichash_blake2b_bytes_min
    • [ ] crypto_generichash_blake2b_final
    • [ ] crypto_generichash_blake2b_init
    • [ ] crypto_generichash_blake2b_init_salt_personal
    • [ ] crypto_generichash_blake2b_keybytes
    • [ ] crypto_generichash_blake2b_keybytes_max
    • [ ] crypto_generichash_blake2b_keybytes_min
    • [ ] crypto_generichash_blake2b_keygen
    • [ ] crypto_generichash_blake2b_personalbytes
    • [ ] crypto_generichash_blake2b_salt_personal
    • [ ] crypto_generichash_blake2b_saltbytes
    • [ ] crypto_generichash_blake2b_statebytes
    • [ ] crypto_generichash_blake2b_update
    • [x] crypto_generichash_bytes
    • [x] crypto_generichash_bytes_max
    • [x] crypto_generichash_bytes_min
    • [x] crypto_generichash_final
    • [x] crypto_generichash_init
    • [x] crypto_generichash_keybytes
    • [x] crypto_generichash_keybytes_max
    • [x] crypto_generichash_keybytes_min
    • [x] crypto_generichash_keygen
    • [x] crypto_generichash_primitive
    • [x] crypto_generichash_statebytes
    • [x] crypto_generichash_update
    • [x] crypto_hash
    • [x] crypto_hash_bytes
    • [x] crypto_hash_primitive
    • [ ] crypto_hash_sha256
    • [ ] crypto_hash_sha256_bytes
    • [ ] crypto_hash_sha256_final
    • [ ] crypto_hash_sha256_init
    • [ ] crypto_hash_sha256_statebytes
    • [ ] crypto_hash_sha256_update
    • [ ] crypto_hash_sha512
    • [ ] crypto_hash_sha512_bytes
    • [ ] crypto_hash_sha512_final
    • [ ] crypto_hash_sha512_init
    • [ ] crypto_hash_sha512_statebytes
    • [ ] crypto_hash_sha512_update
    • [ ] crypto_kdf_blake2b_bytes_max
    • [ ] crypto_kdf_blake2b_bytes_min
    • [ ] crypto_kdf_blake2b_contextbytes
    • [ ] crypto_kdf_blake2b_derive_from_key
    • [ ] crypto_kdf_blake2b_keybytes
    • [x] crypto_kdf_bytes_max
    • [x] crypto_kdf_bytes_min
    • [x] crypto_kdf_contextbytes
    • [x] crypto_kdf_derive_from_key
    • [ ] crypto_kdf_hkdf_sha256_bytes_max
    • [ ] crypto_kdf_hkdf_sha256_bytes_min
    • [ ] crypto_kdf_hkdf_sha256_expand
    • [ ] crypto_kdf_hkdf_sha256_extract
    • [ ] crypto_kdf_hkdf_sha256_keybytes
    • [ ] crypto_kdf_hkdf_sha256_keygen
    • [ ] crypto_kdf_hkdf_sha512_bytes_max
    • [ ] crypto_kdf_hkdf_sha512_bytes_min
    • [ ] crypto_kdf_hkdf_sha512_expand
    • [ ] crypto_kdf_hkdf_sha512_extract
    • [ ] crypto_kdf_hkdf_sha512_keybytes
    • [ ] crypto_kdf_hkdf_sha512_keygen
    • [x] crypto_kdf_keybytes
    • [x] crypto_kdf_keygen
    • [x] crypto_kdf_primitive
    • [x] crypto_kx_client_session_keys
    • [x] crypto_kx_keypair
    • [x] crypto_kx_primitive
    • [x] crypto_kx_publickeybytes
    • [x] crypto_kx_secretkeybytes
    • [x] crypto_kx_seed_keypair
    • [x] crypto_kx_seedbytes
    • [x] crypto_kx_server_session_keys
    • [x] crypto_kx_sessionkeybytes
    • [x] crypto_onetimeauth
    • [x] crypto_onetimeauth_bytes
    • [x] crypto_onetimeauth_final
    • [x] crypto_onetimeauth_init
    • [x] crypto_onetimeauth_keybytes
    • [x] crypto_onetimeauth_keygen
    • [ ] crypto_onetimeauth_poly1305
    • [ ] crypto_onetimeauth_poly1305_bytes
    • [ ] crypto_onetimeauth_poly1305_final
    • [ ] crypto_onetimeauth_poly1305_init
    • [ ] crypto_onetimeauth_poly1305_keybytes
    • [ ] crypto_onetimeauth_poly1305_keygen
    • [ ] crypto_onetimeauth_poly1305_statebytes
    • [ ] crypto_onetimeauth_poly1305_update
    • [ ] crypto_onetimeauth_poly1305_verify
    • [x] crypto_onetimeauth_primitive
    • [x] crypto_onetimeauth_statebytes
    • [x] crypto_onetimeauth_update
    • [x] crypto_onetimeauth_verify
    • [x] crypto_pwhash
    • [x] crypto_pwhash_alg_argon2i13
    • [x] crypto_pwhash_alg_argon2id13
    • [x] crypto_pwhash_alg_default
    • [ ] crypto_pwhash_argon2i
    • [ ] crypto_pwhash_argon2i_alg_argon2i13
    • [ ] crypto_pwhash_argon2i_bytes_max
    • [ ] crypto_pwhash_argon2i_bytes_min
    • [ ] crypto_pwhash_argon2i_memlimit_interactive
    • [x] crypto_pwhash_argon2i_memlimit_max
    • [x] crypto_pwhash_argon2i_memlimit_min
    • [ ] crypto_pwhash_argon2i_memlimit_moderate
    • [ ] crypto_pwhash_argon2i_memlimit_sensitive
    • [ ] crypto_pwhash_argon2i_opslimit_interactive
    • [x] crypto_pwhash_argon2i_opslimit_max
    • [x] crypto_pwhash_argon2i_opslimit_min
    • [ ] crypto_pwhash_argon2i_opslimit_moderate
    • [ ] crypto_pwhash_argon2i_opslimit_sensitive
    • [ ] crypto_pwhash_argon2i_passwd_max
    • [ ] crypto_pwhash_argon2i_passwd_min
    • [ ] crypto_pwhash_argon2i_saltbytes
    • [ ] crypto_pwhash_argon2i_str
    • [ ] crypto_pwhash_argon2i_str_needs_rehash
    • [ ] crypto_pwhash_argon2i_str_verify
    • [ ] crypto_pwhash_argon2i_strbytes
    • [ ] crypto_pwhash_argon2i_strprefix
    • [ ] crypto_pwhash_argon2id
    • [ ] crypto_pwhash_argon2id_alg_argon2id13
    • [ ] crypto_pwhash_argon2id_bytes_max
    • [ ] crypto_pwhash_argon2id_bytes_min
    • [ ] crypto_pwhash_argon2id_memlimit_interactive
    • [ ] crypto_pwhash_argon2id_memlimit_max
    • [ ] crypto_pwhash_argon2id_memlimit_min
    • [ ] crypto_pwhash_argon2id_memlimit_moderate
    • [ ] crypto_pwhash_argon2id_memlimit_sensitive
    • [ ] crypto_pwhash_argon2id_opslimit_interactive
    • [ ] crypto_pwhash_argon2id_opslimit_max
    • [ ] crypto_pwhash_argon2id_opslimit_min
    • [ ] crypto_pwhash_argon2id_opslimit_moderate
    • [ ] crypto_pwhash_argon2id_opslimit_sensitive
    • [ ] crypto_pwhash_argon2id_passwd_max
    • [ ] crypto_pwhash_argon2id_passwd_min
    • [ ] crypto_pwhash_argon2id_saltbytes
    • [ ] crypto_pwhash_argon2id_str
    • [ ] crypto_pwhash_argon2id_str_needs_rehash
    • [ ] crypto_pwhash_argon2id_str_verify
    • [ ] crypto_pwhash_argon2id_strbytes
    • [ ] crypto_pwhash_argon2id_strprefix
    • [x] crypto_pwhash_bytes_max
    • [x] crypto_pwhash_bytes_min
    • [x] crypto_pwhash_memlimit_interactive
    • [x] crypto_pwhash_memlimit_max
    • [x] crypto_pwhash_memlimit_min
    • [x] crypto_pwhash_memlimit_moderate
    • [x] crypto_pwhash_memlimit_sensitive
    • [x] crypto_pwhash_opslimit_interactive
    • [x] crypto_pwhash_opslimit_max
    • [x] crypto_pwhash_opslimit_min
    • [x] crypto_pwhash_opslimit_moderate
    • [x] crypto_pwhash_opslimit_sensitive
    • [x] crypto_pwhash_passwd_max
    • [x] crypto_pwhash_passwd_min
    • [x] crypto_pwhash_primitive
    • [x] crypto_pwhash_saltbytes
    • [ ] crypto_pwhash_scryptsalsa208sha256
    • [ ] crypto_pwhash_scryptsalsa208sha256_bytes_max
    • [ ] crypto_pwhash_scryptsalsa208sha256_bytes_min
    • [ ] crypto_pwhash_scryptsalsa208sha256_ll
    • [ ] crypto_pwhash_scryptsalsa208sha256_memlimit_interactive
    • [ ] crypto_pwhash_scryptsalsa208sha256_memlimit_max
    • [ ] crypto_pwhash_scryptsalsa208sha256_memlimit_min
    • [ ] crypto_pwhash_scryptsalsa208sha256_memlimit_sensitive
    • [ ] crypto_pwhash_scryptsalsa208sha256_opslimit_interactive
    • [ ] crypto_pwhash_scryptsalsa208sha256_opslimit_max
    • [ ] crypto_pwhash_scryptsalsa208sha256_opslimit_min
    • [ ] crypto_pwhash_scryptsalsa208sha256_opslimit_sensitive
    • [ ] crypto_pwhash_scryptsalsa208sha256_passwd_max
    • [ ] crypto_pwhash_scryptsalsa208sha256_passwd_min
    • [ ] crypto_pwhash_scryptsalsa208sha256_saltbytes
    • [ ] crypto_pwhash_scryptsalsa208sha256_str
    • [ ] crypto_pwhash_scryptsalsa208sha256_str_needs_rehash
    • [ ] crypto_pwhash_scryptsalsa208sha256_str_verify
    • [ ] crypto_pwhash_scryptsalsa208sha256_strbytes
    • [ ] crypto_pwhash_scryptsalsa208sha256_strprefix
    • [x] crypto_pwhash_str
    • [x] crypto_pwhash_str_alg
    • [x] crypto_pwhash_str_needs_rehash
    • [x] crypto_pwhash_str_verify
    • [x] crypto_pwhash_strbytes
    • [x] crypto_pwhash_strprefix
    • [x] crypto_scalarmult
    • [x] crypto_scalarmult_base
    • [x] crypto_scalarmult_bytes
    • [ ] crypto_scalarmult_curve25519
    • [ ] crypto_scalarmult_curve25519_base
    • [ ] crypto_scalarmult_curve25519_bytes
    • [ ] crypto_scalarmult_curve25519_scalarbytes
    • [ ] crypto_scalarmult_ed25519
    • [ ] crypto_scalarmult_ed25519_base
    • [ ] crypto_scalarmult_ed25519_base_noclamp
    • [ ] crypto_scalarmult_ed25519_bytes
    • [ ] crypto_scalarmult_ed25519_noclamp
    • [ ] crypto_scalarmult_ed25519_scalarbytes
    • [x] crypto_scalarmult_primitive
    • [ ] crypto_scalarmult_ristretto255
    • [ ] crypto_scalarmult_ristretto255_base
    • [ ] crypto_scalarmult_ristretto255_bytes
    • [ ] crypto_scalarmult_ristretto255_scalarbytes
    • [x] crypto_scalarmult_scalarbytes
    • [x] crypto_secretbox
    • [ ] crypto_secretbox_boxzerobytes
    • [x] crypto_secretbox_detached
    • [x] crypto_secretbox_easy
    • [x] crypto_secretbox_keybytes
    • [x] crypto_secretbox_keygen
    • [x] crypto_secretbox_macbytes
    • [x] crypto_secretbox_messagebytes_max
    • [x] crypto_secretbox_noncebytes
    • [x] crypto_secretbox_open
    • [x] crypto_secretbox_open_detached
    • [x] crypto_secretbox_open_easy
    • [x] crypto_secretbox_primitive
    • [ ] crypto_secretbox_xchacha20poly1305_detached
    • [ ] crypto_secretbox_xchacha20poly1305_easy
    • [ ] crypto_secretbox_xchacha20poly1305_keybytes
    • [ ] crypto_secretbox_xchacha20poly1305_macbytes
    • [ ] crypto_secretbox_xchacha20poly1305_messagebytes_max
    • [ ] crypto_secretbox_xchacha20poly1305_noncebytes
    • [ ] crypto_secretbox_xchacha20poly1305_open_detached
    • [ ] crypto_secretbox_xchacha20poly1305_open_easy
    • [ ] crypto_secretbox_xsalsa20poly1305
    • [ ] crypto_secretbox_xsalsa20poly1305_boxzerobytes
    • [ ] crypto_secretbox_xsalsa20poly1305_keybytes
    • [ ] crypto_secretbox_xsalsa20poly1305_keygen
    • [ ] crypto_secretbox_xsalsa20poly1305_macbytes
    • [ ] crypto_secretbox_xsalsa20poly1305_messagebytes_max
    • [ ] crypto_secretbox_xsalsa20poly1305_noncebytes
    • [ ] crypto_secretbox_xsalsa20poly1305_open
    • [ ] crypto_secretbox_xsalsa20poly1305_zerobytes
    • [ ] crypto_secretbox_zerobytes
    • [x] crypto_secretstream_xchacha20poly1305_abytes
    • [x] crypto_secretstream_xchacha20poly1305_headerbytes
    • [x] crypto_secretstream_xchacha20poly1305_init_pull
    • [x] crypto_secretstream_xchacha20poly1305_init_push
    • [x] crypto_secretstream_xchacha20poly1305_keybytes
    • [x] crypto_secretstream_xchacha20poly1305_keygen
    • [x] crypto_secretstream_xchacha20poly1305_messagebytes_max
    • [x] crypto_secretstream_xchacha20poly1305_pull
    • [x] crypto_secretstream_xchacha20poly1305_push
    • [x] crypto_secretstream_xchacha20poly1305_rekey
    • [x] crypto_secretstream_xchacha20poly1305_statebytes
    • [x] crypto_secretstream_xchacha20poly1305_tag_final
    • [x] crypto_secretstream_xchacha20poly1305_tag_message
    • [x] crypto_secretstream_xchacha20poly1305_tag_push
    • [x] crypto_secretstream_xchacha20poly1305_tag_rekey
    • [x] crypto_shorthash
    • [x] crypto_shorthash_bytes
    • [x] crypto_shorthash_keybytes
    • [x] crypto_shorthash_keygen
    • [x] crypto_shorthash_primitive
    • [ ] crypto_shorthash_siphash24
    • [ ] crypto_shorthash_siphash24_bytes
    • [ ] crypto_shorthash_siphash24_keybytes
    • [ ] crypto_shorthash_siphashx24
    • [ ] crypto_shorthash_siphashx24_bytes
    • [ ] crypto_shorthash_siphashx24_keybytes
    • [x] crypto_sign
    • [x] crypto_sign_bytes
    • [x] crypto_sign_detached
    • [ ] crypto_sign_ed25519
    • [ ] crypto_sign_ed25519_bytes
    • [ ] crypto_sign_ed25519_detached
    • [ ] crypto_sign_ed25519_keypair
    • [ ] crypto_sign_ed25519_messagebytes_max
    • [ ] crypto_sign_ed25519_open
    • [ ] crypto_sign_ed25519_pk_to_curve25519
    • [ ] crypto_sign_ed25519_publickeybytes
    • [ ] crypto_sign_ed25519_secretkeybytes
    • [ ] crypto_sign_ed25519_seed_keypair
    • [ ] crypto_sign_ed25519_seedbytes
    • [ ] crypto_sign_ed25519_sk_to_curve25519
    • [ ] crypto_sign_ed25519_sk_to_pk
    • [ ] crypto_sign_ed25519_sk_to_seed
    • [ ] crypto_sign_ed25519_verify_detached
    • [ ] crypto_sign_ed25519ph_final_create
    • [ ] crypto_sign_ed25519ph_final_verify
    • [ ] crypto_sign_ed25519ph_init
    • [ ] crypto_sign_ed25519ph_statebytes
    • [ ] crypto_sign_ed25519ph_update
    • [x] crypto_sign_final_create
    • [x] crypto_sign_final_verify
    • [x] crypto_sign_init
    • [x] crypto_sign_keypair
    • [x] crypto_sign_messagebytes_max
    • [x] crypto_sign_open
    • [x] crypto_sign_primitive
    • [x] crypto_sign_publickeybytes
    • [x] crypto_sign_secretkeybytes
    • [x] crypto_sign_seed_keypair
    • [x] crypto_sign_seedbytes
    • [x] crypto_sign_statebytes
    • [x] crypto_sign_update
    • [x] crypto_sign_verify_detached
    • [x] crypto_stream
    • [ ] crypto_stream_chacha20
    • [ ] crypto_stream_chacha20_ietf
    • [ ] crypto_stream_chacha20_ietf_ext
    • [ ] crypto_stream_chacha20_ietf_ext_xor_ic
    • [ ] crypto_stream_chacha20_ietf_keybytes
    • [ ] crypto_stream_chacha20_ietf_keygen
    • [ ] crypto_stream_chacha20_ietf_messagebytes_max
    • [ ] crypto_stream_chacha20_ietf_noncebytes
    • [ ] crypto_stream_chacha20_ietf_xor
    • [ ] crypto_stream_chacha20_ietf_xor_ic
    • [ ] crypto_stream_chacha20_keybytes
    • [ ] crypto_stream_chacha20_keygen
    • [ ] crypto_stream_chacha20_messagebytes_max
    • [ ] crypto_stream_chacha20_noncebytes
    • [ ] crypto_stream_chacha20_xor
    • [ ] crypto_stream_chacha20_xor_ic
    • [x] crypto_stream_keybytes
    • [x] crypto_stream_keygen
    • [x] crypto_stream_messagebytes_max
    • [x] crypto_stream_noncebytes
    • [x] crypto_stream_primitive
    • [ ] crypto_stream_salsa20
    • [ ] crypto_stream_salsa2012
    • [ ] crypto_stream_salsa2012_keybytes
    • [ ] crypto_stream_salsa2012_keygen
    • [ ] crypto_stream_salsa2012_messagebytes_max
    • [ ] crypto_stream_salsa2012_noncebytes
    • [ ] crypto_stream_salsa2012_xor
    • [ ] crypto_stream_salsa208
    • [ ] crypto_stream_salsa208_keybytes
    • [ ] crypto_stream_salsa208_keygen
    • [ ] crypto_stream_salsa208_messagebytes_max
    • [ ] crypto_stream_salsa208_noncebytes
    • [ ] crypto_stream_salsa208_xor
    • [ ] crypto_stream_salsa20_keybytes
    • [ ] crypto_stream_salsa20_keygen
    • [ ] crypto_stream_salsa20_messagebytes_max
    • [ ] crypto_stream_salsa20_noncebytes
    • [ ] crypto_stream_salsa20_xor
    • [ ] crypto_stream_salsa20_xor_ic
    • [ ] crypto_stream_xchacha20
    • [ ] crypto_stream_xchacha20_keybytes
    • [ ] crypto_stream_xchacha20_keygen
    • [ ] crypto_stream_xchacha20_messagebytes_max
    • [ ] crypto_stream_xchacha20_noncebytes
    • [ ] crypto_stream_xchacha20_xor
    • [ ] crypto_stream_xchacha20_xor_ic
    • [x] crypto_stream_xor
    • [ ] crypto_stream_xsalsa20
    • [ ] crypto_stream_xsalsa20_keybytes
    • [ ] crypto_stream_xsalsa20_keygen
    • [ ] crypto_stream_xsalsa20_messagebytes_max
    • [ ] crypto_stream_xsalsa20_noncebytes
    • [ ] crypto_stream_xsalsa20_xor
    • [ ] crypto_stream_xsalsa20_xor_ic
    • [ ] crypto_verify_16
    • [ ] crypto_verify_16_bytes
    • [ ] crypto_verify_32
    • [ ] crypto_verify_32_bytes
    • [ ] crypto_verify_64
    • [ ] crypto_verify_64_bytes
    • [ ] escrypt_PBKDF2_SHA256
    • [ ] escrypt_alloc_region
    • [ ] escrypt_free_local
    • [ ] escrypt_free_region
    • [ ] escrypt_gensalt_r
    • [ ] escrypt_init_local
    • [ ] escrypt_kdf_nosse
    • [ ] escrypt_kdf_sse
    • [ ] escrypt_parse_setting
    • [ ] escrypt_r
    • [ ] fe25519_frombytes
    • [ ] fe25519_invert
    • [ ] fe25519_tobytes
    • [ ] ge25519_add_cached
    • [ ] ge25519_double_scalarmult_vartime
    • [ ] ge25519_from_hash
    • [ ] ge25519_from_uniform
    • [ ] ge25519_frombytes
    • [ ] ge25519_frombytes_negate_vartime
    • [ ] ge25519_has_small_order
    • [ ] ge25519_is_canonical
    • [ ] ge25519_is_on_curve
    • [ ] ge25519_is_on_main_subgroup
    • [ ] ge25519_p1p1_to_p2
    • [ ] ge25519_p1p1_to_p3
    • [ ] ge25519_p3_to_cached
    • [ ] ge25519_p3_tobytes
    • [ ] ge25519_scalarmult
    • [ ] ge25519_scalarmult_base
    • [ ] ge25519_sub_cached
    • [ ] ge25519_tobytes
    • [x] randombytes
    • [x] randombytes_buf
    • [x] randombytes_buf_deterministic
    • [x] randombytes_close
    • [x] randombytes_implementation_name
    • [x] randombytes_random
    • [x] randombytes_seedbytes
    • [ ] randombytes_set_implementation
    • [x] randombytes_stir
    • [x] randombytes_uniform
    • [ ] ristretto255_from_hash
    • [ ] ristretto255_frombytes
    • [ ] ristretto255_p3_tobytes
    • [ ] sc25519_invert
    • [ ] sc25519_is_canonical
    • [ ] sc25519_mul
    • [ ] sc25519_muladd
    • [ ] sc25519_reduce
    • [ ] sodium_add
    • [ ] sodium_allocarray
    • [x] sodium_base642bin
    • [x] sodium_base64_encoded_len
    • [x] sodium_bin2base64
    • [x] sodium_bin2hex
    • [ ] sodium_compare
    • [ ] sodium_crit_enter
    • [ ] sodium_crit_leave
    • [ ] sodium_free
    • [x] sodium_hex2bin
    • [ ] sodium_increment
    • [x] sodium_init
    • [ ] sodium_is_zero
    • [x] sodium_library_minimal
    • [x] sodium_library_version_major
    • [x] sodium_library_version_minor
    • [ ] sodium_malloc
    • [x] sodium_memcmp
    • [ ] sodium_memzero
    • [ ] sodium_misuse
    • [ ] sodium_mlock
    • [ ] sodium_mprotect_noaccess
    • [ ] sodium_mprotect_readonly
    • [ ] sodium_mprotect_readwrite
    • [ ] sodium_munlock
    • [x] sodium_pad
    • [x] sodium_runtime_has_aesni
    • [ ] sodium_runtime_has_armcrypto
    • [x] sodium_runtime_has_avx
    • [x] sodium_runtime_has_avx2
    • [x] sodium_runtime_has_avx512f
    • [x] sodium_runtime_has_neon
    • [x] sodium_runtime_has_pclmul
    • [x] sodium_runtime_has_rdrand
    • [x] sodium_runtime_has_sse2
    • [x] sodium_runtime_has_sse3
    • [x] sodium_runtime_has_sse41
    • [x] sodium_runtime_has_ssse3
    • [ ] sodium_scalarmult_curve25519_sandy2x_fe51_mul
    • [ ] sodium_scalarmult_curve25519_sandy2x_fe51_nsquare
    • [ ] sodium_scalarmult_curve25519_sandy2x_fe51_pack
    • [ ] sodium_scalarmult_curve25519_sandy2x_ladder
    • [ ] sodium_set_misuse_handler
    • [ ] sodium_stackzero
    • [ ] sodium_stream_salsa20_xmm6
    • [ ] sodium_stream_salsa20_xmm6_xor_ic
    • [ ] sodium_sub
    • [x] sodium_unpad
    • [x] sodium_version_string
    enhancement 
    opened by kozw 12
  • iOS Build Errors: no rule to process file, UnsafeMutablePointer<_>' to expected argument type 'OpaquePointer?

    iOS Build Errors: no rule to process file, UnsafeMutablePointer<_>' to expected argument type 'OpaquePointer?

    Created a new Flutter project with -i swift -a kotlin options, added flutter_sodium: ^0.0.9 to pubspec.yaml.

    During debug build, I get the following errors:

    Launching lib/main.dart on iPhone Xʀ in debug mode...
    Xcode build done.                                            3.1s
    Failed to build iOS app
    Error output from Xcode build:
    ↳
        ** BUILD FAILED **
    Xcode's output:
    ↳
        === BUILD TARGET flutter_sodium OF PROJECT Pods WITH CONFIGURATION Debug ===
        warning: no rule to process file '~/.pub-cache/hosted/pub.dartlang.org/flutter_sodium-0.0.9/ios/Classes/libsodium-ios/lib/libsodium.a' of type archive.ar for architecture x86_64
        === BUILD TARGET flutter_sodium OF PROJECT Pods WITH CONFIGURATION Debug ===
       ~/.pub-cache/hosted/pub.dartlang.org/flutter_sodium-0.0.9/ios/Classes/SwiftFlutterSodiumPlugin.swift:1358:50: error: cannot convert value of type 'UnsafeMutablePointer<_>' to expected argument type 'OpaquePointer?'
                  flutter_sodium.crypto_generichash_init(statePtr, keyPtr, key.count, outlen)
                                                         ^~~~~~~~
       ~/.pub-cache/hosted/pub.dartlang.org/flutter_sodium-0.0.9/ios/Classes/SwiftFlutterSodiumPlugin.swift:1364:48: error: cannot convert value of type 'UnsafeMutablePointer<_>' to expected argument type 'OpaquePointer?'
                flutter_sodium.crypto_generichash_init(statePtr, nil, 0, outlen)
                                                       ^~~~~~~~
       ~/.pub-cache/hosted/pub.dartlang.org/flutter_sodium-0.0.9/ios/Classes/SwiftFlutterSodiumPlugin.swift:1378:50: error: cannot convert value of type 'UnsafeMutablePointer<_>' to expected argument type 'OpaquePointer?'
                flutter_sodium.crypto_generichash_update(statePtr, iPtr, CUnsignedLongLong(i.count))
                                                         ^~~~~~~~
       ~/.pub-cache/hosted/pub.dartlang.org/flutter_sodium-0.0.9/ios/Classes/SwiftFlutterSodiumPlugin.swift:1394:49: error: cannot convert value of type 'UnsafeMutablePointer<_>' to expected argument type 'OpaquePointer?'
                flutter_sodium.crypto_generichash_final(statePtr, outPtr, outlen)
                                                        ^~~~~~~~
    Could not build the application for the simulator.
    
    Error launching application on iPhone Xʀ.
    Exited (sigterm)
    
    

    $ flutter doctor

    [✓] Flutter (Channel stable, v1.2.1, on Mac OS X 10.14.4 18E226, locale en-US)
    [✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    [✓] iOS toolchain - develop for iOS devices (Xcode 10.2)
    [✓] Android Studio (version 3.3)
    [✓] VS Code (version 1.33.1)
    [✓] Connected device (1 available)
    
    • No issues found!
    

    Podfile

    # Uncomment this line to define a global platform for your project
    platform :ios, '9.0'
    
    # CocoaPods analytics sends network stats synchronously affecting flutter build latency.
    ENV['COCOAPODS_DISABLE_STATS'] = 'true'
    
    project 'Runner', {
      'Debug' => :debug,
      'Profile' => :release,
      'Release' => :release,
    }
    
    def parse_KV_file(file, separator='=')
      file_abs_path = File.expand_path(file)
      if !File.exists? file_abs_path
        return [];
      end
      pods_ary = []
      skip_line_start_symbols = ["#", "/"]
      File.foreach(file_abs_path) { |line|
          next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ }
          plugin = line.split(pattern=separator)
          if plugin.length == 2
            podname = plugin[0].strip()
            path = plugin[1].strip()
            podpath = File.expand_path("#{path}", file_abs_path)
            pods_ary.push({:name => podname, :path => podpath});
          else
            puts "Invalid plugin specification: #{line}"
          end
      }
      return pods_ary
    end
    
    target 'Runner' do
      use_frameworks!
    
      # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
      # referring to absolute paths on developers' machines.
      system('rm -rf .symlinks')
      system('mkdir -p .symlinks/plugins')
    
      # Flutter Pods
      generated_xcode_build_settings = parse_KV_file('./Flutter/Generated.xcconfig')
      if generated_xcode_build_settings.empty?
        puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter packages get is executed first."
      end
      generated_xcode_build_settings.map { |p|
        if p[:name] == 'FLUTTER_FRAMEWORK_DIR'
          symlink = File.join('.symlinks', 'flutter')
          File.symlink(File.dirname(p[:path]), symlink)
          pod 'Flutter', :path => File.join(symlink, File.basename(p[:path]))
        end
      }
    
      # Plugin Pods
      plugin_pods = parse_KV_file('../.flutter-plugins')
      plugin_pods.map { |p|
        symlink = File.join('.symlinks', 'plugins', p[:name])
        File.symlink(p[:path], symlink)
        pod p[:name], :path => File.join(symlink, 'ios')
      }
    end
    
    post_install do |installer|
      installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
          config.build_settings['ENABLE_BITCODE'] = 'NO'
          config.build_settings['SWIFT_VERSION'] = '4.2'
        end
      end
    end
    
    opened by 5inline 10
  • cryptoBoxSeal not returning anything.

    cryptoBoxSeal not returning anything.

    This is a bit of a strange issue. I'm not getting an error, or any kind of response from the function what so ever. It just does nothing. The following code is what I'm using to call the function. The execution just stops when the function is called although my flutter app continues to operate.

    var encoder = new JsonEncoder();

    var jsonencoded = encoder.convert(data);
    
    var jsonBeforeSeal = utf8.encode(jsonencoded);
    
            print("Data before seal.");
            print(jsonBeforeSeal);
    
            print("Public Key");
            print(_publicKey);
    
            Uint8List response = await Sodium.cryptoBoxSeal(jsonBeforeSeal, utf8.encode(_publicKey));
    

    The public key is returned from my server in hex format and worked in my ionic version of my app.

    opened by pneves001 9
  • Plugin with id 'com.android.library' not found.

    Plugin with id 'com.android.library' not found.

    First I'd like to thank you for all your hard work. I really love your project and without it the Psono app would not be possible!

    Now to the problem. I have recently upgraded gradle and so on yet now I receive this error:

    FAILURE: Build failed with an exception.
    
    * Where:
    Build file '/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_sodium-0.1.9/android/build.gradle' line: 1
    
    * What went wrong:
    A problem occurred evaluating root project 'flutter_sodium'.
    > Plugin with id 'com.android.library' not found.
    
    * Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
    
    * Get more help at https://help.gradle.org
    
    BUILD FAILED in 9s
    
    
    The plugin flutter_sodium could not be built due to the issue above.
    

    Googling it brought be to this stackoverflow article.

    https://stackoverflow.com/questions/33508777/gradle-error-in-android-studio-plugin-with-id-com-android-library-not-found/33513015

    Which blames this line here https://github.com/firstfloorsoftware/flutter_sodium/blob/master/android/build.gradle#L1

    I downgraded again to com.android.tools.build:gradle:3.6.4 and things are working again.

    opened by chickahoona 8
  • Cannot use libsodium

    Cannot use libsodium

    i import the package and i do before any encryption call i do

    Sodium.init();

    but on some devices there came a exception:

    dlopen failed: library "libsodium.so" not found

    Screen of user:

    Screenshot_20210106-112014

    is it a bug? or did i miss something?

    do you have any idea, what the problem is?

    bug 
    opened by maerlynflagg 7
  • Use Dart VM FFI

    Use Dart VM FFI

    The Flutter 2019 roadmap lists better support for C/C++ libraries from Flutter, including direct calls to C/C++ from Dart. This is of major importance for flutter_sodium. The current implementation uses platform channels with Java and Swift interop.

    Not only is the runtime performance sub-optimal, there's a lot of code to write and maintain. Not to mention the fact that the Android version is still lacking in features compared to iOS due to a dependency on incomplete 3rd party libraries (#7)

    As soon as native C interop is available, flutter_sodium should take advantage of it. You can track the Dart issue and read more in the FFI vision document. Looks like an initial version is planned somewhere in Q1 2019.

    enhancement 
    opened by kozw 7
  • flutter_sodium does not build for IOS.

    flutter_sodium does not build for IOS.

    === BUILD TARGET flutter_sodium OF PROJECT Pods WITH CONFIGURATION Debug ===
    warning: no rule to process file '/.pub-cache/hosted/pub.dartlang.org/flutter_sodium-0.0.2/ios/Classes/libsodium-ios/lib/libsodium.a' of type archive.ar for architecture armv7
    warning: no rule to process file /.pub-cache/hosted/pub.dartlang.org/flutter_sodium-0.0.2/ios/Classes/libsodium-ios/lib/libsodium.a' of type archive.ar for architecture arm64
    /Users/.pub-cache/hosted/pub.dartlang.org/flutter_sodium-0.0.2/ios/Classes/FlutterSodiumPlugin.m:2:9: fatal error: 'flutter_sodium/flutter_sodium-Swift.h' file not found
    #import <flutter_sodium/flutter_sodium-Swift.h>
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    1 error generated.
    
    opened by pneves001 7
  • Error executing included example app on iOS

    Error executing included example app on iOS

    Hi,

    Included example app crashes on iOS:

    Jun 16 13:48:42 iPhone-7 Runner(Flutter)[510] : [VERBOSE-2:ui_dart_state.cc(166)] Unhandled Exception: Invalid argument(s): Failed to lookup symbol (dlsym(RTLD_DEFAULT, sodium_init): symbol not found) #0 DynamicLibrary.lookup (dart:ffi-patch/ffi_dynamic_library_patch.dart:31) #1 new SodiumBindings (package:flutter_sodium/src/bindings/sodium_bindings.dart:9) #2 Sodium._sodium (package:flutter_sodium/src/sodium.dart:49) #3 Sodium._sodium (package:flutter_sodium/src/sodium.dart:0) #4 Sodium.sodiumInit (package:flutter_sodium/src/sodium.dart:2013) #5 main (package:flutter_sodium_example/main.dart:7) #6 _runMainZoned.. (dart:ui/hooks.dart:247) #7 _rootRun (dart:async/zone.dart:1190) #8 _CustomZone.run (dart:async/zone.dart:1093) #9 _runZoned (dart:async/zone.dart:1630) #10 runZonedGuarded (dart:async/zone.dart:1618) #11 _runMainZoned. (dart:ui/hooks.dart:239) #12 _startIsolate. (dart:isolate-patch/isolate_patch.dart:<\M-b\M^@\M-&>

    Flutter 1.19.0-4.1.pre • channel beta • https://github.com/flutter/flutter.gitFramework • revision f994b76974 (7 days ago) • 2020-06-09 15:53:13 -0700Engine • revision 9a28c3bcf4Tools • Dart 2.9.0 (build 2.9.0-14.1.beta)

    opened by soyangel 6
  • KeyPair functions should return an object rather than a map

    KeyPair functions should return an object rather than a map

    Any functions returning a map would be better off returning an object with members. As it stands, the developer needs to figure out that the public key and secret key are returned under the keys 'pk' and 'sk', and perform their own check that those parameters are actually returned.

    At the least the map should be documented and there should be constants for the various keys.

    If this were to be changed it is a breaking change, but one that could be mitigated either completely or partially by making the class being returned either implement Map<String,Uint8List> or at least override operator [](String key).

    The same goes for the functions that reutrn tx/rx keys and nonce+encrypted key or key+nonce.

    opened by rmtmckenzie 6
  • Key derivation using XOR (^) instead of power function

    Key derivation using XOR (^) instead of power function

    Hi guys!

    I recently moved an app to Flutter 2.x, and with that updated the flutter_sodium to the most up-to-date version.

    After the update I started getting an RangeError coming from the library. Following the functions' calls I faced what I believe to be the issue. Just to clarify, here is the step-by-step:

    KeyDerivation.derive (src/key_derivation.dart) -> cryptoKdfDeriveFromKey (src/sodium.dart) -> RangeError.checkValueInInterval(subkeyId, 0, (2 ^ 64) - 1, 'subkeyId')

    The code checks here if subkeyId fit in the interval between 0 and (2 ^ 64) - 1.

    Something was off about this error, so I made some research and concluded it's a typo in the max value of the range, probably came from the official sodium key derivation docs or something like that. In this page we have the identical math operation: subkey_id can be any value up to (2^64)-1.

    Apparently the end of the interval is erroneous represented here using the math notation instead of dart language notation, which means the ^ character is a bitwise XOR instead of the math operation power, which I suppose should be the correct thing to do here. Btw, the result of (2 ^ 64) - 1 is always 65.

    Anyway, here is the issue. Can you guys confirm? I hope I'm not being blind about something and opening an issue with no need.

    opened by guilhermeavanci 2
  • Update pub.dev release

    Update pub.dev release

    Hey, I want to publish my app to flathub. As flathub links the libraries to /app/libs, I am not able to run my app properly, because the 0.2.0 release on pub.dev is statically linked to /usr/local/libs. If you publish a newer version, I could publish my app (or at least come a step closer to it). That would be pretty nice from you. Thank you very much!

    opened by j0chn1 2
  • Build issue when using Flutter 2.5.0

    Build issue when using Flutter 2.5.0

    Hi guys,

    when building the example app for iOS Simulator I'm getting this error:

    ld: in /Users/peter/Downloads/flutter_sodium-master/example/ios/Pods/../.symlinks/plugins/flutter_sodium/ios/libsodium.a(libsodium_la-aead_chacha20poly1305.o), building for iOS Simulator, but linking in object file built for iOS, file '/Users/peter/Downloads/flutter_sodium-master/example/ios/Pods/../.symlinks/plugins/flutter_sodium/ios/libsodium.a' for architecture arm64
        clang: error: linker command failed with exit code 1 (use -v to see invocation)
    

    Which suggests that libsodium.a does not support arm64 architecture.

    Anyone can help with this?

    Thanks, Peter

    opened by peterstojanowski 3
  • Argon2id in sensitive mode gives SodiumException crypto_pwhash failed with -1

    Argon2id in sensitive mode gives SodiumException crypto_pwhash failed with -1

    I'm using Flutter_Sodium version 0.2.0 and tried to generate an Argon2id13 password hash using the sensitive parameter set.

    My system parameter were:

    Flutter 2.2.1
    Dart 2.13.1
    Sodium version: 1.0.18
    Android 11: sdk_gphone_x86_arm-userdebug 11 RSR1.201013.001 6903271 dev-keys
    

    This is the code I used to generate the hash (the full code follows at the end):

    printC('Generate a 32 byte long encryption key with Argon2id in sensitive mode');
    printC('Sodium version: ' + Sodium.versionString);
    printC('Dart version: ' + Platform.version);
    final passphrase = 'secret passphrase';
    printC('passphrase: ' + passphrase);
    var salt16Byte = generateSalt16Byte();
    printC('salt (Base64): ' + base64Encoding(salt16Byte));
    final outlen = 32;
    final passwd = utf8.encoder.convert(passphrase);
    final opslimit = Sodium.cryptoPwhashOpslimitSensitive;
    final memlimit = Sodium.cryptoPwhashMemlimitSensitive;
    final alg = Sodium.cryptoPwhashAlgArgon2id13;
    printC('opsLimit: ' + Sodium.cryptoPwhashOpslimitSensitive.toString());
    printC('memLimit: ' + Sodium.cryptoPwhashMemlimitSensitive.toString());
    final hash =
    Sodium.cryptoPwhash(outlen, passwd, salt16Byte, opslimit, memlimit, alg);
    printC('hash (Base64): ' + base64Encoding(hash));
    

    I'm using the constants Sodium.cryptoPwhashOpslimitSensitive and Sodium.cryptoPwhashMemlimitSensitive for opsLimit and memLimit.

    The code fails with an Exception caught by gesture: SodiumException crypto_pwhash failed with -1 (full stack see below:):

    I/flutter ( 9661): Generate a 32 byte long encryption key with Argon2id in sensitive mode
    I/flutter ( 9661): Sodium version: 1.0.18
    I/flutter ( 9661): Dart version: 2.13.1 (stable) (Fri May 21 12:45:36 2021 +0200) on "android_ia32"
    I/flutter ( 9661): passphrase: secret passphrase
    I/flutter ( 9661): salt (Base64): tVcZQuWbpNxGrvJ45H5Q8Q==
    I/flutter ( 9661): opsLimit: 4
    I/flutter ( 9661): memLimit: 1073741824
    
    ======== Exception caught by gesture ===============================================================
    The following SodiumException object was thrown while handling a gesture:
      crypto_pwhash failed with -1
    
    When the exception was thrown, this was the stack:
    #0      Result.mustSucceed (package:flutter_sodium/src/extensions.dart:48:7)
    #1      Sodium.cryptoPwhash (package:flutter_sodium/src/sodium.dart:1087:12)
    #2      _MyWidgetState.runYourMainDartCode (package:dartprojectspointycastle/CrossPlatformCryptography/LibsodiumArgon2idSensitiveIssue.dart:136:12)
    #3      _MyWidgetState.build.<anonymous closure> (package:dartprojectspointycastle/CrossPlatformCryptography/LibsodiumArgon2idSensitiveIssue.dart:82:21)
    #4      _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:989:21)
    ...
    Handler: "onTap"
    Recognizer: TapGestureRecognizer#87d41
      debugOwner: GestureDetector
      state: possible
      won arena
      finalPosition: Offset(300.3, 727.6)
      finalLocalPosition: Offset(35.2, 10.3)
      button: 1
      sent tap down
    ====================================================================================================
    

    full code (it's a simple console app, just press "run the code"):

    import 'dart:convert';
    import 'dart:io';
    import 'dart:typed_data';
    
    import 'package:flutter/material.dart';
    import 'package:flutter_sodium/flutter_sodium.dart';
    
    void main() => runApp(MyApp());
    class MyApp extends StatelessWidget {
      @override
      Widget build(BuildContext context) {
        return MaterialApp(
          title: 'Flutter',
          home: Scaffold(
            appBar: AppBar(
              title: Text('Flutter Console'),
            ),
            body: MyWidget(),
          ),
        );
      }
    }
    
    // widget class
    class MyWidget extends StatefulWidget {
      @override
      _MyWidgetState createState() => _MyWidgetState();
    }
    
    class _MyWidgetState extends State<MyWidget> {
      // state variable
      String _textString = 'press the button "run the code"';
      @override
      Widget build(BuildContext context) {
        return Column(
          children: [
            Text(
              'console output',
              style: TextStyle(fontSize: 30),
            ),
            Expanded(
              flex: 1,
              child: new SingleChildScrollView(
                scrollDirection: Axis.vertical,
                child: Padding(
                    padding: EdgeInsets.fromLTRB(10, 5, 10, 5),
                    child: Text(_textString,
                        style: TextStyle(
                          fontSize: 20.0,
                          fontWeight: FontWeight.bold,
                          fontFamily: 'Courier',
                          color: Colors.black,
                        ))),
              ),
            ),
            Container(
              child: Row(
                children: <Widget>[
                  SizedBox(width: 10),
                  Expanded(
                    child: ElevatedButton(
                      child: Text('clear console'),
                      onPressed: () {
                        clearConsole();
                      },
                    ),
                  ),
                  SizedBox(width: 10),
                  Expanded(
                    child: ElevatedButton(
                      child: Text('extra Button'),
                      onPressed: () {
                        runYourSecondDartCode();
                      },
                    ),
                  ),
                  SizedBox(width: 10),
                  Expanded(
                    child: ElevatedButton(
                      child: Text('run the code'),
                      onPressed: () {
                        runYourMainDartCode();
                      },
                    ),
                  ),
                  SizedBox(width: 10),
                ],
              ),
            ),
          ],
        );
      }
    
      void clearConsole() {
        setState(() {
          _textString = ''; // will add additional lines
        });
      }
    
      void printC(_newString) {
        setState(() {
          _textString =
              _textString + _newString + '\n';
        });
        print(_newString); // extra output on Console
      }
      /* ### instructions ###
          place your code inside runYourMainDartCode and print it to the console
          using printC('your output to the console');
          clearConsole() clears the actual console
          place your code that needs to be executed additionally inside
          runYourSecondDartCode and start it with "extra Button"
       */
      void runYourMainDartCode() {
    
        clearConsole();
        printC('Generate a 32 byte long encryption key with Argon2id in sensitive mode');
    
        printC('Sodium version: ' + Sodium.versionString);
        printC('Dart version: ' + Platform.version);
    
        final passphrase = 'secret passphrase';
        printC('passphrase: ' + passphrase);
    
        var salt16Byte = generateSalt16Byte();
        printC('salt (Base64): ' + base64Encoding(salt16Byte));
    
        final outlen = 32;
        final passwd = utf8.encoder.convert(passphrase);
        final opslimit = Sodium.cryptoPwhashOpslimitSensitive;
        final memlimit = Sodium.cryptoPwhashMemlimitSensitive;
        final alg = Sodium.cryptoPwhashAlgArgon2id13;
        printC('opsLimit: ' + Sodium.cryptoPwhashOpslimitSensitive.toString());
        printC('memLimit: ' + Sodium.cryptoPwhashMemlimitSensitive.toString());
        final hash =
        Sodium.cryptoPwhash(outlen, passwd, salt16Byte, opslimit, memlimit, alg);
        printC('hash (Base64): ' + base64Encoding(hash));
      }
    
      Uint8List generateSalt16Byte() {
        return Sodium.randombytesBuf(16);
      }
    
      String base64Encoding(Uint8List input) {
        return base64.encode(input);
      }
    
      void runYourSecondDartCode() {
        printC('execute additional code');
      }
    }
    
    
    opened by java-crypto 2
Releases(v0.0.1)
Owner
First Floor Software
First Floor Software
Dart bindings for Raylib!

Raylib-Dart Dart bindings for raylib 3.7.0, a simple and easy-to-use library to learn videogames programming www.raylib.com Note This project is still

Ryuzaki 6 Jan 18, 2022
Aris wasmjsextend - Binding generator for FFI bindings

Binding generator for FFI bindings. Note: ffigen only supports parsing C headers

Behruz Hurramov 1 Jan 9, 2022
🆙🚀 Flutter application upgrade/ Flutter App Upgrade /Flutter App Update/Flutter Update / download Plug-in

???? Flutter application upgrade/ Flutter App Upgrade /Flutter App Update/Flutter Update / download Plug-in (with notice bar progress), supports full upgrade, hot update and incremental upgrade

PengHui Li 344 Dec 30, 2022
ABC of Flutter widgets. Intended for super beginners at Flutter. Play with 35+ examples in DartPad directly and get familiar with various basic widgets in Flutter

Basic Widgets Examples This is aimed for complete beginners in Flutter, to get them acquainted with the various basic widgets in Flutter. Run this pro

Pooja Bhaumik 815 Jan 3, 2023
Minha primeira aplicação android utilizando Flutter feito no curso de Flutter da Cod3r Cursos Online. O foco dessa aplicação foi um contato inicial com o Flutter.

expenses Expenses é uma aplicação android simples feita em Flutter para controlar despesas pessoais. A aplicação consiste em: Listar transações feitas

Guilherme Teixeira Ais 2 Apr 19, 2022
Flutter Github Following Application, Using Flutter Provider and Flutter HTTP to get data from Github API.

Flutter Github Following Application Watch it on Youtube Previous Designs Checkout my Youtube channel Installation Please remember, after cloning this

Mohammad Rahmani 110 Dec 23, 2022
Flutter RSS feed parsing - A demo application of flutter which parse RSS XML contents to the flutter application

Flutter RSS feed parsing demo This is demo application of flutter which shows ho

Nyakuri Levite 3 Nov 15, 2022
Boris Gautier 1 Jan 31, 2022
Code for Flutter Talk from Flutter Vikings 2022: Custom User Interactions in Flutter

Custom User Interactions - Flutter Vikings 2022 A companion app for the Flutter Vikings 2022 talk - Custom User Interactions with Shortcuts, Intents,

Justin McCandless 9 Sep 16, 2022
Create a Flutter User Profile Page UI where you can access and edit your user's information within your Flutter app.

Flutter Tutorial - User Profile Page UI 1/2 Create a Flutter User Profile Page UI where you can access and edit your user's information within your Fl

Johannes Milke 46 Dec 6, 2022
Create a Flutter User Profile Page UI where you can access and edit your user's information within your Flutter app.

Flutter Tutorial - User Profile Page UI #2 Create a Flutter User Profile Page UI where you can access and edit your user's information within your Flu

Johannes Milke 45 Dec 15, 2022
Let's create a selectable Flutter Navigation Drawer with routing that highlights the current item within the Flutter Sidebar Menu.

Flutter Tutorial - Sidebar Menu & Selectable Navigation Drawer Let's create a selectable Flutter Navigation Drawer with routing that highlights the cu

Johannes Milke 12 Dec 26, 2022
Components that optimize Flutter fluency.(Flutter 流畅度优化的通用方案,轻松解决卡顿问题)

Flutter fluency optimization component "Keframe" Page switching fluency improved: How to use Project depend on: Quick learning Constructor Description

Ke Technologies 793 Dec 30, 2022
Challenge yourself every weekend with flutter. Join me to implement challenging UI & digital designs using Flutter.

Weekend With Flutter This is my new challenge. Every weekend, I want to implement challenging UI & digital designs using Flutter. you can join me with

Payam Zahedi 16 Feb 24, 2022
Let's create a complete Flutter User Profile Page with SharedPreferences to persist the user's information in Flutter.

Flutter Tutorial - User Profile & SharedPreferences Let's create a complete Flutter User Profile Page with SharedPreferences to persist the user's inf

Johannes Milke 21 Dec 3, 2022
Let's create a Flutter Collapsible Sidebar Menu that can collapse and expand the Navigation Drawer in Flutter.

Flutter Tutorial - Collapsible Sidebar Menu & Navigation Drawer Let's create a Flutter Collapsible Sidebar Menu that can collapse and expand the Navig

Johannes Milke 22 Jan 3, 2023
🚗 Apple CarPlay for Flutter Apps. Aims to make it safe to use apps made with Flutter in the car by integrating with CarPlay.

CarPlay with Flutter ?? Flutter Apps now on Apple CarPlay! flutter_carplay aims to make it safe to use iPhone apps made with Flutter in the car by int

Oğuzhan Atalay 156 Dec 26, 2022
Flutter ui boilerplate is easiest way to create new flutter project with clean code and well organized file folder.

Flutter UI Boilerplate "Sharing for fun" Flutter ui boilerplate is easiest way to create new flutter project with clean code and well organized file f

Dimas Ibnu Malik 122 Dec 1, 2022