Skip to content

Android Secure Storage #153

Description

@codefiesta

Now that the Keychain storage has been abstracted out, we'll need to implement the preferred secure storage protocol for Android

#if os(Android)
struct AndroidStorage: Storage {
   ...
}
#endif

class Keychain: @unchecked Sendable {
    /// Initializes the keychain with an overridden accound identifier.
    /// - Parameter account: a key indicating the account owner. Ideally, use the application identifier for this value.
    public init(_ account: String) {
        assert(account.isNotEmpty, "❌ The account identifier cannot be empty.")
        #if canImport(Security)
        self.storage = DefaultStorage(account: account)
        #elseif os(Android)
        self.storage = AndroidStorage(account: account)
        #elseif os(Linux)
        self.storage = LinuxStorage(account: account)
        #endif
    }
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

androidAndroid related issue.help wantedExtra attention is needed

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions