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:

    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

  • 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

  • Decrypts utf-8 string from RatchetMessage.

    Note

    This operation changes session state, so session should be updated in storage.

    Throws

    Throws:

    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 from RatchetSession

    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