From 7e362164868c9f2bd0aa58320ca22cbeee90c831 Mon Sep 17 00:00:00 2001 From: Herbert Poul Date: Tue, 18 Aug 2020 13:27:22 +0200 Subject: [PATCH] Better error message for mac os when unable to load dylib. --- CHANGELOG.md | 4 ++++ lib/src/argon2_ffi_impl.dart | 9 +++++++++ pubspec.yaml | 2 +- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 72860d5..eddda3f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.1.4+3 + +* Better error message for mac os when unable to load dylib. + ## 0.1.4+2 * separate implementation to allow dart:html compilation. diff --git a/lib/src/argon2_ffi_impl.dart b/lib/src/argon2_ffi_impl.dart index cef10b8..1e363bb 100644 --- a/lib/src/argon2_ffi_impl.dart +++ b/lib/src/argon2_ffi_impl.dart @@ -126,6 +126,15 @@ class Argon2FfiFlutter extends Argon2Base { 'Error while loading dynamic library from $path ($libraryName)', e, stackTrace); + if (e.message.toString().contains('hardened programs')) { + final message = 'Unable to load argon2 library. On MacOS you have to ' + 'remove hardening from dart binary:\n\n' + 'codesign --remove-signature ${Platform.resolvedExecutable}\n\n' + 'https://github.com/dart-lang/sdk/issues/39231#issuecomment-579743656'; + _logger.shout(message); + throw ArgumentError('${e.message}\n\n$message'); + } + rethrow; } } diff --git a/pubspec.yaml b/pubspec.yaml index 6a9c861..6e8588e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: argon2_ffi_base description: Base package defining the interface for an Argon2 implementation. -version: 0.1.4+2 +version: 0.1.4+3 homepage: https://github.com/authpass/argon2_ffi_base environment: