// Copyright © 2022 Rangeproof Pty Ltd. All rights reserved. import Foundation public enum Legacy { // MARK: - Collections and Keys internal static let swarmCollectionPrefix = "LokiSwarmCollection-" internal static let lastSnodePoolRefreshDateKey = "lastSnodePoolRefreshDate" internal static let snodePoolCollection = "LokiSnodePoolCollection" internal static let onionRequestPathCollection = "LokiOnionRequestPathCollection" internal static let lastSnodePoolRefreshDateCollection = "LokiLastSnodePoolRefreshDateCollection" internal static let lastMessageHashCollection = "LokiLastMessageHashCollection" internal static let receivedMessagesCollection = "LokiReceivedMessagesCollection" // MARK: - Types public typealias LegacyOnionRequestAPIPath = [Snode] @objc(Snode) public final class Snode: NSObject, NSCoding { // NSObject/NSCoding conformance is needed for YapDatabase compatibility public let address: String public let port: UInt16 public let publicKeySet: KeySet public var ip: String { guard let range = address.range(of: "https://"), range.lowerBound == address.startIndex else { return address } return String(address[range.upperBound..