Skip to content

Commit

Permalink
Merge branch 'main' into PVW-3587-gba-fetch-frontend-additions
Browse files Browse the repository at this point in the history
  • Loading branch information
jippeholwerda committed Oct 24, 2024
2 parents 13d435e + 9e78a64 commit 9da10d8
Show file tree
Hide file tree
Showing 42 changed files with 285 additions and 368 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ class PersonalizePidPreviewScreen : MobileActions() {

private val screen = find.byValueKey("personalizePidPreviewPage")

private val birthText = find.byText("24 maart 2000 in Luik, België")
private val birthText = find.byText("24 maart 2000")
private val genderText = find.byText("Vrouw")
private val addressText = find.byText("Van Wijngaerdenstraat 1, 2596TW Toetsoog")
private val addressText = find.byText("Groenewoudsedijk 51, 3528BG Utrecht")

private val acceptButton = find.byValueKey("acceptButton")
private val rejectButton = find.byValueKey("rejectButton")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class PersonalizeSuccessScreen : MobileActions() {

private val successTitleText = find.byText(l10n.getString("walletPersonalizeSuccessPageTitle"))
private val successDescriptionText = find.byText(l10n.getString("walletPersonalizeSuccessPageDescription"))
private val pidIdCardSubtitleText = find.byText("Froukje")
private val pidIdCardSubtitleText = find.byText("Frouke")
private val pidAddressCardTitleText = find.byText(l10n.getString("pidAddressCardTitle"))

private val nextButton = find.byValueKey("primaryButtonCta")
Expand Down
15 changes: 14 additions & 1 deletion wallet_app/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'dart:async';

import 'package:fimber/fimber.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
Expand Down Expand Up @@ -37,14 +39,25 @@ void main() async {
..dsn = Environment.sentryDsn
..environment = Environment.sentryEnvironment
..release = Environment.sentryRelease() // default applies when SENTRY_RELEASE not set
..debug = kDebugMode,
..debug = kDebugMode
..beforeSend = beforeSend,
appRunner: mainImpl,
);
} else {
mainImpl();
}
}

FutureOr<SentryEvent?> beforeSend(SentryEvent event, Hint hint) async {
// Strip all breadcrumbs and exception values from the event
return event.copyWith(
breadcrumbs: null,
exceptions: event.exceptions?.map((exception) {
return exception.copyWith(value: null);
}).toList(),
);
}

//ignore: avoid_void_async
void mainImpl() async {
// Debug specific setup
Expand Down
36 changes: 2 additions & 34 deletions wallet_core/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions wallet_core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@ rust-version = "1.80"
[workspace.lints.rust]
async_fn_in_trait = "allow"

[workspace.lints.clippy]
cloned_instead_of_copied = "warn"
expl_impl_clone_on_copy = "warn"
needless_pass_by_value = "warn"
redundant_allocation = "warn"
trivially_copy_pass_by_ref = "warn"

[workspace.dependencies]
accept-language = "3.1.0"
aes-gcm = "0.10.3"
Expand Down
4 changes: 2 additions & 2 deletions wallet_core/apple_app_attest/src/attestation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,8 @@ impl Attestation {

let key_identifier = Sha256::digest(public_key.to_encoded_point(false));

// 6. Compute the SHA256 hash of your app’s App ID, and verify that it’s the same as the authenticator data’s
// RP ID hash.
// 6. Compute the SHA256 hash of your app’s App ID, and verify that it’s the same as the authenticator data’s RP
// ID hash.

if attestation.auth_data.as_ref().rp_id_hash() != app_identifier.sha256_hash() {
return Err(AttestationValidationError::RpIdMismatch)?;
Expand Down
13 changes: 1 addition & 12 deletions wallet_core/configuration_server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,10 @@ config = { workspace = true, features = ["toml"] }
etag.workspace = true
http.workspace = true
mime.workspace = true
sentry = { workspace = true, features = [
"backtrace",
"contexts",
"debug-images",
"panic",
"anyhow",
"reqwest",
"rustls",
"tracing",
"log",
] }
serde = { workspace = true, features = ["derive"] }
serde_with = { workspace = true, features = ["base64"] }
tokio = { workspace = true, features = ["rt-multi-thread", "parking_lot"] }
tracing.workspace = true
tracing-subscriber = { workspace = true, features = ["std", "fmt", "ansi", "tracing-log", "parking_lot"] }

wallet_common = { path = "../wallet_common", features = ["sentry"] }
wallet_common.path = "../wallet_common"
17 changes: 4 additions & 13 deletions wallet_core/configuration_server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,11 @@ use crate::settings::Settings;
mod server;
mod settings;

// Cannot use #[tokio::main], see: https://docs.sentry.io/platforms/rust/#async-main-function
fn main() -> Result<(), Box<dyn Error>> {
#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
tracing_subscriber::fmt::init();

let settings = Settings::new().unwrap();
let settings = Settings::new()?;

// Retain [`ClientInitGuard`]
let _guard = settings
.sentry
.as_ref()
.map(|sentry| sentry.init(sentry::release_name!()));

tokio::runtime::Builder::new_multi_thread()
.enable_all()
.build()?
.block_on(async { server::serve(settings).await })
server::serve(settings).await
}
2 changes: 0 additions & 2 deletions wallet_core/configuration_server/src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use std::{env, net::IpAddr, path::PathBuf};
use config::{Config, ConfigError, Environment, File};
use serde::Deserialize;
use serde_with::{base64::Base64, serde_as};
use wallet_common::sentry::Sentry;

#[serde_as]
#[derive(Clone, Deserialize)]
Expand All @@ -15,7 +14,6 @@ pub struct Settings {
pub config_server_cert: Vec<u8>,
#[serde_as(as = "Base64")]
pub config_server_key: Vec<u8>,
pub sentry: Option<Sentry>,
}

impl Settings {
Expand Down
3 changes: 2 additions & 1 deletion wallet_core/error_category/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ sentry = ["dep:sentry", "dep:tracing"]

[dependencies]
error_category_derive.path = "./error_category_derive"
thiserror.workspace = true

sentry = { workspace = true, optional = true }
tracing = { workspace = true, optional = true }

[dev-dependencies]
rstest.workspace = true
sentry = { workspace = true, features = ["test"] }
thiserror.workspace = true
5 changes: 3 additions & 2 deletions wallet_core/error_category/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,13 @@ The following categories exist (which you set using the `#[category(..)]`
attribute):

* `expected`: Expected errors, will not be sent to Sentry
* `critical`: Critical error, report to Sentry, with message(s)
* `critical`: Critical error, report to Sentry with message(s)
* `pd`: Critical error with personal data, sent call stack without messages
* `defer`: Analysis of categorization is deferred to one of the fields
of this variant
* `unexpected`: This is an unexpected error and should never be encountered
by `sentry_capture_error`. Causes a panic
by `sentry_capture_error`. Results in an error being logged. Is reported
to Sentry without message(s).

## Configuration

Expand Down
44 changes: 41 additions & 3 deletions wallet_core/error_category/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,52 @@
#[cfg(feature = "sentry")]
pub mod sentry;

use std::{
fmt::{self, Display, Formatter},
str::FromStr,
};

pub use error_category_derive::{sentry_capture_error, ErrorCategory};

const CRITICAL: &str = "critical";
const EXPECTED: &str = "expected";
const UNEXPECTED: &str = "unexpected";
const PD: &str = "pd";

#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Category {
Expected, // Don't report to Sentry
Critical, // Report Error to Sentry, with contents
PersonalData, // Report Error to Sentry, without contents
Unexpected, // Should never occer at runtime, panic!
Critical, // Report Error to Sentry with contents
PersonalData, // Report Error to Sentry without contents
Unexpected, // Should never occur in the Wallet, log error and report to Sentry without contents
}

#[derive(Debug, thiserror::Error)]
#[error("not a category: {0}")]
pub struct UnrecognizedCategory(String);

impl Display for Category {
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
match self {
Self::Expected => f.write_str(EXPECTED),
Self::Critical => f.write_str(CRITICAL),
Self::PersonalData => f.write_str(PD),
Self::Unexpected => f.write_str(UNEXPECTED),
}
}
}

impl FromStr for Category {
type Err = UnrecognizedCategory;
fn from_str(s: &str) -> Result<Self, Self::Err> {
match s {
EXPECTED => Ok(Self::Expected),
CRITICAL => Ok(Self::Critical),
PD => Ok(Self::PersonalData),
UNEXPECTED => Ok(Self::Unexpected),
_ => Err(UnrecognizedCategory(s.to_string())),
}
}
}

pub trait ErrorCategory {
Expand Down
Loading

0 comments on commit 9da10d8

Please sign in to comment.