Skip to content

Commit 079e2bb

Browse files
chore: improve e2ei developer tools - WPB-24077 πŸ’ (#4459)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: David-Henner <david.henner@wire.com>
1 parent 7d8267c commit 079e2bb

File tree

2 files changed

+30
-9
lines changed

2 files changed

+30
-9
lines changed

β€Žwire-ios/Wire-iOS/Sources/Developer/DeveloperTools/DeveloperE2ei/DeveloperE2eiView.swiftβ€Ž

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ struct DeveloperE2eiView: View {
2828
List {
2929
Section("E2EI Certificate Details") {
3030
HStack {
31-
Text("Valid from")
31+
Text(String("Valid from"))
3232
Spacer()
3333
Text(viewModel.certificateValidFrom)
3434
.lineLimit(1)
@@ -37,7 +37,7 @@ struct DeveloperE2eiView: View {
3737
}
3838

3939
HStack {
40-
Text("Valid to")
40+
Text(String("Valid to"))
4141
Spacer()
4242
Text(viewModel.certificateValidTo)
4343
.lineLimit(1)
@@ -48,19 +48,34 @@ struct DeveloperE2eiView: View {
4848
}
4949

5050
Section("Enroll E2EI Certificate") {
51-
TextField("Certificate expiration time (in seconds)", text: $viewModel.certificateExpirationTime)
51+
Stepper(
52+
value: $viewModel.certificateExpirationTime,
53+
in: DeveloperE2eiViewModel.minimumCertificateExpirationTime ... Int.max,
54+
step: 60
55+
) {
56+
HStack {
57+
Text(String("Expiration time"))
58+
Spacer()
59+
Text("\(viewModel.certificateExpirationTime) s")
60+
.foregroundColor(.secondary)
61+
}
62+
}
5263

53-
Button("Enroll", action: { viewModel.enrollCertificate() })
64+
Button(String("Enroll"), action: { viewModel.enrollCertificate() })
5465
}
5566

5667
Section("Certificate Revocation Lists") {
68+
footNote(
69+
"a Certificate Revocation List (CRL) lists all the certificates that have been revoked for a given domain. They have an expiration time, after which they will be refetched."
70+
)
71+
5772
toggleRow(
5873
title: "Force CRL expiry after 1 minute",
59-
description: "Sets the CRL expiration time to 1 minute. Enable to force refresh the CRLs when the app comes to the foreground (at least one minute after the CRL has been fetched the 1st time).",
74+
description: "Sets the CRL expiration time to 1 minute. Enable to force refresh the CRLs when the app comes to the foreground (at least one minute after the CRL has been fetched the 1st time). - Best to enable before login.",
6075
binding: binding(for: .forceCRLExpiryAfterOneMinute)
6176
)
6277
VStack(alignment: .leading) {
63-
Button("Clear CRL expiration dates", action: { viewModel.removeAllExpirationDates() })
78+
Button(String("Clear CRL expiration dates"), action: { viewModel.removeAllExpirationDates() })
6479
footNote(
6580
"Clears the CRL expiration dates from storage. Will force the CRLs to be refetched when discovering distribution points"
6681
)
@@ -69,8 +84,12 @@ struct DeveloperE2eiView: View {
6984

7085
Section("CRLs expiration dates") {
7186

87+
footNote(
88+
"A CRL (Certificate Revocation List) has an expiration date. When the date is reached, the CRL will be refetched."
89+
)
90+
7291
if viewModel.storedCRLExpirationDatesByURL.isEmpty {
73-
Text("There are no stored expiration dates")
92+
Text(String("There are no stored expiration dates"))
7493
.foregroundColor(.secondary)
7594
} else {
7695
ForEach(Array(viewModel.storedCRLExpirationDatesByURL.keys), id: \.self) { url in
@@ -83,7 +102,7 @@ struct DeveloperE2eiView: View {
83102
}
84103
}
85104

86-
Button("Refresh", action: { viewModel.refreshCRLExpirationDates() })
105+
Button(String("Refresh"), action: { viewModel.refreshCRLExpirationDates() })
87106
}
88107
}
89108
}

β€Žwire-ios/Wire-iOS/Sources/Developer/DeveloperTools/DeveloperE2ei/DeveloperE2eiViewModel.swiftβ€Ž

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ final class DeveloperE2eiViewModel: ObservableObject {
2828
return CRLExpirationDatesRepository(userID: userSession.selfUser.remoteIdentifier)
2929
}
3030

31-
@Published var certificateExpirationTime = ""
31+
static let minimumCertificateExpirationTime = 360
32+
33+
@Published var certificateExpirationTime = minimumCertificateExpirationTime
3234

3335
@Published var storedCRLExpirationDatesByURL = [String: String]()
3436

0 commit comments

Comments
Β (0)