Skip to content

Commit c6a33d6

Browse files
acb-mvbuggmagnet
authored andcommitted
Define the PostQuantumKeyReceiving protocol, along with an extension to decode Data
1 parent b90afeb commit c6a33d6

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
//
2+
// PostQuantumKeyReceiving.swift
3+
// MullvadTypes
4+
//
5+
// Created by Andrew Bulhak on 2024-03-05.
6+
// Copyright © 2024 Mullvad VPN AB. All rights reserved.
7+
//
8+
9+
import Foundation
10+
import WireGuardKitTypes
11+
12+
protocol PostQuantumKeyReceiving {
13+
func receivePostQuantumKey(_ key: PrivateKey)
14+
}
15+
16+
enum PostQuantumKeyReceivingError: Error {
17+
case invalidKey
18+
}
19+
20+
extension PostQuantumKeyReceiving {
21+
func receivePostQuantumKey(_ keyData: Data) throws {
22+
guard let key = PrivateKey(rawValue: keyData) else {
23+
throw PostQuantumKeyReceivingError.invalidKey
24+
}
25+
receivePostQuantumKey(key)
26+
}
27+
}

ios/MullvadVPN.xcodeproj/project.pbxproj

+12
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
449872E42B7CB96300094DDC /* TunnelSettingsUpdateTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 449872E32B7CB96300094DDC /* TunnelSettingsUpdateTests.swift */; };
4545
449EB9FD2B95F8AD00DFA4EB /* DeviceMock.swift in Sources */ = {isa = PBXBuildFile; fileRef = 449EB9FC2B95F8AD00DFA4EB /* DeviceMock.swift */; };
4646
449EB9FF2B95FF2500DFA4EB /* AccountMock.swift in Sources */ = {isa = PBXBuildFile; fileRef = 449EB9FE2B95FF2500DFA4EB /* AccountMock.swift */; };
47+
449EBA262B975B9700DFA4EB /* PostQuantumKeyReceiving.swift in Sources */ = {isa = PBXBuildFile; fileRef = 449EBA252B975B9700DFA4EB /* PostQuantumKeyReceiving.swift */; };
4748
44DD7D242B6CFFD70005F67F /* StartTunnelOperationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 44DD7D232B6CFFD70005F67F /* StartTunnelOperationTests.swift */; };
4849
44DD7D272B6D18FB0005F67F /* MockTunnelInteractor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 44DD7D262B6D18FB0005F67F /* MockTunnelInteractor.swift */; };
4950
44DD7D292B7113CA0005F67F /* MockTunnel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 44DD7D282B7113CA0005F67F /* MockTunnel.swift */; };
@@ -1298,6 +1299,7 @@
12981299
449872E32B7CB96300094DDC /* TunnelSettingsUpdateTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TunnelSettingsUpdateTests.swift; sourceTree = "<group>"; };
12991300
449EB9FC2B95F8AD00DFA4EB /* DeviceMock.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DeviceMock.swift; sourceTree = "<group>"; };
13001301
449EB9FE2B95FF2500DFA4EB /* AccountMock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountMock.swift; sourceTree = "<group>"; };
1302+
449EBA252B975B9700DFA4EB /* PostQuantumKeyReceiving.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PostQuantumKeyReceiving.swift; sourceTree = "<group>"; };
13011303
44DD7D232B6CFFD70005F67F /* StartTunnelOperationTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StartTunnelOperationTests.swift; sourceTree = "<group>"; };
13021304
44DD7D262B6D18FB0005F67F /* MockTunnelInteractor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockTunnelInteractor.swift; sourceTree = "<group>"; };
13031305
44DD7D282B7113CA0005F67F /* MockTunnel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockTunnel.swift; sourceTree = "<group>"; };
@@ -2203,6 +2205,14 @@
22032205
path = MullvadSettings;
22042206
sourceTree = "<group>";
22052207
};
2208+
449EBA242B975B7C00DFA4EB /* Protocols */ = {
2209+
isa = PBXGroup;
2210+
children = (
2211+
449EBA252B975B9700DFA4EB /* PostQuantumKeyReceiving.swift */,
2212+
);
2213+
path = Protocols;
2214+
sourceTree = "<group>";
2215+
};
22062216
44DD7D252B6D18E90005F67F /* Mocks */ = {
22072217
isa = PBXGroup;
22082218
children = (
@@ -2229,6 +2239,7 @@
22292239
581943F228F8014500B0CB5E /* MullvadTypes */ = {
22302240
isa = PBXGroup;
22312241
children = (
2242+
449EBA242B975B7C00DFA4EB /* Protocols */,
22322243
584D26BE270C550B004EA533 /* AnyIPAddress.swift */,
22332244
586A951329013235007BAF2B /* AnyIPEndpoint.swift */,
22342245
06AC113628F83FD70037AF9A /* Cancellable.swift */,
@@ -5451,6 +5462,7 @@
54515462
7AF9BE8C2A321D1F00DBFEDB /* RelayFilter.swift in Sources */,
54525463
58D22414294C90210029F5F8 /* RelayLocation.swift in Sources */,
54535464
581DA2732A1E227D0046ED47 /* RESTTypes.swift in Sources */,
5465+
449EBA262B975B9700DFA4EB /* PostQuantumKeyReceiving.swift in Sources */,
54545466
58D22417294C90210029F5F8 /* FixedWidthInteger+Arithmetics.swift in Sources */,
54555467
);
54565468
runOnlyForDeploymentPostprocessing = 0;

0 commit comments

Comments
 (0)