SecureSession
@objc(VSRSecureSession)
public final class SecureSession : NSObject
SecureSession
Note
This class is thread-safe- Tag: SecureSession
-
Participant identity
Declaration
Swift
@objc public let participantIdentity: String
-
Session name
Declaration
Swift
@objc public let name: String
-
Crypto
Declaration
Swift
@objc public let crypto: VirgilCrypto
-
Encrypts string.
Note
This operation changes session state, so session should be updated in storage.
Throws
Throws:
SecureSessionError.invalidUtf8String
if given string is not correct utf-8 string- Rethrows from crypto
RatchetSession
Declaration
Swift
@objc public func encrypt(string: String) throws -> RatchetMessage
Parameters
string
string to encrypt
Return Value
RatchetMessage
-
Encrypts data.
Note
This operation changes session state, so session should be updated in storage.
Throws
Throws:
- Rethrows from crypto
RatchetSession
Declaration
Swift
@objc public func encrypt(data: Data) throws -> RatchetMessage
Parameters
data
data to encrypt
Return Value
RatchetMessage
- Rethrows from crypto
-
Decrypts data from RatchetMessage.
Note
This operation changes session state, so session should be updated in storage.
Throws
Throws:
- Rethrows from crypto
RatchetSession
Declaration
Swift
@objc public func decryptData(from message: RatchetMessage) throws -> Data
Parameters
message
RatchetMessage
Return Value
Decrypted data
- Rethrows from crypto
-
Decrypts utf-8 string from RatchetMessage.
Note
This operation changes session state, so session should be updated in storage.
Throws
Throws:
SecureSessionError.invalidUtf8String
if decrypted data is not correct utf-8 string- Rethrows from crypto
RatchetSession
Declaration
Swift
@objc public func decryptString(from message: RatchetMessage) throws -> String
Parameters
message
RatchetMessage
Return Value
Decrypted utf-8 string
-
Init session from serialized representation
Throws
Rethrows fromRatchetSession
Declaration
Swift
@objc public init(data: Data, participantIdentity: String, name: String, crypto: VirgilCrypto) throws
Parameters
data
Serialized session
participantIdentity
Participant identity
name
Session name
crypto
VirgilCrypto
-
Serialize session
Declaration
Swift
@objc public func serialize() -> Data
Return Value
Serialized data