it's pretty straightforward to get/put keys in Keychain.app
https://github.com/git/git/blob/35f6318d44379452d8d33e880d8df0267b4a0cd0/contrib/credential/osxkeychain/git-credential-osxkeychain.c
You can also spawn /usr/bin/security but spawning a process on require would be weird.
If we wrote a native addon to wrap those syscalls, we could use Keychain on Mac (if the prebuild is available) and otherwise still use the current strategy.
Any downsides to this?