Code Monkey home page Code Monkey logo

keychainaccess's Issues

Using KeychainAccess for saving UUID and store after reinstall app

Hi,

I am looking solution for have same ID for device even when user delete app and then install it again. I found that others are using keychain for this. But I've read about some problems that sometimes Keychain returns nil and the second problem could be that ID from keychain would be shared across devices and I really don't want that. I guess that when I set synchronizable to false that there shoudn't be second issue. But what about first one? Is it possible that sometimes Keychain returns nil even if there are saved data? For example link here: soffes/SAMKeychain#75 Should I combine this with NSUserDefaults? When app is launched for first time get ID from keychain and save it to NSUserDefaults for other needs. Thanks for help

Merge swift 2.0 to master

I think it would good to cut an official release for swift 2.0 as it's now officially released.

Thanks!

OSX Dev ID

I am needing to store user/pass info in OS X keychain, but not with an AppStore App. I am able to use DeveloperID for this library ? I am not able to use keychain sharing as that is disallowed for non MAS apps.

Documentation is incorrect

Documentation mentions things such as:

try keychain.set("01234567-89ab-cdef-0123-456789abcdef", key: "kishikawakatsumi")

Two issues here:
There is no such function. There is however a function called set forKey.

Secondly, this method does not actually throw any errors, so writing the above will result in a Swift warning.

So I am not sure how to even handle errors.

Documentation needs updating.

2 warnings for iOS 9, XCode7.1.1

Keychain.swift:556:12: Unnecessary check for 'iOS'; minimum deployment target ensures guard will always be true

Keychain.swift:1100:48: 'kSecUseNoAuthenticationUI' was deprecated in iOS 9.0: Use a kSecAuthenticationUI instead.

Check if item exists in keychain without Touch ID auth

Is this possible? Is it possible to see if a value exists at a given key in a keychain secured with Touch ID without prompting the user for their finger print?

If not, is there a way to check if the keychain, as a whole, exists without prompting for authentication?

I was torn as to whether I should ask this on here or on StackOverflow. I hope you don't mind me asking here? πŸ˜‡ πŸ˜…. I figured since I'm using your framework and couldn't find anything about my question in the README, I'd be coming back to you with any answer I got on SO to see how I do it via KeychainAccess.

Many thanks!

keychain value not saved after I kill the app

Everytime I killed the app, my keychain's value are empty/nil.
I'm storing the value like this :
var keychain = Keychain(service: "myapp.app.service")
keychain["login"] = login
keychain["auth_token"] = auth_token

Then in my appDelegate didFinishLaunchingWithOptions, I do this var

var keychain = Keychain(service: "myapp.app.service")
let login = keychain["login"]
let auth_token = keychain["auth_token"]

println(login)
println(keychain)

And after I kill the app and open it again, both my login and keychain are NIL. Anyone has any idea why my Keychains value are nil even though I never delete them? (I've tried both solution KeychainWrapper and KeychainAccess, both same behavior).

Keychain and OnlyThisDevice

Hi,

I'm new to Swift and I am trying to store the Keychains locally only and not across device. I tried setting .synchronizable(false), but I still get a "AfterFirstUnlock" which says that the Keychain migrates to new device. Also, keychain.accessibility(.AlwaysThisDeviceOnly) doesn't seem to work, still get "AfterFirstUnlock" when print(keychain.accessibility). Is there a way to set the Keychain to be only this device and not sync with icloud.

Sorry if this is a dumb question.
Thanks

values not stored?

Hi,

I have a wrapper class for KeychainAccess:

class KeychainHelper: NSObject {

    let keychain: Keychain

    class var sharedInstance: KeychainHelper {
        struct Singleton {
            static let instance = KeychainHelper()
        }
        return Singleton.instance
    }

    override init() {
        self.keychain = Keychain(service: "com.myDomain.myAppName")

        super.init()
    }

    var username:String? {

        get{
            return keychain["username"]
        }
        set{
            keychain["username"] = username
        }
    }
}

And wrote a test for it:

func testUserName() {

        if let existingUserName = KeychainHelper.sharedInstance.username{

            let testUserName = "[email protected]"

            KeychainHelper.sharedInstance.username = testUserName

            XCTAssertEqual(testUserName, KeychainHelper.sharedInstance.username)

             KeychainHelper.sharedInstance.username = existingUserName
             XCTAssertEqual(existingUserName, KeychainHelper.sharedInstance.username)
        }
        else{
            let testUserName = "[email protected]"

            KeychainHelper.sharedInstance.username = testUserName

            if let receivedUserName = KeychainHelper.sharedInstance.username{
                XCTAssertEqual(testUserName, receivedUserName)
            }
            else{
                XCTFail("username was not written to keychain!")
            }

            KeychainHelper.sharedInstance.username = nil
            if let receivedUserName = KeychainHelper.sharedInstance.username{
                XCTAssertEqual(receivedUserName, KeychainHelper.sharedInstance.username)
            }

        }
    }

The test fails, because no value can be fetched from Keychain. If I "po kechain" I get the result []. Any ideas?

Archiving issue

I ended up copying the project manually to get rid of the module issues. That all worked until I tried archiving the project and got the following error:

screen shot 2015-10-20 at 11 41 28 am

please advice

Use with Carthage

Hello,

I can't manage to use KeychainAccess with Carthage.

I get the following error:
*** Building scheme "KeychainAccess" in KeychainAccess.xcworkspace fatal error: SDK count 7 in scheme KeychainAccess is not supported: file /Users/mdiep/Repositories/Carthage/Carthage/Source/CarthageKit/Xcode.swift, line 959

Caught signal triggered by the Swift runtime! Illegal instruction: 4

I just add github "kishikawakatsumi/KeychainAccess" in my Cartfile

If I remove KeychainAccess from the Cartfile, everything runs fine with the command line carthage update --platform iOS --no-use-binaries

Thanks for your help!

git tag for swift-2.0 branch

Thank you for your great library.

I'd like you to tag like '2.0.0-beta.4'
Because I want to add dependency in *.podspec, but podspec doesn't allow symbols like :git, :branch.

can do this in Podfile.

pod 'KeychainAccess', :git => 'https://github.com/kishikawakatsumi/KeychainAccess.git', :branch => 'swift-2.0'

cannot do this in *.podspec

s.dependency 'KeychainAccess', :git => 'https://github.com/kishikawakatsumi/KeychainAccess.git', :branch => 'swift-2.0'

want

s.dependency 'KeychainAccess', '~> 2.0.0-beta.4'

Best πŸ˜„

Add CocoaPods support

CocoaPods recently added support for Swift. Could we add an KeyChain.podspec file to make this great lib available through CocoaPods?

Cannot compile by Xcode7 beta4.

It cannot be compiled with a error "Cannot invoke 'takeUnretainedValue' with no arguments".
takeUnretainedValue 's arguments changed at beta4?

Question: Which Xcode version was used to compile the release binaries

Hi

I was wondering, which Xcode version was used to compile the pre-built binaries from https://github.com/kishikawakatsumi/KeychainAccess/releases? (2.2.0 specifically).

I'm asking because a specific (and weird) issue I experienced using Carthage to embed KeychainAccess in my project. More details here: Carthage/Carthage#832

Could it be that they were created using an older version dan Xcode 7.0.1 (maybe one of the beta builds?)

Getting current warning on swift 2.0

/Users/allaire/Dropbox/Projects/agendrix/ios/Pods/KeychainAccess/Lib/KeychainAccess/Keychain.swift:289:19: Unnecessary check for 'iOS'; minimum deployment target ensures guard will always be true

var query = options.query()

query[kSecAttrAccount as String] = key
#if os(iOS)
if #available(iOS 9.0, *) {
    query[kSecUseAuthenticationUI as String] = kCFBooleanFalse
} else if #available(iOS 8.0, *) {
    query[kSecUseNoAuthenticationUI as String] = kCFBooleanTrue
}
#endif

merge Swift 2.0 branch

Swift 2.0 is now official / released with Xcode 7. This should be merged to Master and Swift 2.0 branch deleted. Additionally you might want to start a Swift 2.1 branch...

License not mentioned in Keychain.swift

Hey

This is a tedious t crossing issue, but I noticed that the MIT licence the project is licensed under isn't reflected in the source file and it appears that the source as a whole is all rights reserved.

Repeating OSX Keychain Access Prompts

Good morning,

I am wondering if there is a way to get OSX to stop prompting each time the keychain is accessed. I click "Always allow" and it still prompts every time I access a particular value stored in the keychain.

let keychain = Keychain(service: "com.mycompany.myapp");
// Causes prompt #1
let someValue = keychain[Constants.SomeKey];

// Causes prompt #2
let someValue2 = keychain[Constants.SomeKey2];

It was my understanding that by initializing the Keychain with a service, all key/value pairs in this context would be authorized as a group.

Cheers,

Adam

Keychain synchronizable and TouchID

I try to enable the keychain synchronization together with a Touch ID enabled login.
Unfortunately I receive the following error whenever I set .synchronizable(true):

OSStatus error:[-50] One or more parameters passed to a function were not valid.

error: Optional(Error Domain=com.kishikawakatsumi.KeychainAccess.error Code=-50 "One or more parameters passed to a function were not valid." UserInfo=0x7fb271d3e6b0 {NSLocalizedDescription=One or more parameters passed to a function were not valid.})

And thats the example code:

let keychain = Keychain(service: "my.service").synchronizable(true)
    keychain.remove("default.tenantid")

    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)) {
        let failable = keychain
            .authenticationPrompt("Please auth!")
            .getStringOrError("default.tenantid")

        if failable.succeeded {
            var tenantId: String? = failable.value

            if tenantId == nil{
                tenantId = NSUUID().UUIDString

                let error = keychain
                    .accessibility(.WhenPasscodeSetThisDeviceOnly, authenticationPolicy: .UserPresence)
                    .set(tenantId!, key: "default.tenantid")

                if error != nil {
                    println("error: \(error)")
                    // Error handling if needed...
                }
            }

            //logged in
            println(tenantId)

        } else {
            println("error: \(failable.error?.localizedDescription)")
            // Error handling if needed...
        }
    }

What's wrong?

`APPLICATION_EXTENSION_API_ONLY = YES`

APPLICATION_EXTENSION_API_ONLY = YES can prevent following warning when using KeychainAccess from App Extension project.

ld: warning: linking against dylib not safe for use in application extensions: …Carthage/Build/iOS/KeychainAccess.framework/KeychainAccess

Subclassing

Hi All,

Im not sure if im doing this correctly, but im trying to subclass KeychainAccess..

The problem is that I cannot override any constructor cause the only designated is private and I cant call convenience constructors from the subclass..
My final goal is to create a singleton with Keychain:

static let sharedInstance = KeychainManager()

where.. class KeychainManager : Keychain

Can anyone give me hand to understand?

Thanks

Target for iOS?

It would be nice to have a target inside the KeychainAccess project specifically for iOS.

As I can't use Cocoapods due to embedded frameworks are not supported I've included your KeychainAccess as git submodule into my iOS project and checked out the tag 2.3.5

Unfortunately I receive a an unexpected Mach- O header code after archiving when trying to upload to iTunes Connect.

This is due to the fact the KeychainAccess library is built for OS X by default (Base SDK is set to OS X).
Please add a second framework target, so this can be embedded in iOS projects without modifying your code / settings.

Returning just key-value pairs as dictionary.

When I'm returning all values, I noticed there are only two methods: allItems and allKeys.
Is there a way to return just key value pairs in one dictionary??

For example, [ "last_name" : "value1", "first_name" : "value2" ].

Thank you!

Error -34018 required entitlement

Hello,

I'm frequently getting this error:

Error Domain=com.kishikawakatsumi.KeychainAccess.error Code=-34018 "Internal error when a required entitlement isn't present, client has neither application-identifier nor keychain-access-groups entitlements."

I noticed it tends to happen when the application comes back from Background. Any idea where this could come from?

Swift 2.1 build and archive

Please could you make a new release with an archive attached build from Xcode 7.1 + Swift 2.1? The current release and archive don't work with Xcode 7.1 and Swift 2.1.

screen shot 2015-10-22 at 15 04 24

Thanks! πŸ˜„

KeychainAccess not compatible with iOS7 ?

In the docs it says this wrapper can be used in iOS7, however, when I try to install it in CocoaPods it says:

[!] The platform of the target XXX (iOS 7.0) is not compatible with KeychainAccess (1.1.1) which has a minimum requirement of iOS 8.0 - OS X 10.9.

Is it true that it is only available on iOS8 and above ?

Build error on carthage update for swift-2.0 branch

I'm getting the following error when I try to run carthage update pointed at your swift-2.0 branch:

*** Building scheme "KeychainAccess-iOS" in KeychainAccess.xcworkspace
A shell task failed with exit code 65:
** BUILD FAILED **


The following build commands failed:
CompileSwift normal x86_64 /Users/n/Documents/Digest/digest_app_ios/DigestApp/Carthage/Checkouts/KeychainAccess/Lib/KeychainAccess/Keychain.swift
CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler
(2 failures)

Segmentation fault: 11

Thoughts?

Unable to build with Carthage: Scheme KeychainAccess-tvOS is not currently configured for the build action

I won't pretend to know enough about build schemes etc for this, but on trying to update my builds, I get this error:

Scheme KeychainAccess-tvOS is not currently configured for the build action

I am guessing that this is to do with taking the schemes out of the project file. I can build with version == 2.3.1, but not with ~>2.2.0 (which resolves to 2.3.2) which I was using previously, and, interestingly enough, not with == 2.2.0 (which says it resolves to 2.2.0).

My Carthage build command is carthage update --no-use-binaries --no-skip-current --platform ios.

Is this perhaps because of not sharing build schemes or some such thing?

is this library compatible with ObjC

i was not able to import this library to an Objc project successfully.
i was reading through the minimum requirement for such compatibility and i noticed that the Swift classes do not carry @objc keyword with them so is this intentional or is it okay to contribute a patch for making the library Objc portable ?

Cocoapods unknown option character `X' in: -Xlinker

Im getting an error after I install via Cocoapods:

error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: unknown option character `X' in: -Xlinker

Libtool /Users/Mathias/Library/Developer/Xcode/DerivedData/Orb-gabuteysqfjkydacbhuayztonsub/Build/Products/Debug-iphonesimulator/libPods-Orb-KeychainAccess.a normal x86_64
cd /Users/Mathias/Desktop/Orb/Pods
export IPHONEOS_DEPLOYMENT_TARGET=8.1
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -static -arch_only x86_64 -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.1.sdk -L/Users/Mathias/Library/Developer/Xcode/DerivedData/Orb-gabuteysqfjkydacbhuayztonsub/Build/Products/Debug-iphonesimulator -filelist /Users/Mathias/Library/Developer/Xcode/DerivedData/Orb-gabuteysqfjkydacbhuayztonsub/Build/Intermediates/Pods.build/Debug-iphonesimulator/Pods-Orb-KeychainAccess.build/Objects-normal/x86_64/Pods-Orb-KeychainAccess.LinkFileList -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator -Xlinker -add_ast_path -Xlinker /Users/Mathias/Library/Developer/Xcode/DerivedData/Orb-gabuteysqfjkydacbhuayztonsub/Build/Intermediates/Pods.build/Debug-iphonesimulator/Pods-Orb-KeychainAccess.build/Objects-normal/x86_64/Pods_Orb_KeychainAccess.swiftmodule -framework Foundation -o /Users/Mathias/Library/Developer/Xcode/DerivedData/Orb-gabuteysqfjkydacbhuayztonsub/Build/Products/Debug-iphonesimulator/libPods-Orb-KeychainAccess.a

error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: unknown option character `X' in: -Xlinker
Usage: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -static [-] file [...] [-filelist listfile[,dirname]] [-arch_only arch] [-sacLT] [-no_warning_for_no_symbols]
Usage: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -dynamic [-] file [...] [-filelist listfile[,dirname]] [-arch_only arch] [-o output] [-install_name name] [-compatibility_version #] [-current_version #] [-seg1addr 0x#] [-segs_read_only_addr 0x#] [-segs_read_write_addr 0x#] [-seg_addr_table ] [-seg_addr_table_filename <file_system_path>] [-all_load] [-noall_load]

I have other pods in my podfile that works. Not sure what happened here

Cheers!

Keep getting errors while saving data to Keychain

 keychain["\(PartConfigurationViewController.formName)_all_fields"] = "\(self.dataSource.requiredFields.count)"

        keychain["\(PartConfigurationViewController.formName)_invalid_fields"] = String(self.dataSource.invalidFields.count)

Whenever I run these methods, I get two errors saying same thing:

error:[-67594] failed to convert data to string

Can you guess why this is causing a problem?? self.dataSource.invalidFields.count is just Int type, btw.

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.