diff --git a/lib/src/argon2_ffi_impl.dart b/lib/src/argon2_ffi_impl.dart index 8369d5b..676b85d 100644 --- a/lib/src/argon2_ffi_impl.dart +++ b/lib/src/argon2_ffi_impl.dart @@ -1,11 +1,11 @@ import 'dart:convert'; import 'dart:ffi'; import 'dart:io'; -import 'dart:typed_data'; import 'package:argon2_ffi_base/src/argon2_ffi_base.dart'; import 'package:argon2_ffi_base/src/utils.dart'; import 'package:ffi/ffi.dart'; +import 'package:flutter/foundation.dart'; import 'package:logging/logging.dart'; import 'package:path/path.dart' as path; @@ -99,7 +99,21 @@ class Argon2FfiFlutter extends Argon2Base { } static ResolveLibrary defaultResolveLibrary = (name) { - if (Platform.isLinux) { + if (TargetPlatform.aurora == defaultTargetPlatform) { + // on Aurora library is put into /usr/share/{AppName}/lib directory + final appName = path.basename(Platform.resolvedExecutable); + _logger.finest( + 'Resolving path to $name relative to /usr/share/$appName/lib'); + + final libPath = path.join('/usr/share/$appName/lib', name); + final f = File(libPath); + _logger.finest('checking /usr/share/$appName/lib for $name'); + if (f.existsSync()) { + // library available in the same path as the executable. + return libPath; + } + _logger.severe('Unable to find $name at $appName'); + } else if (Platform.isLinux) { // on linux the library is put into a `lib` sub directory. _logger.finest( 'Resolving path to $name relative to ${Platform.resolvedExecutable}'); @@ -142,8 +156,13 @@ class Argon2FfiFlutter extends Argon2Base { (Platform.isIOS || Platform.isMacOS)) { return DynamicLibrary.executable(); } + final libraryNames = [ [Platform.isAndroid, 'libargon2_ffi.so'], + [ + TargetPlatform.aurora == defaultTargetPlatform, + 'libargon2_ffi_platform_plugin.so' + ], [Platform.isLinux, './libargon2_ffi_plugin.so'], [Platform.isWindows, 'argon2_ffi_plugin.dll'], [Platform.isMacOS, 'libargon2_ffi.dylib'], diff --git a/pubspec.lock b/pubspec.lock index 4c33013..c581a73 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1,33 +1,95 @@ # Generated by pub # See https://dart.dev/tools/pub/glossary#lockfile packages: + characters: + dependency: transitive + description: + name: characters + sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" + url: "https://pub.dev" + source: hosted + version: "1.3.0" + collection: + dependency: transitive + description: + name: collection + sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687 + url: "https://pub.dev" + source: hosted + version: "1.17.2" ffi: dependency: "direct main" description: name: ffi - url: "https://pub.dartlang.org" + sha256: "7bf0adc28a23d395f19f3f1eb21dd7cfd1dd9f8e1c50051c069122e6853bc878" + url: "https://pub.dev" source: hosted - version: "2.0.0" + version: "2.1.0" + flutter: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" lints: dependency: "direct dev" description: name: lints - url: "https://pub.dartlang.org" + sha256: "5cfd6509652ff5e7fe149b6df4859e687fca9048437857cb2e65c8d780f396e3" + url: "https://pub.dev" source: hosted version: "2.0.0" logging: dependency: "direct main" description: name: logging - url: "https://pub.dartlang.org" + sha256: "293ae2d49fd79d4c04944c3a26dfd313382d5f52e821ec57119230ae16031ad4" + url: "https://pub.dev" source: hosted version: "1.0.2" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41" + url: "https://pub.dev" + source: hosted + version: "0.5.0" + meta: + dependency: transitive + description: + name: meta + sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3" + url: "https://pub.dev" + source: hosted + version: "1.9.1" path: dependency: "direct main" description: name: path - url: "https://pub.dartlang.org" + sha256: db9d4f58c908a4ba5953fcee2ae317c94889433e5024c27ce74a37f94267945b + url: "https://pub.dev" source: hosted version: "1.8.2" + sky_engine: + dependency: transitive + description: flutter + source: sdk + version: "0.0.99" + vector_math: + dependency: transitive + description: + name: vector_math + sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + web: + dependency: transitive + description: + name: web + sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10 + url: "https://pub.dev" + source: hosted + version: "0.1.4-beta" sdks: - dart: ">=2.17.0 <3.0.0" + dart: ">=3.1.0-185.0.dev <4.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index 241fb1c..f12fc88 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -2,12 +2,15 @@ name: argon2_ffi_base description: Base package defining the interface for an Argon2 implementation. version: 1.1.1 homepage: https://github.com/authpass/argon2_ffi_base +publish_to: none environment: sdk: '>=2.12.0 <3.0.0' dependencies: ffi: ">=1.0.0 <3.0.0" + flutter: + sdk: flutter logging: ">=1.0.0 <2.0.0" path: ">=1.8.0 <2.0.0"