Skip to content
Snippets Groups Projects
Commit cd98797a authored by Dariusz Rybicki's avatar Dariusz Rybicki
Browse files

Rename Environment to NDFEnvironment

parent 9077cdef
No related branches found
No related tags found
2 merge requests!102Release 1.0.0,!33XXMessengerClient
......@@ -16,7 +16,7 @@ extension CMixManager {
.appendingPathComponent("xx.network.client")
.path,
fileManager: FileManager = .default,
environment: Environment = .mainnet,
ndfEnvironment: NDFEnvironment = .mainnet,
downloadNDF: DownloadAndVerifySignedNdf = .live,
generateSecret: GenerateSecret = .live,
passwordStorage: PasswordStorage,
......@@ -31,7 +31,7 @@ extension CMixManager {
fileManager: fileManager
),
create: .live(
environment: environment,
ndfEnvironment: ndfEnvironment,
downloadNDF: downloadNDF,
generateSecret: generateSecret,
passwordStorage: passwordStorage,
......@@ -42,7 +42,7 @@ extension CMixManager {
loadCMix: loadCMix
),
restore: .live(
environment: environment,
ndfEnvironment: ndfEnvironment,
downloadNDF: downloadNDF,
generateSecret: generateSecret,
passwordStorage: passwordStorage,
......
......@@ -11,7 +11,7 @@ public struct CMixManagerCreate {
extension CMixManagerCreate {
public static func live(
environment: Environment,
ndfEnvironment: NDFEnvironment,
downloadNDF: DownloadAndVerifySignedNdf,
generateSecret: GenerateSecret,
passwordStorage: PasswordStorage,
......@@ -22,7 +22,7 @@ extension CMixManagerCreate {
loadCMix: LoadCMix
) -> CMixManagerCreate {
CMixManagerCreate {
let ndfData = try downloadNDF(environment)
let ndfData = try downloadNDF(ndfEnvironment)
let password = generateSecret()
try passwordStorage.save(password)
try? fileManager.removeItem(atPath: directoryPath)
......
......@@ -14,7 +14,7 @@ public struct CMixManagerRestore {
extension CMixManagerRestore {
public static func live(
environment: Environment,
ndfEnvironment: NDFEnvironment,
downloadNDF: DownloadAndVerifySignedNdf,
generateSecret: GenerateSecret,
passwordStorage: PasswordStorage,
......@@ -23,7 +23,7 @@ extension CMixManagerRestore {
newCMixFromBackup: NewCMixFromBackup
) -> CMixManagerRestore {
CMixManagerRestore { backup, passphrase in
let ndfData = try downloadNDF(environment)
let ndfData = try downloadNDF(ndfEnvironment)
let password = generateSecret()
try passwordStorage.save(password)
try? fileManager.removeItem(atPath: directoryPath)
......
......@@ -2,9 +2,9 @@ import Bindings
import XCTestDynamicOverlay
public struct DownloadAndVerifySignedNdf {
public var run: (Environment) throws -> Data
public var run: (NDFEnvironment) throws -> Data
public func callAsFunction(_ env: Environment) throws -> Data {
public func callAsFunction(_ env: NDFEnvironment) throws -> Data {
try run(env)
}
}
......
import Foundation
public struct Environment: Equatable {
public struct NDFEnvironment: Equatable {
public init(url: URL, cert: String) {
self.url = url
self.cert = cert
......@@ -10,8 +10,8 @@ public struct Environment: Equatable {
public var cert: String
}
extension Environment {
public static let mainnet = Environment(
extension NDFEnvironment {
public static let mainnet = NDFEnvironment(
url: URL(string: "https://elixxir-bins.s3.us-west-1.amazonaws.com/ndf/mainnet.json")!,
cert: """
-----BEGIN CERTIFICATE-----
......@@ -50,3 +50,10 @@ extension Environment {
"""
)
}
extension NDFEnvironment {
public static let unimplemented = NDFEnvironment(
url: URL(fileURLWithPath: "unimplemented"),
cert: "unimplemented"
)
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment