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
4 changes: 3 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ jobs:
echo "BUILD_NAME=$BUILD_NAME" >> $GITHUB_ENV

- name: flutter test
run: flutter test
run: |
./gen-artifacts.sh skip
flutter test

- name: Build iOS
env:
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/smoke.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ jobs:
touch env.sh

- name: flutter test
run: flutter test
run: |
./gen-artifacts.sh skip
flutter test

- name: Build Android debug
run: flutter build appbundle --debug
Expand Down Expand Up @@ -123,7 +125,9 @@ jobs:
touch env.sh

- name: flutter test
run: flutter test
run: |
./gen-artifacts.sh skip
flutter test

- name: Build iOS
run: |
Expand Down
2 changes: 1 addition & 1 deletion gen-artifacts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ elif [ "$1" = "android" ]; then
rm -rf ../android/mobileNebula/mobileNebula.aar
cp mobileNebula.aar ../android/mobileNebula/mobileNebula.aar

else
elif [ "$1" != "skip" ]; then
echo "Error: unsupported target os $1"
exit 1
fi
Expand Down
2 changes: 2 additions & 0 deletions ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
customLLDBInitFile = "$(SRCROOT)/Flutter/ephemeral/flutter_lldbinit"
shouldUseLaunchSchemeArgsEnv = "YES">
<MacroExpansion>
<BuildableReference
Expand All @@ -61,6 +62,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
customLLDBInitFile = "$(SRCROOT)/Flutter/ephemeral/flutter_lldbinit"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
42 changes: 22 additions & 20 deletions lib/models/certificate.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import 'package:mobile_nebula/errors/parse_error.dart';

class CertificateInfo {
Certificate cert;
String? rawCert;
CertificateValidity? validity;

CertificateInfo.debug({this.rawCert = ""}) : cert = Certificate.debug(), validity = CertificateValidity.debug();
CertificateInfo.debug({this.rawCert = ''}) : cert = Certificate.debug(), validity = CertificateValidity.debug();

CertificateInfo.fromJson(Map<String, dynamic> json)
: cert = Certificate.fromJson(json['Cert']),
Expand Down Expand Up @@ -34,50 +36,50 @@ class Certificate {

Certificate.debug()
: version = 2,
name = "DEBUG",
name = 'DEBUG',
networks = [],
unsafeNetworks = [],
groups = [],
isCa = false,
notBefore = DateTime.now(),
notAfter = DateTime.now(),
issuer = "DEBUG",
publicKey = "",
curve = "",
fingerprint = "DEBUG",
signature = "DEBUG";
issuer = 'DEBUG',
publicKey = '',
curve = '',
fingerprint = 'DEBUG',
signature = 'DEBUG';

factory Certificate.fromJson(Map<String, dynamic> json) {
Map<String, dynamic> details = json;
String publicKey;
String curve;
if (json.containsKey("details")) {
details = json["details"];
if (json.containsKey('details')) {
details = json['details'];
//TODO: currently swift and kotlin flatten the certificate structure but
// nebula outputs cert json in the nested format
switch (json["version"]) {
switch (json['version']) {
case 1:
// In V1 the public key was under details
publicKey = details["publicKey"];
curve = details["curve"];
publicKey = details['publicKey'];
curve = details['curve'];
break;
case 2:
// In V2 the public key moved to the top level
publicKey = json["publicKey"];
curve = json["curve"];
publicKey = json['publicKey'];
curve = json['curve'];
break;
default:
throw Exception('Unknown certificate version');
throw ParseError('unknown certificate version: ${json['version']}');
}
} else {
// This is a flattened certificate format, publicKey is at the top
publicKey = json["publicKey"];
curve = json["curve"];
publicKey = json['publicKey'];
curve = json['curve'];
}

return Certificate(
json["version"],
details["name"],
json['version'],
details['name'],
List<String>.from(details['networks'] ?? []),
List<String>.from(details['unsafeNetworks'] ?? []),
List<String>.from(details['groups'] ?? []),
Expand Down Expand Up @@ -113,7 +115,7 @@ class CertificateValidity {
bool valid;
String reason;

CertificateValidity.debug() : valid = true, reason = "";
CertificateValidity.debug() : valid = true, reason = '';

CertificateValidity.fromJson(Map<String, dynamic> json) : valid = json['Valid'], reason = json['Reason'];
}
Loading
Loading