summaryrefslogtreecommitdiffhomepage
path: root/ios/MullvadVPN/AccessMethodRepository/ShadowsocksCipher.swift
diff options
context:
space:
mode:
authorAndrej Mihajlov <and@mullvad.net>2023-11-02 10:47:15 +0100
committerJon Petersson <jon.petersson@kvadrat.se>2023-12-13 15:42:20 +0100
commit8188c51e1b0a5705db7e94053c6d8d45faf615fe (patch)
tree79b38d2b0ff8d8d2fd5b7ab06adde476c3c523e5 /ios/MullvadVPN/AccessMethodRepository/ShadowsocksCipher.swift
parentc1e2a227931e8e6011353ff9fce56fe733e4ac63 (diff)
downloadmullvadvpn-8188c51e1b0a5705db7e94053c6d8d45faf615fe.tar.xz
mullvadvpn-8188c51e1b0a5705db7e94053c6d8d45faf615fe.zip
Add API access methods UI/part of backend
Diffstat (limited to 'ios/MullvadVPN/AccessMethodRepository/ShadowsocksCipher.swift')
-rw-r--r--ios/MullvadVPN/AccessMethodRepository/ShadowsocksCipher.swift48
1 files changed, 48 insertions, 0 deletions
diff --git a/ios/MullvadVPN/AccessMethodRepository/ShadowsocksCipher.swift b/ios/MullvadVPN/AccessMethodRepository/ShadowsocksCipher.swift
new file mode 100644
index 0000000000..8610bf33c1
--- /dev/null
+++ b/ios/MullvadVPN/AccessMethodRepository/ShadowsocksCipher.swift
@@ -0,0 +1,48 @@
+//
+// ShadowsocksCipher.swift
+// MullvadVPN
+//
+// Created by pronebird on 13/11/2023.
+// Copyright © 2023 Mullvad VPN AB. All rights reserved.
+//
+
+import Foundation
+
+/// Type representing a shadowsocks cipher.
+struct ShadowsocksCipher: RawRepresentable, CustomStringConvertible, Equatable, Hashable, Codable {
+ let rawValue: String
+
+ var description: String {
+ rawValue
+ }
+
+ /// Default cipher.
+ static let `default` = ShadowsocksCipher(rawValue: "chacha20")
+
+ /// All supported ciphers.
+ static let supportedCiphers = supportedCipherIdentifiers.map { ShadowsocksCipher(rawValue: $0) }
+}
+
+private let supportedCipherIdentifiers = [
+ // Stream ciphers.
+ "aes-128-cfb",
+ "aes-128-cfb1",
+ "aes-128-cfb8",
+ "aes-128-cfb128",
+ "aes-256-cfb",
+ "aes-256-cfb1",
+ "aes-256-cfb8",
+ "aes-256-cfb128",
+ "rc4",
+ "rc4-md5",
+ "chacha20",
+ "salsa20",
+ "chacha20-ietf",
+ // AEAD ciphers.
+ "aes-128-gcm",
+ "aes-256-gcm",
+ "chacha20-ietf-poly1305",
+ "xchacha20-ietf-poly1305",
+ "aes-128-pmac-siv",
+ "aes-256-pmac-siv",
+]