SyncKeyStorage
@objc(VSSSyncKeyStorage)
open class SyncKeyStorage : NSObject
Class responsible for synchronization between Keychain and Keyknox Cloud
-
CloudKeyStorageProtocol implementation
Declaration
Swift
public let cloudKeyStorage: CloudKeyStorageProtocol
-
Creates local key storage instance, to read keys withoud connecting to the Cloud
Declaration
Swift
public static func makeLocalStorage(identity: String, keychainStorage: KeychainStorageProtocol) -> KeychainStorageProtocol
Parameters
identity
User’s identity to separate keys in Keychain
keychainStorage
KeychainStorageProtocol implementation
Return Value
returns KeychainStorageProtocol
-
Init
Declaration
Swift
public init(identity: String, keychainStorage: KeychainStorageProtocol, cloudKeyStorage: CloudKeyStorageProtocol)
Parameters
identity
User’s identity to separate keys in Keychain
keychainStorage
KeychainStorageProtocol implementation
cloudKeyStorage
CloudKeyStorageProtocol implementation
-
Init
Throws
Rethrows fromKeychainStorageParams
Declaration
Swift
@objc public convenience init(identity: String, cloudKeyStorage: CloudKeyStorage) throws
Parameters
identity
User’s identity to separate keys in Keychain
cloudKeyStorage
CloudKeyStorageProtocol implementation
-
Init
Declaration
Swift
@objc public convenience init(identity: String, accessTokenProvider: AccessTokenProvider, crypto: VirgilCrypto, publicKeys: [VirgilPublicKey], privateKey: VirgilPrivateKey) throws
Parameters
identity
User’s identity to separate keys in Keychain
crypto
Crypto
accessTokenProvider
AccessTokenProvider implementation
publicKeys
Public keys used for encryption and signature verification
privateKey
Private key used for decryption and signature generation
-
Updates entry in Keyknox Cloud and Keychain
Declaration
Swift
@objc open func updateEntry(withName name: String, data: Data, meta: [String: String]?, completion: @escaping (Error?) -> Void)
Parameters
name
Name
data
New data
meta
New meta
completion
Completion handler
-
Deletes entries from both Keychain and Keyknox Cloud
Declaration
Swift
@objc open func deleteEntry(withName name: String, completion: @escaping (Error?) -> Void)
Parameters
name
Names to delete
completion
Completion handler
-
Stores entry in both Keychain and Keyknox Cloud
Declaration
Swift
@objc open func storeEntry(withName name: String, data: Data, meta: [String: String]? = nil, completion: @escaping (KeychainEntry?, Error?) -> Void)
Parameters
name
Name
data
Data
meta
Meta
completion
Completion handler
-
Performs synchronization between Keychain and Keyknox Cloud
Declaration
Swift
@objc open func sync(completion: @escaping (Error?) -> Void)
Parameters
completion
Completion handler
-
Checks if entry exists in Keychain
Declaration
Swift
@objc open func existsEntryNoThrow(withName name: String) -> Bool
Parameters
name
Entry name
Return Value
true if entry exists, false - otherwise
-
Stores entries in both Keychain and Keyknox Cloud
Declaration
Swift
@objc open func storeEntries(_ keyEntries: [KeyknoxKeyEntry], completion: @escaping ([KeychainEntry]?, Error?) -> Void)
Parameters
keyEntries
Key entries to store
completion
Completion handler
-
Deletes entries from both Keychain and Keyknox Cloud
Declaration
Swift
@objc open func deleteEntries(withNames names: [String], completion: @escaping (Error?) -> Void)
Parameters
names
Names to delete
completion
Completion handler
-
Updates recipients. See KeyknoxManager.updateRecipients
Declaration
Swift
@objc open func updateRecipients(newPublicKeys: [VirgilPublicKey]? = nil, newPrivateKey: VirgilPrivateKey? = nil, completion: @escaping (Error?) -> Void)
Parameters
newPublicKeys
New public keys
newPrivateKey
New private key
completion
Completion handler
-
Deletes all entries in both Keychain and Keyknox Cloud
Declaration
Swift
@objc open func deleteAllEntries(completion: @escaping (Error?) -> Void)
Parameters
completion
Completion handler
-
Updates entry in Keyknox Cloud and Keychain
Declaration
Swift
public func updateEntry(withName name: String, data: Data, meta: [String : String]?) -> GenericOperation<Void>
Parameters
name
Name
data
New data
meta
New meta
Return Value
GenericOperation
-
Retrieves entry from Keychain
Throws
Rethrows fromKeychainStorage
Declaration
Swift
@objc open func retrieveEntry(withName name: String) throws -> KeychainEntry
Parameters
name
Name
Return Value
KeychainEntry
-
Deletes entries from both Keychain and Keyknox Cloud
Declaration
Swift
public func deleteEntries(withNames names: [String]) -> GenericOperation<Void>
Parameters
names
Names to delete
Return Value
GenericOperation
-
Deletes entry from both Keychain and Keyknox Cloud
Declaration
Swift
public func deleteEntry(withName name: String) -> GenericOperation<Void>
Parameters
name
Name
Return Value
GenericOperation
-
Stores entry in both Keychain and Keyknox Cloud
Declaration
Swift
public func storeEntry(withName name: String, data: Data, meta: [String: String]? = nil) -> GenericOperation<KeychainEntry>
Parameters
name
Name
data
Data
meta
Meta
Return Value
GenericOperation
-
Stores entries in both Keychain and Keyknox Cloud
Declaration
Swift
public func storeEntries(_ keyEntries: [KeyknoxKeyEntry]) -> GenericOperation<[KeychainEntry]>
Parameters
keyEntries
Key entries to store
Return Value
GenericOperation<[KeychainEntry]>
-
Performs synchronization between Keychain and Keyknox Cloud
Declaration
Swift
public func sync() -> GenericOperation<Void>
Return Value
GenericOperation
-
Updates recipients. See KeyknoxManager.updateRecipients
Declaration
Swift
public func updateRecipients(newPublicKeys: [VirgilPublicKey]? = nil, newPrivateKey: VirgilPrivateKey? = nil) -> GenericOperation<Void>
Parameters
newPublicKeys
New public keys
newPrivateKey
New private key
Return Value
GenericOperation
-
Retrieves all entries from Keychain
Throws
Rethrows fromKeychainStorage
Declaration
Swift
public func retrieveAllEntries() throws -> [KeychainEntry]
Return Value
Keychain entries
-
Checks if entry exists in Keychain
Throws
Rethrows fromKeychainStorage
Declaration
Swift
public func existsEntry(withName name: String) throws -> Bool
Parameters
name
Entry name
Return Value
true if entry exists, false otherwise
-
Deletes all entries in both Keychain and Keyknox Cloud
Declaration
Swift
public func deleteAllEntries() -> GenericOperation<Void>
Return Value
GenericOperation