Skip to content
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### UI Controller API

- Renamed `InitiateEventStream()` to `Subscribe()`
- Serialize `BackgroundEvent`, `HybridState`, `UsbState` as tag-value structs

# [0.1.0] - 2025-08-14

Expand Down
53 changes: 14 additions & 39 deletions credentialsd-common/meson.build
Original file line number Diff line number Diff line change
@@ -1,42 +1,17 @@
# Currently, we're not building this with meson and just letting cargo path dependencies for the other projects build this lib.
# Not efficient, since the UI and daemon projects will build it separately, but leaving it this way for now.

# common_lib_name = 'xyzii-credman-portal-gtk'
# base_id = 'xyz.iinuwa.CredentialManagerUi'
#
# cargo = find_program('cargo', required: true)
#
# version = meson.project_version()
#
# if get_option('profile') == 'development'
# profile = 'Devel'
# vcs_tag = run_command('git', 'rev-parse', '--short', 'HEAD', check: false).stdout().strip()
# if vcs_tag == ''
# version_suffix = '-devel'
# else
# version_suffix = '-@0@'.format(vcs_tag)
# endif
# application_id = '@0@.@1@'.format(base_id, profile)
# else
# profile = ''
# version_suffix = ''
# application_id = base_id
# endif
#
# meson.add_dist_script(
# meson.project_source_root() / 'build-aux/dist-vendor.sh',
# meson.project_build_root() / 'meson-dist' / common_lib_name + '-' + version,
# meson.project_source_root(),
# )
#
# cargo_options = [
# '--manifest-path', meson.project_source_root() / meson.current_source_dir() / 'Cargo.toml',
# ]
# cargo_options += [
# '--target-dir', meson.project_build_root() / meson.current_build_dir() / 'target',
# ]
# if get_option('cargo_offline') == true
# cargo_options += ['--offline']
# endif
#
# subdir('src')
common_lib_name = 'credentialsd-common'
cargo = find_program('cargo', required: true)

cargo_options = [
'--manifest-path', meson.project_source_root() / meson.current_source_dir() / 'Cargo.toml',
]
cargo_options += [
'--target-dir', meson.project_build_root() / meson.current_build_dir() / 'target',
]
if get_option('cargo_offline') == true
cargo_options += ['--offline']
endif

subdir('src')
35 changes: 24 additions & 11 deletions credentialsd-common/src/meson.build
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# Currently, we're not building this with meson and just letting cargo path dependencies for the other projects build this lib.
# Not efficient, since the UI and daemon projects will build it separately, but leaving it this way for now.

# if get_option('profile') == 'default'
# cargo_options += ['--release']
# rust_target = 'release'
# message('Building in release mode')
# else
# rust_target = 'debug'
# message('Building in debug mode')
# endif
#
# cargo_env = ['CARGO_HOME=' + cargo_home]
if get_option('profile') == 'default'
cargo_options += ['--release']
rust_target = 'release'
message('Building in release mode')
else
rust_target = 'debug'
message('Building in debug mode')
endif

cargo_env = ['CARGO_HOME=' + cargo_home]
#
# custom_target(
# 'cargo-build',
Expand All @@ -31,4 +31,17 @@
# common_lib_name / 'src' / rust_target / common_lib_name,
# '@OUTPUT@',
# ],
# )
# )
test(
'credentialsd-common cargo-unit-tests',
cargo,
env: [cargo_env],
args: [
'test',
'--lib',
'--no-fail-fast', cargo_options,
'--',
'--nocapture',
],
protocol: 'exitcode',
)
19 changes: 18 additions & 1 deletion credentialsd-common/src/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ pub enum UsbState {
Failed(Error),
}

#[derive(Debug)]
#[derive(Clone, Debug)]
pub enum BackgroundEvent {
UsbStateChanged(UsbState),
HybridQrStateChanged(HybridState),
Expand Down Expand Up @@ -301,6 +301,7 @@ impl Display for Error {
}
}

#[derive(Debug)]
pub enum WebAuthnError {
/// The ceremony was cancelled by an AbortController. See § 5.6 Abort
/// Operations with AbortSignal and § 1.3.4 Aborting Authentication
Expand Down Expand Up @@ -337,3 +338,19 @@ pub enum WebAuthnError {
/// the value of `user.id` was empty or was longer than 64 bytes.
TypeError,
}

impl std::error::Error for WebAuthnError {}

impl Display for WebAuthnError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(match self {
WebAuthnError::AbortError => "Operation was aborted by client.",
WebAuthnError::ConstraintError => "Resident key or user verification requirement was not able to be met.",
WebAuthnError::InvalidStateError => "A user consented to create a new credential after trying to use an authenticator with a previously registered credential.",
WebAuthnError::NotSupportedError => "Operation parameters are not supported.",
WebAuthnError::SecurityError => "Validation of the client context for given RP ID failed.",
WebAuthnError::NotAllowedError => "An unspecified error occurred, and the operation is not allowed to continue.",
WebAuthnError::TypeError => "Invalid parameters specified.",
})
}
}
Loading