Group

@objc(VTEGroup)
open class Group : NSObject

Class representing Group

  • Range of valid participants count

    Declaration

    Swift

    @available(*, deprecated, renamed: "ValidParticipantsCountRange")
    public static let ValidParticipatnsCountRange: ClosedRange<Int>
  • Range of valid participants count

    Declaration

    Swift

    public static let ValidParticipantsCountRange: ClosedRange<Int>
  • Initiator

    Declaration

    Swift

    @objc
    public let initiator: String
  • Participants

    Declaration

    Swift

    @objc
    public internal(set) var participants: Set<String> { get }

Extension with group encrypt and decrypt operations

  • Signs and encrypts data for group

    Throws

    corresponding error

    Important

    Requires private key in local storage

    Declaration

    Swift

    @objc
    open func encrypt(data: Data) throws -> Data

    Parameters

    data

    data to encrypt

    Return Value

    encrypted data

  • Decrypts and verifies data from group participant

    Throws

    corresponding error

    Declaration

    Swift

    @objc
    open func decrypt(data: Data, from senderCard: Card, date: Date? = nil) throws -> Data

    Parameters

    data

    encrypted data

    senderCard

    sender Card to verify with

    date

    date of message. Use it to prevent verifying new messages with old card

    Return Value

    decrypted data

  • Signs then encrypts string for group

    Throws

    corresponding error

    Important

    Requires private key in local storage

    Declaration

    Swift

    @objc
    open func encrypt(text: String) throws -> String

    Parameters

    text

    String to encrypt

    Return Value

    encrypted base64String

  • Decrypts and verifies base64 string from group participant

    Throws

    corresponding error

    Declaration

    Swift

    @objc
    open func decrypt(text: String, from senderCard: Card, date: Date? = nil) throws -> String

    Parameters

    text

    encryted String

    senderCard

    sender Card to verify with

    date

    date of message. Use it to prevent verifying new messages with old card

    Return Value

    decrypted String

Extension with group management operations

  • Updates group

    Declaration

    Swift

    public func update() -> GenericOperation<Void>

    Return Value

    CallbackOperation

  • Adds new participants to group

    Note

    New participant will be able to decrypt all history

    Declaration

    Swift

    public func add(participants: FindUsersResult) -> GenericOperation<Void>

    Parameters

    participants

    Cards of users to add. Result of findUsers call

    Return Value

    CallbackOperation

  • Share group access and history on new Card of existing participant

    Declaration

    Swift

    public func reAdd(participant: Card) -> GenericOperation<Void>

    Parameters

    participant

    participant Card

    Return Value

    CallbackOperation

  • Removes participants from group

    Note

    Removed participant will not be able to decrypt previous history again after group update

    Declaration

    Swift

    public func remove(participants: FindUsersResult) -> GenericOperation<Void>

    Parameters

    participants

    Cards of users to remove. Result of findUsers call

    Return Value

    CallbackOperation

  • Adds new participant to group

    Note

    New participant will be able to decrypt all history

    Declaration

    Swift

    public func add(participant card: Card) -> GenericOperation<Void>

    Parameters

    card

    Card of user to add

    Return Value

    CallbackOperation

  • Removes participant from group

    Declaration

    Swift

    public func remove(participant card: Card) -> GenericOperation<Void>

    Parameters

    card

    Card of user to remove

    Return Value

    CallbackOperation

Extension with group management operations with string participants parameter

  • Adds new participants to group

    Note

    New participant will be able to decrypt all history

    Declaration

    Swift

    public func add(participants: [String]) -> GenericOperation<Void>

    Parameters

    participants

    Identities of users to add

    Return Value

    CallbackOperation

  • Adds new participant to group

    Note

    New participant will be able to decrypt all history

    Declaration

    Swift

    public func add(participant: String) -> GenericOperation<Void>

    Parameters

    card

    User to add

    Return Value

    CallbackOperation

  • Share group access and history on new Card of existing participant

    Declaration

    Swift

    public func reAdd(participant: String) -> GenericOperation<Void>

    Parameters

    participant

    participant to re add

    Return Value

    CallbackOperation

  • Removes participants from group

    Note

    Removed participant will not be able to decrypt previous history again after group update

    Declaration

    Swift

    public func remove(participants: [String]) -> GenericOperation<Void>

    Parameters

    participants

    Users to remove

    Return Value

    CallbackOperation

  • Removes participant from group

    Declaration

    Swift

    public func remove(participant: String) -> GenericOperation<Void>

    Parameters

    participant

    User to remove

    Return Value

    CallbackOperation

Extension with Objective-C compatible operations

  • Updates group

    Declaration

    Swift

    @objc
    open func update(completion: @escaping (_ error: Error?) -> Void)

    Parameters

    completion

    completion handler

    error

    corresponding error

  • Adds new participants to group

    Note

    New participant will be able to decrypt all history

    Declaration

    Swift

    @objc
    open func add(
        participants: FindUsersResult,
        completion: @escaping (_ error: Error?) -> Void
    )

    Parameters

    participants

    Cards of users to add. Result of findUsers call

    completion

    completion handler

    error

    corresponding error

  • Adds new participants to group

    Note

    New participant will be able to decrypt all history

    Declaration

    Swift

    public func add(
        participants: [String],
        completion: @escaping (_ error: Error?) -> Void
    )

    Parameters

    participants

    Identities of users to add

    completion

    completion handler

    error

    corresponding error

  • Adds new participant to group

    Note

    New participant will be able to decrypt all history

    Declaration

    Swift

    @objc
    open func add(
        participant: Card,
        completion: @escaping (_ error: Error?) -> Void
    )

    Parameters

    participant

    Card of user to add

    completion

    completion handler

    error

    corresponding error

  • Adds new participant to group

    Note

    New participant will be able to decrypt all history

    Declaration

    Swift

    public func add(
        participant: String,
        completion: @escaping (_ error: Error?) -> Void
    )

    Parameters

    participant

    New participant will be able to decrypt all history

    completion

    completion handler

    error

    corresponding error

  • Share group access and history on new Card of existing participant

    Declaration

    Swift

    @objc
    open func reAdd(participant: Card, completion: @escaping (_ error: Error?) -> Void)

    Parameters

    participant

    participant Card

    completion

    completion handler

    error

    corresponding error

  • Share group access and history on new Card of existing participant

    Declaration

    Swift

    public func reAdd(participant: String, completion: @escaping (_ error: Error?) -> Void)

    Parameters

    participant

    participant to re add

    completion

    completion handler

    error

    corresponding error

  • Removes participants from group

    Note

    Removed participant will not be able to decrypt previous history again after group update

    Declaration

    Swift

    @objc
    open func remove(
        participants: FindUsersResult,
        completion: @escaping (_ error: Error?) -> Void
    )

    Parameters

    participants

    Cards of users to remove. Result of findUsers call

    completion

    completion handler

    error

    corresponding error

  • Removes participants from group

    Note

    Removed participant will not be able to decrypt previous history again after group update

    Declaration

    Swift

    public func remove(
        participants: [String],
        completion: @escaping (_ error: Error?) -> Void
    )

    Parameters

    participants

    Users to remove

    completion

    completion handler

    error

    corresponding error

  • Removes participant from group

    Declaration

    Swift

    @objc
    open func remove(
        participant: Card,
        completion: @escaping (_ error: Error?) -> Void
    )

    Parameters

    participant

    Card of user to remove

    completion

    completion handler

    error

    corresponding error

  • Removes participant from group

    Declaration

    Swift

    public func remove(
        participant: String,
        completion: @escaping (_ error: Error?) -> Void
    )

    Parameters

    participant

    User to remove

    completion

    completion handler

    error

    corresponding error