SaltProviding

public protocol SaltProviding : AnyObject

Implementers must implement this for providing salt which can be used during encryption.

  • Generates a new salt for the given entity. Existing salt associated with the given entity, if any, will be replaced with the newly generated salt. Note: A salt can be associated with a nil entity as well.

    Throws

    SaltProviderError

    Declaration

    Swift

    func generateSalt(for entity: String?) throws -> String

    Parameters

    entity

    name of the entity for which salt is to be generated. If nil or empty, a default salt will be generated.

    Return Value

    newly generated salt for the entity.

  • Returns the salt associated with the given entity Returns empty if there is no salt associated with the given entity

    Throws

    SaltProviderError

    Declaration

    Swift

    func getSalt(for entity: String?) throws -> String?

    Parameters

    entity

    name of the entity

    Return Value

    salt associated with the entity

  • Checks if a salt is already associated with the given entity

    Declaration

    Swift

    func saltExists(for entity: String?) throws -> Bool

    Parameters

    entity

    name of the entity

    Return Value

    true if salt exists, false otherwise

  • Clears the salt already associated with the given entity, if any.

    Declaration

    Swift

    func clearSalt(for entity: String?)

    Parameters

    entity

    name of the entity

  • reset the salt(s) associated with the provider

    Declaration

    Swift

    func reset()