Skip to content

Conversation

@Benehiko
Copy link

This patch adds the kSecAttrGeneric key so that credentials can store additional publicly available metadata on kSecClassGenericPassword credentials. The caller can add any generic metadata they'd like to store as long as it does not exceed the size of math.MaxUint32.

This allows for a wider variety of use cases where many secrets are fetched from the keychain without fetching the underlying secret. Additional filtering rules could apply on the fetch secrets based on the metadata.

More information about kSecAttrGeneric can be found here https://developer.apple.com/documentation/security/ksecattrgeneric

This patch adds the `kSecAttrGeneric` key so that credentials can store
additional publicly available metadata on kSecClassGenericPassword
credentials. The caller can add any generic metadata they'd like to
store as long as it does not exceed the size of math.MaxUint32.

This allows for a wider variety of use cases where many secrets are fetched
from the keychain without fetching the underlying secret. Additional
filtering rules could apply on the fetch secrets based on the metadata.

More information about `kSecAttrGeneric` can be found here https://developer.apple.com/documentation/security/ksecattrgeneric

Signed-off-by: Alano Terblanche <18033717+Benehiko@users.noreply.github.com>
Comment on lines +225 to +226
enc := gob.NewEncoder(&b)
if err := enc.Encode(val); err != nil {
Copy link
Author

Choose a reason for hiding this comment

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

maybe there's a more efficient way of doing this?

@Benehiko
Copy link
Author

Benehiko commented Jul 16, 2025

I'll add some tests soon. done

Signed-off-by: Alano Terblanche <18033717+Benehiko@users.noreply.github.com>
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.

1 participant