mirror of https://github.com/oxen-io/session-ios
mirror of https://github.com/oxen-io/session-ios
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
799 B
33 lines
799 B
// |
|
// Copyright (c) 2018 Open Whisper Systems. All rights reserved. |
|
// |
|
|
|
import Foundation |
|
|
|
public enum OWSSignalAddressError: Error { |
|
case assertionError(description: String) |
|
} |
|
|
|
@objc |
|
public class OWSSignalAddress: NSObject { |
|
@objc |
|
public let recipientId: String |
|
|
|
@objc |
|
public let deviceId: UInt |
|
|
|
// MARK: Initializers |
|
|
|
@objc public init(recipientId: String, deviceId: UInt) throws { |
|
guard recipientId.count > 0 else { |
|
throw OWSSignalAddressError.assertionError(description: "Invalid recipient id: \(deviceId)") |
|
} |
|
|
|
guard deviceId > 0 else { |
|
throw OWSSignalAddressError.assertionError(description: "Invalid device id: \(deviceId)") |
|
} |
|
|
|
self.recipientId = recipientId |
|
self.deviceId = deviceId |
|
} |
|
}
|
|
|