Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(core): Remaining secure storage bindings #59

Merged
merged 23 commits into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 58 additions & 1 deletion .github/workflows/celest_core.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ jobs:
uses: subosito/flutter-action@62f096cacda5168a3bd7b95793373be14fa4fbaf # 2.13.0
with:
cache: true
- name: Get Packages
- name: Get Packages (Example)
working-directory: packages/celest_core/example
run: flutter pub get
- name: Enable KVM
Expand All @@ -94,3 +94,60 @@ jobs:
api-level: 31
arch: x86_64
script: cd packages/celest_core/example && flutter test -d emulator integration_test/secure_storage_test.dart
test_linux:
needs: analyze_and_format
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Git Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # 4.1.1
- name: Setup Flutter
uses: subosito/flutter-action@62f096cacda5168a3bd7b95793373be14fa4fbaf # 2.13.0
with:
cache: true
- name: Install Build Dependencies
run: sudo apt-get update && sudo apt-get install -y clang cmake git ninja-build pkg-config libgtk-3-dev liblzma-dev libstdc++-12-dev
- name: Setup Test Environment
working-directory: packages/celest_core
run: tool/setup-ci.sh
- name: Get Packages
working-directory: packages/celest_core
run: dart pub get
- name: Test
working-directory: packages/celest_core
run: dart test
- name: Get Packages (Example)
working-directory: packages/celest_core/example
run: flutter pub get
- name: Test (Linux)
working-directory: packages/celest_core/example
run: |
# Headless tests require virtual display for the linux tests to run.
export DISPLAY=:99
sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 &
flutter test -d linux integration_test/secure_storage_test.dart
# TODO: Re-enable
# Need to fix this: Git error. Command: `git clone --mirror https://github.com/dart-lang/native /c/Users/runneradmin/.pub-cache\git\cache\native-647c69ed8027da6d6def6bc40efa87cf1a2f76aa`
# test_windows:
# needs: analyze_and_format
# runs-on: windows-latest
# timeout-minutes: 15
# steps:
# - name: Git Checkout
# uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # 4.1.1
# - name: Setup Flutter
# uses: subosito/flutter-action@62f096cacda5168a3bd7b95793373be14fa4fbaf # 2.13.0
# with:
# cache: true
# - name: Get Packages
# working-directory: packages/celest_core
# run: dart pub get --no-example
# - name: Test
# working-directory: packages/celest_core
# run: dart test
# - name: Get Packages (Example)
# working-directory: packages/celest_core/example
# run: flutter pub get
# - name: Test (Windows)
# working-directory: packages/celest_core/example
# run: flutter test -d windows integration_test/secure_storage_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ final _random = Random();
Iterable<(int, String)> get _largeKeyValuePairs sync* {
for (final length in const [100, 1000, 10000]) {
final string = String.fromCharCodes(
List.generate(length, (_) => _random.nextInt(255) + 1),
List.generate(length, (_) => _random.nextInt(94) + 33),
);
yield (length, string);
}
Expand Down
45 changes: 45 additions & 0 deletions packages/celest_core/ffigen.glib.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Glib
description: |
Bindings for glib on Linux.

Regenerate bindings with `dart run ffigen --config=ffigen.glib.yaml`.
language: c
output: lib/src/native/linux/glib.ffi.dart
headers:
entry-points:
- /usr/include/glib-2.0/glib.h
- /usr/include/glib-2.0/glib-object.h
- /usr/include/glib-2.0/gio/gio.h
preamble: |
// ignore_for_file: type=lint
// ignore_for_file: return_of_invalid_type
// ignore_for_file: unnecessary_non_null_assertion
comments:
style: any
length: full

exclude-all-by-default: true
typedefs:
include:
- gboolean
- gint
- gpointer
functions:
include:
- g_hash_table_new
- g_hash_table_insert
- g_hash_table_destroy
- g_application_get_default
- g_application_get_application_id
- g_error_free
structs:
include:
- _GError
- _GHashTable
- _GCancellable
- _GObject
rename:
"_GError": GError
"_GHashTable": GHashTable
"_GCancellable": GCancellable
"_GObject": GObject
69 changes: 69 additions & 0 deletions packages/celest_core/ffigen.libsecret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Libsecret
description: |
Bindings for Libsecret on Linux.

Regenerate bindings with `dart run ffigen --config=ffigen.libsecret.yaml`.
language: c
output: lib/src/native/linux/libsecret.ffi.dart
headers:
entry-points:
- /usr/include/libsecret-1/libsecret/secret.h
preamble: |
// ignore_for_file: type=lint
// ignore_for_file: return_of_invalid_type
// ignore_for_file: unnecessary_non_null_assertion
library-imports:
glib: package:celest_core/src/native/linux/glib.ffi.dart
comments:
style: any
length: full

exclude-all-by-default: true
functions:
include:
- secret_password_storev_sync
- secret_password_lookupv_sync
- secret_password_clearv_sync
- secret_password_free
structs:
include:
- SecretSchema
- SecretSchemaAttribute
enums:
include:
- SecretSchemaAttributeType
- SecretSchemaFlags
macros:
include:
- SECRET_COLLECTION_DEFAULT
type-map:
typedefs:
GHashTable:
lib: glib
c-type: GHashTable
dart-type: GHashTable
GError:
lib: glib
c-type: GError
dart-type: GError
GCancellable:
lib: glib
c-type: GCancellable
dart-type: GCancellable
gpointer:
lib: glib
c-type: gpointer
dart-type: gpointer
gboolean:
lib: glib
c-type: gboolean
dart-type: int
gchar:
lib: pkg_ffi
c-type: Utf8
dart-type: Char
gint:
lib: glib
c-type: gint
dart-type: int

Loading
Loading