SandboxedKeychainStorage

@objc(VSSSandboxedKeychainStorage)
public final class SandboxedKeychainStorage : NSObject
extension SandboxedKeychainStorage: KeychainStorageProtocol

KeychainStorage that sandboxes entries using identity and prefix

  • Underlying key storage

    Declaration

    Swift

    public let keychainStorage: KeychainStorageProtocol
  • User’s identity

    Declaration

    Swift

    @objc
    public let identity: String?
  • Entries’ name prefix

    Declaration

    Swift

    @objc
    public let prefix: String?
  • Init

    Declaration

    Swift

    public init(identity: String? = nil, prefix: String? = nil, keychainStorage: KeychainStorageProtocol)

    Parameters

    identity

    User’s identity

    prefix

    Entries’ name prefix

    keychainStorage

    KeychainStorage used to store keys

  • Stores key in Keychain

    Throws

    Declaration

    Swift

    @objc
    public func store(data: Data, withName name: String, meta: [String : String]?) throws -> KeychainEntry

    Parameters

    data

    Data

    name

    Name

    meta

    Meta

    Return Value

    Stored Keychain entry

  • Updates entry

    Declaration

    Swift

    @objc
    public func updateEntry(withName name: String, data: Data, meta: [String : String]?) throws

    Parameters

    name

    Name

    data

    New data

    meta

    New meta

  • Retrieves entry from Keychain

    Throws

    Declaration

    Swift

    @objc
    public func retrieveEntry(withName name: String) throws -> KeychainEntry

    Parameters

    name

    Name

    Return Value

    Retrieved Keychain entry

  • Retrieves all entries from Keychain

    Throws

    Declaration

    Swift

    @objc
    public func retrieveAllEntries() throws -> [KeychainEntry]

    Return Value

    All Keychain entries

  • Deletes keychain entry

    Throws

    Rethrows from KeychainStorage

    Declaration

    Swift

    @objc
    public func deleteEntry(withName name: String) throws

    Parameters

    name

    Name

  • Checks if entry exists in Keychain

    Throws

    Rethrows from KeychainStorage

    Declaration

    Swift

    public func existsEntry(withName name: String) throws -> Bool

    Parameters

    name

    Name

    Return Value

    true if entry exists, false - otherwise