4 ms·
You don't need Swift to use the Keychain API. It's doable from pure C.
by cyberax 10mo ago
You don't need Swift to use the Keychain API. It's doable from pure C.
- johncolanduoni 10mo agoIn fact, SecurityFramework doesn’t have a real Swift/Obj-C API. The relevant functions are all direct bindings to C ABIs (just with wrappers around the CoreFoundation types).
- lloeki 10mo ago> The third one is just the open-source tailscaled binary that you have to compile yourself, and it doesn't talk to the Keychain. I use this one (via nix-darwin) because it has the nice property of starting as a systemwide daemon outside of any user context, which in turn means that it has no (user) keychain to access (there are some conundrums between accessing such keychains and "GUI" i.e user login being needed, irrespective of C vs Swift or whatever). Maybe it _could_ store things in the system keychain? But I'm not entirely sure what the gain would be when the intent is to have tailscale access through fully unattended reboots.
- cronos 10mo agoGood to know, my understanding of the macOS system APIs is fairly limited. I'm sure it's doable, with some elbow grease and CGO. We just haven't prioritized that variant of the client due to relatively low usage.
- cyberax 10mo agoIf you want to avoid Cgo, you can use https://github.com/ebitengine/purego https://github.com/ebitengine/purego or Goffi to call the native functions. It's a bit cursed, but works.