Skip to content

Conversation

iykazrji
Copy link
Contributor

@iykazrji iykazrji commented Mar 15, 2025

Pull Request Checklist


PR-Codex overview

This PR introduces functionality for securely handling ephemeral private keys using the Keychain in the KeychainHelper.swift file. It updates the NativeTEKStamperImpl.swift to utilize these new Keychain methods for storing and retrieving the private key.

Detailed summary

  • Added KeychainHelper.swift to manage ephemeral private keys.
  • Implemented savePrivateKeyToKeychain, getPrivateKeyFromKeychain, and deletePrivateKeyFromKeychain methods.
  • Updated NativeTEKStamperImpl to retrieve the private key from Keychain and save it if not present.
  • Removed direct initialization of ephemeralPrivateKey in create method, replaced with Keychain call.
  • Enhanced clear method to delete the private key from Keychain.

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

Copy link

vercel bot commented Mar 15, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
aa-sdk-site ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 21, 2025 6:00pm
aa-sdk-ui-demo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 21, 2025 6:00pm

Copy link
Contributor Author


How to use the Graphite Merge Queue

Add the label graphite-merge-queue to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@rthomare
Copy link
Contributor

@iykazrji do you think we could break this PR up? Ideally one that updates the example and another that fixes the bug?

@iykazrji iykazrji force-pushed the iyk/investigate-ios-sessions branch from d83eb59 to b3b0d9f Compare March 17, 2025 20:49
@iykazrji
Copy link
Contributor Author

Sure! @rthomare , Updated this PR, would be working on updating the examples regardless, so that would come in a separate PR

Copy link
Contributor

@rthomare rthomare left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally looks good just a couple of comments to simplify.

Copy link
Contributor

@rthomare rthomare left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for making all these iterations, great work! We are so close just a couple of thoughts.

let account_kit_ephemeral_private_key = "ephemeralPrivateKey"

// Keep save_ephemeral_private_key_query mutable
var save_ephemeral_private_key_query: [String: Any] = [
Copy link
Contributor

@rthomare rthomare Mar 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh didn't realize we need to update this one. Can we either make a static function for this one, or just make this let inlined in the function.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using var here since we need to modify the query to pass in the kSecValueData in the savePrivateKeyToKeychain() function.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah still think we should isolate the generation of it, but we should probably do a generator function or something: #1457 (comment)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, just made an update to make a local copy of it in the savePrivateKeyToKeychain() function which can then be updated with the kSecValueData . Please help take a look if this is a better implementation.

@iykazrji iykazrji merged commit c2fc412 into main Mar 21, 2025
8 checks passed
@iykazrji iykazrji deleted the iyk/investigate-ios-sessions branch March 21, 2025 20:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants