diff --git a/analysis_options.yaml b/analysis_options.yaml new file mode 100644 index 0000000..0439848 --- /dev/null +++ b/analysis_options.yaml @@ -0,0 +1,27 @@ +# This file configures the analyzer, which statically analyzes Dart code to +# check for errors, warnings, and lints. +# +# The issues identified by the analyzer are surfaced in the UI of Dart-enabled +# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be +# invoked from the command line by running `flutter analyze`. + +# The following line activates a set of recommended lints for Flutter apps, +# packages, and plugins designed to encourage good coding practices. +include: package:flutter_lints/flutter.yaml + +linter: + # The lint rules applied to this project can be customized in the + # section below to disable rules from the `package:flutter_lints/flutter.yaml` + # included above or to enable additional rules. A list of all available lints + # and their documentation is published at https://dart.dev/lints. + # + # Instead of disabling a lint rule for the entire project in the + # section below, it can also be suppressed for a single line of code + # or a specific dart file by using the `// ignore: name_of_lint` and + # `// ignore_for_file: name_of_lint` syntax on the line or in the file + # producing the lint. + rules: + # avoid_print: false # Uncomment to disable the `avoid_print` rule + # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule +# Additional information about this file can be found at +# https://dart.dev/guides/language/analysis-options diff --git a/example/.gitignore b/example/.gitignore index ae1f183..7853315 100644 --- a/example/.gitignore +++ b/example/.gitignore @@ -35,3 +35,9 @@ lib/generated_plugin_registrant.dart # Exceptions to above rules. !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages +macos +linux +windows +android +ios +web diff --git a/example/.metadata b/example/.metadata index 4adf4bf..78a65c5 100644 --- a/example/.metadata +++ b/example/.metadata @@ -4,7 +4,42 @@ # This file should be version controlled and should not be manually edited. version: - revision: f139b11009aeb8ed2a3a3aa8b0066e482709dde3 - channel: stable + revision: "9e1c857886f07d342cf106f2cd588bcd5e031bb2" + channel: "stable" project_type: app + +# Tracks metadata for the flutter migrate command +migration: + platforms: + - platform: root + create_revision: 9e1c857886f07d342cf106f2cd588bcd5e031bb2 + base_revision: 9e1c857886f07d342cf106f2cd588bcd5e031bb2 + - platform: android + create_revision: 9e1c857886f07d342cf106f2cd588bcd5e031bb2 + base_revision: 9e1c857886f07d342cf106f2cd588bcd5e031bb2 + - platform: ios + create_revision: 9e1c857886f07d342cf106f2cd588bcd5e031bb2 + base_revision: 9e1c857886f07d342cf106f2cd588bcd5e031bb2 + - platform: linux + create_revision: 9e1c857886f07d342cf106f2cd588bcd5e031bb2 + base_revision: 9e1c857886f07d342cf106f2cd588bcd5e031bb2 + - platform: macos + create_revision: 9e1c857886f07d342cf106f2cd588bcd5e031bb2 + base_revision: 9e1c857886f07d342cf106f2cd588bcd5e031bb2 + - platform: web + create_revision: 9e1c857886f07d342cf106f2cd588bcd5e031bb2 + base_revision: 9e1c857886f07d342cf106f2cd588bcd5e031bb2 + - platform: windows + create_revision: 9e1c857886f07d342cf106f2cd588bcd5e031bb2 + base_revision: 9e1c857886f07d342cf106f2cd588bcd5e031bb2 + + # User provided section + + # List of Local paths (relative to this file) that should be + # ignored by the migrate tool. + # + # Files that are not part of the templates will be ignored by default. + unmanaged_files: + - 'lib/main.dart' + - 'ios/Runner.xcodeproj/project.pbxproj' diff --git a/example/analysis_options.yaml b/example/analysis_options.yaml new file mode 100644 index 0000000..0d29021 --- /dev/null +++ b/example/analysis_options.yaml @@ -0,0 +1,28 @@ +# This file configures the analyzer, which statically analyzes Dart code to +# check for errors, warnings, and lints. +# +# The issues identified by the analyzer are surfaced in the UI of Dart-enabled +# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be +# invoked from the command line by running `flutter analyze`. + +# The following line activates a set of recommended lints for Flutter apps, +# packages, and plugins designed to encourage good coding practices. +include: package:flutter_lints/flutter.yaml + +linter: + # The lint rules applied to this project can be customized in the + # section below to disable rules from the `package:flutter_lints/flutter.yaml` + # included above or to enable additional rules. A list of all available lints + # and their documentation is published at https://dart.dev/lints. + # + # Instead of disabling a lint rule for the entire project in the + # section below, it can also be suppressed for a single line of code + # or a specific dart file by using the `// ignore: name_of_lint` and + # `// ignore_for_file: name_of_lint` syntax on the line or in the file + # producing the lint. + rules: + # avoid_print: false # Uncomment to disable the `avoid_print` rule + # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule + +# Additional information about this file can be found at +# https://dart.dev/guides/language/analysis-options diff --git a/example/android/.gitignore b/example/android/.gitignore deleted file mode 100644 index bc2100d..0000000 --- a/example/android/.gitignore +++ /dev/null @@ -1,7 +0,0 @@ -gradle-wrapper.jar -/.gradle -/captures/ -/gradlew -/gradlew.bat -/local.properties -GeneratedPluginRegistrant.java diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle deleted file mode 100644 index 6cee61f..0000000 --- a/example/android/app/build.gradle +++ /dev/null @@ -1,67 +0,0 @@ -def localProperties = new Properties() -def localPropertiesFile = rootProject.file('local.properties') -if (localPropertiesFile.exists()) { - localPropertiesFile.withReader('UTF-8') { reader -> - localProperties.load(reader) - } -} - -def flutterRoot = localProperties.getProperty('flutter.sdk') -if (flutterRoot == null) { - throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") -} - -def flutterVersionCode = localProperties.getProperty('flutter.versionCode') -if (flutterVersionCode == null) { - flutterVersionCode = '1' -} - -def flutterVersionName = localProperties.getProperty('flutter.versionName') -if (flutterVersionName == null) { - flutterVersionName = '1.0' -} - -apply plugin: 'com.android.application' -apply plugin: 'kotlin-android' -apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" - -android { - compileSdkVersion 28 - - sourceSets { - main.java.srcDirs += 'src/main/kotlin' - } - - lintOptions { - disable 'InvalidPackage' - } - - defaultConfig { - // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). - applicationId "com.firstfloorsoftware.flutter_sodium_example" - minSdkVersion 16 - targetSdkVersion 28 - versionCode flutterVersionCode.toInteger() - versionName flutterVersionName - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - } - - buildTypes { - release { - // TODO: Add your own signing config for the release build. - // Signing with the debug keys for now, so `flutter run --release` works. - signingConfig signingConfigs.debug - } - } -} - -flutter { - source '../..' -} - -dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" - testImplementation 'junit:junit:4.12' - androidTestImplementation 'androidx.test:runner:1.1.1' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' -} diff --git a/example/android/app/src/debug/AndroidManifest.xml b/example/android/app/src/debug/AndroidManifest.xml deleted file mode 100644 index ccb2dac..0000000 --- a/example/android/app/src/debug/AndroidManifest.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - diff --git a/example/android/app/src/main/AndroidManifest.xml b/example/android/app/src/main/AndroidManifest.xml deleted file mode 100644 index 0d35ed3..0000000 --- a/example/android/app/src/main/AndroidManifest.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - diff --git a/example/android/app/src/main/kotlin/com/firstfloorsoftware/flutter_sodium_example/MainActivity.kt b/example/android/app/src/main/kotlin/com/firstfloorsoftware/flutter_sodium_example/MainActivity.kt deleted file mode 100644 index e6de98c..0000000 --- a/example/android/app/src/main/kotlin/com/firstfloorsoftware/flutter_sodium_example/MainActivity.kt +++ /dev/null @@ -1,12 +0,0 @@ -package com.firstfloorsoftware.flutter_sodium_example - -import androidx.annotation.NonNull; -import io.flutter.embedding.android.FlutterActivity -import io.flutter.embedding.engine.FlutterEngine -import io.flutter.plugins.GeneratedPluginRegistrant - -class MainActivity: FlutterActivity() { - override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) { - GeneratedPluginRegistrant.registerWith(flutterEngine); - } -} diff --git a/example/android/app/src/main/res/drawable/launch_background.xml b/example/android/app/src/main/res/drawable/launch_background.xml deleted file mode 100644 index 304732f..0000000 --- a/example/android/app/src/main/res/drawable/launch_background.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - diff --git a/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png deleted file mode 100644 index db77bb4..0000000 Binary files a/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png and /dev/null differ diff --git a/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png deleted file mode 100644 index 17987b7..0000000 Binary files a/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png and /dev/null differ diff --git a/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png deleted file mode 100644 index 09d4391..0000000 Binary files a/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png and /dev/null differ diff --git a/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png deleted file mode 100644 index d5f1c8d..0000000 Binary files a/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and /dev/null differ diff --git a/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png deleted file mode 100644 index 4d6372e..0000000 Binary files a/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and /dev/null differ diff --git a/example/android/app/src/main/res/values/styles.xml b/example/android/app/src/main/res/values/styles.xml deleted file mode 100644 index 00fa441..0000000 --- a/example/android/app/src/main/res/values/styles.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - diff --git a/example/android/app/src/profile/AndroidManifest.xml b/example/android/app/src/profile/AndroidManifest.xml deleted file mode 100644 index ccb2dac..0000000 --- a/example/android/app/src/profile/AndroidManifest.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - diff --git a/example/android/build.gradle b/example/android/build.gradle deleted file mode 100644 index 3100ad2..0000000 --- a/example/android/build.gradle +++ /dev/null @@ -1,31 +0,0 @@ -buildscript { - ext.kotlin_version = '1.3.50' - repositories { - google() - jcenter() - } - - dependencies { - classpath 'com.android.tools.build:gradle:3.5.0' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - } -} - -allprojects { - repositories { - google() - jcenter() - } -} - -rootProject.buildDir = '../build' -subprojects { - project.buildDir = "${rootProject.buildDir}/${project.name}" -} -subprojects { - project.evaluationDependsOn(':app') -} - -task clean(type: Delete) { - delete rootProject.buildDir -} diff --git a/example/android/gradle.properties b/example/android/gradle.properties deleted file mode 100644 index 38c8d45..0000000 --- a/example/android/gradle.properties +++ /dev/null @@ -1,4 +0,0 @@ -org.gradle.jvmargs=-Xmx1536M -android.enableR8=true -android.useAndroidX=true -android.enableJetifier=true diff --git a/example/android/gradle/wrapper/gradle-wrapper.jar b/example/android/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 13372ae..0000000 Binary files a/example/android/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/example/android/gradle/wrapper/gradle-wrapper.properties b/example/android/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index 296b146..0000000 --- a/example/android/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,6 +0,0 @@ -#Fri Jun 23 08:50:38 CEST 2017 -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip diff --git a/example/android/gradlew b/example/android/gradlew deleted file mode 100755 index 9d82f78..0000000 --- a/example/android/gradlew +++ /dev/null @@ -1,160 +0,0 @@ -#!/usr/bin/env bash - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn ( ) { - echo "$*" -} - -die ( ) { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; -esac - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules -function splitJvmOpts() { - JVM_OPTS=("$@") -} -eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS -JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" - -exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/example/android/gradlew.bat b/example/android/gradlew.bat deleted file mode 100644 index aec9973..0000000 --- a/example/android/gradlew.bat +++ /dev/null @@ -1,90 +0,0 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windowz variants - -if not "%OS%" == "Windows_NT" goto win9xME_args -if "%@eval[2+2]" == "4" goto 4NT_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* -goto execute - -:4NT_args -@rem Get arguments from the 4NT Shell from JP Software -set CMD_LINE_ARGS=%$ - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/example/android/settings.gradle b/example/android/settings.gradle deleted file mode 100644 index 5a2f14f..0000000 --- a/example/android/settings.gradle +++ /dev/null @@ -1,15 +0,0 @@ -include ':app' - -def flutterProjectRoot = rootProject.projectDir.parentFile.toPath() - -def plugins = new Properties() -def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins') -if (pluginsFile.exists()) { - pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) } -} - -plugins.each { name, path -> - def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile() - include ":$name" - project(":$name").projectDir = pluginDirectory -} diff --git a/example/assets/fonts/RobotoMono-Regular.ttf b/example/assets/fonts/RobotoMono-Regular.ttf deleted file mode 100755 index b158a33..0000000 Binary files a/example/assets/fonts/RobotoMono-Regular.ttf and /dev/null differ diff --git a/example/ios/.gitignore b/example/ios/.gitignore deleted file mode 100644 index e96ef60..0000000 --- a/example/ios/.gitignore +++ /dev/null @@ -1,32 +0,0 @@ -*.mode1v3 -*.mode2v3 -*.moved-aside -*.pbxuser -*.perspectivev3 -**/*sync/ -.sconsign.dblite -.tags* -**/.vagrant/ -**/DerivedData/ -Icon? -**/Pods/ -**/.symlinks/ -profile -xcuserdata -**/.generated/ -Flutter/App.framework -Flutter/Flutter.framework -Flutter/Flutter.podspec -Flutter/Generated.xcconfig -Flutter/app.flx -Flutter/app.zip -Flutter/flutter_assets/ -Flutter/flutter_export_environment.sh -ServiceDefinitions.json -Runner/GeneratedPluginRegistrant.* - -# Exceptions to above rules. -!default.mode1v3 -!default.mode2v3 -!default.pbxuser -!default.perspectivev3 diff --git a/example/ios/Flutter/AppFrameworkInfo.plist b/example/ios/Flutter/AppFrameworkInfo.plist deleted file mode 100644 index 6b4c0f7..0000000 --- a/example/ios/Flutter/AppFrameworkInfo.plist +++ /dev/null @@ -1,26 +0,0 @@ - - - - - CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) - CFBundleExecutable - App - CFBundleIdentifier - io.flutter.flutter.app - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - App - CFBundlePackageType - FMWK - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1.0 - MinimumOSVersion - 8.0 - - diff --git a/example/ios/Flutter/Debug.xcconfig b/example/ios/Flutter/Debug.xcconfig deleted file mode 100644 index b2f5fae..0000000 --- a/example/ios/Flutter/Debug.xcconfig +++ /dev/null @@ -1,3 +0,0 @@ -#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" -#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" -#include "Generated.xcconfig" diff --git a/example/ios/Flutter/Release.xcconfig b/example/ios/Flutter/Release.xcconfig deleted file mode 100644 index 88c2914..0000000 --- a/example/ios/Flutter/Release.xcconfig +++ /dev/null @@ -1,3 +0,0 @@ -#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" -#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" -#include "Generated.xcconfig" diff --git a/example/ios/Podfile b/example/ios/Podfile deleted file mode 100644 index 1e8c3c9..0000000 --- a/example/ios/Podfile +++ /dev/null @@ -1,41 +0,0 @@ -# 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 flutter_root - generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) - unless File.exist?(generated_xcode_build_settings_path) - raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" - end - - File.foreach(generated_xcode_build_settings_path) do |line| - matches = line.match(/FLUTTER_ROOT\=(.*)/) - return matches[1].strip if matches - end - raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" -end - -require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) - -flutter_ios_podfile_setup - -target 'Runner' do - use_frameworks! - use_modular_headers! - - flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) -end - -post_install do |installer| - installer.pods_project.targets.each do |target| - flutter_additional_ios_build_settings(target) - end -end diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock deleted file mode 100644 index 6df20b8..0000000 --- a/example/ios/Podfile.lock +++ /dev/null @@ -1,28 +0,0 @@ -PODS: - - Flutter (1.0.0) - - flutter_sodium (0.0.1): - - Flutter - - url_launcher (0.0.1): - - Flutter - -DEPENDENCIES: - - Flutter (from `Flutter`) - - flutter_sodium (from `.symlinks/plugins/flutter_sodium/ios`) - - url_launcher (from `.symlinks/plugins/url_launcher/ios`) - -EXTERNAL SOURCES: - Flutter: - :path: Flutter - flutter_sodium: - :path: ".symlinks/plugins/flutter_sodium/ios" - url_launcher: - :path: ".symlinks/plugins/url_launcher/ios" - -SPEC CHECKSUMS: - Flutter: 434fef37c0980e73bb6479ef766c45957d4b510c - flutter_sodium: c84426b4de738514b5b66cfdeb8a06634e72fe0b - url_launcher: 6fef411d543ceb26efce54b05a0a40bfd74cbbef - -PODFILE CHECKSUM: aafe91acc616949ddb318b77800a7f51bffa2a4c - -COCOAPODS: 1.10.1 diff --git a/example/ios/Runner.xcodeproj/project.pbxproj b/example/ios/Runner.xcodeproj/project.pbxproj deleted file mode 100644 index 7713c0b..0000000 --- a/example/ios/Runner.xcodeproj/project.pbxproj +++ /dev/null @@ -1,574 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; - 149FB357672EE250597AC929 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4C838EC254A0CCC58ACAA81B /* Pods_Runner.framework */; }; - 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; - 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; - 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; - 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; - 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; -/* End PBXBuildFile section */ - -/* Begin PBXCopyFilesBuildPhase section */ - 9705A1C41CF9048500538489 /* Embed Frameworks */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = ""; - dstSubfolderSpec = 10; - files = ( - ); - name = "Embed Frameworks"; - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; - 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; - 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; - 4C838EC254A0CCC58ACAA81B /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; - 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; - 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; - 80F2A67D88D5308C7C03107D /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; - 8675E4787B222EA609FB9914 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; - 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; - 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; - 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; - 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; - 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; - 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - E4CB2F8B43CC8EB2CA464EDF /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 97C146EB1CF9000F007C117D /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 149FB357672EE250597AC929 /* Pods_Runner.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 15C5CDE098F27C804253D648 /* Pods */ = { - isa = PBXGroup; - children = ( - 8675E4787B222EA609FB9914 /* Pods-Runner.debug.xcconfig */, - E4CB2F8B43CC8EB2CA464EDF /* Pods-Runner.release.xcconfig */, - 80F2A67D88D5308C7C03107D /* Pods-Runner.profile.xcconfig */, - ); - name = Pods; - path = Pods; - sourceTree = ""; - }; - 6B28B36E418160D8E8452581 /* Frameworks */ = { - isa = PBXGroup; - children = ( - 4C838EC254A0CCC58ACAA81B /* Pods_Runner.framework */, - ); - name = Frameworks; - sourceTree = ""; - }; - 9740EEB11CF90186004384FC /* Flutter */ = { - isa = PBXGroup; - children = ( - 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, - 9740EEB21CF90195004384FC /* Debug.xcconfig */, - 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, - 9740EEB31CF90195004384FC /* Generated.xcconfig */, - ); - name = Flutter; - sourceTree = ""; - }; - 97C146E51CF9000F007C117D = { - isa = PBXGroup; - children = ( - 9740EEB11CF90186004384FC /* Flutter */, - 97C146F01CF9000F007C117D /* Runner */, - 97C146EF1CF9000F007C117D /* Products */, - 15C5CDE098F27C804253D648 /* Pods */, - 6B28B36E418160D8E8452581 /* Frameworks */, - ); - sourceTree = ""; - }; - 97C146EF1CF9000F007C117D /* Products */ = { - isa = PBXGroup; - children = ( - 97C146EE1CF9000F007C117D /* Runner.app */, - ); - name = Products; - sourceTree = ""; - }; - 97C146F01CF9000F007C117D /* Runner */ = { - isa = PBXGroup; - children = ( - 97C146FA1CF9000F007C117D /* Main.storyboard */, - 97C146FD1CF9000F007C117D /* Assets.xcassets */, - 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, - 97C147021CF9000F007C117D /* Info.plist */, - 97C146F11CF9000F007C117D /* Supporting Files */, - 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, - 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, - 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, - 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, - ); - path = Runner; - sourceTree = ""; - }; - 97C146F11CF9000F007C117D /* Supporting Files */ = { - isa = PBXGroup; - children = ( - ); - name = "Supporting Files"; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 97C146ED1CF9000F007C117D /* Runner */ = { - isa = PBXNativeTarget; - buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; - buildPhases = ( - E29DD6FFE92E2C786601B5A9 /* [CP] Check Pods Manifest.lock */, - 9740EEB61CF901F6004384FC /* Run Script */, - 97C146EA1CF9000F007C117D /* Sources */, - 97C146EB1CF9000F007C117D /* Frameworks */, - 97C146EC1CF9000F007C117D /* Resources */, - 9705A1C41CF9048500538489 /* Embed Frameworks */, - 3B06AD1E1E4923F5004D2608 /* Thin Binary */, - 52D823E0B64BC1FAD8E1E7C2 /* [CP] Embed Pods Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = Runner; - productName = Runner; - productReference = 97C146EE1CF9000F007C117D /* Runner.app */; - productType = "com.apple.product-type.application"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 97C146E61CF9000F007C117D /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 1020; - ORGANIZATIONNAME = "The Chromium Authors"; - TargetAttributes = { - 97C146ED1CF9000F007C117D = { - CreatedOnToolsVersion = 7.3.1; - LastSwiftMigration = 1100; - }; - }; - }; - buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = en; - hasScannedForEncodings = 0; - knownRegions = ( - en, - Base, - ); - mainGroup = 97C146E51CF9000F007C117D; - productRefGroup = 97C146EF1CF9000F007C117D /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 97C146ED1CF9000F007C117D /* Runner */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - 97C146EC1CF9000F007C117D /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, - 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, - 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, - 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXShellScriptBuildPhase section */ - 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "Thin Binary"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; - }; - 52D823E0B64BC1FAD8E1E7C2 /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh", - "${BUILT_PRODUCTS_DIR}/flutter_sodium/flutter_sodium.framework", - "${BUILT_PRODUCTS_DIR}/url_launcher/url_launcher.framework", - ); - name = "[CP] Embed Pods Frameworks"; - outputPaths = ( - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_sodium.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/url_launcher.framework", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; - 9740EEB61CF901F6004384FC /* Run Script */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "Run Script"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; - }; - E29DD6FFE92E2C786601B5A9 /* [CP] Check Pods Manifest.lock */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", - ); - name = "[CP] Check Pods Manifest.lock"; - outputFileListPaths = ( - ); - outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; - showEnvVarsInLog = 0; - }; -/* End PBXShellScriptBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 97C146EA1CF9000F007C117D /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, - 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXVariantGroup section */ - 97C146FA1CF9000F007C117D /* Main.storyboard */ = { - isa = PBXVariantGroup; - children = ( - 97C146FB1CF9000F007C117D /* Base */, - ); - name = Main.storyboard; - sourceTree = ""; - }; - 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { - isa = PBXVariantGroup; - children = ( - 97C147001CF9000F007C117D /* Base */, - ); - name = LaunchScreen.storyboard; - sourceTree = ""; - }; -/* End PBXVariantGroup section */ - -/* Begin XCBuildConfiguration section */ - 249021D3217E4FDB00AE95B9 /* Profile */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - SUPPORTED_PLATFORMS = iphoneos; - TARGETED_DEVICE_FAMILY = "1,2"; - VALIDATE_PRODUCT = YES; - }; - name = Profile; - }; - 249021D4217E4FDB00AE95B9 /* Profile */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CLANG_ENABLE_MODULES = YES; - CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - ENABLE_BITCODE = NO; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Flutter", - ); - INFOPLIST_FILE = Runner/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Flutter", - ); - PRODUCT_BUNDLE_IDENTIFIER = com.firstfloorsoftware.flutterSodiumExample; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; - SWIFT_VERSION = 5.0; - VERSIONING_SYSTEM = "apple-generic"; - }; - name = Profile; - }; - 97C147031CF9000F007C117D /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Debug; - }; - 97C147041CF9000F007C117D /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - SUPPORTED_PLATFORMS = iphoneos; - SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - TARGETED_DEVICE_FAMILY = "1,2"; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; - 97C147061CF9000F007C117D /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CLANG_ENABLE_MODULES = YES; - CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - ENABLE_BITCODE = NO; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Flutter", - ); - INFOPLIST_FILE = Runner/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Flutter", - ); - PRODUCT_BUNDLE_IDENTIFIER = com.firstfloorsoftware.flutterSodiumExample; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 5.0; - VERSIONING_SYSTEM = "apple-generic"; - }; - name = Debug; - }; - 97C147071CF9000F007C117D /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CLANG_ENABLE_MODULES = YES; - CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - ENABLE_BITCODE = NO; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Flutter", - ); - INFOPLIST_FILE = Runner/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Flutter", - ); - PRODUCT_BUNDLE_IDENTIFIER = com.firstfloorsoftware.flutterSodiumExample; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; - SWIFT_VERSION = 5.0; - VERSIONING_SYSTEM = "apple-generic"; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 97C147031CF9000F007C117D /* Debug */, - 97C147041CF9000F007C117D /* Release */, - 249021D3217E4FDB00AE95B9 /* Profile */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 97C147061CF9000F007C117D /* Debug */, - 97C147071CF9000F007C117D /* Release */, - 249021D4217E4FDB00AE95B9 /* Profile */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 97C146E61CF9000F007C117D /* Project object */; -} diff --git a/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 919434a..0000000 --- a/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme deleted file mode 100644 index a28140c..0000000 --- a/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/example/ios/Runner.xcworkspace/contents.xcworkspacedata b/example/ios/Runner.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 21a3cc1..0000000 --- a/example/ios/Runner.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - diff --git a/example/ios/Runner/AppDelegate.swift b/example/ios/Runner/AppDelegate.swift deleted file mode 100644 index 70693e4..0000000 --- a/example/ios/Runner/AppDelegate.swift +++ /dev/null @@ -1,13 +0,0 @@ -import UIKit -import Flutter - -@UIApplicationMain -@objc class AppDelegate: FlutterAppDelegate { - override func application( - _ application: UIApplication, - didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? - ) -> Bool { - GeneratedPluginRegistrant.register(with: self) - return super.application(application, didFinishLaunchingWithOptions: launchOptions) - } -} diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json deleted file mode 100644 index d36b1fa..0000000 --- a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json +++ /dev/null @@ -1,122 +0,0 @@ -{ - "images" : [ - { - "size" : "20x20", - "idiom" : "iphone", - "filename" : "Icon-App-20x20@2x.png", - "scale" : "2x" - }, - { - "size" : "20x20", - "idiom" : "iphone", - "filename" : "Icon-App-20x20@3x.png", - "scale" : "3x" - }, - { - "size" : "29x29", - "idiom" : "iphone", - "filename" : "Icon-App-29x29@1x.png", - "scale" : "1x" - }, - { - "size" : "29x29", - "idiom" : "iphone", - "filename" : "Icon-App-29x29@2x.png", - "scale" : "2x" - }, - { - "size" : "29x29", - "idiom" : "iphone", - "filename" : "Icon-App-29x29@3x.png", - "scale" : "3x" - }, - { - "size" : "40x40", - "idiom" : "iphone", - "filename" : "Icon-App-40x40@2x.png", - "scale" : "2x" - }, - { - "size" : "40x40", - "idiom" : "iphone", - "filename" : "Icon-App-40x40@3x.png", - "scale" : "3x" - }, - { - "size" : "60x60", - "idiom" : "iphone", - "filename" : "Icon-App-60x60@2x.png", - "scale" : "2x" - }, - { - "size" : "60x60", - "idiom" : "iphone", - "filename" : "Icon-App-60x60@3x.png", - "scale" : "3x" - }, - { - "size" : "20x20", - "idiom" : "ipad", - "filename" : "Icon-App-20x20@1x.png", - "scale" : "1x" - }, - { - "size" : "20x20", - "idiom" : "ipad", - "filename" : "Icon-App-20x20@2x.png", - "scale" : "2x" - }, - { - "size" : "29x29", - "idiom" : "ipad", - "filename" : "Icon-App-29x29@1x.png", - "scale" : "1x" - }, - { - "size" : "29x29", - "idiom" : "ipad", - "filename" : "Icon-App-29x29@2x.png", - "scale" : "2x" - }, - { - "size" : "40x40", - "idiom" : "ipad", - "filename" : "Icon-App-40x40@1x.png", - "scale" : "1x" - }, - { - "size" : "40x40", - "idiom" : "ipad", - "filename" : "Icon-App-40x40@2x.png", - "scale" : "2x" - }, - { - "size" : "76x76", - "idiom" : "ipad", - "filename" : "Icon-App-76x76@1x.png", - "scale" : "1x" - }, - { - "size" : "76x76", - "idiom" : "ipad", - "filename" : "Icon-App-76x76@2x.png", - "scale" : "2x" - }, - { - "size" : "83.5x83.5", - "idiom" : "ipad", - "filename" : "Icon-App-83.5x83.5@2x.png", - "scale" : "2x" - }, - { - "size" : "1024x1024", - "idiom" : "ios-marketing", - "filename" : "Icon-App-1024x1024@1x.png", - "scale" : "1x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png deleted file mode 100644 index dc9ada4..0000000 Binary files a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png and /dev/null differ diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png deleted file mode 100644 index 28c6bf0..0000000 Binary files a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png and /dev/null differ diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png deleted file mode 100644 index 2ccbfd9..0000000 Binary files a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png and /dev/null differ diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png deleted file mode 100644 index f091b6b..0000000 Binary files a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png and /dev/null differ diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png deleted file mode 100644 index 4cde121..0000000 Binary files a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png and /dev/null differ diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png deleted file mode 100644 index d0ef06e..0000000 Binary files a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png and /dev/null differ diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png deleted file mode 100644 index dcdc230..0000000 Binary files a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png and /dev/null differ diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png deleted file mode 100644 index 2ccbfd9..0000000 Binary files a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png and /dev/null differ diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png deleted file mode 100644 index c8f9ed8..0000000 Binary files a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png and /dev/null differ diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png deleted file mode 100644 index a6d6b86..0000000 Binary files a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png and /dev/null differ diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png deleted file mode 100644 index a6d6b86..0000000 Binary files a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png and /dev/null differ diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png deleted file mode 100644 index 75b2d16..0000000 Binary files a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png and /dev/null differ diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png deleted file mode 100644 index c4df70d..0000000 Binary files a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png and /dev/null differ diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png deleted file mode 100644 index 6a84f41..0000000 Binary files a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png and /dev/null differ diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png deleted file mode 100644 index d0e1f58..0000000 Binary files a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png and /dev/null differ diff --git a/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json b/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json deleted file mode 100644 index 0bedcf2..0000000 --- a/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "LaunchImage.png", - "scale" : "1x" - }, - { - "idiom" : "universal", - "filename" : "LaunchImage@2x.png", - "scale" : "2x" - }, - { - "idiom" : "universal", - "filename" : "LaunchImage@3x.png", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} diff --git a/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png b/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png deleted file mode 100644 index 9da19ea..0000000 Binary files a/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png and /dev/null differ diff --git a/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png b/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png deleted file mode 100644 index 9da19ea..0000000 Binary files a/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png and /dev/null differ diff --git a/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png b/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png deleted file mode 100644 index 9da19ea..0000000 Binary files a/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png and /dev/null differ diff --git a/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md b/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md deleted file mode 100644 index 89c2725..0000000 --- a/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# Launch Screen Assets - -You can customize the launch screen with your own desired assets by replacing the image files in this directory. - -You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. \ No newline at end of file diff --git a/example/ios/Runner/Base.lproj/LaunchScreen.storyboard b/example/ios/Runner/Base.lproj/LaunchScreen.storyboard deleted file mode 100644 index f2e259c..0000000 --- a/example/ios/Runner/Base.lproj/LaunchScreen.storyboard +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/example/ios/Runner/Base.lproj/Main.storyboard b/example/ios/Runner/Base.lproj/Main.storyboard deleted file mode 100644 index f3c2851..0000000 --- a/example/ios/Runner/Base.lproj/Main.storyboard +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/example/ios/Runner/Info.plist b/example/ios/Runner/Info.plist deleted file mode 100644 index 25e9cf1..0000000 --- a/example/ios/Runner/Info.plist +++ /dev/null @@ -1,45 +0,0 @@ - - - - - CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - flutter_sodium_example - CFBundlePackageType - APPL - CFBundleShortVersionString - $(FLUTTER_BUILD_NAME) - CFBundleSignature - ???? - CFBundleVersion - $(FLUTTER_BUILD_NUMBER) - LSRequiresIPhoneOS - - UILaunchStoryboardName - LaunchScreen - UIMainStoryboardFile - Main - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - UISupportedInterfaceOrientations~ipad - - UIInterfaceOrientationPortrait - UIInterfaceOrientationPortraitUpsideDown - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - UIViewControllerBasedStatusBarAppearance - - - diff --git a/example/ios/Runner/Runner-Bridging-Header.h b/example/ios/Runner/Runner-Bridging-Header.h deleted file mode 100644 index 7335fdf..0000000 --- a/example/ios/Runner/Runner-Bridging-Header.h +++ /dev/null @@ -1 +0,0 @@ -#import "GeneratedPluginRegistrant.h" \ No newline at end of file diff --git a/example/lib/main.dart b/example/lib/main.dart index ac42d70..fc9a770 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -6,10 +6,12 @@ import 'topic_page.dart'; void main() { Sodium.init(); - runApp(MyApp()); + runApp(const MyApp()); } class MyApp extends StatelessWidget { + const MyApp({Key? key}) : super(key: key); + @override Widget build(BuildContext context) { return MaterialApp( @@ -17,17 +19,19 @@ class MyApp extends StatelessWidget { theme: ThemeData( primarySwatch: Colors.blue, ), - home: HomePage(), + home: const HomePage(), ); } } class HomePage extends StatelessWidget { + const HomePage({Key? key}) : super(key: key); + @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( - title: Text('flutter_sodium'), + title: const Text('flutter_sodium'), ), body: SafeArea( child: FutureBuilder( @@ -46,11 +50,12 @@ class HomePage extends StatelessWidget { title: Text(topic.title, style: Theme.of(context) .textTheme - .headline6)) + .titleLarge)) else ListTile( title: Text(topic.title), - trailing: Icon(Icons.arrow_forward_ios, + trailing: const Icon( + Icons.arrow_forward_ios, size: 12.0), onTap: () => Navigator.push( context, diff --git a/example/lib/sample_widget.dart b/example/lib/sample_widget.dart index 662294e..6ef6eff 100644 --- a/example/lib/sample_widget.dart +++ b/example/lib/sample_widget.dart @@ -3,18 +3,18 @@ import 'toc.dart'; class SampleWidget extends StatelessWidget { final Sample sample; - SampleWidget(this.sample); + const SampleWidget(this.sample, {Key? key}) : super(key: key); @override Widget build(BuildContext context) { return Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( - padding: EdgeInsets.symmetric(vertical: 16.0), + padding: const EdgeInsets.symmetric(vertical: 16.0), child: Text(sample.title ?? '(no title)', - style: Theme.of(context).textTheme.headline5)), - if (sample.description != null && sample.description!.length > 0) + style: Theme.of(context).textTheme.headlineSmall)), + if (sample.description != null && sample.description!.isNotEmpty) Padding( - padding: EdgeInsets.only(bottom: 16.0), + padding: const EdgeInsets.only(bottom: 16.0), child: Text(sample.description!), ), CodeBlock(sample.code), @@ -26,7 +26,7 @@ class SampleWidget extends StatelessWidget { class SampleRunner extends StatefulWidget { final Sample sample; - SampleRunner(this.sample); + const SampleRunner(this.sample, {Key? key}) : super(key: key); @override State createState() => _SampleRunnerState(); @@ -57,7 +57,8 @@ class _SampleRunnerState extends State { Widget build(BuildContext context) { if (_sampleRun == null) { return Padding( - padding: EdgeInsets.only(top: 16.0), child: RunButton(_runSample)); + padding: const EdgeInsets.only(top: 16.0), + child: RunButton(_runSample)); } return FutureBuilder( @@ -67,19 +68,19 @@ class _SampleRunnerState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( - padding: EdgeInsets.symmetric(vertical: 16.0), + padding: const EdgeInsets.symmetric(vertical: 16.0), child: RunButton( snapshot.connectionState == ConnectionState.done ? _runSample : null)), Padding( - padding: EdgeInsets.only(bottom: 16.0), + padding: const EdgeInsets.only(bottom: 16.0), child: Text('Result', - style: Theme.of(context).textTheme.headline6)), + style: Theme.of(context).textTheme.titleLarge)), // display progress only for async code snippets if (widget.sample.funcAsync != null && snapshot.connectionState != ConnectionState.done) - LinearProgressIndicator(), + const LinearProgressIndicator(), AnimatedOpacity( opacity: snapshot.connectionState == ConnectionState.done ? 1 @@ -103,11 +104,11 @@ class _SampleRunnerState extends State { class RunButton extends StatelessWidget { final VoidCallback? onPressed; - RunButton(this.onPressed); + const RunButton(this.onPressed, {Key? key}) : super(key: key); @override Widget build(BuildContext context) { - return ElevatedButton(child: Text('Run'), onPressed: onPressed); + return ElevatedButton(onPressed: onPressed, child: const Text('Run')); } } @@ -115,14 +116,15 @@ class CodeBlock extends StatelessWidget { final String? _code; final Color color; - CodeBlock(this._code, {this.color = Colors.black12}); + const CodeBlock(this._code, {Key? key, this.color = Colors.black12}) + : super(key: key); @override Widget build(BuildContext context) { return Container( - padding: EdgeInsets.all(10.0), + padding: const EdgeInsets.all(10.0), color: color, child: Text(_code ?? '(code not found)', - style: TextStyle(fontFamily: 'RobotoMono', fontSize: 12.0))); + style: const TextStyle(fontSize: 12.0))); } } diff --git a/example/lib/samples.dart b/example/lib/samples.dart index 7e8cd93..efaacea 100644 --- a/example/lib/samples.dart +++ b/example/lib/samples.dart @@ -23,7 +23,7 @@ class Samples { void api2(Function(Object) print) { // BEGIN api2: High-level API: Compute a password hash using the high-level API with predefined salt. - final p = 'hello world'; + const p = 'hello world'; final h = PasswordHash.hashString(p, salt); print('salt: ${Sodium.bin2hex(salt)}'); @@ -155,7 +155,7 @@ class Samples { final k = CryptoAuth.randomKey(); // compute tag - final m = 'hello world'; + const m = 'hello world'; final t = CryptoAuth.computeString(m, k); print(Sodium.bin2hex(t)); @@ -173,7 +173,7 @@ class Samples { final n = CryptoBox.randomNonce(); // Alice encrypts message for Bob - final m = 'hello world'; + const m = 'hello world'; final e = CryptoBox.encryptString(m, n, b.pk, a.sk); print(Sodium.bin2hex(e)); @@ -194,7 +194,7 @@ class Samples { final n = CryptoBox.randomNonce(); // Alice encrypts message for Bob - final m = 'hello world'; + const m = 'hello world'; final c = CryptoBox.encryptStringDetached(m, n, b.pk, a.sk); print('cipher: ${Sodium.bin2hex(c.c)}'); @@ -216,7 +216,7 @@ class Samples { final n = CryptoBox.randomNonce(); // Alice encrypts message for Bob - final m = 'hello world'; + const m = 'hello world'; final e = CryptoBox.encryptString(m, n, b.pk, a.sk); print(Sodium.bin2hex(e)); @@ -239,7 +239,7 @@ class Samples { // Alice encrypts message for Bob (precalculated) final k = CryptoBox.sharedSecret(b.pk, a.sk); - final m = 'hello world'; + const m = 'hello world'; final c = CryptoBox.encryptStringDetachedAfternm(m, n, k); print('cipher: ${Sodium.bin2hex(c.c)}'); @@ -259,7 +259,7 @@ class Samples { final k = SealedBox.randomKeys(); // Anonymous sender encrypts a message using an ephemeral key pair and the recipient's public key - final m = 'hello world'; + const m = 'hello world'; final c = SealedBox.sealString(m, k.pk); print('cipher: ${Sodium.bin2hex(c)}'); @@ -279,7 +279,7 @@ class Samples { final n = SecretBox.randomNonce(); // encrypt - final m = 'hello world'; + const m = 'hello world'; final e = SecretBox.encryptString(m, n, k); print(Sodium.bin2hex(e)); @@ -296,7 +296,7 @@ class Samples { final n = SecretBox.randomNonce(); // encrypt - final m = 'hello world'; + const m = 'hello world'; final c = SecretBox.encryptStringDetached(m, n, k); print('cipher: ${Sodium.bin2hex(c.c)}'); print('mac: ${Sodium.bin2hex(c.mac)}'); @@ -310,7 +310,7 @@ class Samples { void sign1(Function(Object) print) { // BEGIN sign1: Combined mode: Compute a signed message - final m = 'hello world'; + const m = 'hello world'; final k = CryptoSign.randomKeys(); // sign with secret key @@ -331,7 +331,7 @@ class Samples { final k = CryptoSign.randomKeys(); // Author computes signature using secret key - final m = 'hello world'; + const m = 'hello world'; final s = CryptoSign.signStringDetached(m, k.sk); print(Sodium.bin2hex(s)); @@ -392,7 +392,7 @@ class Samples { void generic1(Function(Object) print) { // BEGIN generic1: Single-part without a key: - final v = 'Arbitrary data to hash'; + const v = 'Arbitrary data to hash'; final h = GenericHash.hashString(v); print(Sodium.bin2hex(h)); @@ -401,7 +401,7 @@ class Samples { void generic2(Function(Object) print) { // BEGIN generic2: Single-part with a key: - final v = 'Arbitrary data to hash'; + const v = 'Arbitrary data to hash'; final k = GenericHash.randomKey(); final h = GenericHash.hashString(v, key: k); @@ -434,7 +434,7 @@ class Samples { void pwhash1(Function(Object) print) { // BEGIN pwhash1: Hash: Derives a hash from given password and salt. - final p = 'hello world'; + const p = 'hello world'; final s = PasswordHash.randomSalt(); final h = PasswordHash.hashString(p, s); @@ -444,7 +444,7 @@ class Samples { void pwhash2(Function(Object) print) { // BEGIN pwhash2: Hash storage: Computes a password verification string for given password. - final p = 'hello world'; + const p = 'hello world'; final s = PasswordHash.hashStringStorage(p); print(s); @@ -461,7 +461,7 @@ class Samples { w.start(); // compute hash - final p = 'hello world'; + const p = 'hello world'; final s = await compute(PasswordHash.hashStringStorageModerate, p); print(s); @@ -472,7 +472,7 @@ class Samples { void shorthash1(Function(Object) print) { // BEGIN shorthash1: Usage: Computes a fixed-size fingerprint for given string value and key. - final m = 'hello world'; + const m = 'hello world'; final k = ShortHash.randomKey(); final h = ShortHash.hashString(m, k); @@ -551,8 +551,8 @@ class Samples { print('key: ${Sodium.bin2hex(k)}'); // encrypt - final m = 'hello world'; - final d = '123456'; + const m = 'hello world'; + const d = '123456'; final c = ChaCha20Poly1305.encryptString(m, n, k, additionalData: d); print('cipher: ${Sodium.bin2hex(c)}'); @@ -573,8 +573,8 @@ class Samples { print('key: ${Sodium.bin2hex(k)}'); // encrypt - final m = 'hello world'; - final d = '123456'; + const m = 'hello world'; + const d = '123456'; final c = ChaCha20Poly1305.encryptStringDetached(m, n, k, additionalData: d); @@ -598,8 +598,8 @@ class Samples { print('key: ${Sodium.bin2hex(k)}'); // encrypt - final m = 'hello world'; - final d = '123456'; + const m = 'hello world'; + const d = '123456'; final c = ChaCha20Poly1305Ietf.encryptString(m, n, k, additionalData: d); print('cipher: ${Sodium.bin2hex(c)}'); @@ -620,8 +620,8 @@ class Samples { print('key: ${Sodium.bin2hex(k)}'); // encrypt - final m = 'hello world'; - final d = '123456'; + const m = 'hello world'; + const d = '123456'; final c = ChaCha20Poly1305Ietf.encryptStringDetached(m, n, k, additionalData: d); @@ -645,8 +645,8 @@ class Samples { print('key: ${Sodium.bin2hex(k)}'); // encrypt - final m = 'hello world'; - final d = '123456'; + const m = 'hello world'; + const d = '123456'; final c = XChaCha20Poly1305Ietf.encryptString(m, n, k, additionalData: d); print('cipher: ${Sodium.bin2hex(c)}'); @@ -667,8 +667,8 @@ class Samples { print('key: ${Sodium.bin2hex(k)}'); // encrypt - final m = 'hello world'; - final d = '123456'; + const m = 'hello world'; + const d = '123456'; final c = XChaCha20Poly1305Ietf.encryptStringDetached(m, n, k, additionalData: d); @@ -685,7 +685,7 @@ class Samples { void onetime1(Function(Object) print) { // BEGIN onetime1: Single-part: - final m = 'hello world'; + const m = 'hello world'; final k = OnetimeAuth.randomKey(); final t = OnetimeAuth.computeString(m, k); print(Sodium.bin2hex(t)); @@ -707,7 +707,7 @@ class Samples { void hash1(Function(Object) print) { // BEGIN hash1: Usage: SHA-512 hashing - final m = 'hello world'; + const m = 'hello world'; final h = Hash.hashString(m); print(Sodium.bin2hex(h)); // END hash1 diff --git a/example/lib/toc.dart b/example/lib/toc.dart index 000328a..38960c8 100644 --- a/example/lib/toc.dart +++ b/example/lib/toc.dart @@ -2,8 +2,8 @@ import 'dart:convert'; import 'package:flutter/material.dart'; import 'samples.dart'; -typedef void SampleFunc(Function(Object) print); -typedef Future SampleFuncAsync(Function(Object) print); +typedef SampleFunc = void Function(Function(Object) print); +typedef SampleFuncAsync = Future Function(Function(Object) print); class Section extends Topic { Section(String title) : super(title); @@ -241,7 +241,7 @@ String _formatCode(String code) { for (var i = 0; i < lines.length; i++) { String line = lines[i]; // skip empty first and last lines - if (line.trim().length == 0 && (i == 0 || i == lines.length - 1)) { + if (line.trim().isEmpty && (i == 0 || i == lines.length - 1)) { continue; } // determine indent diff --git a/example/lib/topic_page.dart b/example/lib/topic_page.dart index 20ac3e4..7c160cc 100644 --- a/example/lib/topic_page.dart +++ b/example/lib/topic_page.dart @@ -1,12 +1,12 @@ import 'package:flutter/material.dart'; import 'package:flutter_sodium_example/sample_widget.dart'; -import 'package:url_launcher/url_launcher.dart'; +import 'package:url_launcher/url_launcher_string.dart'; import 'toc.dart'; class TopicPage extends StatelessWidget { final Topic topic; - TopicPage(this.topic); + const TopicPage(this.topic, {Key? key}) : super(key: key); @override Widget build(BuildContext context) { @@ -17,32 +17,31 @@ class TopicPage extends StatelessWidget { body: SafeArea( child: SingleChildScrollView( child: Container( - padding: EdgeInsets.all(15.0), + padding: const EdgeInsets.all(15.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ // description if (topic.description != null) Padding( - padding: EdgeInsets.only(bottom: 16.0), + padding: const EdgeInsets.only(bottom: 16.0), child: Text(topic.description!)), // more info button if (topic.url != null) Padding( - padding: EdgeInsets.only(bottom: 16.0), + padding: const EdgeInsets.only(bottom: 16.0), child: InkWell( - child: Text( + child: const Text( 'More information', - style: TextStyle( - color: Theme.of(context).accentColor), + style: TextStyle(color: Colors.blue), ), - onTap: () => launch(topic.url!)), + onTap: () => launchUrlString(topic.url!)), ), // 0..n samples if (topic.samples != null) for (var sample in topic.samples!) Padding( - padding: EdgeInsets.only(bottom: 16.0), + padding: const EdgeInsets.only(bottom: 16.0), child: SampleWidget(sample)) ], ))))); diff --git a/example/macos/Podfile b/example/macos/Podfile deleted file mode 100644 index d60ec71..0000000 --- a/example/macos/Podfile +++ /dev/null @@ -1,82 +0,0 @@ -platform :osx, '10.11' - -# 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 - -def pubspec_supports_macos(file) - file_abs_path = File.expand_path(file) - if !File.exists? file_abs_path - return false; - end - File.foreach(file_abs_path) { |line| - return true if line =~ /^\s*macos:/ - } - return false -end - -target 'Runner' do - use_frameworks! - use_modular_headers! - - # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock - # referring to absolute paths on developers' machines. - ephemeral_dir = File.join('Flutter', 'ephemeral') - symlink_dir = File.join(ephemeral_dir, '.symlinks') - symlink_plugins_dir = File.join(symlink_dir, 'plugins') - system("rm -rf #{symlink_dir}") - system("mkdir -p #{symlink_plugins_dir}") - - # Flutter Pods - generated_xcconfig = parse_KV_file(File.join(ephemeral_dir, 'Flutter-Generated.xcconfig')) - if generated_xcconfig.empty? - puts "Flutter-Generated.xcconfig must exist. If you're running pod install manually, make sure flutter packages get is executed first." - end - generated_xcconfig.map { |p| - if p[:name] == 'FLUTTER_FRAMEWORK_DIR' - symlink = File.join(symlink_dir, 'flutter') - File.symlink(File.dirname(p[:path]), symlink) - pod 'FlutterMacOS', :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(symlink_plugins_dir, p[:name]) - File.symlink(p[:path], symlink) - if pubspec_supports_macos(File.join(symlink, 'pubspec.yaml')) - pod p[:name], :path => File.join(symlink, 'macos') - end - } -end - -# Prevent Cocoapods from embedding a second Flutter framework and causing an error with the new Xcode build system. -install! 'cocoapods', :disable_input_output_paths => true diff --git a/example/pubspec.yaml b/example/pubspec.yaml index a0fc7dd..2e1e50a 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -1,7 +1,7 @@ name: flutter_sodium_example version: 2.0.0 description: Demonstrates how to use the flutter_sodium plugin. -publish_to: 'none' +publish_to: "none" environment: sdk: ">=2.12.0 <3.0.0" @@ -9,20 +9,16 @@ environment: dependencies: flutter: sdk: flutter + flutter_sodium: + path: ../ url_launcher: ^6.0.2 dev_dependencies: flutter_test: sdk: flutter - - flutter_sodium: - path: ../ + flutter_lints: flutter: uses-material-design: true assets: - lib/samples.dart - fonts: - - family: RobotoMono - fonts: - - asset: assets/fonts/RobotoMono-Regular.ttf \ No newline at end of file diff --git a/example/test/widget_test.dart b/example/test/widget_test.dart index 570e0e4..ab73b3a 100644 --- a/example/test/widget_test.dart +++ b/example/test/widget_test.dart @@ -1,8 +1 @@ -// This is a basic Flutter widget test. -// -// To perform an interaction with a widget in your test, use the WidgetTester -// utility that Flutter provides. For example, you can send tap and scroll -// gestures. You can also use WidgetTester to find child widgets in the widget -// tree, read text, and verify that the values of widget properties are correct. - void main() {} diff --git a/lib/src/bindings/libsodium.dart b/lib/src/bindings/libsodium.dart index 77a174b..3917162 100644 --- a/lib/src/bindings/libsodium.dart +++ b/lib/src/bindings/libsodium.dart @@ -13,9 +13,23 @@ DynamicLibrary _load() { return DynamicLibrary.process(); } if (Platform.isMacOS) { + String? path; // assuming user installed libsodium as per the installation instructions // see also https://libsodium.gitbook.io/doc/installation - return DynamicLibrary.open('/usr/local/lib/libsodium.dylib'); + final paths = [ + '/usr/local/lib/libsodium.dylib', + '/opt/homebrew/lib/libsodium.dylib' + ]; + for (final p in paths) { + if (File(p).existsSync()) { + path = p; + break; + } + } + if (path == null) { + throw SodiumException('cannot find associated path'); + } + return DynamicLibrary.open(path); } if (Platform.isLinux) { // assuming user installed libsodium as per the installation instructions @@ -35,6 +49,6 @@ DynamicLibrary _load() { // almost works, but is sign extended. extension Bindings on DynamicLibrary { int Function() lookupSizet(String symbolName) => sizeOf() == 4 - ? this.lookup>(symbolName).asFunction() - : this.lookup>(symbolName).asFunction(); + ? lookup>(symbolName).asFunction() + : lookup>(symbolName).asFunction(); } diff --git a/lib/src/extensions.dart b/lib/src/extensions.dart index e374149..368f4b7 100644 --- a/lib/src/extensions.dart +++ b/lib/src/extensions.dart @@ -27,14 +27,14 @@ extension Uint8Pointer on Pointer { extension Uint8ListExtensions on Uint8List { Pointer toPointer({int? size}) { - final p = calloc(size ?? this.length); - p.asTypedList(size ?? this.length).setAll(0, this); + final p = calloc(size ?? length); + p.asTypedList(size ?? length).setAll(0, this); return p; } Uint8List toNullTerminatedList({int? maxLength}) { - if ((maxLength == null || this.length < maxLength) && this.last != 0) { - return new Uint8List(this.length + 1)..setAll(0, this); + if ((maxLength == null || length < maxLength) && last != 0) { + return Uint8List(length + 1)..setAll(0, this); } // return unchanged diff --git a/lib/src/password_hash.dart b/lib/src/password_hash.dart index d9e3f2a..99aa3aa 100644 --- a/lib/src/password_hash.dart +++ b/lib/src/password_hash.dart @@ -1,3 +1,5 @@ +// ignore_for_file: constant_identifier_names + import 'dart:typed_data'; import 'dart:convert'; import 'sodium.dart'; diff --git a/lib/src/sodium.dart b/lib/src/sodium.dart index ed2b353..97c358c 100644 --- a/lib/src/sodium.dart +++ b/lib/src/sodium.dart @@ -133,20 +133,20 @@ class Sodium { RangeError.checkValueInInterval(k.length, cryptoAuthKeybytes, cryptoAuthKeybytes, 'k', 'Invalid length'); - final _out = calloc(cryptoAuthBytes); - final _in = i.toPointer(); - final _k = k.toPointer(); + final out0 = calloc(cryptoAuthBytes); + final i0 = i.toPointer(); + final k0 = k.toPointer(); try { _cryptoAuth - .crypto_auth(_out, _in, i.length, _k) + .crypto_auth(out0, i0, i.length, k0) .mustSucceed('crypto_auth'); - return _out.toList(cryptoAuthBytes); + return out0.toList(cryptoAuthBytes); } finally { - calloc.free(_out); - calloc.free(_in); - calloc.free(_k); + calloc.free(out0); + calloc.free(i0); + calloc.free(k0); } } @@ -156,26 +156,26 @@ class Sodium { RangeError.checkValueInInterval(k.length, cryptoAuthKeybytes, cryptoAuthKeybytes, 'k', 'Invalid length'); - final _h = h.toPointer(); - final _in = i.toPointer(); - final _k = k.toPointer(); + final h0 = h.toPointer(); + final i0 = i.toPointer(); + final k0 = k.toPointer(); try { - return _cryptoAuth.crypto_auth_verify(_h, _in, i.length, _k) == 0; + return _cryptoAuth.crypto_auth_verify(h0, i0, i.length, k0) == 0; } finally { - calloc.free(_h); - calloc.free(_in); - calloc.free(_k); + calloc.free(h0); + calloc.free(i0); + calloc.free(k0); } } static Uint8List cryptoAuthKeygen() { - final _k = calloc(cryptoAuthKeybytes); + final k0 = calloc(cryptoAuthKeybytes); try { - _cryptoAuth.crypto_auth_keygen(_k); - return _k.toList(cryptoAuthKeybytes); + _cryptoAuth.crypto_auth_keygen(k0); + return k0.toList(cryptoAuthKeybytes); } finally { - calloc.free(_k); + calloc.free(k0); } } @@ -200,36 +200,36 @@ class Sodium { static KeyPair cryptoBoxSeedKeypair(Uint8List seed) { RangeError.checkValueInInterval(seed.length, cryptoBoxSeedbytes, cryptoBoxSeedbytes, 'seed', 'Invalid length'); - final _pk = calloc(cryptoBoxPublickeybytes); - final _sk = calloc(cryptoBoxSecretkeybytes); - final _seed = seed.toPointer(); + final pk = calloc(cryptoBoxPublickeybytes); + final sk = calloc(cryptoBoxSecretkeybytes); + final seed0 = seed.toPointer(); try { _cryptoBox - .crypto_box_seed_keypair(_pk, _sk, _seed) + .crypto_box_seed_keypair(pk, sk, seed0) .mustSucceed('crypto_box_seed_keypair'); return KeyPair( - pk: _pk.toList(cryptoBoxPublickeybytes), - sk: _sk.toList(cryptoBoxSecretkeybytes)); + pk: pk.toList(cryptoBoxPublickeybytes), + sk: sk.toList(cryptoBoxSecretkeybytes)); } finally { - calloc.free(_pk); - calloc.free(_sk); - calloc.free(_seed); + calloc.free(pk); + calloc.free(sk); + calloc.free(seed0); } } static KeyPair cryptoBoxKeypair() { - final _pk = calloc(cryptoBoxPublickeybytes); - final _sk = calloc(cryptoBoxSecretkeybytes); + final pk = calloc(cryptoBoxPublickeybytes); + final sk = calloc(cryptoBoxSecretkeybytes); try { - _cryptoBox.crypto_box_keypair(_pk, _sk).mustSucceed('crypto_box_keypair'); + _cryptoBox.crypto_box_keypair(pk, sk).mustSucceed('crypto_box_keypair'); return KeyPair( - pk: _pk.toList(cryptoBoxPublickeybytes), - sk: _sk.toList(cryptoBoxSecretkeybytes)); + pk: pk.toList(cryptoBoxPublickeybytes), + sk: sk.toList(cryptoBoxSecretkeybytes)); } finally { - calloc.free(_pk); - calloc.free(_sk); + calloc.free(pk); + calloc.free(sk); } } @@ -242,24 +242,24 @@ class Sodium { RangeError.checkValueInInterval(sk.length, cryptoBoxSecretkeybytes, cryptoBoxSecretkeybytes, 'sk', 'Invalid length'); - final _c = calloc(m.length + cryptoBoxMacbytes); - final _m = m.toPointer(); - final _n = n.toPointer(); - final _pk = pk.toPointer(); - final _sk = sk.toPointer(); + final c = calloc(m.length + cryptoBoxMacbytes); + final m0 = m.toPointer(); + final n0 = n.toPointer(); + final pk0 = pk.toPointer(); + final sk0 = sk.toPointer(); try { _cryptoBox - .crypto_box_easy(_c, _m, m.length, _n, _pk, _sk) + .crypto_box_easy(c, m0, m.length, n0, pk0, sk0) .mustSucceed('crypto_box_easy'); - return _c.toList(m.length + cryptoBoxMacbytes); + return c.toList(m.length + cryptoBoxMacbytes); } finally { - calloc.free(_c); - calloc.free(_m); - calloc.free(_n); - calloc.free(_pk); - calloc.free(_sk); + calloc.free(c); + calloc.free(m0); + calloc.free(n0); + calloc.free(pk0); + calloc.free(sk0); } } @@ -272,24 +272,24 @@ class Sodium { RangeError.checkValueInInterval(sk.length, cryptoBoxSecretkeybytes, cryptoBoxSecretkeybytes, 'sk', 'Invalid length'); - final _m = calloc(c.length - cryptoBoxMacbytes); - final _c = c.toPointer(); - final _n = n.toPointer(); - final _pk = pk.toPointer(); - final _sk = sk.toPointer(); + final m = calloc(c.length - cryptoBoxMacbytes); + final c0 = c.toPointer(); + final n0 = n.toPointer(); + final pk0 = pk.toPointer(); + final sk0 = sk.toPointer(); try { _cryptoBox - .crypto_box_open_easy(_m, _c, c.length, _n, _pk, _sk) + .crypto_box_open_easy(m, c0, c.length, n0, pk0, sk0) .mustSucceed('crypto_box_open_easy'); - return _m.toList(c.length - cryptoBoxMacbytes); + return m.toList(c.length - cryptoBoxMacbytes); } finally { - calloc.free(_m); - calloc.free(_c); - calloc.free(_n); - calloc.free(_pk); - calloc.free(_sk); + calloc.free(m); + calloc.free(c0); + calloc.free(n0); + calloc.free(pk0); + calloc.free(sk0); } } @@ -302,27 +302,27 @@ class Sodium { RangeError.checkValueInInterval(sk.length, cryptoBoxSecretkeybytes, cryptoBoxSecretkeybytes, 'sk', 'Invalid length'); - final _c = calloc(m.length); - final _mac = calloc(cryptoBoxMacbytes); - final _m = m.toPointer(); - final _n = n.toPointer(); - final _pk = pk.toPointer(); - final _sk = sk.toPointer(); + final c = calloc(m.length); + final mac = calloc(cryptoBoxMacbytes); + final m0 = m.toPointer(); + final n0 = n.toPointer(); + final pk0 = pk.toPointer(); + final sk0 = sk.toPointer(); try { _cryptoBox - .crypto_box_detached(_c, _mac, _m, m.length, _n, _pk, _sk) + .crypto_box_detached(c, mac, m0, m.length, n0, pk0, sk0) .mustSucceed('crypto_box_detached'); return DetachedCipher( - c: _c.toList(m.length), mac: _mac.toList(cryptoBoxMacbytes)); + c: c.toList(m.length), mac: mac.toList(cryptoBoxMacbytes)); } finally { - calloc.free(_c); - calloc.free(_mac); - calloc.free(_m); - calloc.free(_n); - calloc.free(_pk); - calloc.free(_sk); + calloc.free(c); + calloc.free(mac); + calloc.free(m0); + calloc.free(n0); + calloc.free(pk0); + calloc.free(sk0); } } @@ -337,26 +337,26 @@ class Sodium { RangeError.checkValueInInterval(sk.length, cryptoBoxSecretkeybytes, cryptoBoxSecretkeybytes, 'sk', 'Invalid length'); - final _m = calloc(c.length); - final _mac = mac.toPointer(); - final _c = c.toPointer(); - final _n = n.toPointer(); - final _pk = pk.toPointer(); - final _sk = sk.toPointer(); + final m = calloc(c.length); + final mac0 = mac.toPointer(); + final c0 = c.toPointer(); + final n0 = n.toPointer(); + final pk0 = pk.toPointer(); + final sk0 = sk.toPointer(); try { _cryptoBox - .crypto_box_open_detached(_m, _c, _mac, c.length, _n, _pk, _sk) + .crypto_box_open_detached(m, c0, mac0, c.length, n0, pk0, sk0) .mustSucceed('crypto_box_open_detached'); - return _m.toList(c.length); + return m.toList(c.length); } finally { - calloc.free(_m); - calloc.free(_mac); - calloc.free(_c); - calloc.free(_n); - calloc.free(_pk); - calloc.free(_sk); + calloc.free(m); + calloc.free(mac0); + calloc.free(c0); + calloc.free(n0); + calloc.free(pk0); + calloc.free(sk0); } } @@ -366,19 +366,19 @@ class Sodium { RangeError.checkValueInInterval(sk.length, cryptoBoxSecretkeybytes, cryptoBoxSecretkeybytes, 'sk', 'Invalid length'); - final _k = calloc(cryptoBoxBeforenmbytes); - final _pk = pk.toPointer(); - final _sk = sk.toPointer(); + final k = calloc(cryptoBoxBeforenmbytes); + final pk0 = pk.toPointer(); + final sk0 = sk.toPointer(); try { _cryptoBox - .crypto_box_beforenm(_k, _pk, _sk) + .crypto_box_beforenm(k, pk0, sk0) .mustSucceed('crypto_box_beforenm'); - return _k.toList(cryptoBoxBeforenmbytes); + return k.toList(cryptoBoxBeforenmbytes); } finally { - calloc.free(_k); - calloc.free(_pk); - calloc.free(_sk); + calloc.free(k); + calloc.free(pk0); + calloc.free(sk0); } } @@ -388,22 +388,22 @@ class Sodium { RangeError.checkValueInInterval(k.length, cryptoBoxBeforenmbytes, cryptoBoxBeforenmbytes, 'k', 'Invalid length'); - final _c = calloc(m.length + cryptoBoxMacbytes); - final _m = m.toPointer(); - final _n = n.toPointer(); - final _k = k.toPointer(); + final c = calloc(m.length + cryptoBoxMacbytes); + final m0 = m.toPointer(); + final n0 = n.toPointer(); + final k0 = k.toPointer(); try { _cryptoBox - .crypto_box_easy_afternm(_c, _m, m.length, _n, _k) + .crypto_box_easy_afternm(c, m0, m.length, n0, k0) .mustSucceed('crypto_box_easy_afternm'); - return _c.toList(m.length + cryptoBoxMacbytes); + return c.toList(m.length + cryptoBoxMacbytes); } finally { - calloc.free(_c); - calloc.free(_m); - calloc.free(_n); - calloc.free(_k); + calloc.free(c); + calloc.free(m0); + calloc.free(n0); + calloc.free(k0); } } @@ -414,22 +414,22 @@ class Sodium { RangeError.checkValueInInterval(k.length, cryptoBoxBeforenmbytes, cryptoBoxBeforenmbytes, 'k', 'Invalid length'); - final _m = calloc(c.length - cryptoBoxMacbytes); - final _c = c.toPointer(); - final _n = n.toPointer(); - final _k = k.toPointer(); + final m = calloc(c.length - cryptoBoxMacbytes); + final c0 = c.toPointer(); + final n0 = n.toPointer(); + final k0 = k.toPointer(); try { _cryptoBox - .crypto_box_open_easy_afternm(_m, _c, c.length, _n, _k) + .crypto_box_open_easy_afternm(m, c0, c.length, n0, k0) .mustSucceed('crypto_box_open_easy_afternm'); - return _m.toList(c.length - cryptoBoxMacbytes); + return m.toList(c.length - cryptoBoxMacbytes); } finally { - calloc.free(_m); - calloc.free(_c); - calloc.free(_n); - calloc.free(_k); + calloc.free(m); + calloc.free(c0); + calloc.free(n0); + calloc.free(k0); } } @@ -440,25 +440,25 @@ class Sodium { RangeError.checkValueInInterval(k.length, cryptoBoxBeforenmbytes, cryptoBoxBeforenmbytes, 'k', 'Invalid length'); - final _c = calloc(m.length); - final _mac = calloc(cryptoBoxMacbytes); - final _m = m.toPointer(); - final _n = n.toPointer(); - final _k = k.toPointer(); + final c = calloc(m.length); + final mac = calloc(cryptoBoxMacbytes); + final m0 = m.toPointer(); + final n0 = n.toPointer(); + final k0 = k.toPointer(); try { _cryptoBox - .crypto_box_detached_afternm(_c, _mac, _m, m.length, _n, _k) + .crypto_box_detached_afternm(c, mac, m0, m.length, n0, k0) .mustSucceed('crypto_box_detached_afternm'); return DetachedCipher( - c: _c.toList(m.length), mac: _mac.toList(cryptoBoxMacbytes)); + c: c.toList(m.length), mac: mac.toList(cryptoBoxMacbytes)); } finally { - calloc.free(_c); - calloc.free(_mac); - calloc.free(_m); - calloc.free(_n); - calloc.free(_k); + calloc.free(c); + calloc.free(mac); + calloc.free(m0); + calloc.free(n0); + calloc.free(k0); } } @@ -471,24 +471,24 @@ class Sodium { RangeError.checkValueInInterval(k.length, cryptoBoxBeforenmbytes, cryptoBoxBeforenmbytes, 'k', 'Invalid length'); - final _m = calloc(c.length); - final _mac = mac.toPointer(); - final _c = c.toPointer(); - final _n = n.toPointer(); - final _k = k.toPointer(); + final m = calloc(c.length); + final mac0 = mac.toPointer(); + final c0 = c.toPointer(); + final n0 = n.toPointer(); + final k0 = k.toPointer(); try { _cryptoBox - .crypto_box_open_detached_afternm(_m, _c, _mac, c.length, _n, _k) + .crypto_box_open_detached_afternm(m, c0, mac0, c.length, n0, k0) .mustSucceed('crypto_box_open_detached_afternm'); - return _m.toList(c.length); + return m.toList(c.length); } finally { - calloc.free(_m); - calloc.free(_mac); - calloc.free(_c); - calloc.free(_n); - calloc.free(_k); + calloc.free(m); + calloc.free(mac0); + calloc.free(c0); + calloc.free(n0); + calloc.free(k0); } } @@ -496,20 +496,20 @@ class Sodium { RangeError.checkValueInInterval(pk.length, cryptoBoxPublickeybytes, cryptoBoxPublickeybytes, 'pk', 'Invalid length'); - final _c = calloc(m.length + cryptoBoxSealbytes); - final _m = m.toPointer(); - final _pk = pk.toPointer(); + final c = calloc(m.length + cryptoBoxSealbytes); + final m0 = m.toPointer(); + final pk0 = pk.toPointer(); try { _cryptoBox - .crypto_box_seal(_c, _m, m.length, _pk) + .crypto_box_seal(c, m0, m.length, pk0) .mustSucceed('crypto_box_seal'); - return _c.toList(m.length + cryptoBoxSealbytes); + return c.toList(m.length + cryptoBoxSealbytes); } finally { - calloc.free(_c); - calloc.free(_m); - calloc.free(_pk); + calloc.free(c); + calloc.free(m0); + calloc.free(pk0); } } @@ -519,22 +519,22 @@ class Sodium { RangeError.checkValueInInterval(sk.length, cryptoBoxSecretkeybytes, cryptoBoxSecretkeybytes, 'sk', 'Invalid length'); - final _m = calloc(c.length - cryptoBoxSealbytes); - final _c = c.toPointer(); - final _pk = pk.toPointer(); - final _sk = sk.toPointer(); + final m = calloc(c.length - cryptoBoxSealbytes); + final c0 = c.toPointer(); + final pk0 = pk.toPointer(); + final sk0 = sk.toPointer(); try { _cryptoBox - .crypto_box_seal_open(_m, _c, c.length, _pk, _sk) + .crypto_box_seal_open(m, c0, c.length, pk0, sk0) .mustSucceed('crypto_box_seal_open'); - return _m.toList(c.length - cryptoBoxSealbytes); + return m.toList(c.length - cryptoBoxSealbytes); } finally { - calloc.free(_m); - calloc.free(_c); - calloc.free(_pk); - calloc.free(_sk); + calloc.free(m); + calloc.free(c0); + calloc.free(pk0); + calloc.free(sk0); } } @@ -559,22 +559,22 @@ class Sodium { RangeError.checkValueInInterval(c.length, cryptoCoreHchacha20Constbytes, cryptoCoreHchacha20Constbytes, 'c', 'Invalid length'); } - final _out = calloc(cryptoCoreHchacha20Outputbytes); - final _in = i.toPointer(); - final _k = k.toPointer(); - final _c = c?.toPointer() ?? nullptr; + final out = calloc(cryptoCoreHchacha20Outputbytes); + final i0 = i.toPointer(); + final k0 = k.toPointer(); + final c0 = c?.toPointer() ?? nullptr; try { _cryptoCore - .crypto_core_hchacha20(_out, _in, _k, _c) + .crypto_core_hchacha20(out, i0, k0, c0) .mustSucceed('crypto_core_hchacha20'); - return _out.toList(cryptoCoreHchacha20Outputbytes); + return out.toList(cryptoCoreHchacha20Outputbytes); } finally { - calloc.free(_out); - calloc.free(_in); - calloc.free(_k); - if (_c != nullptr) { - calloc.free(_c); + calloc.free(out); + calloc.free(i0); + calloc.free(k0); + if (c0 != nullptr) { + calloc.free(c0); } } } @@ -597,22 +597,22 @@ class Sodium { RangeError.checkValueInInterval(c.length, cryptoCoreHsalsa20Constbytes, cryptoCoreHsalsa20Constbytes, 'c', 'Invalid length'); } - final _out = calloc(cryptoCoreHsalsa20Outputbytes); - final _in = i.toPointer(); - final _k = k.toPointer(); - final _c = c?.toPointer() ?? nullptr; + final out = calloc(cryptoCoreHsalsa20Outputbytes); + final i0 = i.toPointer(); + final k0 = k.toPointer(); + final c0 = c?.toPointer() ?? nullptr; try { _cryptoCore - .crypto_core_hsalsa20(_out, _in, _k, _c) + .crypto_core_hsalsa20(out, i0, k0, c0) .mustSucceed('crypto_core_hsalsa20'); - return _out.toList(cryptoCoreHsalsa20Outputbytes); + return out.toList(cryptoCoreHsalsa20Outputbytes); } finally { - calloc.free(_out); - calloc.free(_in); - calloc.free(_k); - if (_c != nullptr) { - calloc.free(_c); + calloc.free(out); + calloc.free(i0); + calloc.free(k0); + if (c0 != nullptr) { + calloc.free(c0); } } } @@ -645,21 +645,20 @@ class Sodium { cryptoGenerichashKeybytesMax, 'key', 'Invalid length'); } - final _out = calloc(outlen); - final _in = i.toPointer(); - final _key = key?.toPointer() ?? nullptr; + final out = calloc(outlen); + final i0 = i.toPointer(); + final key0 = key?.toPointer() ?? nullptr; try { _cryptoGenerichash - .crypto_generichash( - _out, outlen, _in, i.length, _key, key?.length ?? 0) + .crypto_generichash(out, outlen, i0, i.length, key0, key?.length ?? 0) .mustSucceed('crypto_generichash'); - return _out.toList(outlen); + return out.toList(outlen); } finally { - calloc.free(_out); - calloc.free(_in); - if (_key != nullptr) { - calloc.free(_key); + calloc.free(out); + calloc.free(i0); + if (key0 != nullptr) { + calloc.free(key0); } } } @@ -672,30 +671,30 @@ class Sodium { RangeError.checkValueInInterval( outlen, cryptoGenerichashBytesMin, cryptoGenerichashBytesMax); - final _state = calloc(cryptoGenerichashStatebytes); - final _key = key?.toPointer() ?? nullptr; + final state = calloc(cryptoGenerichashStatebytes); + final key0 = key?.toPointer() ?? nullptr; try { _cryptoGenerichash - .crypto_generichash_init(_state, _key, key?.length ?? 0, outlen) + .crypto_generichash_init(state, key0, key?.length ?? 0, outlen) .mustSucceed('crypto_generichash_init'); - return _state; + return state; } finally { - if (_key != nullptr) { - calloc.free(_key); + if (key0 != nullptr) { + calloc.free(key0); } } } static void cryptoGenerichashUpdate(Pointer state, Uint8List i) { - final _in = i.toPointer(); + final i0 = i.toPointer(); try { _cryptoGenerichash - .crypto_generichash_update(state, _in, i.length) + .crypto_generichash_update(state, i0, i.length) .mustSucceed('crypto_generichash_update'); } finally { - calloc.free(_in); + calloc.free(i0); } } @@ -703,26 +702,26 @@ class Sodium { RangeError.checkValueInInterval( outlen, cryptoGenerichashBytesMin, cryptoGenerichashBytesMax); - final _out = calloc(outlen); + final out = calloc(outlen); try { _cryptoGenerichash - .crypto_generichash_final(state, _out, outlen) + .crypto_generichash_final(state, out, outlen) .mustSucceed('crypto_generichash_final'); - return _out.toList(outlen); + return out.toList(outlen); } finally { // note: caller is responsible for freeing state - calloc.free(_out); + calloc.free(out); } } static Uint8List cryptoGenerichashKeygen() { - final _k = calloc(cryptoGenerichashKeybytes); + final k = calloc(cryptoGenerichashKeybytes); try { - _cryptoGenerichash.crypto_generichash_keygen(_k); - return _k.toList(cryptoGenerichashKeybytes); + _cryptoGenerichash.crypto_generichash_keygen(k); + return k.toList(cryptoGenerichashKeybytes); } finally { - calloc.free(_k); + calloc.free(k); } } @@ -733,14 +732,14 @@ class Sodium { static String get cryptoHashPrimitive => _cryptoHash.primitive().toDartString(); static Uint8List cryptoHash(Uint8List i) { - final _out = calloc(cryptoHashBytes); - final _i = i.toPointer(); + final out = calloc(cryptoHashBytes); + final i0 = i.toPointer(); try { - _cryptoHash.hash(_out, _i, i.length).mustSucceed('crypto_hash'); - return _out.toList(cryptoHashBytes); + _cryptoHash.hash(out, i0, i.length).mustSucceed('crypto_hash'); + return out.toList(cryptoHashBytes); } finally { - calloc.free(_out); - calloc.free(_i); + calloc.free(out); + calloc.free(i0); } } @@ -764,29 +763,29 @@ class Sodium { RangeError.checkValueInInterval(key.length, cryptoKdfKeybytes, cryptoKdfKeybytes, 'key', 'Invalid length'); - final _subkey = calloc(subkeyLen); - final _ctx = ctx.toPointer(); - final _key = key.toPointer(); + final subkey = calloc(subkeyLen); + final ctx0 = ctx.toPointer(); + final key0 = key.toPointer(); try { _cryptoKdf - .crypto_kdf_derive_from_key(_subkey, subkeyLen, subkeyId, _ctx, _key) + .crypto_kdf_derive_from_key(subkey, subkeyLen, subkeyId, ctx0, key0) .mustSucceed('crypto_kdf_derive_from_key'); - return _subkey.toList(subkeyLen); + return subkey.toList(subkeyLen); } finally { - calloc.free(_subkey); - calloc.free(_ctx); - calloc.free(_key); + calloc.free(subkey); + calloc.free(ctx0); + calloc.free(key0); } } static Uint8List cryptoKdfKeygen() { - final _k = calloc(cryptoKdfKeybytes); + final k = calloc(cryptoKdfKeybytes); try { - _cryptoKdf.crypto_kdf_keygen(_k); - return _k.toList(cryptoKdfKeybytes); + _cryptoKdf.crypto_kdf_keygen(k); + return k.toList(cryptoKdfKeybytes); } finally { - calloc.free(_k); + calloc.free(k); } } @@ -804,36 +803,36 @@ class Sodium { static KeyPair cryptoKxSeedKeypair(Uint8List seed) { RangeError.checkValueInInterval(seed.length, cryptoKxSeedbytes, cryptoKxSeedbytes, 'seed', 'Invalid length'); - final _pk = calloc(cryptoKxPublickeybytes); - final _sk = calloc(cryptoKxSecretkeybytes); - final _seed = seed.toPointer(); + final pk = calloc(cryptoKxPublickeybytes); + final sk = calloc(cryptoKxSecretkeybytes); + final seed0 = seed.toPointer(); try { _cryptoKx - .crypto_kx_seed_keypair(_pk, _sk, _seed) + .crypto_kx_seed_keypair(pk, sk, seed0) .mustSucceed('crypto_kx_seed_keypair'); return KeyPair( - pk: _pk.toList(cryptoKxPublickeybytes), - sk: _sk.toList(cryptoKxSecretkeybytes)); + pk: pk.toList(cryptoKxPublickeybytes), + sk: sk.toList(cryptoKxSecretkeybytes)); } finally { - calloc.free(_pk); - calloc.free(_sk); - calloc.free(_seed); + calloc.free(pk); + calloc.free(sk); + calloc.free(seed0); } } static KeyPair cryptoKxKeypair() { - final _pk = calloc(cryptoKxPublickeybytes); - final _sk = calloc(cryptoKxSecretkeybytes); + final pk = calloc(cryptoKxPublickeybytes); + final sk = calloc(cryptoKxSecretkeybytes); try { - _cryptoKx.crypto_kx_keypair(_pk, _sk).mustSucceed('crypto_kx_keypair'); + _cryptoKx.crypto_kx_keypair(pk, sk).mustSucceed('crypto_kx_keypair'); return KeyPair( - pk: _pk.toList(cryptoKxPublickeybytes), - sk: _sk.toList(cryptoKxSecretkeybytes)); + pk: pk.toList(cryptoKxPublickeybytes), + sk: sk.toList(cryptoKxSecretkeybytes)); } finally { - calloc.free(_pk); - calloc.free(_sk); + calloc.free(pk); + calloc.free(sk); } } @@ -846,27 +845,27 @@ class Sodium { RangeError.checkValueInInterval(serverPk.length, cryptoKxPublickeybytes, cryptoKxPublickeybytes, 'serverPk', 'Invalid length'); - final _rx = calloc(cryptoKxSessionkeybytes); - final _tx = calloc(cryptoKxSessionkeybytes); - final _clientPk = clientPk.toPointer(); - final _clientSk = clientSk.toPointer(); - final _serverPk = serverPk.toPointer(); + final rx = calloc(cryptoKxSessionkeybytes); + final tx = calloc(cryptoKxSessionkeybytes); + final clientPk0 = clientPk.toPointer(); + final clientSk0 = clientSk.toPointer(); + final serverPk0 = serverPk.toPointer(); try { _cryptoKx .crypto_kx_client_session_keys( - _rx, _tx, _clientPk, _clientSk, _serverPk) + rx, tx, clientPk0, clientSk0, serverPk0) .mustSucceed('crypto_kx_client_session_keys'); return SessionKeys( - rx: _rx.toList(cryptoKxSessionkeybytes), - tx: _tx.toList(cryptoKxSessionkeybytes)); + rx: rx.toList(cryptoKxSessionkeybytes), + tx: tx.toList(cryptoKxSessionkeybytes)); } finally { - calloc.free(_rx); - calloc.free(_tx); - calloc.free(_clientPk); - calloc.free(_clientSk); - calloc.free(_serverPk); + calloc.free(rx); + calloc.free(tx); + calloc.free(clientPk0); + calloc.free(clientSk0); + calloc.free(serverPk0); } } @@ -879,27 +878,27 @@ class Sodium { RangeError.checkValueInInterval(clientPk.length, cryptoKxPublickeybytes, cryptoKxPublickeybytes, 'clientPk', 'Invalid length'); - final _rx = calloc(cryptoKxSessionkeybytes); - final _tx = calloc(cryptoKxSessionkeybytes); - final _serverPk = serverPk.toPointer(); - final _serverSk = serverSk.toPointer(); - final _clientPk = clientPk.toPointer(); + final rx = calloc(cryptoKxSessionkeybytes); + final tx = calloc(cryptoKxSessionkeybytes); + final serverPk0 = serverPk.toPointer(); + final serverSk0 = serverSk.toPointer(); + final clientPk0 = clientPk.toPointer(); try { _cryptoKx .crypto_kx_server_session_keys( - _rx, _tx, _serverPk, _serverSk, _clientPk) + rx, tx, serverPk0, serverSk0, clientPk0) .mustSucceed('crypto_kx_server_session_keys'); return SessionKeys( - rx: _rx.toList(cryptoKxSessionkeybytes), - tx: _tx.toList(cryptoKxSessionkeybytes)); + rx: rx.toList(cryptoKxSessionkeybytes), + tx: tx.toList(cryptoKxSessionkeybytes)); } finally { - calloc.free(_rx); - calloc.free(_tx); - calloc.free(_serverPk); - calloc.free(_serverSk); - calloc.free(_clientPk); + calloc.free(rx); + calloc.free(tx); + calloc.free(serverPk0); + calloc.free(serverSk0); + calloc.free(clientPk0); } } @@ -919,18 +918,18 @@ class Sodium { RangeError.checkValueInInterval(k.length, cryptoOnetimeauthKeybytes, cryptoOnetimeauthKeybytes, 'k', 'Invalid length'); - final _out = calloc(cryptoOnetimeauthBytes); - final _in = i.toPointer(); - final _k = k.toPointer(); + final out = calloc(cryptoOnetimeauthBytes); + final i0 = i.toPointer(); + final k0 = k.toPointer(); try { _cryptoOnetimeauth - .crypto_onetimeauth(_out, _in, i.length, _k) + .crypto_onetimeauth(out, i0, i.length, k0) .mustSucceed('crypto_onetimeauth'); - return _out.toList(cryptoOnetimeauthBytes); + return out.toList(cryptoOnetimeauthBytes); } finally { - calloc.free(_out); - calloc.free(_in); - calloc.free(_k); + calloc.free(out); + calloc.free(i0); + calloc.free(k0); } } @@ -940,17 +939,17 @@ class Sodium { RangeError.checkValueInInterval(k.length, cryptoOnetimeauthKeybytes, cryptoOnetimeauthKeybytes, 'k', 'Invalid length'); - final _h = h.toPointer(); - final _in = i.toPointer(); - final _k = k.toPointer(); + final h0 = h.toPointer(); + final i0 = i.toPointer(); + final k0 = k.toPointer(); try { return _cryptoOnetimeauth.crypto_onetimeauth_verify( - _h, _in, i.length, _k) == + h0, i0, i.length, k0) == 0; } finally { - calloc.free(_h); - calloc.free(_in); - calloc.free(_k); + calloc.free(h0); + calloc.free(i0); + calloc.free(k0); } } @@ -958,46 +957,46 @@ class Sodium { RangeError.checkValueInInterval(key.length, cryptoOnetimeauthKeybytes, cryptoOnetimeauthKeybytes, 'key', 'Invalid length'); - final _state = calloc(cryptoOnetimeauthStatebytes); - final _k = key.toPointer(); + final state = calloc(cryptoOnetimeauthStatebytes); + final k = key.toPointer(); try { _cryptoOnetimeauth - .crypto_onetimeauth_init(_state, _k) + .crypto_onetimeauth_init(state, k) .mustSucceed('crypto_onetimeauth_init'); - return _state; + return state; } finally { - calloc.free(_k); + calloc.free(k); } } static void cryptoOnetimeauthUpdate(Pointer state, Uint8List i) { - final _in = i.toPointer(); + final i0 = i.toPointer(); try { _cryptoOnetimeauth - .crypto_onetimeauth_update(state, _in, i.length) + .crypto_onetimeauth_update(state, i0, i.length) .mustSucceed('crypto_onetimeauth_update'); } finally { - calloc.free(_in); + calloc.free(i0); } } static Uint8List cryptoOnetimeauthFinal(Pointer state) { - final _out = calloc(cryptoOnetimeauthBytes); + final out = calloc(cryptoOnetimeauthBytes); try { - _cryptoOnetimeauth.crypto_onetimeauth_final(state, _out); - return _out.toList(cryptoOnetimeauthBytes); + _cryptoOnetimeauth.crypto_onetimeauth_final(state, out); + return out.toList(cryptoOnetimeauthBytes); } finally { - calloc.free(_out); + calloc.free(out); } } static Uint8List cryptoOnetimeauthKeygen() { - final _k = calloc(cryptoOnetimeauthKeybytes); + final k = calloc(cryptoOnetimeauthKeybytes); try { - _cryptoOnetimeauth.crypto_onetimeauth_keygen(_k); - return _k.toList(cryptoOnetimeauthKeybytes); + _cryptoOnetimeauth.crypto_onetimeauth_keygen(k); + return k.toList(cryptoOnetimeauthKeybytes); } finally { - calloc.free(_k); + calloc.free(k); } } @@ -1077,20 +1076,20 @@ class Sodium { RangeError.checkValueInInterval( alg, cryptoPwhashAlgArgon2i13, cryptoPwhashAlgArgon2id13, 'alg'); - final _out = calloc(outlen); - final _passwd = passwd.toPointer(); - final _salt = salt.toPointer(); + final out = calloc(outlen); + final passwd0 = passwd.toPointer(); + final salt0 = salt.toPointer(); try { _cryptoPwhash - .crypto_pwhash(_out, outlen, _passwd, passwd.length, _salt, opslimit, + .crypto_pwhash(out, outlen, passwd0, passwd.length, salt0, opslimit, memlimit, alg) .mustSucceed('crypto_pwhash'); - return _out.toList(outlen); + return out.toList(outlen); } finally { - calloc.free(_out); - calloc.free(_passwd); - calloc.free(_salt); + calloc.free(out); + calloc.free(passwd0); + calloc.free(salt0); } } @@ -1103,16 +1102,16 @@ class Sodium { RangeError.checkValueInInterval( memlimit, cryptoPwhashMemlimitMin, cryptoPwhashMemlimitMax, 'memlimit'); - final _out = calloc(cryptoPwhashStrbytes); - final _passwd = passwd.toPointer(); + final out = calloc(cryptoPwhashStrbytes); + final passwd0 = passwd.toPointer(); try { _cryptoPwhash - .crypto_pwhash_str(_out, _passwd, passwd.length, opslimit, memlimit) + .crypto_pwhash_str(out, passwd0, passwd.length, opslimit, memlimit) .mustSucceed('crypto_pwhash_str'); - return _out.toNullTerminatedList(cryptoPwhashStrbytes); + return out.toNullTerminatedList(cryptoPwhashStrbytes); } finally { - calloc.free(_out); - calloc.free(_passwd); + calloc.free(out); + calloc.free(passwd0); } } @@ -1127,17 +1126,17 @@ class Sodium { RangeError.checkValueInInterval( alg, cryptoPwhashAlgArgon2i13, cryptoPwhashAlgArgon2id13, 'alg'); - final _out = calloc(cryptoPwhashStrbytes); - final _passwd = passwd.toPointer(); + final out = calloc(cryptoPwhashStrbytes); + final passwd0 = passwd.toPointer(); try { _cryptoPwhash .crypto_pwhash_str_alg( - _out, _passwd, passwd.length, opslimit, memlimit, alg) + out, passwd0, passwd.length, opslimit, memlimit, alg) .mustSucceed('crypto_pwhash_str_alg'); - return _out.toNullTerminatedList(cryptoPwhashStrbytes); + return out.toNullTerminatedList(cryptoPwhashStrbytes); } finally { - calloc.free(_out); - calloc.free(_passwd); + calloc.free(out); + calloc.free(passwd0); } } @@ -1148,15 +1147,15 @@ class Sodium { cryptoPwhashPasswdMax, 'passwd', 'Invalid length'); // make sure str is null terminated - final _str = + final str0 = str.toNullTerminatedList(maxLength: cryptoPwhashStrbytes).toPointer(); - final _passwd = passwd.toPointer(); + final passwd0 = passwd.toPointer(); try { return _cryptoPwhash.crypto_pwhash_str_verify( - _str, _passwd, passwd.length); + str0, passwd0, passwd.length); } finally { - calloc.free(_passwd); - calloc.free(_str); + calloc.free(passwd0); + calloc.free(str0); } } @@ -1170,13 +1169,13 @@ class Sodium { memlimit, cryptoPwhashMemlimitMin, cryptoPwhashMemlimitMax, 'memlimit'); // make sure str is null terminated - final _str = + final str0 = str.toNullTerminatedList(maxLength: cryptoPwhashStrbytes).toPointer(); try { return _cryptoPwhash.crypto_pwhash_str_needs_rehash( - _str, opslimit, memlimit); + str0, opslimit, memlimit); } finally { - calloc.free(_str); + calloc.free(str0); } } @@ -1196,16 +1195,16 @@ class Sodium { RangeError.checkValueInInterval(n.length, cryptoScalarmultScalarbytes, cryptoScalarmultScalarbytes, 'n', 'Invalid length'); - final _q = calloc(cryptoScalarmultBytes); - final _n = n.toPointer(); + final q = calloc(cryptoScalarmultBytes); + final n0 = n.toPointer(); try { _cryptoScalarmult - .crypto_scalarmult_base(_q, _n) + .crypto_scalarmult_base(q, n0) .mustSucceed('crypto_scalarmult_base'); - return _q.toList(cryptoScalarmultBytes); + return q.toList(cryptoScalarmultBytes); } finally { - calloc.free(_q); - calloc.free(_n); + calloc.free(q); + calloc.free(n0); } } @@ -1215,18 +1214,18 @@ class Sodium { RangeError.checkValueInInterval(p.length, cryptoScalarmultBytes, cryptoScalarmultBytes, 'p', 'Invalid length'); - final _q = calloc(cryptoScalarmultBytes); - final _n = n.toPointer(); - final _p = p.toPointer(); + final q = calloc(cryptoScalarmultBytes); + final n0 = n.toPointer(); + final p0 = p.toPointer(); try { _cryptoScalarmult - .crypto_scalarmult(_q, _n, _p) + .crypto_scalarmult(q, n0, p0) .mustSucceed('crypto_scalarmult'); - return _q.toList(cryptoScalarmultBytes); + return q.toList(cryptoScalarmultBytes); } finally { - calloc.free(_q); - calloc.free(_n); - calloc.free(_p); + calloc.free(q); + calloc.free(n0); + calloc.free(p0); } } @@ -1250,21 +1249,21 @@ class Sodium { RangeError.checkValueInInterval(k.length, cryptoSecretboxKeybytes, cryptoSecretboxKeybytes, 'k', 'Invalid length'); - final _c = calloc(m.length + cryptoSecretboxMacbytes); - final _m = m.toPointer(); - final _n = n.toPointer(); - final _k = k.toPointer(); + final c = calloc(m.length + cryptoSecretboxMacbytes); + final m0 = m.toPointer(); + final n0 = n.toPointer(); + final k0 = k.toPointer(); try { _cryptoSecretbox - .crypto_secretbox_easy(_c, _m, m.length, _n, _k) + .crypto_secretbox_easy(c, m0, m.length, n0, k0) .mustSucceed('crypto_secretbox_easy'); - return _c.toList(m.length + cryptoSecretboxMacbytes); + return c.toList(m.length + cryptoSecretboxMacbytes); } finally { - calloc.free(_c); - calloc.free(_m); - calloc.free(_n); - calloc.free(_k); + calloc.free(c); + calloc.free(m0); + calloc.free(n0); + calloc.free(k0); } } @@ -1275,21 +1274,21 @@ class Sodium { RangeError.checkValueInInterval(k.length, cryptoSecretboxKeybytes, cryptoSecretboxKeybytes, 'k', 'Invalid length'); - final _m = calloc(c.length - cryptoSecretboxMacbytes); - final _c = c.toPointer(); - final _n = n.toPointer(); - final _k = k.toPointer(); + final m = calloc(c.length - cryptoSecretboxMacbytes); + final c0 = c.toPointer(); + final n0 = n.toPointer(); + final k0 = k.toPointer(); try { _cryptoSecretbox - .crypto_secretbox_open_easy(_m, _c, c.length, _n, _k) + .crypto_secretbox_open_easy(m, c0, c.length, n0, k0) .mustSucceed('crypto_secretbox_open_easy'); - return _m.toList(c.length - cryptoSecretboxMacbytes); + return m.toList(c.length - cryptoSecretboxMacbytes); } finally { - calloc.free(_m); - calloc.free(_c); - calloc.free(_n); - calloc.free(_k); + calloc.free(m); + calloc.free(c0); + calloc.free(n0); + calloc.free(k0); } } @@ -1300,24 +1299,24 @@ class Sodium { RangeError.checkValueInInterval(k.length, cryptoSecretboxKeybytes, cryptoSecretboxKeybytes, 'k', 'Invalid length'); - final _c = calloc(m.length); - final _mac = calloc(cryptoSecretboxMacbytes); - final _m = m.toPointer(); - final _n = n.toPointer(); - final _k = k.toPointer(); + final c = calloc(m.length); + final mac = calloc(cryptoSecretboxMacbytes); + final m0 = m.toPointer(); + final n0 = n.toPointer(); + final k0 = k.toPointer(); try { _cryptoSecretbox - .crypto_secretbox_detached(_c, _mac, _m, m.length, _n, _k) + .crypto_secretbox_detached(c, mac, m0, m.length, n0, k0) .mustSucceed('crypto_secretbox_detached'); return DetachedCipher( - c: _c.toList(m.length), mac: _mac.toList(cryptoSecretboxMacbytes)); + c: c.toList(m.length), mac: mac.toList(cryptoSecretboxMacbytes)); } finally { - calloc.free(_c); - calloc.free(_mac); - calloc.free(_m); - calloc.free(_n); - calloc.free(_k); + calloc.free(c); + calloc.free(mac); + calloc.free(m0); + calloc.free(n0); + calloc.free(k0); } } @@ -1330,33 +1329,33 @@ class Sodium { RangeError.checkValueInInterval(k.length, cryptoSecretboxKeybytes, cryptoSecretboxKeybytes, 'k', 'Invalid length'); - final _m = calloc(c.length); - final _mac = mac.toPointer(); - final _c = c.toPointer(); - final _n = n.toPointer(); - final _k = k.toPointer(); + final m = calloc(c.length); + final mac0 = mac.toPointer(); + final c0 = c.toPointer(); + final n0 = n.toPointer(); + final k0 = k.toPointer(); try { _cryptoSecretbox - .crypto_secretbox_open_detached(_m, _c, _mac, c.length, _n, _k) + .crypto_secretbox_open_detached(m, c0, mac0, c.length, n0, k0) .mustSucceed('crypto_secretbox_open_detached'); - return _m.toList(c.length); + return m.toList(c.length); } finally { - calloc.free(_m); - calloc.free(_mac); - calloc.free(_c); - calloc.free(_n); - calloc.free(_k); + calloc.free(m); + calloc.free(mac0); + calloc.free(c0); + calloc.free(n0); + calloc.free(k0); } } static Uint8List cryptoSecretboxKeygen() { - final _k = calloc(cryptoSecretboxKeybytes); + final k = calloc(cryptoSecretboxKeybytes); try { - _cryptoSecretbox.crypto_secretbox_keygen(_k); - return _k.toList(cryptoSecretboxKeybytes); + _cryptoSecretbox.crypto_secretbox_keygen(k); + return k.toList(cryptoSecretboxKeybytes); } finally { - calloc.free(_k); + calloc.free(k); } } @@ -1384,12 +1383,12 @@ class Sodium { _cryptoSecretStream.crypto_secretstream_xchacha20poly1305_statebytes(); static Uint8List cryptoSecretstreamXchacha20poly1305Keygen() { - final _k = calloc(cryptoSecretstreamXchacha20poly1305Keybytes); + final k = calloc(cryptoSecretstreamXchacha20poly1305Keybytes); try { - _cryptoSecretStream.crypto_secretstream_xchacha20poly1305_keygen(_k); - return _k.toList(cryptoSecretstreamXchacha20poly1305Keybytes); + _cryptoSecretStream.crypto_secretstream_xchacha20poly1305_keygen(k); + return k.toList(cryptoSecretstreamXchacha20poly1305Keybytes); } finally { - calloc.free(_k); + calloc.free(k); } } @@ -1402,46 +1401,46 @@ class Sodium { 'key', 'Invalid length'); - final _state = calloc(cryptoSecretstreamXchacha20poly1305Statebytes); - final _header = + final state = calloc(cryptoSecretstreamXchacha20poly1305Statebytes); + final header = calloc(cryptoSecretstreamXchacha20poly1305Headerbytes); - final _k = key.toPointer(); + final k = key.toPointer(); try { _cryptoSecretStream - .crypto_secretstream_xchacha20poly1305_init_push(_state, _header, _k) + .crypto_secretstream_xchacha20poly1305_init_push(state, header, k) .mustSucceed('crypto_secretstream_xchacha20poly1305_init_push'); return InitPushResult( - state: _state, + state: state, header: - _header.toList(cryptoSecretstreamXchacha20poly1305Headerbytes)); + header.toList(cryptoSecretstreamXchacha20poly1305Headerbytes)); } finally { - calloc.free(_header); - calloc.free(_k); + calloc.free(header); + calloc.free(k); } } static Uint8List cryptoSecretstreamXchacha20poly1305Push( Pointer state, Uint8List m, Uint8List? ad, int tag) { - final _c = + final c = calloc(m.length + cryptoSecretstreamXchacha20poly1305Abytes); - final _clenP = calloc(1); - final _m = m.toPointer(); - final _ad = ad?.toPointer() ?? nullptr; - final _adlen = ad?.length ?? 0; + final clenP = calloc(1); + final m0 = m.toPointer(); + final ad0 = ad?.toPointer() ?? nullptr; + final adlen = ad?.length ?? 0; try { _cryptoSecretStream .crypto_secretstream_xchacha20poly1305_push( - state, _c, _clenP, _m, m.length, _ad, _adlen, tag) + state, c, clenP, m0, m.length, ad0, adlen, tag) .mustSucceed('crypto_secretstream_xchacha20poly1305_push'); - return _c.toList(_clenP[0]); + return c.toList(clenP[0]); } finally { - calloc.free(_c); - calloc.free(_clenP); - calloc.free(_m); - calloc.free(_ad); + calloc.free(c); + calloc.free(clenP); + calloc.free(m0); + calloc.free(ad0); } } @@ -1460,51 +1459,51 @@ class Sodium { 'k', 'Invalid length'); - final _state = calloc(cryptoSecretstreamXchacha20poly1305Statebytes); - final _header = header.toPointer(); - final _k = k.toPointer(); + final state = calloc(cryptoSecretstreamXchacha20poly1305Statebytes); + final header0 = header.toPointer(); + final k0 = k.toPointer(); try { _cryptoSecretStream - .crypto_secretstream_xchacha20poly1305_init_pull(_state, _header, _k) + .crypto_secretstream_xchacha20poly1305_init_pull(state, header0, k0) .mustSucceed('crypto_secretstream_xchacha20poly1305_init_pull'); - return _state; + return state; } finally { - calloc.free(_header); - calloc.free(_k); + calloc.free(header0); + calloc.free(k0); } } static PullResult cryptoSecretstreamXchacha20poly1305Pull( Pointer state, Uint8List c, Uint8List? ad) { - final _m = + final m = calloc(c.length - cryptoSecretstreamXchacha20poly1305Abytes); - final _mlenP = calloc(1); - final _tagP = calloc(1); - final _c = c.toPointer(); - final _ad = ad?.toPointer() ?? nullptr; - final _adlen = ad?.length ?? 0; + final mlenP = calloc(1); + final tagP = calloc(1); + final c0 = c.toPointer(); + final ad0 = ad?.toPointer() ?? nullptr; + final adlen = ad?.length ?? 0; try { _cryptoSecretStream .crypto_secretstream_xchacha20poly1305_pull( state, - _m, - _mlenP, - _tagP, - _c, + m, + mlenP, + tagP, + c0, c.length, - _ad, - _adlen, + ad0, + adlen, ) .mustSucceed('crypto_secretstream_xchacha20poly1305_pull'); - return PullResult(m: _m.toList(_mlenP[0]), tag: _tagP[0]); + return PullResult(m: m.toList(mlenP[0]), tag: tagP[0]); } finally { - calloc.free(_m); - calloc.free(_mlenP); - calloc.free(_tagP); - calloc.free(_c); - calloc.free(_ad); + calloc.free(m); + calloc.free(mlenP); + calloc.free(tagP); + calloc.free(c0); + calloc.free(ad0); } } @@ -1526,27 +1525,27 @@ class Sodium { RangeError.checkValueInInterval(k.length, cryptoShorthashKeybytes, cryptoShorthashKeybytes, 'k', 'Invalid length'); - final _out = calloc(cryptoShorthashBytes); - final _in = i.toPointer(); - final _k = k.toPointer(); + final out = calloc(cryptoShorthashBytes); + final i0 = i.toPointer(); + final k0 = k.toPointer(); try { _cryptoShorthash - .crypto_shorthash(_out, _in, i.length, _k) + .crypto_shorthash(out, i0, i.length, k0) .mustSucceed('crypto_shorthash'); - return _out.toList(cryptoShorthashBytes); + return out.toList(cryptoShorthashBytes); } finally { - calloc.free(_out); - calloc.free(_k); + calloc.free(out); + calloc.free(k0); } } static Uint8List cryptoShorthashKeygen() { - final _k = calloc(cryptoShorthashKeybytes); + final k = calloc(cryptoShorthashKeybytes); try { - _cryptoShorthash.crypto_shorthash_keygen(_k); - return _k.toList(cryptoShorthashKeybytes); + _cryptoShorthash.crypto_shorthash_keygen(k); + return k.toList(cryptoShorthashKeybytes); } finally { - calloc.free(_k); + calloc.free(k); } } @@ -1572,38 +1571,38 @@ class Sodium { static KeyPair cryptoSignSeedKeypair(Uint8List seed) { RangeError.checkValueInInterval(seed.length, cryptoSignSeedbytes, cryptoSignSeedbytes, 'seed', 'Invalid length'); - final _pk = calloc(cryptoSignPublickeybytes); - final _sk = calloc(cryptoSignSecretkeybytes); - final _seed = seed.toPointer(); + final pk = calloc(cryptoSignPublickeybytes); + final sk = calloc(cryptoSignSecretkeybytes); + final seed0 = seed.toPointer(); try { _cryptoSign - .crypto_sign_seed_keypair(_pk, _sk, _seed) + .crypto_sign_seed_keypair(pk, sk, seed0) .mustSucceed('crypto_sign_seed_keypair'); return KeyPair( - pk: _pk.toList(cryptoSignPublickeybytes), - sk: _sk.toList(cryptoSignSecretkeybytes)); + pk: pk.toList(cryptoSignPublickeybytes), + sk: sk.toList(cryptoSignSecretkeybytes)); } finally { - calloc.free(_pk); - calloc.free(_sk); - calloc.free(_seed); + calloc.free(pk); + calloc.free(sk); + calloc.free(seed0); } } static KeyPair cryptoSignKeypair() { - final _pk = calloc(cryptoSignPublickeybytes); - final _sk = calloc(cryptoSignSecretkeybytes); + final pk = calloc(cryptoSignPublickeybytes); + final sk = calloc(cryptoSignSecretkeybytes); try { _cryptoSign - .crypto_sign_keypair(_pk, _sk) + .crypto_sign_keypair(pk, sk) .mustSucceed('crypto_sign_keypair'); return KeyPair( - pk: _pk.toList(cryptoSignPublickeybytes), - sk: _sk.toList(cryptoSignSecretkeybytes)); + pk: pk.toList(cryptoSignPublickeybytes), + sk: sk.toList(cryptoSignSecretkeybytes)); } finally { - calloc.free(_pk); - calloc.free(_sk); + calloc.free(pk); + calloc.free(sk); } } @@ -1611,21 +1610,21 @@ class Sodium { RangeError.checkValueInInterval(sk.length, cryptoSignSecretkeybytes, cryptoSignSecretkeybytes, 'sk', 'Invalid length'); - final _sm = calloc(m.length + cryptoSignBytes); - final _smlenP = calloc(1); - final _m = m.toPointer(); - final _sk = sk.toPointer(); + final sm = calloc(m.length + cryptoSignBytes); + final smlenP = calloc(1); + final m0 = m.toPointer(); + final sk0 = sk.toPointer(); try { _cryptoSign - .crypto_sign(_sm, _smlenP, _m, m.length, _sk) + .crypto_sign(sm, smlenP, m0, m.length, sk0) .mustSucceed('crypto_sign'); - return _sm.toList(_smlenP[0]); + return sm.toList(smlenP[0]); } finally { - calloc.free(_sm); - calloc.free(_smlenP); - calloc.free(_m); - calloc.free(_sk); + calloc.free(sm); + calloc.free(smlenP); + calloc.free(m0); + calloc.free(sk0); } } @@ -1633,21 +1632,21 @@ class Sodium { RangeError.checkValueInInterval(pk.length, cryptoSignPublickeybytes, cryptoSignPublickeybytes, 'pk', 'Invalid length'); - final _m = calloc(sm.length - cryptoSignBytes); - final _mlenP = calloc(1); - final _sm = sm.toPointer(); - final _pk = pk.toPointer(); + final m = calloc(sm.length - cryptoSignBytes); + final mlenP = calloc(1); + final sm0 = sm.toPointer(); + final pk0 = pk.toPointer(); try { _cryptoSign - .crypto_sign_open(_m, _mlenP, _sm, sm.length, _pk) + .crypto_sign_open(m, mlenP, sm0, sm.length, pk0) .mustSucceed('crypto_sign_open'); - return _m.toList(_mlenP[0]); + return m.toList(mlenP[0]); } finally { - calloc.free(_m); - calloc.free(_mlenP); - calloc.free(_sm); - calloc.free(_pk); + calloc.free(m); + calloc.free(mlenP); + calloc.free(sm0); + calloc.free(pk0); } } @@ -1655,21 +1654,21 @@ class Sodium { RangeError.checkValueInInterval(sk.length, cryptoSignSecretkeybytes, cryptoSignSecretkeybytes, 'sk', 'Invalid length'); - final _sig = calloc(cryptoSignBytes); - final _siglenP = calloc(1); - final _m = m.toPointer(); - final _sk = sk.toPointer(); + final sig = calloc(cryptoSignBytes); + final siglenP = calloc(1); + final m0 = m.toPointer(); + final sk0 = sk.toPointer(); try { _cryptoSign - .crypto_sign_detached(_sig, _siglenP, _m, m.length, _sk) + .crypto_sign_detached(sig, siglenP, m0, m.length, sk0) .mustSucceed('crypto_sign_detached'); - return _sig.toList(_siglenP[0]); + return sig.toList(siglenP[0]); } finally { - calloc.free(_sig); - calloc.free(_siglenP); - calloc.free(_m); - calloc.free(_sk); + calloc.free(sig); + calloc.free(siglenP); + calloc.free(m0); + calloc.free(sk0); } } @@ -1680,33 +1679,33 @@ class Sodium { RangeError.checkValueInInterval(pk.length, cryptoSignPublickeybytes, cryptoSignPublickeybytes, 'pk', 'Invalid length'); - final _sig = sig.toPointer(); - final _m = m.toPointer(); - final _pk = pk.toPointer(); + final sig0 = sig.toPointer(); + final m0 = m.toPointer(); + final pk0 = pk.toPointer(); try { - return _cryptoSign.crypto_sign_verify_detached(_sig, _m, m.length, _pk); + return _cryptoSign.crypto_sign_verify_detached(sig0, m0, m.length, pk0); } finally { - calloc.free(_sig); - calloc.free(_m); - calloc.free(_pk); + calloc.free(sig0); + calloc.free(m0); + calloc.free(pk0); } } static Pointer cryptoSignInit() { - final _state = calloc(cryptoSignStatebytes); - _cryptoSign.crypto_sign_init(_state).mustSucceed('crypto_sign_init'); - return _state; + final state = calloc(cryptoSignStatebytes); + _cryptoSign.crypto_sign_init(state).mustSucceed('crypto_sign_init'); + return state; } static void cryptoSignUpdate(Pointer state, Uint8List m) { - final _m = m.toPointer(); + final m0 = m.toPointer(); try { _cryptoSign - .crypto_sign_update(state, _m, m.length) + .crypto_sign_update(state, m0, m.length) .mustSucceed('crypto_sign_update'); } finally { - calloc.free(_m); + calloc.free(m0); } } @@ -1714,19 +1713,19 @@ class Sodium { RangeError.checkValueInInterval(sk.length, cryptoSignSecretkeybytes, cryptoSignSecretkeybytes, 'sk', 'Invalid length'); - final _sig = calloc(cryptoSignBytes); - final _siglenP = calloc(1); - final _sk = sk.toPointer(); + final sig = calloc(cryptoSignBytes); + final siglenP = calloc(1); + final sk0 = sk.toPointer(); try { _cryptoSign - .crypto_sign_final_create(state, _sig, _siglenP, _sk) + .crypto_sign_final_create(state, sig, siglenP, sk0) .mustSucceed('crypto_sign_final_create'); - return _sig.toList(_siglenP[0]); + return sig.toList(siglenP[0]); } finally { // note: caller is responsible for freeing state - calloc.free(_sig); - calloc.free(_siglenP); - calloc.free(_sk); + calloc.free(sig); + calloc.free(siglenP); + calloc.free(sk0); } } @@ -1737,14 +1736,14 @@ class Sodium { RangeError.checkValueInInterval(pk.length, cryptoSignPublickeybytes, cryptoSignPublickeybytes, 'pk', 'Invalid length'); - final _sig = sig.toPointer(); - final _pk = pk.toPointer(); + final sig0 = sig.toPointer(); + final pk0 = pk.toPointer(); try { - return _cryptoSign.crypto_sign_final_verify(state, _sig, _pk); + return _cryptoSign.crypto_sign_final_verify(state, sig0, pk0); } finally { // note: caller is responsible for freeing state - calloc.free(_sig); - calloc.free(_pk); + calloc.free(sig0); + calloc.free(pk0); } } @@ -1752,16 +1751,16 @@ class Sodium { RangeError.checkValueInInterval(sk.length, cryptoSignSecretkeybytes, cryptoSignSecretkeybytes, 'sk', 'Invalid length'); - final _seed = calloc(cryptoSignSeedbytes); - final _sk = sk.toPointer(); + final seed = calloc(cryptoSignSeedbytes); + final sk0 = sk.toPointer(); try { _cryptoSign - .crypto_sign_ed25519_sk_to_seed(_seed, _sk) + .crypto_sign_ed25519_sk_to_seed(seed, sk0) .mustSucceed('crypto_sign_ed25519_sk_to_seed'); - return _seed.toList(cryptoSignSeedbytes); + return seed.toList(cryptoSignSeedbytes); } finally { - calloc.free(_seed); - calloc.free(_sk); + calloc.free(seed); + calloc.free(sk0); } } @@ -1769,16 +1768,16 @@ class Sodium { RangeError.checkValueInInterval(sk.length, cryptoSignSecretkeybytes, cryptoSignSecretkeybytes, 'sk', 'Invalid length'); - final _pk = calloc(cryptoSignPublickeybytes); - final _sk = sk.toPointer(); + final pk = calloc(cryptoSignPublickeybytes); + final sk0 = sk.toPointer(); try { _cryptoSign - .crypto_sign_ed25519_sk_to_pk(_pk, _sk) + .crypto_sign_ed25519_sk_to_pk(pk, sk0) .mustSucceed('crypto_sign_ed25519_sk_to_pk'); - return _pk.toList(cryptoSignPublickeybytes); + return pk.toList(cryptoSignPublickeybytes); } finally { - calloc.free(_pk); - calloc.free(_sk); + calloc.free(pk); + calloc.free(sk0); } } @@ -1790,16 +1789,16 @@ class Sodium { 'ed25519Pk', 'Invalid length'); - final _curve25519Pk = calloc(cryptoScalarmultCurve25519Bytes); - final _ed25519Pk = ed25519Pk.toPointer(); + final curve25519Pk = calloc(cryptoScalarmultCurve25519Bytes); + final ed25519Pk0 = ed25519Pk.toPointer(); try { _cryptoSign - .crypto_sign_ed25519_pk_to_curve25519(_curve25519Pk, _ed25519Pk) + .crypto_sign_ed25519_pk_to_curve25519(curve25519Pk, ed25519Pk0) .mustSucceed('crypto_sign_ed25519_pk_to_curve25519'); - return _curve25519Pk.toList(cryptoScalarmultCurve25519Bytes); + return curve25519Pk.toList(cryptoScalarmultCurve25519Bytes); } finally { - calloc.free(_curve25519Pk); - calloc.free(_ed25519Pk); + calloc.free(curve25519Pk); + calloc.free(ed25519Pk0); } } @@ -1811,16 +1810,16 @@ class Sodium { 'ed25519Sk', 'Invalid length'); - final _curve25519Pk = calloc(cryptoScalarmultCurve25519Bytes); - final _ed25519Sk = ed25519Sk.toPointer(); + final curve25519Pk = calloc(cryptoScalarmultCurve25519Bytes); + final ed25519Sk0 = ed25519Sk.toPointer(); try { _cryptoSign - .crypto_sign_ed25519_sk_to_curve25519(_curve25519Pk, _ed25519Sk) + .crypto_sign_ed25519_sk_to_curve25519(curve25519Pk, ed25519Sk0) .mustSucceed('crypto_sign_ed25519_sk_to_curve25519'); - return _curve25519Pk.toList(cryptoScalarmultCurve25519Bytes); + return curve25519Pk.toList(cryptoScalarmultCurve25519Bytes); } finally { - calloc.free(_curve25519Pk); - calloc.free(_ed25519Sk); + calloc.free(curve25519Pk); + calloc.free(ed25519Sk0); } } @@ -1841,18 +1840,16 @@ class Sodium { RangeError.checkValueInInterval(k.length, cryptoStreamKeybytes, cryptoStreamKeybytes, 'k', 'Invalid length'); - final _c = calloc(clen); - final _n = n.toPointer(); - final _k = k.toPointer(); + final c = calloc(clen); + final n0 = n.toPointer(); + final k0 = k.toPointer(); try { - _cryptoStream - .crypto_stream(_c, clen, _n, _k) - .mustSucceed('crypto_stream'); - return _c.toList(clen); + _cryptoStream.crypto_stream(c, clen, n0, k0).mustSucceed('crypto_stream'); + return c.toList(clen); } finally { - calloc.free(_c); - calloc.free(_n); - calloc.free(_k); + calloc.free(c); + calloc.free(n0); + calloc.free(k0); } } @@ -1862,30 +1859,30 @@ class Sodium { RangeError.checkValueInInterval(k.length, cryptoStreamKeybytes, cryptoStreamKeybytes, 'k', 'Invalid length'); - final _c = calloc(m.length); - final _m = m.toPointer(); - final _n = n.toPointer(); - final _k = k.toPointer(); + final c = calloc(m.length); + final m0 = m.toPointer(); + final n0 = n.toPointer(); + final k0 = k.toPointer(); try { _cryptoStream - .crypto_stream_xor(_c, _m, m.length, _n, _k) + .crypto_stream_xor(c, m0, m.length, n0, k0) .mustSucceed('crypto_stream_xor'); - return _c.toList(m.length); + return c.toList(m.length); } finally { - calloc.free(_c); - calloc.free(_m); - calloc.free(_n); - calloc.free(_k); + calloc.free(c); + calloc.free(m0); + calloc.free(n0); + calloc.free(k0); } } static Uint8List cryptoStreamKeygen() { - final _k = calloc(cryptoStreamKeybytes); + final k = calloc(cryptoStreamKeybytes); try { - _cryptoStream.crypto_stream_keygen(_k); - return _k.toList(cryptoStreamKeybytes); + _cryptoStream.crypto_stream_keygen(k); + return k.toList(cryptoStreamKeybytes); } finally { - calloc.free(_k); + calloc.free(k); } } @@ -1897,12 +1894,12 @@ class Sodium { static Uint8List randombytesBuf(int size) { RangeError.checkNotNegative(size); - final _buf = calloc(size); + final buf = calloc(size); try { - _randombytes.randombytes_buf(_buf, size); - return _buf.toList(size); + _randombytes.randombytes_buf(buf, size); + return buf.toList(size); } finally { - calloc.free(_buf); + calloc.free(buf); } } @@ -1911,14 +1908,14 @@ class Sodium { RangeError.checkValueInInterval(seed.length, randombytesSeedbytes, randombytesSeedbytes, 'seed', 'Invalid length'); - final _buf = calloc(size); - final _seed = seed.toPointer(); + final buf = calloc(size); + final seed0 = seed.toPointer(); try { - _randombytes.randombytes_buf_deterministic(_buf, size, _seed); - return _buf.toList(size); + _randombytes.randombytes_buf_deterministic(buf, size, seed0); + return buf.toList(size); } finally { - calloc.free(_buf); - calloc.free(_seed); + calloc.free(buf); + calloc.free(seed0); } } @@ -1965,38 +1962,38 @@ class Sodium { static bool get runtimeHasRdrand => _sodium.sodium_runtime_has_rdrand() == 1; static String bin2hex(Uint8List bin) { - final _hexMaxlen = bin.length * 2 + 1; - final _hex = calloc(_hexMaxlen); - final _bin = bin.toPointer(); + final hexMaxlen = bin.length * 2 + 1; + final hex = calloc(hexMaxlen); + final bin0 = bin.toPointer(); try { return _sodium - .sodium_bin2hex(_hex, _hexMaxlen, _bin, bin.length) + .sodium_bin2hex(hex, hexMaxlen, bin0, bin.length) .toDartString(); } finally { - calloc.free(_hex); - calloc.free(_bin); + calloc.free(hex); + calloc.free(bin0); } } static Uint8List hex2bin(String hex, {String? ignore = ': '}) { - final _bin = calloc(hex.length); - final _hex = hex.toNativeUtf8(); - final _ignore = ignore == null ? nullptr : ignore.toNativeUtf8(); - final _binlen = calloc(4); + final bin = calloc(hex.length); + final hex0 = hex.toNativeUtf8(); + final ignore0 = ignore == null ? nullptr : ignore.toNativeUtf8(); + final binlen0 = calloc(4); try { _sodium .sodium_hex2bin( - _bin, hex.length, _hex, _hex.length, _ignore, _binlen, nullptr) + bin, hex.length, hex0, hex0.length, ignore0, binlen0, nullptr) .mustSucceed('sodium_hex2bin'); final binlen = - _binlen.toList(4).buffer.asByteData().getUint32(0, Endian.host); - return _bin.toList(binlen); + binlen0.toList(4).buffer.asByteData().getUint32(0, Endian.host); + return bin.toList(binlen); } finally { - calloc.free(_bin); - calloc.free(_hex); - calloc.free(_ignore); - calloc.free(_binlen); + calloc.free(bin); + calloc.free(hex0); + calloc.free(ignore0); + calloc.free(binlen0); } } @@ -2010,39 +2007,39 @@ class Sodium { static String bin2base64(Uint8List bin, {int variant = base64VariantOriginal}) { - final _b64maxlen = _sodium.sodium_base64_encoded_len(bin.length, variant); - final _b64 = calloc(_b64maxlen); - final _bin = bin.toPointer(); + final b64maxlen = _sodium.sodium_base64_encoded_len(bin.length, variant); + final b64 = calloc(b64maxlen); + final bin0 = bin.toPointer(); try { return _sodium - .sodium_bin2base64(_b64, _b64maxlen, _bin, bin.length, variant) + .sodium_bin2base64(b64, b64maxlen, bin0, bin.length, variant) .toDartString(); } finally { - calloc.free(_b64); - calloc.free(_bin); + calloc.free(b64); + calloc.free(bin0); } } static Uint8List base642bin(String b64, {String? ignore, int variant = base64VariantOriginal}) { - final _bin = calloc(b64.length); - final _b64 = b64.toNativeUtf8(); - final _ignore = ignore == null ? nullptr : ignore.toNativeUtf8(); - final _binlen = calloc(4); + final bin = calloc(b64.length); + final b640 = b64.toNativeUtf8(); + final ignore0 = ignore == null ? nullptr : ignore.toNativeUtf8(); + final binlen0 = calloc(4); try { _sodium - .sodium_base642bin(_bin, b64.length, _b64, _b64.length, _ignore, - _binlen, nullptr, variant) + .sodium_base642bin(bin, b64.length, b640, b640.length, ignore0, + binlen0, nullptr, variant) .mustSucceed('sodium_base642bin'); final binlen = - _binlen.toList(4).buffer.asByteData().getUint32(0, Endian.host); - return _bin.toList(binlen); + binlen0.toList(4).buffer.asByteData().getUint32(0, Endian.host); + return bin.toList(binlen); } finally { - calloc.free(_bin); - calloc.free(_b64); - calloc.free(_ignore); - calloc.free(_binlen); + calloc.free(bin); + calloc.free(b640); + calloc.free(ignore0); + calloc.free(binlen0); } } @@ -2050,44 +2047,44 @@ class Sodium { if (b1.length != b2.length) { return false; } - final _b1 = b1.toPointer(); - final _b2 = b2.toPointer(); + final b10 = b1.toPointer(); + final b20 = b2.toPointer(); try { - return _sodium.sodium_memcmp(_b1, _b2, b1.length) == 0; + return _sodium.sodium_memcmp(b10, b20, b1.length) == 0; } finally { - calloc.free(_b1); - calloc.free(_b2); + calloc.free(b10); + calloc.free(b20); } } static Uint8List pad(Uint8List buf, int blockSize) { - final _buf = buf.toPointer(size: buf.length + blockSize); - final _paddedlen = calloc(1); + final buf0 = buf.toPointer(size: buf.length + blockSize); + final paddedlen = calloc(1); try { _sodium .sodium_pad( - _paddedlen, _buf, buf.length, blockSize, buf.length + blockSize) + paddedlen, buf0, buf.length, blockSize, buf.length + blockSize) .mustSucceed('sodium_pad'); - return _buf.toList(_paddedlen[0]); + return buf0.toList(paddedlen[0]); } finally { - calloc.free(_buf); - calloc.free(_paddedlen); + calloc.free(buf0); + calloc.free(paddedlen); } } static Uint8List unpad(Uint8List buf, int blockSize) { - final _buf = buf.toPointer(); - final _unpaddedlen = calloc(1); + final buf0 = buf.toPointer(); + final unpaddedlen = calloc(1); try { _sodium - .sodium_unpad(_unpaddedlen, _buf, buf.length, blockSize) + .sodium_unpad(unpaddedlen, buf0, buf.length, blockSize) .mustSucceed('sodium_unpad'); - return _buf.toList(_unpaddedlen[0]); + return buf0.toList(unpaddedlen[0]); } finally { - calloc.free(_buf); - calloc.free(_unpaddedlen); + calloc.free(buf0); + calloc.free(unpaddedlen); } } } @@ -2117,25 +2114,25 @@ class _CryptoAead { RangeError.checkValueInInterval( k.length, keybytes, keybytes, 'k', 'Invalid length'); - final _c = calloc(m.length + abytes); - final _clenP = calloc(1); - final _m = m.toPointer(); - final _ad = ad?.toPointer() ?? nullptr; - final _adlen = ad?.length ?? 0; - final _npub = npub.toPointer(); - final _k = k.toPointer(); + final c = calloc(m.length + abytes); + final clenP = calloc(1); + final m0 = m.toPointer(); + final ad0 = ad?.toPointer() ?? nullptr; + final adlen = ad?.length ?? 0; + final npub0 = npub.toPointer(); + final k0 = k.toPointer(); try { _bindings - .encrypt(_c, _clenP, _m, m.length, _ad, _adlen, nullptr, _npub, _k) + .encrypt(c, clenP, m0, m.length, ad0, adlen, nullptr, npub0, k0) .mustSucceed('${name}_encrypt'); - return _c.toList(_clenP[0]); + return c.toList(clenP[0]); } finally { - calloc.free(_c); - calloc.free(_clenP); - calloc.free(_m); - calloc.free(_ad); - calloc.free(_npub); - calloc.free(_k); + calloc.free(c); + calloc.free(clenP); + calloc.free(m0); + calloc.free(ad0); + calloc.free(npub0); + calloc.free(k0); } } @@ -2147,25 +2144,25 @@ class _CryptoAead { RangeError.checkValueInInterval( k.length, keybytes, keybytes, 'k', 'Invalid length'); - final _m = calloc(c.length - abytes); - final _mlenP = calloc(1); - final _c = c.toPointer(); - final _ad = ad?.toPointer() ?? nullptr; - final _adlen = ad?.length ?? 0; - final _npub = npub.toPointer(); - final _k = k.toPointer(); + final m = calloc(c.length - abytes); + final mlenP = calloc(1); + final c0 = c.toPointer(); + final ad0 = ad?.toPointer() ?? nullptr; + final adlen = ad?.length ?? 0; + final npub0 = npub.toPointer(); + final k0 = k.toPointer(); try { _bindings - .decrypt(_m, _mlenP, nullptr, _c, c.length, _ad, _adlen, _npub, _k) + .decrypt(m, mlenP, nullptr, c0, c.length, ad0, adlen, npub0, k0) .mustSucceed('${name}_decrypt'); - return _m.toList(_mlenP[0]); + return m.toList(mlenP[0]); } finally { - calloc.free(_m); - calloc.free(_mlenP); - calloc.free(_c); - calloc.free(_ad); - calloc.free(_npub); - calloc.free(_k); + calloc.free(m); + calloc.free(mlenP); + calloc.free(c0); + calloc.free(ad0); + calloc.free(npub0); + calloc.free(k0); } } @@ -2177,29 +2174,28 @@ class _CryptoAead { RangeError.checkValueInInterval( k.length, keybytes, keybytes, 'k', 'Invalid length'); - final _c = calloc(m.length); - final _mac = calloc(abytes); - final _maclenP = calloc(1); - final _m = m.toPointer(); - final _ad = ad?.toPointer() ?? nullptr; - final _adlen = ad?.length ?? 0; - final _npub = npub.toPointer(); - final _k = k.toPointer(); + final c = calloc(m.length); + final mac = calloc(abytes); + final maclenP = calloc(1); + final m0 = m.toPointer(); + final ad0 = ad?.toPointer() ?? nullptr; + final adlen = ad?.length ?? 0; + final npub0 = npub.toPointer(); + final k0 = k.toPointer(); try { _bindings .encrypt_detached( - _c, _mac, _maclenP, _m, m.length, _ad, _adlen, nullptr, _npub, _k) + c, mac, maclenP, m0, m.length, ad0, adlen, nullptr, npub0, k0) .mustSucceed('${name}_encrypt_detached'); - return DetachedCipher( - c: _c.toList(m.length), mac: _mac.toList(_maclenP[0])); + return DetachedCipher(c: c.toList(m.length), mac: mac.toList(maclenP[0])); } finally { - calloc.free(_c); - calloc.free(_mac); - calloc.free(_maclenP); - calloc.free(_m); - calloc.free(_ad); - calloc.free(_npub); - calloc.free(_k); + calloc.free(c); + calloc.free(mac); + calloc.free(maclenP); + calloc.free(m0); + calloc.free(ad0); + calloc.free(npub0); + calloc.free(k0); } } @@ -2213,36 +2209,36 @@ class _CryptoAead { RangeError.checkValueInInterval( k.length, keybytes, keybytes, 'k', 'Invalid length'); - final _m = calloc(c.length); - final _c = c.toPointer(); - final _mac = mac.toPointer(); - final _ad = ad?.toPointer() ?? nullptr; - final _adlen = ad?.length ?? 0; - final _npub = npub.toPointer(); - final _k = k.toPointer(); + final m = calloc(c.length); + final c0 = c.toPointer(); + final mac0 = mac.toPointer(); + final ad0 = ad?.toPointer() ?? nullptr; + final adlen = ad?.length ?? 0; + final npub0 = npub.toPointer(); + final k0 = k.toPointer(); try { _bindings .decrypt_detached( - _m, nullptr, _c, c.length, _mac, _ad, _adlen, _npub, _k) + m, nullptr, c0, c.length, mac0, ad0, adlen, npub0, k0) .mustSucceed('${name}_decrypt_detached'); - return _m.toList(c.length); + return m.toList(c.length); } finally { - calloc.free(_m); - calloc.free(_c); - calloc.free(_mac); - calloc.free(_ad); - calloc.free(_npub); - calloc.free(_k); + calloc.free(m); + calloc.free(c0); + calloc.free(mac0); + calloc.free(ad0); + calloc.free(npub0); + calloc.free(k0); } } Uint8List keygen() { - final _k = calloc(keybytes); + final k = calloc(keybytes); try { - _bindings.keygen(_k); - return _k.toList(keybytes); + _bindings.keygen(k); + return k.toList(keybytes); } finally { - calloc.free(_k); + calloc.free(k); } } } diff --git a/lib/src/sodium_exception.dart b/lib/src/sodium_exception.dart index 6d7b607..90169c3 100644 --- a/lib/src/sodium_exception.dart +++ b/lib/src/sodium_exception.dart @@ -4,5 +4,6 @@ class SodiumException { SodiumException(this.message); /// Returns a string representation of this object. + @override String toString() => message; } diff --git a/pubspec.yaml b/pubspec.yaml index 34ad69a..ac0d2fc 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -10,12 +10,20 @@ environment: dependencies: flutter: sdk: flutter - ffi: ^2.0.1 + ffi: ">=2.0.1 <3.0.0" dev_dependencies: + flutter_lints: flutter_test: sdk: flutter +platforms: + android: + ios: + linux: + macos: + windows: + flutter: plugin: platforms: diff --git a/test/flutter_sodium_test.dart b/test/flutter_sodium_test.dart index 3debb1b..b870073 100644 --- a/test/flutter_sodium_test.dart +++ b/test/flutter_sodium_test.dart @@ -33,11 +33,11 @@ void main() { }); test('pwhash', () { - final outlen = 16; + const outlen = 16; final passwd = utf8.encoder.convert('hello world'); final salt = Sodium.hex2bin('10fb7e754a23de756aacb30f810f23df'); - final opslimit = 1; - final memlimit = 8192; + const opslimit = 1; + const memlimit = 8192; final alg = Sodium.cryptoPwhashAlgDefault; final hash =