Skip to content

Commit

Permalink
Auto update with latest AS Release v91.0.0 (#37)
Browse files Browse the repository at this point in the history
* Version 91.0.0

Co-authored-by: Firefox Sync Engineering <[email protected]>
  • Loading branch information
github-actions[bot] and Firefox Sync Engineering authored Feb 1, 2022
1 parent 4ca440b commit 3d00374
Show file tree
Hide file tree
Showing 16 changed files with 1,112 additions and 230 deletions.
4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// swift-tools-version:5.4
import PackageDescription

let checksum = "397f09236f031fe614bfdbc5ba4b8953bfd98e1df640e442962a5d7e2b96d006"
let version = "v90.0.0"
let checksum = "24d3d6a0364adef008bf33549751dee847b09d6b046666e955480805ca508d9a"
let version = "v91.0.0"
let url = "https://github.com/mozilla/application-services/releases/download/\(version)/MozillaRustComponents.xcframework.zip"

let package = Package(
Expand Down
11 changes: 5 additions & 6 deletions generated/fxa-client/FxAClient/FxAccountStorage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

import Foundation
import SwiftKeychainWrapper

class KeyChainAccountStorage {
internal var keychainWrapper: KeychainWrapper
internal var keychainWrapper: MZKeychainWrapper
internal static var keychainKey: String = "accountJSON"
internal static var accessibility: KeychainItemAccessibility = .afterFirstUnlock
internal static var accessibility: MZKeychainItemAccessibility = .afterFirstUnlock

init(keychainAccessGroup: String?) {
keychainWrapper = KeychainWrapper.sharedAppContainerKeychain(keychainAccessGroup: keychainAccessGroup)
keychainWrapper = MZKeychainWrapper.sharedAppContainerKeychain(keychainAccessGroup: keychainAccessGroup)
}

func read() -> PersistedFirefoxAccount? {
Expand Down Expand Up @@ -55,9 +54,9 @@ class KeyChainAccountStorage {
}
}

public extension KeychainWrapper {
public extension MZKeychainWrapper {
func ensureStringItemAccessibility(
_ accessibility: SwiftKeychainWrapper.KeychainItemAccessibility,
_ accessibility: MZKeychainItemAccessibility,
forKey key: String
) {
if hasValue(forKey: key) {
Expand Down
9 changes: 4 additions & 5 deletions generated/fxa-client/FxAClient/KeychainWrapper+.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

import Foundation
import SwiftKeychainWrapper

extension KeychainWrapper {
extension MZKeychainWrapper {
/// Return the base bundle identifier.
///
/// This function is smart enough to find out if it is being called from an extension or the main application. In
Expand All @@ -22,13 +21,13 @@ extension KeychainWrapper {
return baseBundleIdentifier
}

static var shared: KeychainWrapper?
static var shared: MZKeychainWrapper?

static func sharedAppContainerKeychain(keychainAccessGroup: String?) -> KeychainWrapper {
static func sharedAppContainerKeychain(keychainAccessGroup: String?) -> MZKeychainWrapper {
if let s = shared {
return s
}
let wrapper = KeychainWrapper(serviceName: baseBundleIdentifier, accessGroup: keychainAccessGroup)
let wrapper = MZKeychainWrapper(serviceName: baseBundleIdentifier, accessGroup: keychainAccessGroup)
shared = wrapper
return wrapper
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
//
// KeychainOptions.swift
// SwiftKeychainWrapper
//
// Created by James Blair on 4/24/16.
// Copyright © 2016 Jason Rendel. All rights reserved.
//
// The MIT License (MIT)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

// swiftlint:disable all

import Foundation

protocol MZKeychainAttrRepresentable {
var keychainAttrValue: CFString { get }
}

// MARK: - KeychainItemAccessibility

public enum MZKeychainItemAccessibility {
/**
The data in the keychain item cannot be accessed after a restart until the device has been unlocked once by the user.

After the first unlock, the data remains accessible until the next restart. This is recommended for items that need to be accessed by background applications. Items with this attribute migrate to a new device when using encrypted backups.
*/
@available(iOS 4, *)
case afterFirstUnlock

/**
The data in the keychain item cannot be accessed after a restart until the device has been unlocked once by the user.

After the first unlock, the data remains accessible until the next restart. This is recommended for items that need to be accessed by background applications. Items with this attribute do not migrate to a new device. Thus, after restoring from a backup of a different device, these items will not be present.
*/
@available(iOS 4, *)
case afterFirstUnlockThisDeviceOnly

/**
The data in the keychain item can always be accessed regardless of whether the device is locked.

This is not recommended for application use. Items with this attribute migrate to a new device when using encrypted backups.
*/
@available(iOS 4, *)
case always

/**
The data in the keychain can only be accessed when the device is unlocked. Only available if a passcode is set on the device.

This is recommended for items that only need to be accessible while the application is in the foreground. Items with this attribute never migrate to a new device. After a backup is restored to a new device, these items are missing. No items can be stored in this class on devices without a passcode. Disabling the device passcode causes all items in this class to be deleted.
*/
@available(iOS 8, *)
case whenPasscodeSetThisDeviceOnly

/**
The data in the keychain item can always be accessed regardless of whether the device is locked.

This is not recommended for application use. Items with this attribute do not migrate to a new device. Thus, after restoring from a backup of a different device, these items will not be present.
*/
@available(iOS 4, *)
case alwaysThisDeviceOnly

/**
The data in the keychain item can be accessed only while the device is unlocked by the user.

This is recommended for items that need to be accessible only while the application is in the foreground. Items with this attribute migrate to a new device when using encrypted backups.

This is the default value for keychain items added without explicitly setting an accessibility constant.
*/
@available(iOS 4, *)
case whenUnlocked

/**
The data in the keychain item can be accessed only while the device is unlocked by the user.

This is recommended for items that need to be accessible only while the application is in the foreground. Items with this attribute do not migrate to a new device. Thus, after restoring from a backup of a different device, these items will not be present.
*/
@available(iOS 4, *)
case whenUnlockedThisDeviceOnly

static func accessibilityForAttributeValue(_ keychainAttrValue: CFString) -> MZKeychainItemAccessibility? {
for (key, value) in keychainItemAccessibilityLookup {
if value == keychainAttrValue {
return key
}
}

return nil
}
}

private let keychainItemAccessibilityLookup: [MZKeychainItemAccessibility: CFString] = {
var lookup: [MZKeychainItemAccessibility: CFString] = [
.afterFirstUnlock: kSecAttrAccessibleAfterFirstUnlock,
.afterFirstUnlockThisDeviceOnly: kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly,
.always: kSecAttrAccessibleAlways,
.whenPasscodeSetThisDeviceOnly: kSecAttrAccessibleWhenPasscodeSetThisDeviceOnly,
.alwaysThisDeviceOnly: kSecAttrAccessibleAlwaysThisDeviceOnly,
.whenUnlocked: kSecAttrAccessibleWhenUnlocked,
.whenUnlockedThisDeviceOnly: kSecAttrAccessibleWhenUnlockedThisDeviceOnly,
]

return lookup
}()

extension MZKeychainItemAccessibility: MZKeychainAttrRepresentable {
internal var keychainAttrValue: CFString {
return keychainItemAccessibilityLookup[self]!
}
}
Loading

0 comments on commit 3d00374

Please sign in to comment.