UserManager

@objc
public class UserManager : NSObject

Manage users and their face templates

  • Callback block with an array of face templates and optional error as parameters

    Declaration

    Swift

    public typealias FaceTemplateArrayCallback = ([FaceTemplate], Error?) -> Void
  • Callback block with an optional error as parameter

    Declaration

    Swift

    public typealias ErrorCallback = (Error?) -> Void
  • Callback block with an array of strings and optional error as parameters

    Declaration

    Swift

    public typealias StringArrayCallback = ([String], Error?) -> Void
  • Callback block with a number and optional error as parameters

    Declaration

    Swift

    public typealias NumberCallback = (NSNumber, Error?) -> Void
  • Callback block with a dictionary of face template arrays keyed by user ids strings and optional error as parameters

    Declaration

    Swift

    public typealias FaceTemplateDictionaryCallback = (UserFaceTemplates, Error?) -> Void
  • Dictionary of face template arrays keyed by user id strings

    Declaration

    Swift

    public typealias UserFaceTemplates = [String : [FaceTemplate]]
  • Assign face templates to a user

    Note

    If a user record with the given identifier does not exist it will be created. If any of the face templates are already assigned to a different user they will be reassigned to the specified user. If any of the face templates is the last remaining template for the user to whom they were previously assigned the user will be deleted. This method replaces the less performant addFaceTemplates(_:to).

    Declaration

    Swift

    @available(*, message: "Introduced in Ver-ID 3.4.0")
    @objc
    public func assignFaceTemplates(_ faceTemplates: [FaceTemplate], to user: String) throws

    Parameters

    faceTemplates

    Array of face templates to assign to the user

    user

    Identifier for the user

  • Assign face templates to a user

    Note

    If a user record with the given identifier does not exist it will be created. If any of the face templates are already assigned to a different user they will be reassigned to the specified user. If any of the face templates is the last remaining template for the user to whom they were previously assigned the user will be deleted. This method replaces the less performant addFaceTemplates(_:to).

    Declaration

    Swift

    @available(*, message: "Introduced in Ver-ID 3.4.0")
    @objc
    public func assignFaceTemplates(_ faceTemplates: [FaceTemplate], to user: String, completion: @escaping ErrorCallback)

    Parameters

    faceTemplates

    Array of face templates to assign to the user

    user

    Identifier for the user

    completion

    Block invoked on completion

  • Delete face templates

    Note

    If the given face templates are the last remaining face templates for a user the user will be deleted.

    Declaration

    Swift

    @available(*, message: "Introduced in Ver-ID 3.4.0")
    @objc
    public func deleteFaceTemplates(_ faceTemplates: [FaceTemplate]) throws

    Parameters

    faceTemplates

    Array of face templates to delete

  • Delete face templates

    Note

    If the given face templates are the last remaining face templates for a user the user will be deleted.

    Declaration

    Swift

    @available(*, message: "Introduced in Ver-ID 3.4.0")
    @objc
    public func deleteFaceTemplates(_ faceTemplates: [FaceTemplate], completion: @escaping ErrorCallback)

    Parameters

    faceTemplates

    Array of face templates to delete

  • Add face templates to a user identified by a string

    Note

    If a user record with the given identifier does not exist it will be created. If any of the face templates are already associated with another user they will be duplicated. To avoid this use assignFaceTemplates(_:to) instead.

    Declaration

    Swift

    @available(*, deprecated, message: "Deprecated in Ver-ID 3.4.0")
    @objc
    public func addFaceTemplates(_ faceTemplates: [FaceTemplate], to user: String) throws

    Parameters

    faceTemplates

    Array of face templates to associate with the user

    user

    Identifier for the user

  • Add face templates to a user identified by a string

    Note

    If a user record with the given identifier does not exist it will be created. If any of the face templates are already associated with the user they will not be duplicated.

    Declaration

    Swift

    @available(*, deprecated, message: "Deprecated in Ver-ID 3.4.0")
    @objc
    public func addFaceTemplates(_ faceTemplates: [FaceTemplate], to user: String, completion: @escaping ErrorCallback)

    Parameters

    faceTemplates

    Array of face templates to associate with the user

    user

    Identifier for the user

    completion

    Block invoked on completion

  • Retrieve user’s face templates

    Declaration

    Swift

    @objc
    public func faceTemplates(for user: String) throws -> [FaceTemplate]

    Parameters

    user

    Identifier for the user for whom to retrieve templates

    Return Value

    Array of face templates associated with the user

  • Retrieve user’s face templates

    Declaration

    Swift

    @objc
    public func faceTemplates(for user: String, completion: @escaping FaceTemplateArrayCallback)

    Parameters

    user

    Identifier for the user for whom to retrieve templates

    completion

    Block invoked on completion

  • Remove face templates from a user

    Note

    Face templates that are not associated with the user will be ignored. This method is replaced by the better-performing deleteFaceTemplates(_).

    Declaration

    Swift

    @available(*, deprecated: 3.4.0)
    @objc
    public func removeFaceTemplates(_ faceTemplates: [FaceTemplate], from user: String) throws

    Parameters

    faceTemplates

    Face templates to dissassociate from the user

    user

    Identifier for the user from whom the face templates will be removed

  • Remove face templates from a user

    Note

    Face templates that are not associated with the user will be ignored. This method is replaced by the better-performing deleteFaceTemplates(_:completion).

    Declaration

    Swift

    @available(*, deprecated: 3.4.0)
    @objc
    public func removeFaceTemplates(_ faceTemplates: [FaceTemplate], from user: String, completion: @escaping ErrorCallback)

    Parameters

    faceTemplates

    Face templates to dissassociate from the user

    user

    Identifier for the user from whom the face templates will be removed

    completion

    Block invoked on completion

  • Retrieve a list of user identifiers who are associated with at least one face template

    Declaration

    Swift

    @objc
    public func users() throws -> [String]

    Return Value

    Array of user identifiers who are associated with at least one face template

  • Retrieve a list of user identifiers who are associated with at least one face template

    Declaration

    Swift

    @objc
    public func users(_ completion: @escaping StringArrayCallback)

    Parameters

    completion

    Block invoked on completion

  • Identify users whose face templates match the given face template

    Declaration

    Swift

    @available(*, message: "Introduced in 3.4.0")
    @objc
    public func identifyUsers(in faceTemplate: FaceTemplate, securityLevel: VerIDSecurityLevel = .normal) throws -> [String]

    Parameters

    faceTemplate

    Face template to which to compare user face templates

    securityLevel

    Security level to use on the authentication

    Return Value

    Identifiers for users whose faces are similar to the supplied face template.

  • Identify users whose face templates match the given face template

    Declaration

    Swift

    @available(*, message: "Introduced in 3.4.0")
    @objc
    public func identifyUsers(in faceTemplate: FaceTemplate, securityLevel: VerIDSecurityLevel = .normal, completion: @escaping StringArrayCallback)

    Parameters

    faceTemplate

    Face template to which to compare user face templates

    securityLevel

    Security level to use on the authentication

    completion

    Block invoked on completion. The block’s string array parameter contains identifiers for users whose faces are similar to the supplied face template.

  • Identify users whose face templates match the given face template

    Declaration

    Swift

    @available(*, deprecated, message: "Use identifyUsers(in:securityLevel:﹚ instead")
    @objc
    public func identifyUsers(in faceTemplate: FaceTemplate, similarityThreshold: NSNumber) throws -> [String]

    Parameters

    faceTemplate

    Face template to which to compare user face templates

    similarityThreshold

    alue between 0.0 and 1.0 or nil to use a default value of 0.5

    Return Value

    Identifiers for users whose face templates’ distance to the given template is greater than the similarity threshold

  • Identify users whose face templates match the given face template

    Declaration

    Swift

    @available(*, deprecated, message: "Deprecated in 3.4.0, use identifyUsers(in:securityLevel:completion:﹚ instead")
    @objc
    public func identifyUsers(in faceTemplate: FaceTemplate, similarityThreshold: NSNumber, completion: @escaping StringArrayCallback)

    Parameters

    faceTemplate

    Face template to which to compare user face templates

    similarityThreshold

    Value between 0.0 and 1.0 or nil to use a default value of 0.5

    completion

    Block invoked on completion. The block’s string array parameter contains identifiers for users whose face templates’ distance to the given template is greater than the similarity threshold.

  • Compare a face template to templates of a given user

    Declaration

    Swift

    @objc
    public func compareFaceTemplate(_ faceTemplate: FaceTemplate, to user: String) throws -> NSNumber

    Parameters

    faceTemplate

    Face template to compare

    user

    User to whose face templates the given face template will be compared to

    Return Value

    Similarity score ranging from 0.0 (no similarity) to 1.0 (same)

  • Compare a face template to templates of a given user

    Declaration

    Swift

    @objc
    public func compareFaceTemplate(_ faceTemplate: FaceTemplate, to user: String, completion: @escaping NumberCallback)

    Parameters

    faceTemplate

    Face template to compare

    user

    User to whose face templates the given face template will be compared to

    completion

    Block invoked on completion. The block’s number parameter is a similarity score ranging from 0.0 (no similarity) to 1.0 (same).

  • Remove user record and its associated face templates

    Declaration

    Swift

    @objc
    public func removeUser(_ id: String) throws

    Parameters

    id

    User identifier

  • Remove user record and its associated face templates

    Declaration

    Swift

    @objc
    public func removeUser(_ id: String, completion: @escaping ErrorCallback)

    Parameters

    id

    User identifier

    completion

    Block invoked on completion

  • Remove user records and their associated face templates

    Declaration

    Swift

    @objc
    public func removeUsers(_ ids: [String]) throws

    Parameters

    ids

    User identifiers

  • Remove user records and their associated face templates

    Declaration

    Swift

    @objc
    public func removeUsers(_ ids: [String], completion: @escaping ErrorCallback)

    Parameters

    ids

    User identifiers

    completion

    Block to invoke on completion

  • Export all face templates

    Declaration

    Swift

    @objc
    public func exportFaceTemplates() throws -> UserFaceTemplates

    Return Value

    Dictionary of face template arrays keyed by user identifiers

  • Export all face templates

    Declaration

    Swift

    @objc
    public func exportFaceTemplates(_ completion: @escaping FaceTemplateDictionaryCallback)

    Parameters

    completion

    Block invoked on completion. The block’s dictionary contains arrays of face templates keyed by user identifiers.

  • Import face templates

    Note

    If the user exists templates will be appended to the user record

    Declaration

    Swift

    @objc
    public func importFaceTemplates(_ faceTemplates: UserFaceTemplates) throws

    Parameters

    faceTemplates

    Dictionary of face template arrays keyed by user identifiers to import

  • Import face templates

    Note

    If the user exists templates will be appended to the user record

    Declaration

    Swift

    @objc
    public func importFaceTemplates(_ faceTemplates: UserFaceTemplates, completion: @escaping ErrorCallback)

    Parameters

    faceTemplates

    Dictionary of face template arrays keyed by user identifiers to import

    completion

    Block invoked on completion