TF-2464 Save keychain as data
Signed-off-by: dab246 <tdvu@linagora.com> (cherry picked from commit e29e93e97d35d21dc095688a40f074572488486a)
This commit is contained in:
@@ -42,18 +42,18 @@ class KeychainController: KeychainControllerDelegate {
|
||||
|
||||
func updateEmailDeliveryStateToKeychain(accountId: String, newEmailDeliveryState: String) {
|
||||
do {
|
||||
if let sharingSession = retrieveSharingSessionFromKeychain(accountId: accountId) {
|
||||
let newSharingSession = sharingSession.updateEmailDeliveryState(newEmailDeliveryState: newEmailDeliveryState)
|
||||
try keychain.set(newSharingSession.toJson() ?? "", key: accountId)
|
||||
if let sharingSession = retrieveSharingSessionFromKeychain(accountId: accountId),
|
||||
let newSharingSessionData = sharingSession.updateEmailDeliveryState(newEmailDeliveryState: newEmailDeliveryState).toData() {
|
||||
try keychain.set(newSharingSessionData, key: accountId)
|
||||
}
|
||||
} catch {}
|
||||
}
|
||||
|
||||
func updateTokenOidc(accountId: String, newTokenOidc: TokenOidc) {
|
||||
do {
|
||||
if let sharingSession = retrieveSharingSessionFromKeychain(accountId: accountId) {
|
||||
let newSharingSession = sharingSession.updateTokenOidc(newTokenOidc: newTokenOidc)
|
||||
try keychain.set(newSharingSession.toJson() ?? "", key: accountId)
|
||||
if let sharingSession = retrieveSharingSessionFromKeychain(accountId: accountId),
|
||||
let newSharingSessionData = sharingSession.updateTokenOidc(newTokenOidc: newTokenOidc).toData() {
|
||||
try keychain.set(newSharingSessionData, key: accountId)
|
||||
}
|
||||
} catch {}
|
||||
}
|
||||
|
||||
@@ -55,11 +55,4 @@ extension KeychainSharingSession {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func toJson() -> String? {
|
||||
if let data = toData(), let jsonString = String(data: data, encoding: .utf8) {
|
||||
return jsonString
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user