kishikawakatsumi / KeychainAccess

Simple Swift wrapper for Keychain that works on iOS, watchOS, tvOS and macOS.
MIT License
7.98k stars 788 forks source link

Designed for iPad (iOS on MacOS) macOS 13.0 #549

Open mariohahn opened 2 years ago

mariohahn commented 2 years ago

if I try to store my credentials I get:

OSStatus error:[-34018] Internal error when a required entitlement isn't present, client has neither application-identifier nor keychain-access-groups entitlements.

Do you have any idea on how to solve that

mariohahn commented 2 years ago

it worked perfectly below macOS 13.0.

i also did codesign -d --entitlements :- AppName.app

`<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "https://www.apple.com/DTDs/PropertyList-1.0.dtd">

application-identifier xxxxxx com.apple.developer.team-identifier xxxxx com.apple.security.application-groups xxxxx get-task-allow keychain-access-groups xxxx `
avjiang commented 2 years ago

yeah i am facing this issue as well

below macOS 13.0 it is working well

avjiang commented 2 years ago

@mariohahn do you have any fix regarding this issue?

kishikawakatsumi commented 2 years ago

Can you try to set access group in your entitlements and retest it?

The access group should be like the following: $(AppIdentifierPrefix)com.sample.KeychainAccessVentura

Screen Shot 2022-11-01 at 2 54 31

Also the code should be changed like the following:

let keychain = Keychain( service: "com.sample.KeychainAccessVentura”, accessGroup: “675ZX48YRQ.com.sample.KeychainAccessVentura" ) keychain["ventura"] = “venturaTestKeychain"

$(AppIdentifierPrefix) is your TEAM_ID and dot.

kishikawakatsumi commented 2 years ago

Can you try to set access group in your entitlements and retest it?

The access group should be like the following: $(AppIdentifierPrefix)com.sample.KeychainAccessVentura

Screen Shot 2022-11-01 at 2 54 31

Also the code should be changed like the following:

let keychain = Keychain( service: "com.sample.KeychainAccessVentura”, accessGroup: “675ZX48YRQ.com.sample.KeychainAccessVentura" ) keychain["ventura"] = “venturaTestKeychain"

$(AppIdentifierPrefix) is your TEAM_ID and dot.

piercifani commented 2 years ago

I can confirm that @kishikawakatsumi workaround works.

However, how would we use App Groups to share keychain items with this? I used to use the accessGroup to specify the AppGroup ID...