Coder Social home page Coder Social logo

auth0 / simplekeychain Goto Github PK

View Code? Open in Web Editor NEW
565.0 55.0 75.0 1.42 MB

A simple Keychain wrapper for iOS, macOS, tvOS, and watchOS

Home Page: https://auth0.github.io/SimpleKeychain

License: MIT License

Ruby 4.96% Swift 95.04%
keychain ios security dx-sdk

simplekeychain's Introduction

SimpleKeychain

Version Build Status Coverage Status License

📚 Documentation • 🚀 Getting Started • 📃 Support Policy • 💬 Feedback

Migrating from 0.x? Check the Migration Guide.

Documentation

Getting Started

Requirements

  • iOS 14.0+ / macOS 11.0+ / tvOS 14.0+ / watchOS 7.0+
  • Xcode 15.x
  • Swift 5.9+

Important

Check the Support Policy to learn when dropping Xcode, Swift, and platform versions will not be considered a breaking change.

Installation

Swift Package Manager

Open the following menu item in Xcode:

File > Add Packages...

In the Search or Enter Package URL search box enter this URL:

https://github.com/auth0/SimpleKeychain

Then, select the dependency rule and press Add Package.

Cocoapods

Add the following line to your Podfile:

pod 'SimpleKeychain', '~> 1.0'

Then, run pod install.

Carthage

Add the following line to your Cartfile:

github "auth0/SimpleKeychain" ~> 1.0

Then, run carthage bootstrap --use-xcframeworks.

Usage

Learn about more advanced features in Examples ↗

See all the available features in the API documentation ↗

let simpleKeychain = SimpleKeychain()

You can specify a service name under which to save items. By default the bundle identifier of your app is used.

let simpleKeychain = SimpleKeychain(service: "Auth0")

Store a string or data item

try simpleKeychain.set(accessToken, forKey: "auth0-access-token")

Check if an item is stored

let isStored = try simpleKeychain.hasItem(forKey: "auth0-access-token")

Retrieve a string item

let accessToken = try simpleKeychain.string(forKey: "auth0-access-token")

Retrieve a data item

let accessToken = try simpleKeychain.data(forKey: "auth0-credentials")

Retrieve the keys of all stored items

let keys = try simpleKeychain.keys()

Remove an item

try simpleKeychain.deleteItem(forKey: "auth0-access-token")

Remove all items

try simpleKeychain.deleteAll()

Error handling

All methods will throw a SimpleKeychainError upon failure.

catch let error as SimpleKeychainError {
    print(error)
}

Support Policy

This Policy defines the extent of the support for Xcode, Swift, and platform (iOS, macOS, tvOS, and watchOS) versions in SimpleKeychain.

Xcode

The only supported versions of Xcode are those that can be currently used to submit apps to the App Store. Once a Xcode version becomes unsupported, dropping it from SimpleKeychain will not be considered a breaking change, and will be done in a minor release.

Swift

The minimum supported Swift minor version is the one released with the oldest-supported Xcode version. Once a Swift minor becomes unsupported, dropping it from SimpleKeychain will not be considered a breaking change, and will be done in a minor release.

Platforms

We support only the last four major versions of any platform, including the current major version.

Once a platform version becomes unsupported, dropping it from SimpleKeychain will not be considered a breaking change, and will be done in a minor release. For example, iOS 14 will cease to be supported when iOS 18 gets released, and SimpleKeychain will be able to drop it in a minor release.

In the case of macOS, the yearly named releases are considered a major platform version for the purposes of this Policy, regardless of the actual version numbers.

Feedback

Contributing

We appreciate feedback and contribution to this repo! Before you get started, please see the following:

Raise an issue

To provide feedback or report a bug, please raise an issue on our issue tracker.

Vulnerability reporting

Please do not report security vulnerabilities on the public GitHub issue tracker. The Responsible Disclosure Program details the procedure for disclosing security issues.


Auth0 Logo

Auth0 is an easy-to-implement, adaptable authentication and authorization platform. To learn more check out Why Auth0?

This project is licensed under the MIT license. See the LICENSE file for more info.

simplekeychain's People

Contributors

adamjmcgrath avatar arpit-jn avatar asclepix avatar cocojoe avatar cysp avatar damieng avatar davidjb avatar dependabot[bot] avatar desusai7 avatar eaceto avatar elkraneo avatar evansims avatar fossabot avatar hzalaz avatar janakmshah avatar joshcanhelp avatar jstart avatar lbalmaceda avatar mathieutozer avatar mgonto avatar nsarno avatar pose avatar snyk-bot avatar sre-57-opslevel[bot] avatar stevenwong-okta avatar stuclift avatar widcket avatar woloski avatar yanniks avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

simplekeychain's Issues

dyld: Symbol not found: _kSecAttrAccessControl

Deployment target: iOS 7.0

On iphone with iOS 7.1

dyld: Symbol not found: _kSecAttrAccessControl
  Referenced from: /var/mobile/Applications/7A33DEE1-9255-4627-8231-BF4910661F60/myapp.app/myapp
  Expected in: /System/Library/Frameworks/Security.framework/Security
 in /var/mobile/Applications/7A33DEE1-9255-4627-8231-BF4910661F60/myapp.app/myapp

I cant found "kSecAttrAccessControl" in my source code. On iphone with iOS 8.1 everything is ok.

Missing nullable annotation for method keyRefOfRSAKeyWithTag:

Description

The method - (SecKeyRef)keyRefOfRSAKeyWithTag:(NSString *)keyTag; in the class extension A0SimpleKeychain (KeyPair) can return NULL but has no nullable annotation.

Reproduction

Choose Analyze from the Product menu in Xcode for any project with the Simplekeychain Library:

Pods/SimpleKeychain/SimpleKeychain/A0SimpleKeychain+KeyPair.m:120:9: warning: Null returned from a method that is expected to return a non-null value return NULL; ^~~~~~~~~~~

Environment

  • SimpleKeychain (0.10.0)
  • Target platform iOS 10

TouchID does not show up

I've tried to implement A0SimpleKeychain in my project - but for some reason the TouchID does not show up. It seems like I'm not able to store anything in the Keychain - as the id changes every time I execute the app.

Here's my code:

var error: NSError?
let message = "Please login"
let keychain = A0SimpleKeychain()
var defaultAccount = keychain.stringForKey("default.account", promptMessage: message)

if defaultAccount == nil {
    let uuid = NSUUID().UUIDString.stringByReplacingOccurrencesOfString("-", withString: "", options: nil, range: nil).lowercaseString

    defaultAccount = NSString(string: uuid)

    let keychain = A0SimpleKeychain()
    keychain.useAccessControl = true
    keychain.defaultAccessiblity = .WhenPasscodeSetThisDeviceOnly
    keychain.setString(defaultAccount, forKey: "default.account")
}

println(split( defaultAccount ){ $0 == "$" })

What I'm doing wrong?

@objc Annotations for Cross-Language usage

Checklist

  • I have looked into the README and have not found a suitable solution or answer.
  • I have searched the issues and have not found a suitable solution or answer.
  • I have searched the Auth0 Community forums and have not found a suitable solution or answer.
  • I agree to the terms within the Auth0 Code of Conduct.

Describe the problem you'd like to have solved

The public accessors of the new Version (1.0) do not use the @objc modifier, thus they can not be used in legacy / objective-c code, which is sad and kind of unnecessary.

Describe the ideal solution

Add @objc to public method signatures

Alternatives and current workarounds

No response

Additional context

No response

'keychain()' is unavailable error with Swift

Hi guys,

This line from the README :
A0SimpleKeychain.keychain().setString(jwt, forKey:"auth0-user-jwt")
gives me the following error :
'keychain()' is unavailable: use object construction 'A0SimpleKeychain()'

After reading the code a bit more, I changed the line to this and it works :
A0SimpleKeychain().setString(jwt, forKey:"auth0-user-jwt")

I'm not too sure why but it looks like the conversion from obj-c to swift is not working as expected, any ideas?

I'm using Xcode 6.1

No way to disable useAccessControl

Description

I'm trying to request Biometric only once, for that I deal with biometric by my own and use the keychain without access control, but there is no way, I ended by prompting for FaceId several times and is very annoying.

I guess it is related to #78.

Reproduction

final class KeychainManager {
    static let shared = KeychainManager()
    // MARK: - private methods
    private lazy var defaultKeychain: A0SimpleKeychain = {
        let keychain = A0SimpleKeychain(service: App.shared.isProductionRunEnvironment ? "Auth0" : "Auth0-STAGE")
        keychain.useAccessControl = false
        return keychain
    }()
    private lazy var context: LAContext = {
        var context = LAContext()
        context.touchIDAuthenticationAllowableReuseDuration = 60
        return context
    }()

    // MARK: Public methods
    func getPasswordWithBiometricAuth(_ completion: @escaping (String?) -> Void) {
        var error: NSError?
        if context.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: &error) {
            log.debug("canEvaluatePolicy")
            context.evaluatePolicy(.deviceOwnerAuthenticationWithBiometrics,
                                   localizedReason: NSLocalizedString("KeychainManager.shared.passwordPromptMessage",
                                                                      comment: "")
            ) { (success, _) in
                log.debug("policy with \(success ? "success":"failure")")
                if success,
                    let email = Defaults[.rememberedEmail],
                    let password = self.defaultKeychain.string(forKey: "\(email).password") {
                    completion(password)
                } else {
                    completion(nil)
                }
            }
        } else {
            completion(nil)
        }
    }

Environment

In my Podifle:

    pod 'Auth0', '~> 1.21'
    pod 'SimpleKeychain', '~> 0.10'

My project supports iOS 11.4 in advance.

Privacy Manifest

Checklist

  • I have looked into the Readme and the Examples, and have not found a suitable solution or answer.
  • I have searched the issues and have not found a suitable solution or answer.
  • I have searched the Auth0 Community forums and have not found a suitable solution or answer.
  • I agree to the terms within the Auth0 Code of Conduct.

Describe the problem you'd like to have solved

From Apple docs:

Starting in spring 2024, you must include the privacy manifest for any SDK listed below when you submit new apps in App Store Connect that include those SDKs, or when you submit an app update that adds one of the listed SDKs as part of the update. Signatures are also required in these cases where the listed SDKs are used as binary dependencies.

Could you please add a privacy manifest for this library?

Describe the ideal solution

The library would have a privacy manifest

Alternatives and current workarounds

No response

Additional context

auth0/Auth0.swift#810

Update dependency (Quick)

Trying to add latest versions of Quick & Nimble frameworks into my project via SPM. But getting following error:

Dependencies could not be resolved because root depends on 'Quick' 4.0.0..<5.0.0 and root depends on 'SimpleKeychain' 0.12.2..<1.0.0.
'SimpleKeychain' >= 0.12.2 practically depends on 'Quick' 3.0.0..<4.0.0 because 'SimpleKeychain' 0.12.2 depends on 'Quick' 3.0.0..<4.0.0 and no versions of 'SimpleKeychain' match the requirement 0.12.3..<1.0.0.

Could you please update SimpleKeychain to use latest Quick & Nimble versions?

Also I was wondering if it is worth having these dependencies (Quick & Nimble) in such a small framework like SimpleKeychain. It contains only 20± unit tests. Please consider rewriting them using XCTest. Framework will become lighter and you will lose additional 3rd party dependencies.

Migration ObjC SimpleKeychain to Swift

Hello Guys I'm migrating old app wrote in ObjC to Swift, When I try to access to the stored keys but I can't access to the value. But In ObjC app I can, I'm no sure why, I check all possibilities and all is OK could you help me?

Add Privacy Manifest File

Checklist

  • I have looked into the Readme and the Examples, and have not found a suitable solution or answer.
  • I have searched the issues and have not found a suitable solution or answer.
  • I have searched the Auth0 Community forums and have not found a suitable solution or answer.
  • I agree to the terms within the Auth0 Code of Conduct.

Describe the problem you'd like to have solved

From Spring 2024, apps that don’t describe their use of required reason API in their privacy manifest file won’t be accepted by App Store Connect.

Although Pushwoosh SDK isn't mentioned in Apple's provided list of SDKs (see link below), considering Apple's strict privacy policies, you should add the Privacy Manifest file on your own before it comes into their notice. Lots of the SDKs (Firebase, Facebook, Alamofire, etc.) have already updated their SDKs and added the required privacy manifest file.

https://developer.apple.com/news/?id=r1henawx
https://developer.apple.com/support/third-party-SDK-requirements/

Describe the ideal solution

Add Privacy Manifest File

Alternatives and current workarounds

No response

Additional context

No response

Keychain data getting lost on app upgrade

Description

I am storing JWT token in keychain using -

A0SimpleKeychain().setString(token, forKey:"user-jwt")

And using the following to retrieve it back -

A0SimpleKeychain().string(forKey: key)

I am seeing in production logs that for some users, token is not getting fetched from keychain after app upgrade. Is it iOS issue or anything I am missing out here. Please suggest.

Environment

  • Version of SimpleKeychain used: 0.9.0
  • Version of OS used: 12.4
  • Additional dependencies that might be relevant:
  • If using Carthage or CocoaPods, please include your Cartfile or Podfile
    Podfile.txt
  • Xcode version: 10.3

Cannot set string in simulator.

Hello;

I am trying this code in simulator. But it doesn't work. token is nil.

 [[A0SimpleKeychain keychain] setString:value forKey:key];
 NSLog(@"token is %@", [[A0SimpleKeychain keychain] stringForKey:key]);

If I run this in a device, it works.

What is wrong?

Add Privacy Manifest

Checklist

  • I have looked into the Readme and the Examples, and have not found a suitable solution or answer.
  • I have searched the issues and have not found a suitable solution or answer.
  • I have searched the Auth0 Community forums and have not found a suitable solution or answer.
  • I agree to the terms within the Auth0 Code of Conduct.

Describe the problem you'd like to have solved

From Apple docs:

Starting in spring 2024, you must include the privacy manifest for any SDK listed below when you submit new apps in App Store Connect that include those SDKs, or when you submit an app update that adds one of the listed SDKs as part of the update. Signatures are also required in these cases where the listed SDKs are used as binary dependencies.

Describe the ideal solution

Add a privacy manifest for this library

https://developer.apple.com/news/?id=r1henawx
https://developer.apple.com/documentation/bundleresources/privacy_manifest_files

Alternatives and current workarounds

No response

Additional context

No response

Crash on setData Auth0.Profile

Using this
keychain.setData(NSKeyedArchiver.archivedDataWithRootObject(profile), forKey: "profile")
from the Auth0 documentation: https://auth0.com/docs/quickstart/native/ios-swift/03-session-handling#validate-an-existent-idtoken

The application is crashing and returning this:
-[A0Profile encodeWithCoder:]: unrecognized selector sent to instance *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[A0Profile encodeWithCoder:]: unrecognized selector sent to instance'

Xcode 8 / Swift 2.3 : keychain.setString returns false

Hi,

My code was working fine until I migrated to XCode 8 / Swift 2.3.
It is inspired from the Auth0 documentation.
Basically, now, keychain.setString always return false.
So my class property currentIdToken is nil.

Any ideas ?

Thanks
Fred

   import Foundation
   import Lock
   import SimpleKeychain

  // Keys for SimpleKeychain
  struct SimpleKeychainKeys {
      static let service          = "Auth0"
      static let id_token         = "id_token"
      static let refresh_token    = "refresh_token"
      static let profile          = "profile"
  }

  class UserAuth {
      private class var keychain: A0SimpleKeychain {
          return A0SimpleKeychain(service: SimpleKeychainKeys.service)
      }

      class var currentIdToken: String? {
          get {
              let idToken = keychain.stringForKey(SimpleKeychainKeys.id_token)
              return idToken
          }
          set {
              if let newIdToken = newValue {
                  keychain.setString(newIdToken, forKey: SimpleKeychainKeys.id_token)
              }
          }
      }
  }

Swift 3

Hi, will there be conversion to Swift 3?

Add Privacy manifest file

Checklist

  • I have looked into the Readme and the Examples, and have not found a suitable solution or answer.
  • I have searched the issues and have not found a suitable solution or answer.
  • I have searched the Auth0 Community forums and have not found a suitable solution or answer.
  • I agree to the terms within the Auth0 Code of Conduct.

Describe the problem you'd like to have solved

The primary issue I'm encountering involves the lack of a feature for handling privacy manifests within the JWTDecode.swift library. As per the new App Store guidelines effective from May 1, 2024, all applications are required to include a privacy manifest. This is crucial for ensuring that our app remains compliant with App Store policies and avoids any potential disruption in service or availability on the App Store.

Describe the ideal solution

The optimal solution would be for JWTDecode.swift to integrate a feature that allows for easy creation and management of privacy manifests in accordance with the upcoming App Store requirements. This would ideally include functionalities to specify the data types accessed or collected by our application and any third-party integrations, ensuring a seamless process for developers to declare their app's privacy practices transparently. Such an update would greatly assist in maintaining the app's compliance and streamline the development process for all users of your library.

Alternatives and current workarounds

No response

Additional context

No response

Carthage - "dyld: Library not loaded"

I have attempted to install SimpleKeychain via Carthage via the following steps:

  1. Add "github "auth0/SimpleKeychain"
    " to Cartfile
  2. Run "Carthage update"
  3. Link build phases Carthage to directory "$(SRCROOT)/Carthage/Build/iOS/SimpleKeychain.framework"

When I try to build the project in Xcode I receive the following compiler error:

dyld: Library not loaded: @rpath/SimpleKeychain.framework/SimpleKeychain
Referenced from: /Users//Library/Developer/Xcode/DerivedData//Build/Products/Debug-iphonesimulator/Login.framework/Login
Reason: image not found

Has anyone found a way around this and installing Simple Keychain via Carthage?

Code Errors in Your README.

You should update this project's README to fix the typos when documenting code.

Particularly when you are talking about using Touch ID, the code provided has errors:

keychain.useAcessControl = true keychain.defaultAccesiblity = .WhenPasscodeSetThisDeviceOnly

They should be:

keychain.useAccessControl = true keychain.defaultAccessiblity = .WhenPasscodeSetThisDeviceOnly

The differences are subtle but naturally they don't allow the code to compile. Please update the snippet I mentioned with the one I just gave you. Thanks!

Keychain values stay after deleting the app

When I login with Auth0, I save the profile and the id_token using A0SimpleKeychain. Is it normal that once I delete the app and reinstall it, the keychain is still there? If it's normal, it's only available from my app right?

Thanks

how to disable touch ID dialog

Hi, I would like to access the keychain on iOS 8 without the keychain showing up. Do you know how i can achieve this?

This is me accessing it in swift. I know the sample project works in objective c, and you can access the keychain without the touchID prompt. Doesn't seem to work the same way with swift.

Let me know.
Cheers :)

Abhi

Building iOS Framework with Auth0 dependency results in SimpleKeychain namespace errors

Checklist

  • I have looked into the README and the Examples and have not found a suitable solution or answer.
  • I have searched the issues and have not found a suitable solution or answer.
  • I have searched the Auth0 Community forums and have not found a suitable solution or answer.
  • I agree to the terms within the Auth0 Code of Conduct.

Description

Our SDK's iOS Framework is failing to build on latest XCode/iOS due to SimpleKeychain 1.0.1. We rely on it indirectly through Auth0 2.3.2

target-sdk-name iphonesimulator16.4
/Users/zaiddaghestani/Library/Developer/Xcode/DerivedData/InAppChat-aoeogmlunlplijccjrdaeoewqjmo/Build/Intermediates.noindex/ArchiveIntermediates/InAppChat/IntermediateBuildFilesPath/SimpleKeychain.build/Release-iphonesimulator/SimpleKeychain.build/Objects-normal/x86_64/SimpleKeychain.private.swiftinterface:25:26: error: 'SimpleKeychain' is not a member type of struct 'SimpleKeychain.SimpleKeychain'
extension SimpleKeychain.SimpleKeychain {
          ~~~~~~~~~~~~~~ ^
/Users/zaiddaghestani/Library/Developer/Xcode/DerivedData/InAppChat-aoeogmlunlplijccjrdaeoewqjmo/Build/Intermediates.noindex/ArchiveIntermediates/InAppChat/IntermediateBuildFilesPath/SimpleKeychain.build/Release-iphonesimulator/SimpleKeychain.build/Objects-normal/x86_64/SimpleKeychain.private.swiftinterface:22:15: note: 'SimpleKeychain' declared here
public struct SimpleKeychain {
              ^
/Users/zaiddaghestani/Library/Developer/Xcode/DerivedData/InAppChat-aoeogmlunlplijccjrdaeoewqjmo/Build/Intermediates.noindex/ArchiveIntermediates/InAppChat/IntermediateBuildFilesPath/SimpleKeychain.build/Release-iphonesimulator/SimpleKeychain.build/Objects-normal/x86_64/SimpleKeychain.private.swiftinterface:29:26: error: 'SimpleKeychain' is not a member type of struct 'SimpleKeychain.SimpleKeychain'
extension SimpleKeychain.SimpleKeychain {
          ~~~~~~~~~~~~~~ ^
/Users/zaiddaghestani/Library/Developer/Xcode/DerivedData/InAppChat-aoeogmlunlplijccjrdaeoewqjmo/Build/Intermediates.noindex/ArchiveIntermediates/InAppChat/IntermediateBuildFilesPath/SimpleKeychain.build/Release-iphonesimulator/SimpleKeychain.build/Objects-normal/x86_64/SimpleKeychain.private.swiftinterface:22:15: note: 'SimpleKeychain' declared here
public struct SimpleKeychain {
              ^
/Users/zaiddaghestani/Library/Developer/Xcode/DerivedData/InAppChat-aoeogmlunlplijccjrdaeoewqjmo/Build/Intermediates.noindex/ArchiveIntermediates/InAppChat/IntermediateBuildFilesPath/SimpleKeychain.build/Release-iphonesimulator/SimpleKeychain.build/Objects-normal/x86_64/SimpleKeychain.private.swiftinterface:33:26: error: 'SimpleKeychain' is not a member type of struct 'SimpleKeychain.SimpleKeychain'
extension SimpleKeychain.SimpleKeychain {
          ~~~~~~~~~~~~~~ ^
/Users/zaiddaghestani/Library/Developer/Xcode/DerivedData/InAppChat-aoeogmlunlplijccjrdaeoewqjmo/Build/Intermediates.noindex/ArchiveIntermediates/InAppChat/IntermediateBuildFilesPath/SimpleKeychain.build/Release-iphonesimulator/SimpleKeychain.build/Objects-normal/x86_64/SimpleKeychain.private.swiftinterface:22:15: note: 'SimpleKeychain' declared here
public struct SimpleKeychain {
              ^
/Users/zaiddaghestani/Library/Developer/Xcode/DerivedData/InAppChat-aoeogmlunlplijccjrdaeoewqjmo/Build/Intermediates.noindex/ArchiveIntermediates/InAppChat/IntermediateBuildFilesPath/SimpleKeychain.build/Release-iphonesimulator/SimpleKeychain.build/Objects-normal/x86_64/SimpleKeychain.private.swiftinterface:37:26: error: 'SimpleKeychain' is not a member type of struct 'SimpleKeychain.SimpleKeychain'
extension SimpleKeychain.SimpleKeychain {
          ~~~~~~~~~~~~~~ ^
/Users/zaiddaghestani/Library/Developer/Xcode/DerivedData/InAppChat-aoeogmlunlplijccjrdaeoewqjmo/Build/Intermediates.noindex/ArchiveIntermediates/InAppChat/IntermediateBuildFilesPath/SimpleKeychain.build/Release-iphonesimulator/SimpleKeychain.build/Objects-normal/x86_64/SimpleKeychain.private.swiftinterface:22:15: note: 'SimpleKeychain' declared here
public struct SimpleKeychain {
              ^
/Users/zaiddaghestani/Library/Developer/Xcode/DerivedData/InAppChat-aoeogmlunlplijccjrdaeoewqjmo/Build/Intermediates.noindex/ArchiveIntermediates/InAppChat/IntermediateBuildFilesPath/SimpleKeychain.build/Release-iphonesimulator/SimpleKeychain.build/Objects-normal/x86_64/SimpleKeychain.private.swiftinterface:66:26: error: 'SimpleKeychainError' is not a member type of struct 'SimpleKeychain.SimpleKeychain'
extension SimpleKeychain.SimpleKeychainError : Swift.Equatable {
          ~~~~~~~~~~~~~~ ^
/Users/zaiddaghestani/Library/Developer/Xcode/DerivedData/InAppChat-aoeogmlunlplijccjrdaeoewqjmo/Build/Intermediates.noindex/ArchiveIntermediates/InAppChat/IntermediateBuildFilesPath/SimpleKeychain.build/Release-iphonesimulator/SimpleKeychain.build/Objects-normal/x86_64/SimpleKeychain.private.swiftinterface:22:15: note: 'SimpleKeychain' declared here
public struct SimpleKeychain {
              ^
/Users/zaiddaghestani/Library/Developer/Xcode/DerivedData/InAppChat-aoeogmlunlplijccjrdaeoewqjmo/Build/Intermediates.noindex/ArchiveIntermediates/InAppChat/IntermediateBuildFilesPath/SimpleKeychain.build/Release-iphonesimulator/SimpleKeychain.build/Objects-normal/x86_64/SimpleKeychain.private.swiftinterface:69:26: error: 'SimpleKeychainError' is not a member type of struct 'SimpleKeychain.SimpleKeychain'
extension SimpleKeychain.SimpleKeychainError {
          ~~~~~~~~~~~~~~ ^
/Users/zaiddaghestani/Library/Developer/Xcode/DerivedData/InAppChat-aoeogmlunlplijccjrdaeoewqjmo/Build/Intermediates.noindex/ArchiveIntermediates/InAppChat/IntermediateBuildFilesPath/SimpleKeychain.build/Release-iphonesimulator/SimpleKeychain.build/Objects-normal/x86_64/SimpleKeychain.private.swiftinterface:22:15: note: 'SimpleKeychain' declared here
public struct SimpleKeychain {
              ^
/Users/zaiddaghestani/Library/Developer/Xcode/DerivedData/InAppChat-aoeogmlunlplijccjrdaeoewqjmo/Build/Intermediates.noindex/ArchiveIntermediates/InAppChat/IntermediateBuildFilesPath/SimpleKeychain.build/Release-iphonesimulator/SimpleKeychain.build/Objects-normal/x86_64/SimpleKeychain.private.swiftinterface:73:26: error: 'Accessibility' is not a member type of struct 'SimpleKeychain.SimpleKeychain'
extension SimpleKeychain.Accessibility : Swift.Equatable {}
          ~~~~~~~~~~~~~~ ^
/Users/zaiddaghestani/Library/Developer/Xcode/DerivedData/InAppChat-aoeogmlunlplijccjrdaeoewqjmo/Build/Intermediates.noindex/ArchiveIntermediates/InAppChat/IntermediateBuildFilesPath/SimpleKeychain.build/Release-iphonesimulator/SimpleKeychain.build/Objects-normal/x86_64/SimpleKeychain.private.swiftinterface:22:15: note: 'SimpleKeychain' declared here
public struct SimpleKeychain {
              ^
/Users/zaiddaghestani/Library/Developer/Xcode/DerivedData/InAppChat-aoeogmlunlplijccjrdaeoewqjmo/Build/Intermediates.noindex/ArchiveIntermediates/InAppChat/IntermediateBuildFilesPath/SimpleKeychain.build/Release-iphonesimulator/SimpleKeychain.build/Objects-normal/x86_64/SimpleKeychain.private.swiftinterface:74:26: error: 'Accessibility' is not a member type of struct 'SimpleKeychain.SimpleKeychain'
extension SimpleKeychain.Accessibility : Swift.Hashable {}
          ~~~~~~~~~~~~~~ ^
/Users/zaiddaghestani/Library/Developer/Xcode/DerivedData/InAppChat-aoeogmlunlplijccjrdaeoewqjmo/Build/Intermediates.noindex/ArchiveIntermediates/InAppChat/IntermediateBuildFilesPath/SimpleKeychain.build/Release-iphonesimulator/SimpleKeychain.build/Objects-normal/x86_64/SimpleKeychain.private.swiftinterface:22:15: note: 'SimpleKeychain' declared here
public struct SimpleKeychain {
              ^
/Users/zaiddaghestani/Library/Developer/Xcode/DerivedData/InAppChat-aoeogmlunlplijccjrdaeoewqjmo/Build/Intermediates.noindex/ArchiveIntermediates/InAppChat/IntermediateBuildFilesPath/SimpleKeychain.build/Release-iphonesimulator/SimpleKeychain.build/Objects-normal/x86_64/SimpleKeychain.private.swiftinterface:67:46: error: 'SimpleKeychainError' is not a member type of struct 'SimpleKeychain.SimpleKeychain'
  public static func == (lhs: SimpleKeychain.SimpleKeychainError, rhs: SimpleKeychain.SimpleKeychainError) -> Swift.Bool
                              ~~~~~~~~~~~~~~ ^
/Users/zaiddaghestani/Library/Developer/Xcode/DerivedData/InAppChat-aoeogmlunlplijccjrdaeoewqjmo/Build/Intermediates.noindex/ArchiveIntermediates/InAppChat/IntermediateBuildFilesPath/SimpleKeychain.build/Release-iphonesimulator/SimpleKeychain.build/Objects-normal/x86_64/SimpleKeychain.private.swiftinterface:22:15: note: 'SimpleKeychain' declared here
public struct SimpleKeychain {
              ^
/Users/zaiddaghestani/Library/Developer/Xcode/DerivedData/InAppChat-aoeogmlunlplijccjrdaeoewqjmo/Build/Intermediates.noindex/ArchiveIntermediates/InAppChat/IntermediateBuildFilesPath/SimpleKeychain.build/Release-iphonesimulator/SimpleKeychain.build/Objects-normal/x86_64/SimpleKeychain.private.swiftinterface:67:87: error: 'SimpleKeychainError' is not a member type of struct 'SimpleKeychain.SimpleKeychain'
  public static func == (lhs: SimpleKeychain.SimpleKeychainError, rhs: SimpleKeychain.SimpleKeychainError) -> Swift.Bool
                                                                       ~~~~~~~~~~~~~~ ^
/Users/zaiddaghestani/Library/Developer/Xcode/DerivedData/InAppChat-aoeogmlunlplijccjrdaeoewqjmo/Build/Intermediates.noindex/ArchiveIntermediates/InAppChat/IntermediateBuildFilesPath/SimpleKeychain.build/Release-iphonesimulator/SimpleKeychain.build/Objects-normal/x86_64/SimpleKeychain.private.swiftinterface:22:15: note: 'SimpleKeychain' declared here
public struct SimpleKeychain {
              ^
/Users/zaiddaghestani/Library/Developer/Xcode/DerivedData/InAppChat-aoeogmlunlplijccjrdaeoewqjmo/Build/Intermediates.noindex/ArchiveIntermediates/InAppChat/IntermediateBuildFilesPath/SimpleKeychain.build/Release-iphonesimulator/SimpleKeychain.build/Objects-normal/x86_64/SimpleKeychain.private.swiftinterface:23:134: error: 'Accessibility' is not a member type of struct 'SimpleKeychain.SimpleKeychain'
  public init(service: Swift.String = Bundle.main.bundleIdentifier!, accessGroup: Swift.String? = nil, accessibility: SimpleKeychain.Accessibility = .afterFirstUnlock, accessControlFlags: Security.SecAccessControlCreateFlags? = nil, context: LocalAuthentication.LAContext? = nil, synchronizable: Swift.Bool = false, attributes: [Swift.String : Any] = [:])
                                                                                                                      ~~~~~~~~~~~~~~ ^
/Users/zaiddaghestani/Library/Developer/Xcode/DerivedData/InAppChat-aoeogmlunlplijccjrdaeoewqjmo/Build/Intermediates.noindex/ArchiveIntermediates/InAppChat/IntermediateBuildFilesPath/SimpleKeychain.build/Release-iphonesimulator/SimpleKeychain.build/Objects-normal/x86_64/SimpleKeychain.private.swiftinterface:22:15: note: 'SimpleKeychain' declared here
public struct SimpleKeychain {
              ^
/Users/zaiddaghestani/Library/Developer/Xcode/DerivedData/InAppChat-aoeogmlunlplijccjrdaeoewqjmo/Build/Intermediates.noindex/ArchiveIntermediates/InAppChat/IntermediateBuildFilesPath/SimpleKeychain.build/Release-iphonesimulator/SimpleKeychain.build/Objects-normal/x86_64/SimpleKeychain.private.swiftinterface:54:61: error: 'SimpleKeychainError' is not a member type of struct 'SimpleKeychain.SimpleKeychain'
  public static let operationNotImplemented: SimpleKeychain.SimpleKeychainError
                                             ~~~~~~~~~~~~~~ ^
/Users/zaiddaghestani/Library/Developer/Xcode/DerivedData/InAppChat-aoeogmlunlplijccjrdaeoewqjmo/Build/Intermediates.noindex/ArchiveIntermediates/InAppChat/IntermediateBuildFilesPath/SimpleKeychain.build/Release-iphonesimulator/SimpleKeychain.build/Objects-normal/x86_64/SimpleKeychain.private.swiftinterface:22:15: note: 'SimpleKeychain' declared here
public struct SimpleKeychain {
              ^
/Users/zaiddaghestani/Library/Developer/Xcode/DerivedData/InAppChat-aoeogmlunlplijccjrdaeoewqjmo/Build/Intermediates.noindex/ArchiveIntermediates/InAppChat/IntermediateBuildFilesPath/SimpleKeychain.build/Release-iphonesimulator/SimpleKeychain.build/Objects-normal/x86_64/SimpleKeychain.private.swiftinterface:55:55: error: 'SimpleKeychainError' is not a member type of struct 'SimpleKeychain.SimpleKeychain'
  public static let invalidParameters: SimpleKeychain.SimpleKeychainError
                                       ~~~~~~~~~~~~~~ ^
/Users/zaiddaghestani/Library/Developer/Xcode/DerivedData/InAppChat-aoeogmlunlplijccjrdaeoewqjmo/Build/Intermediates.noindex/ArchiveIntermediates/InAppChat/IntermediateBuildFilesPath/SimpleKeychain.build/Release-iphonesimulator/SimpleKeychain.build/Objects-normal/x86_64/SimpleKeychain.private.swiftinterface:22:15: note: 'SimpleKeychain' declared here
public struct SimpleKeychain {
              ^
/Users/zaiddaghestani/Library/Developer/Xcode/DerivedData/InAppChat-aoeogmlunlplijccjrdaeoewqjmo/Build/Intermediates.noindex/ArchiveIntermediates/InAppChat/IntermediateBuildFilesPath/SimpleKeychain.build/Release-iphonesimulator/SimpleKeychain.build/Objects-normal/x86_64/SimpleKeychain.private.swiftinterface:56:50: error: 'SimpleKeychainError' is not a member type of struct 'SimpleKeychain.SimpleKeychain'
  public static let userCanceled: SimpleKeychain.SimpleKeychainError
                                  ~~~~~~~~~~~~~~ ^
/Users/zaiddaghestani/Library/Developer/Xcode/DerivedData/InAppChat-aoeogmlunlplijccjrdaeoewqjmo/Build/Intermediates.noindex/ArchiveIntermediates/InAppChat/IntermediateBuildFilesPath/SimpleKeychain.build/Release-iphonesimulator/SimpleKeychain.build/Objects-normal/x86_64/SimpleKeychain.private.swiftinterface:22:15: note: 'SimpleKeychain' declared here
public struct SimpleKeychain {
              ^
/Users/zaiddaghestani/Library/Developer/Xcode/DerivedData/InAppChat-aoeogmlunlplijccjrdaeoewqjmo/Build/Intermediates.noindex/ArchiveIntermediates/InAppChat/IntermediateBuildFilesPath/SimpleKeychain.build/Release-iphonesimulator/SimpleKeychain.build/Objects-normal/x86_64/SimpleKeychain.private.swiftinterface:57:54: error: 'SimpleKeychainError' is not a member type of struct 'SimpleKeychain.SimpleKeychain'
  public static let itemNotAvailable: SimpleKeychain.SimpleKeychainError
                                      ~~~~~~~~~~~~~~ ^
/Users/zaiddaghestani/Library/Developer/Xcode/DerivedData/InAppChat-aoeogmlunlplijccjrdaeoewqjmo/Build/Intermediates.noindex/ArchiveIntermediates/InAppChat/IntermediateBuildFilesPath/SimpleKeychain.build/Release-iphonesimulator/SimpleKeychain.build/Objects-normal/x86_64/SimpleKeychain.private.swiftinterface:22:15: note: 'SimpleKeychain' declared here
public struct SimpleKeychain {
              ^
/Users/zaiddaghestani/Library/Developer/Xcode/DerivedData/InAppChat-aoeogmlunlplijccjrdaeoewqjmo/Build/Intermediates.noindex/ArchiveIntermediates/InAppChat/IntermediateBuildFilesPath/SimpleKeychain.build/Release-iphonesimulator/SimpleKeychain.build/Objects-normal/x86_64/SimpleKeychain.private.swiftinterface:58:48: error: 'SimpleKeychainError' is not a member type of struct 'SimpleKeychain.SimpleKeychain'
  public static let authFailed: SimpleKeychain.SimpleKeychainError
                                ~~~~~~~~~~~~~~ ^
/Users/zaiddaghestani/Library/Developer/Xcode/DerivedData/InAppChat-aoeogmlunlplijccjrdaeoewqjmo/Build/Intermediates.noindex/ArchiveIntermediates/InAppChat/IntermediateBuildFilesPath/SimpleKeychain.build/Release-iphonesimulator/SimpleKeychain.build/Objects-normal/x86_64/SimpleKeychain.private.swiftinterface:22:15: note: 'SimpleKeychain' declared here
public struct SimpleKeychain {
              ^
/Users/zaiddaghestani/Library/Developer/Xcode/DerivedData/InAppChat-aoeogmlunlplijccjrdaeoewqjmo/Build/Intermediates.noindex/ArchiveIntermediates/InAppChat/IntermediateBuildFilesPath/SimpleKeychain.build/Release-iphonesimulator/SimpleKeychain.build/Objects-normal/x86_64/SimpleKeychain.private.swiftinterface:59:51: error: 'SimpleKeychainError' is not a member type of struct 'SimpleKeychain.SimpleKeychain'
  public static let duplicateItem: SimpleKeychain.SimpleKeychainError
                                   ~~~~~~~~~~~~~~ ^
/Users/zaiddaghestani/Library/Developer/Xcode/DerivedData/InAppChat-aoeogmlunlplijccjrdaeoewqjmo/Build/Intermediates.noindex/ArchiveIntermediates/InAppChat/IntermediateBuildFilesPath/SimpleKeychain.build/Release-iphonesimulator/SimpleKeychain.build/Objects-normal/x86_64/SimpleKeychain.private.swiftinterface:22:15: note: 'SimpleKeychain' declared here
public struct SimpleKeychain {
              ^
/Users/zaiddaghestani/Library/Developer/Xcode/DerivedData/InAppChat-aoeogmlunlplijccjrdaeoewqjmo/Build/Intermediates.noindex/ArchiveIntermediates/InAppChat/IntermediateBuildFilesPath/SimpleKeychain.build/Release-iphonesimulator/SimpleKeychain.build/Objects-normal/x86_64/SimpleKeychain.private.swiftinterface:60:50: error: 'SimpleKeychainError' is not a member type of struct 'SimpleKeychain.SimpleKeychain'
  public static let itemNotFound: SimpleKeychain.SimpleKeychainError
                                  ~~~~~~~~~~~~~~ ^
/Users/zaiddaghestani/Library/Developer/Xcode/DerivedData/InAppChat-aoeogmlunlplijccjrdaeoewqjmo/Build/Intermediates.noindex/ArchiveIntermediates/InAppChat/IntermediateBuildFilesPath/SimpleKeychain.build/Release-iphonesimulator/SimpleKeychain.build/Objects-normal/x86_64/SimpleKeychain.private.swiftinterface:22:15: note: 'SimpleKeychain' declared here
public struct SimpleKeychain {
              ^
/Users/zaiddaghestani/Library/Developer/Xcode/DerivedData/InAppChat-aoeogmlunlplijccjrdaeoewqjmo/Build/Intermediates.noindex/ArchiveIntermediates/InAppChat/IntermediateBuildFilesPath/SimpleKeychain.build/Release-iphonesimulator/SimpleKeychain.build/Objects-normal/x86_64/SimpleKeychain.private.swiftinterface:61:59: error: 'SimpleKeychainError' is not a member type of struct 'SimpleKeychain.SimpleKeychain'
  public static let interactionNotAllowed: SimpleKeychain.SimpleKeychainError
                                           ~~~~~~~~~~~~~~ ^
/Users/zaiddaghestani/Library/Developer/Xcode/DerivedData/InAppChat-aoeogmlunlplijccjrdaeoewqjmo/Build/Intermediates.noindex/ArchiveIntermediates/InAppChat/IntermediateBuildFilesPath/SimpleKeychain.build/Release-iphonesimulator/SimpleKeychain.build/Objects-normal/x86_64/SimpleKeychain.private.swiftinterface:22:15: note: 'SimpleKeychain' declared here
public struct SimpleKeychain {
              ^
/Users/zaiddaghestani/Library/Developer/Xcode/DerivedData/InAppChat-aoeogmlunlplijccjrdaeoewqjmo/Build/Intermediates.noindex/ArchiveIntermediates/InAppChat/IntermediateBuildFilesPath/SimpleKeychain.build/Release-iphonesimulator/SimpleKeychain.build/Objects-normal/x86_64/SimpleKeychain.private.swiftinterface:62:50: error: 'SimpleKeychainError' is not a member type of struct 'SimpleKeychain.SimpleKeychain'
  public static let decodeFailed: SimpleKeychain.SimpleKeychainError
                                  ~~~~~~~~~~~~~~ ^
/Users/zaiddaghestani/Library/Developer/Xcode/DerivedData/InAppChat-aoeogmlunlplijccjrdaeoewqjmo/Build/Intermediates.noindex/ArchiveIntermediates/InAppChat/IntermediateBuildFilesPath/SimpleKeychain.build/Release-iphonesimulator/SimpleKeychain.build/Objects-normal/x86_64/SimpleKeychain.private.swiftinterface:22:15: note: 'SimpleKeychain' declared here
public struct SimpleKeychain {
              ^
/Users/zaiddaghestani/Library/Developer/Xcode/DerivedData/InAppChat-aoeogmlunlplijccjrdaeoewqjmo/Build/Intermediates.noindex/ArchiveIntermediates/InAppChat/IntermediateBuildFilesPath/SimpleKeychain.build/Release-iphonesimulator/SimpleKeychain.build/Objects-normal/x86_64/SimpleKeychain.private.swiftinterface:63:43: error: 'SimpleKeychainError' is not a member type of struct 'SimpleKeychain.SimpleKeychain'
  public static let other: SimpleKeychain.SimpleKeychainError
                           ~~~~~~~~~~~~~~ ^
/Users/zaiddaghestani/Library/Developer/Xcode/DerivedData/InAppChat-aoeogmlunlplijccjrdaeoewqjmo/Build/Intermediates.noindex/ArchiveIntermediates/InAppChat/IntermediateBuildFilesPath/SimpleKeychain.build/Release-iphonesimulator/SimpleKeychain.build/Objects-normal/x86_64/SimpleKeychain.private.swiftinterface:22:15: note: 'SimpleKeychain' declared here
public struct SimpleKeychain {
              ^
/Users/zaiddaghestani/Library/Developer/Xcode/DerivedData/InAppChat-aoeogmlunlplijccjrdaeoewqjmo/Build/Intermediates.noindex/ArchiveIntermediates/InAppChat/IntermediateBuildFilesPath/SimpleKeychain.build/Release-iphonesimulator/SimpleKeychain.build/Objects-normal/x86_64/SimpleKeychain.private.swiftinterface:64:45: error: 'SimpleKeychainError' is not a member type of struct 'SimpleKeychain.SimpleKeychain'
  public static let unknown: SimpleKeychain.SimpleKeychainError
                             ~~~~~~~~~~~~~~ ^
/Users/zaiddaghestani/Library/Developer/Xcode/DerivedData/InAppChat-aoeogmlunlplijccjrdaeoewqjmo/Build/Intermediates.noindex/ArchiveIntermediates/InAppChat/IntermediateBuildFilesPath/SimpleKeychain.build/Release-iphonesimulator/SimpleKeychain.build/Objects-normal/x86_64/SimpleKeychain.private.swiftinterface:22:15: note: 'SimpleKeychain' declared here
public struct SimpleKeychain {
              ^
/Users/zaiddaghestani/Library/Developer/Xcode/DerivedData/InAppChat-aoeogmlunlplijccjrdaeoewqjmo/Build/Intermediates.noindex/ArchiveIntermediates/InAppChat/IntermediateBuildFilesPath/SimpleKeychain.build/Release-iphonesimulator/SimpleKeychain.build/Objects-normal/x86_64/SimpleKeychain.private.swiftinterface:1:1: error: failed to verify module interface of 'SimpleKeychain' due to the errors above; the textual interface may be broken by project issues or a compiler bug
// swift-interface-format-version: 1.0
^

Reproduction

  1. Create an iOS Framework
  2. Depend on auth0 via SwiftPM
  3. Compile
xcodebuild archive \
-scheme InAppChat \
-destination "generic/platform=iOS" \
-archivePath ../build/InAppChat-iOS \
SKIP_INSTALL=NO \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES

SimpleKeychain version

1.0.1

Platform

iOS

Platform version(s)

15+

Xcode version

14.3

Package manager

SPM

EXC_BAD_ACCESS (SIGSEGV)

Describe the problem

When calling .dataForKey I am getting a random EXC_BAD_ACCESS (SIGSEGV) intermittently. Here is some information from the crash report

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x0000eb03c466b430 -> 0x00000003c466b430 (possible pointer authentication failure)
VM Region Info: 0x3c466b430 is not in any region.  Bytes after previous region: 4905677873  Bytes before following region: 51465767888
      REGION TYPE                 START - END      [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL
      MALLOC_NANO              280000000-2a0000000 [512.0M] rw-/rwx SM=COW  
--->  GAP OF 0xd20000000 BYTES
      commpage (reserved)      fc0000000-1000000000 [  1.0G] ---/--- SM=NUL  ...(unallocated)

Termination Signal: Segmentation fault: 11
Termination Reason: Namespace SIGNAL, Code 0xb
Terminating Process: exc handler [18346]
Triggered by Thread:  0

Thread 0 name:
Thread 0 Crashed:
0   libobjc.A.dylib               	0x00000001b4fa21e0 objc_msgSend + 32
1   LocalAuthentication           	0x00000001cddb7a04 -[LAContext externalizedContext] + 280 (LAContext.m:1055)
2   Security                      	0x00000001a79afd50 LACopyACMContext + 104
3   Security                      	0x00000001a7a48da4 SecItemAttributesPrepare + 416 (SecItem.c:1215)
4   Security                      	0x00000001a7a48aa8 SecItemAuthDoQuery + 416 (SecItem.c:1458)
5   Security                      	0x00000001a7a4aa58 __SecItemCopyMatching_block_invoke + 140 (SecItem.c:1792)
6   Security                      	0x00000001a7a46544 SecOSStatusWith + 56 (SecItem.c:327)
7   Security                      	0x00000001a7a49c2c SecItemCopyMatching + 384 (SecItem.c:1791)
8   SimpleKeychain                	0x0000000101e31ea8 -[A0SimpleKeychain dataForKey:promptMessage:error:] + 88 (A0SimpleKeychain.m:98)

image

Reproduction

The crash seems to occur when:

  • accessing the keychain concurrently from two threads
  • High frequency of calls

Environment

Please provide the following:

  • SimpleKeychain Version 0.12.3
  • iOS Version 14.7.1
  • Xcode 12.5.1

Thank you. Please let me know if I can provide any further information?

Does not work in iOS13.4 simulator

Description

When using the iOS13.4 simulator, SimpleKeychain reports that it saved successfully. When I try to retrieve the saved object, I get empty data.

Reproduction

  • Add this to a fresh Xcode project , e.g. in the AppDelegate.
let keychain = A0SimpleKeychain()
keychain.setString("foo", forKey: "f")
let string = keychain.string(forKey: "f")!
assert(string == "foo")
  • Run on iOS 12.4 sim, no assert.
  • Run on iOS 13.4 sim, assertion failed.

Environment

  • Version of this library used: 0.11.0
  • Version of the platform or framework used, if applicable: iOS 13.4 simulator

App transfer, keychain loss

Hi,

I have transferred my app to another account.
I was using SimpleKeychain without setting service name and access group.

Nevertheless, i cannot reach my keychain data which is saved before transferring my app.
How can i solve this problem?

Nullability Static Analysis warnings in Xcode 8 (8A218a)

All of the methods in the A0SimpleKeychain header are enclosed in NS_ASSUME_NONNULL_BEGIN/NS_ASSUME_NONNULL_END but several of the data/string setter methods allow for nil handling in the implementation.

This generates static analysis warnings in Xcode 8.

screen shot 2016-09-20 at 4 11 43 pm

Problem setting custom prompt message when app asks for Touch ID/Passcode

Hi,

I'm having trouble trying to set a custom prompt message when accessing Keychain.

I followed the documentation and set a new NSString with my custom message:

NSString *message = NSLocalizedString(@"msg.keychain.prompt", nil);
NSString *savedValue = [keychain stringForKey:@"value" promptMessage:message];

The problem is: The message doesn't show up. I tried to debug to see if I can find the problem and when the code reaches the method - (NSDictionary *)queryFetchOneByKey:(NSString *)key message:(NSString *)message { everything is nil, including message. Therefore the message isn't displayed.

screen shot 2017-05-24 at 10 29 16 am

screen shot 2017-05-24 at 10 29 31 am

I'm running pod version 0.7.0.

Any help is appreciated. Thanks!

Swift package manager support

In order to efficiently and accurately address your issue or feature request, please read through the template below and answer all relevant questions. Your additional work here is greatly appreciated and will help us respond as quickly as possible. Please delete any sections or questions below that do not pertain to this request.

For general support or usage questions, please use the Auth0 Community or Auth0 Support.

Description

Description of the bug or feature request and why it's a problem. Consider including:

  • The use case or overall problem you're trying to solve
  • Information about when the problem started

Prerequisites

[ x ] I have read the Auth0 general contribution guidelines.

[ x ] I have read the Auth0 Code of Conduct.

[ x ] I have checked the Auth0 Community for related posts.

[ x ] I have checked for related or duplicate Issues and PRs.

Environment

Please provide the following:

  • Version of SimpleKeychain used: 0.9.0
  • Version of OS used: iOS 13
  • Additional dependencies that might be relevant:
  • If using Carthage or CocoaPods, please include your Cartfile or Podfile
  • Xcode version: 11

Reproduction

  • this is not a bug, just a feature request

Feature request

Support for Swift package manager would be great, since Xcode now treats Swift Packages as a first class citizen.

Always getting "Error trying to access to non available kSecUseOperationPrompt in iOS7" log

I'm trying to use this on ios 7 and 8, so if I'm not using user access control and kSecUseOperationPrompt either, but I'm always getting this error log in the query.
Shouldnt it be like this? :

  • (NSDictionary *)queryFetchOneByKey:(NSString *)key message:(NSString *)message {
    NSMutableDictionary *query = [self baseQuery];
    [query addEntriesFromDictionary:@{
    (__bridge id)kSecReturnData: @yES,
    (__bridge id)kSecMatchLimit: (__bridge id)kSecMatchLimitOne,
    (__bridge id)kSecAttrAccount: key,
    }];

    if TARGET_OS_IPHONE

    if (message) {
    if (self.useAccessControl && floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_7_1) {
    query[(__bridge id)kSecUseOperationPrompt] = message;
    } else {
    NSLog(@"Error trying to access to non available kSecUseOperationPrompt in iOS7");
    }
    }

    endif

    return query;
    }

Next SimpleKeychain major release

Hello! 👋

Today we published the SimpleKeychain 1.0.0 First Availability release.

The GA release is planned for the third week of July.

Highlights

  • Improved error handling.
  • Support for custom attributes.
  • Support for sharing items with other devices through iCloud synchronization.

Documentation

Feedback

We’d love for you to give the FA release a try, and welcome your feedback on any recommendations or issues you encounter. Should you have any feedback or questions, please raise an issue.

EXC_BAD_ACCESS in dataForKey - release 0.11.0

Description

When calling .dataForKey, I intermittently crash my app on the following EXC_BAD_ACCESS. I am always passing the same Key into the method to retrieve the user's "token" from KeyChain. I expect to always receive my token, or nil.

Reproduction

I seem to see this crash after one of two things:

  1. High frequency requests from the UI to retrieve the user's token, OR
  2. A certain number of requests to retrieve the user's token has been reached

The reason I raise item 2 is that the issue only happens after a while in my app's lifecycle, (i.e. after it has been used to do a certain number of things).

Screen Shot 2020-03-14 at 15 17 12

Environment

  • SimpleKeyChain version 0.11.0
  • Xcode version 11.3.1 (11C504)
  • iOS version 13.3.1

Thank you. Please let me know if I can provide any further information?

Default accessiblity should be kSecAttrAccessibleWhenUnlockedThisDeviceOnly

Right now accessibility is kSecAttrAccessibleAfterFirstUnlock which basically means always available even when device locked is and has not been rebooted recently....

A more sensible default should be kSecAttrAccessibleWhenUnlockedThisDeviceOnly otherwise it's easy for a programmer to leave the default assume it's protected well.

No Swift interface for new additions

Description

I'm not able to access to some the new features added with #74 on Swift code.

Reproduction

I'm trying to deal with biometric authentication by my own, so I want to pass my own LAContext to the A0SimpleKeychain instance but there is no way, the interface isn't accessible in Swift.

Environment

In my Podifle:

    pod 'Auth0', '~> 1.21'
    pod 'SimpleKeychain', '~> 0.10'

My project supports iOS 11.4 in advance.

Under swift, do I need to import the security framework manually to use the keychain?

Hello there,
I'm using the KeychainWrapper in my project and everything works fine but now I wonder about the need for the security framework which I didn't import manually. Is this something I still need to do in swift? I can Cmd+click those kSec keys in the wrapper and it sends me to the security framework - does this mean it's "built in" into swift now or something like that?

If I do need that framework why does it work right now "without" it? Are my strings saved but not encrypted or something like that?

Btw: I asked that on SO as well but the answers weren't completely satisfying thats why I ask here now.

Thanks a lot in advance

tvOS 12: Sharing values with Access Group doesn't work

Hi, I am trying to share access token to topShelf extension on tvOS, but I always get a nil values.
Sharing is not supported on tvOS or Am I doing anything wrong?
App:
let keychain = A0SimpleKeychain(service: Auth0Key.SERVICE.rawValue, accessGroup: Auth0Key.GROUP.rawValue)

keychain.setString("pokus", forKey: "pokus")`

topShelf:
let keychain = A0SimpleKeychain(service: Auth0Key.SERVICE.rawValue, accessGroup: Auth0Key.GROUP.rawValue)

let value = keychain.string(forKey: "pokus")

Local Authentication is not reused

Please do not report security vulnerabilities here. The Responsible Disclosure Program details the procedure for disclosing security issues.

Thank you in advance for helping us to improve this library! Please read through the template below and answer all relevant questions. Your additional work here is greatly appreciated and will help us respond as quickly as possible. For general support or usage questions, use the Auth0 Community or Auth0 Support. Finally, to avoid duplicates, please search existing Issues before submitting one here.

By submitting an Issue to this repository, you agree to the terms within the Auth0 Code of Conduct.

Description

When keychain's accesibility is configured as afterFirstUnlockThisDeviceOnly and useAccessControl is true, the device prompts the unlock password, once per access to keychain (either it's for setting or getting a key's value).

As specified at https://developer.apple.com/documentation/localauthentication/accessing_keychain_items_with_face_id_or_touch_id the keychain default's behavior is to create a new LocalAuthentication every time it's used. A LocalAuthentication context must be created and reuse in order to avoid this behavior (which leads to poor UX)

Reproduction

keychain = A0SimpleKeychain()
keychain.useAccessControl = true
keychain.defaultAccessiblity = .afterFirstUnlockThisDeviceOnly

keychain.setString("TEST 1", forKey: "KEY 1", promptMessage: "Write KEY 1")
keychain.setString("TEST 2", forKey: "KEY 2", promptMessage: "Write KEY 2")
keychain.setString("TEST 3", forKey: "KEY 3", promptMessage: "Write KEY 3")

let v1 = keychain.string(forKey: "KEY 1", promptMessage: "Read KEY 1")
let v2 = keychain.string(forKey: "KEY 2", promptMessage: "Read KEY 2")
let v3 = keychain.string(forKey: "KEY 3", promptMessage: "Read KEY 3")

Detail the steps taken to reproduce this error, what was expected, and whether this issue can be reproduced consistently or if it is intermittent.

Where applicable, please include:

  • Code sample to reproduce the issue
  • Log files (redact/remove sensitive information)
  • Application settings (redact/remove sensitive information)
  • Screenshots

Environment

Please provide the following:

  • Version of this library used: 0.9.0
  • Version of the platform or framework used, if applicable: iOS 13.1
  • Other relevant versions (language, server software, OS, browser): Swift 5
  • Other modules/plugins/libraries that might be involved:

Error in CircleCI pipeline: Duplicate symbol due to code coverage

Describe the problem

No problem with actual library.

Issue occurs when running through circleCI pipeline. Received a duplicate symbol error when compiling all the different libraries in the Xcode project on circleCI with another swift package dependency (SQLite.swift). Has anyone else seen experienced something like this?

What was the expected behavior?

  • Compiling of code coverage should run smoothly

Screenshot of circleCI pipeline error that occurs

Screen Shot 2022-04-12 at 8 02 26 AM

Environment

Please provide the following:

  • Version of SimpleKeychain used: 0.12.5
  • **Version of SQLite.swift used: 0.13.2
  • Version of iOS/macOS/tvOS/watchOS: iOS deployment 14.0
  • Version of Xcode: 13.3

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.