EncryptedFile.Builder


public final class EncryptedFile.Builder


Builder class to configure EncryptedFile

Summary

Public constructors

Builder(
    @NonNull Context context,
    @NonNull File file,
    @NonNull MasterKey masterKey,
    @NonNull EncryptedFile.FileEncryptionScheme fileEncryptionScheme
)

Builder for an EncryptedFile.

Builder(
    @NonNull File file,
    @NonNull Context context,
    @NonNull String masterKeyAlias,
    @NonNull EncryptedFile.FileEncryptionScheme fileEncryptionScheme
)

This method is deprecated.

Use Builder instead.

Public constructors

Builder

Added in 1.1.0-alpha07
public Builder(
    @NonNull Context context,
    @NonNull File file,
    @NonNull MasterKey masterKey,
    @NonNull EncryptedFile.FileEncryptionScheme fileEncryptionScheme
)

Builder for an EncryptedFile.

Builder

Added in 1.0.0
Deprecated in 1.1.0-alpha07
public Builder(
    @NonNull File file,
    @NonNull Context context,
    @NonNull String masterKeyAlias,
    @NonNull EncryptedFile.FileEncryptionScheme fileEncryptionScheme
)

Builder for an EncryptedFile.

If the masterKeyAlias used here is for a key that is not yet created, this method will not be thread safe. Use the alternate signature that is not deprecated for multi-threaded contexts.

Public methods

build

Added in 1.0.0
public @NonNull EncryptedFile build()
Returns
@NonNull EncryptedFile

An EncryptedFile with the specified parameters.

setKeysetAlias

Added in 1.0.0
public @NonNull EncryptedFile.Builder setKeysetAlias(@NonNull String keysetAlias)
Parameters
@NonNull String keysetAlias

The alias in the SharedPreferences file to store the keyset.

Returns
@NonNull EncryptedFile.Builder

This Builder

setKeysetPrefName

Added in 1.0.0
public @NonNull EncryptedFile.Builder setKeysetPrefName(@NonNull String keysetPrefName)
Parameters
@NonNull String keysetPrefName

The SharedPreferences file to store the keyset.

Returns
@NonNull EncryptedFile.Builder

This Builder