SecuredKeyEncryptor

public struct SecuredKeyEncryptor : Encryptor

A struct that provides encryption and decryption functionalities using SecuredKey.

  • Initializes a new instance of SecuredKeyEncryptor.

    This initializer attempts to create a SecuredKey with the given application tag. If it fails, the initializer returns nil.

    Declaration

    Swift

    public init?()
  • encrypt(data:) Asynchronous

    Encrypts the given data.

    Throws

    EncryptorError.failedToEncrypt if the encryption fails.

    Declaration

    Swift

    public func encrypt(data: Data) async throws -> Data

    Parameters

    data

    The data to encrypt.

    Return Value

    The encrypted data.

  • decrypt(data:) Asynchronous

    Decrypts the given data.

    Throws

    EncryptorError.failedToDecrypt if the decryption fails.

    Declaration

    Swift

    public func decrypt(data: Data) async throws -> Data

    Parameters

    data

    The data to decrypt.

    Return Value

    The decrypted data.