I was moving my development environment to a new machine recently.
Most of the process should have been straightforward. My projects were in GitHub, so I could clone the repositories, install their dependencies, and get back to work.
Except the repositories weren't everything.
Over the years, I'd accumulated environment files containing API keys, database credentials, certificates, and other configuration values I'd deliberately kept out of version control.
Some credentials had expired. Others had been replaced months ago. A few were probably no longer necessary. Several projects depended on the same credentials, sometimes intentionally and sometimes because I'd taken the convenient route and never revisited it.
I didn't want to transfer a collection of sensitive files between machines. I also didn't want to visit every provider's dashboard, reconstruct each environment, or figure out which copies of a credential were still current.
I started wondering why I needed to do any of this.
When I move to another Mac, my passwords generally come with me. I don't export them into a text file, carry that file to the new machine, and manually recreate every login. Apple Passwords and 1Password already provide a much better interaction.
Why couldn't environment variables and certificates work the same way?
I wanted to pull down a repository, open the project, and have access to the credentials it already depended on.
That question became the starting point for Latchkey.
At first, I thought I was solving a portability problem. I wanted my projects to work when I moved between computers.
But the more I worked on it, the less the problem seemed to be about moving credentials. I was starting to question why so many applications needed their own copies in the first place, and then what a copy actually lets its holder do.
The part Git doesn't carry
Git is remarkably good at moving the parts of a project we've decided belong in source control.
A repository can preserve years of changes, branches, dependencies, configuration, and documentation. A new machine can reconstruct a great deal of the development environment from those files.
But many of the credentials needed to operate that software are deliberately absent.
We put .env.local in .gitignore. We keep private keys outside the repository. We configure deployment tokens in provider dashboards and CI systems. Some applications depend on certificates installed elsewhere on the machine.
These are sensible precautions. Committing a production credential to a repository is generally a terrible way to distribute it.
But the precautions leave us with a peculiar problem.
We can reconstruct the software, but not necessarily the authority it needs to operate.
Those values live somewhere else, often in several places, without a reliable record of how they relate to the project. When we move machines, we discover just how much of the development environment existed outside the repository.
I'd made myself responsible for remembering where all those values came from.
A reference is not a secret
A password manager separates the identity of a credential from the act of remembering its value.
I know which website I want to access. The manager knows which credentials belong to that website. I rarely need to handle the credential directly.
I wanted something similar for development: credentials with identities of their own, so a project could say what it needed and another system could manage the corresponding values.
This wasn't a new idea in security engineering.
Secret managers, workload identities, short-lived credentials, and scoped authorization have existed for years. HashiCorp Vault, cloud identity systems, and provider-specific secret stores already address substantial parts of the problem. The distinction between an identity, a credential, and the authority to act is well established. RFC 8693, OAuth 2.0 Token Exchange, for instance, describes delegation and impersonation as different ways of acting on behalf of another party. Neither is the same thing as simply finding a token in a file.
What interested me was applying those ideas to the everyday experience of developing software on my Mac.
Apple already provides a protected credential store with encrypted synchronization between authorized devices. I didn't need to invent another cloud service for synchronizing secrets. I could build on Keychain.
Latchkey uses its own keychain access group, separate from the credentials managed by the Apple Passwords application. It stores synchronizable items through the data-protection keychain, using the same underlying iCloud Keychain infrastructure. Apple's Keychain Services documentation describes the synchronizable-item attribute and its constraints.
The value isn't the only thing stored there. A record also carries the credential's identity, type, service, and the project and environment it belongs to, and those records synchronize between Macs that use the same Apple Account, provided iCloud Keychain is enabled and working. Receiving the secret value on another machine isn't enough. The application also needs to know what the value represents.
My first thought wasn't to eliminate .env files. Applications already understand them, and they're easy to inspect. I wanted to change what they contained.
Consider an environment file:
DATABASE_URL=postgres://user:password@db.example.com/app
STRIPE_SECRET_KEY=sk_live_example
OPENAI_API_KEY=example-tokenThese are illustrative values, but the structure is familiar. The file associates names with values. It doesn't establish who owns those credentials, where they came from, what permissions they have, or when they expire.
Latchkey can import the selected credentials into the vault and replace their values with references:
DATABASE_URL=latchkey://shop/production/DATABASE_URL
STRIPE_SECRET_KEY=latchkey://shop/production/STRIPE_SECRET_KEY
OPENAI_API_KEY=latchkey://OPENAI_API_KEYA command runs through Latchkey, which resolves the references and supplies the values to the process after checking the applicable access rules:
latchkey run --env-file .env.local -- npm run devThe application still receives the configuration it expects. I no longer have to maintain copies of the underlying secrets.
The same records work in the other direction. Each environment keeps a record of its variables: references to stored credentials, and plain settings such as PORT=3000 that aren't secrets at all. Because those records synchronize with the credentials, a fresh checkout on another Mac can get its .env.local back from the record rather than from the old machine, and a process can be started from the record without writing a file. Writing the actual values into a file is still possible for tools that need it, but Latchkey treats it as a deliberate disclosure: it asks every time, won't write into a tracked file in a Git checkout, and won't let an agent do it.
What it reconstructs is the configuration using the credentials as they are now. A stored credential may have been rotated since the project last ran. That is usually what I want: the project working with its current credentials, not every expired token that happened to exist when I last opened it.
Knowing a reference also doesn't grant access to the credential. The reference identifies a stored item. Authorization happens when something attempts to retrieve or use it. That's useful for an agent examining a project's configuration: it can see which services and credential identities the project expects without seeing their values.
It's also the first of the distinctions this essay keeps returning to. A reference tells software which credential it needs. It doesn't establish whether the program asking should be allowed to use it.
Sometimes we share credentials
There's another aspect of development that security advice doesn't always account for particularly well.
We reuse credentials.
Sometimes several applications genuinely depend on the same provider account. Sometimes a prototype borrows a token from an existing project. Sometimes the arrangement was intended to last an afternoon and survives for two years.
I do it. I'm sure plenty of other developers do, too.
When credentials are stored as literal values, sharing usually means copying. A key ends up in three environment files, a deployment dashboard, and perhaps a CI workflow. Eventually, you need to rotate it, but you don't remember everywhere it went.
References provide a different representation. Three projects can depend on the same managed credential without maintaining three separate copies of its value, and the environments that reference it are recorded.
Those records aren't a complete dependency registry. The value might also exist in an older configuration file, another secret manager, or a remote deployment platform. A running service might still be using a copy it received months earlier. Known references aren't the same as all actual consumers.
But they're a useful starting point, and because reuse is explicit, we can identify arrangements that ought to be separated. A development project using a production credential is no longer merely a suspicious line in a forgotten file. It's a relationship that can be identified and examined.
That doesn't make sharing safe by itself. If multiple applications receive the same bearer token, they still share whatever authority the token carries. A shared reference reduces duplication without reducing the authority its consumers share. But it makes the sharing easier to understand, rotate, and eventually replace with narrower credentials.
Credentials have lives of their own
Once I stopped thinking about credentials as strings in files, another set of questions appeared.
What is a credential beyond its value?
It has a provider. It may belong to a particular account, project, or organization. It may carry permissions broader than the application using it actually needs. It may expire, be revoked, or require periodic rotation. It may be used by development, preview, staging, and production environments. And it probably has dependencies.
API_KEY=...The name alone doesn't tell me when the key was issued, whether it's still valid, which project created it, or whether an agent used it yesterday.
A managed credential can carry more. Latchkey associates stored items with properties such as kind, service, project and environment identity, and access rules. It keeps version history and records operations performed through its broker.
Lifecycle information can extend that model with expiration dates, provider-side validity checks, permission discovery, exposure indicators, and dependency tracking. These concerns are not peculiar to Latchkey: the OWASP Secrets Management Cheat Sheet covers creation, rotation, revocation, auditing, and the difficulties introduced by shared secrets.
But the evidence matters.
An expiration date supplied by a provider is different from one I entered manually. An unsuccessful authentication attempt doesn't necessarily prove a token has been revoked. A credential that hasn't been accessed locally for six months might still be essential to a deployed application.
Likewise, an access log can tell me that Latchkey released a credential to a process. It cannot necessarily tell me every API request that process subsequently made.
A useful credential-management system should distinguish what it knows, what it has inferred, and what it cannot observe.
I've been examining that separation more generally in Foundations of Computational Interaction. An event record, an observation of its effects, and enough evidence to support a particular claim are not interchangeable. A credential manager meets the same difficulty when it tries to explain what happened after releasing a value to another process, and it matters most during rotation: the system can help identify a shared credential's managed references, but it shouldn't claim they represent every copy in existence.
The agent kept handing the problem back to me
While developing Latchkey, I kept running into another situation.
I'd ask a coding agent to implement a feature that depended on an external service.
The agent could examine the codebase, install dependencies, write an integration, add tests, and update the configuration.
Then it needed an API key.
At that point, the work frequently came back to me. I'd need to visit the provider dashboard, retrieve or create a credential, copy it, and give the agent some way to use it. Sometimes I already had the value stored elsewhere. That didn't help much if I still had to retrieve it manually and run a command to put it into the environment.
I'd automated much of the development work while leaving myself responsible for carrying credentials between systems.
I didn't want to become a full-time intermediary between my agents and the services they were authorized to use.
An agent should be able to identify the credentials an application needs, check whether an appropriate one exists, and request access. It should be able to read and update environment files, because that's part of configuring software, while working with references instead of the values they identify. And it should be able to rebuild a project's environment from the stored records, which matters when it's working in a fresh checkout or a Git worktree where the ignored .env.local doesn't exist.
If it needs a new credential, it should eventually be able to start a provider-supported provisioning process, assuming I've authorized that. That part isn't built.
Some providers will still require an interactive login, multifactor authentication, or human confirmation. Those requirements shouldn't be bypassed simply because an agent is performing the work.
But I didn't see a reason every request should require me to manually copy a value I already owned.
And once an agent can get to a credential without me, a harder question takes over.
Having a key isn't the same as having permission
Suppose I ask an agent to deploy revision 73 of project A to staging.
The deployment token available to the agent might also permit changing production, modifying configuration, or accessing unrelated projects.
The token defines what the provider will accept. My request defines what I intended to authorize. Those are not necessarily the same boundaries.
A bearer credential conveys its authority to anyone holding it. If I give that credential to an agent, I'm giving it the technical ability to perform operations beyond its assigned task. I can tell the agent to behave responsibly and stay out of production. Those instructions may help, but they aren't a security boundary. An agent can misunderstand an instruction, encounter malicious content, or invoke a tool incorrectly without intending to do anything harmful.
So perhaps the agent shouldn't receive the underlying credential at all. Instead, it could ask a trusted component to perform the operation.
There's a familiar difference between giving someone a key to a building and having them ask the person at the front desk to open a room. But the person at the front desk still needs to know which room they're authorized to open.
Suppose the credential manager receives the request, checks the applicable policy, and gets approval to continue, while the underlying token can still modify several projects and environments. Even if the agent never sees that token, something still has to ensure that the operation performed is the operation authorized.
Could the agent substitute another revision after approval? Could the target environment change? Could an approval be replayed for another operation? Could the component holding the credential execute a broader request than I approved?
Keeping the secret away from the agent doesn't answer those questions. An authorization decision has to stay attached to the operation through execution, and the component using the credential has to enforce whatever restrictions the destination service doesn't enforce itself. Afterwards, the result still needs its own verification: a deployment command that exited successfully is evidence about the command, not proof that the right revision reached the right place.
There are limits. A deployment provider might not support permissions as narrow as one revision of one project. A tool might require a raw token. In those cases, the system has to distinguish between the restrictions it can enforce and the restrictions it merely requests.
I think about credential use in three arrangements.
Credential retrieval gives an authorized process the value. Storage and retrieval can be controlled, but the process then possesses whatever authority the credential carries.
Mediated credential use keeps the value with an intermediary that performs operations on the caller's behalf. The caller doesn't receive the secret, but the intermediary must reliably enforce the operations it is authorized to perform.
Constrained delegation gives the caller narrower authority, either through a provider-issued credential or an execution mechanism that can enforce restrictions on particular resources or operations.
These aren't mutually exclusive architectures, and none is safe by default. A short-lived credential can still be dangerously privileged. A proxy can conceal a token while permitting broad API access. An approval dialog can be correctly implemented and still authorize something broader than the user intended.
Latchkey offers different arrangements for different situations. For ordinary processes, it resolves references and supplies values when a command starts. For OpenAI and Anthropic API use, it has a proxy mode: the process receives a placeholder and a local address, and the proxy forwards its requests to the provider with the real key inserted. Only the command Latchkey started, and the processes it starts, can use the proxy; another program that learns the placeholder is refused. The proxy can also be limited to named models and to a number of requests. For AWS, Latchkey can request temporary credentials through STS, either a session token or an assumed role, that expire after fifteen minutes unless asked to last longer.
Those are real reductions in exposure. They are not a general permission system. The proxy hides the key and narrows which models and how many requests, but it doesn't judge individual API operations or what they cost. Temporary AWS credentials still carry whatever the role allows.
Concealing a credential is not the same as constraining its use. A system that asks permission before revealing a secret is not the same as one that can perform an authorized action without revealing it. And a system that performs the action without revealing the secret must still ensure that it performs the right action.
That's the boundary where Latchkey stops. In ACP Gateway, another project I've been developing, policy decisions about whether an agent's requested operation may proceed live in a separate service. Latchkey concerns custody and access to credentials; ACP Gateway decides whether an operation is permitted. Neither substitutes for enforcement at the point of execution. The credential holder has to honor the policy decision, and the execution path has to enforce the approved scope. Otherwise, the authorization system becomes another interface that can be bypassed.
Centralizing credentials also moves the trust boundary rather than removing it. A compromised project may no longer have every stored secret, but the broker becomes a target, because it can exercise authority across many projects and services. It has to authenticate callers, protect stored values, limit its operations, manage approvals, and keep evidence of what occurred. Even then, it cannot guarantee that a process behaves safely after receiving a raw credential.
The underlying question is how much authority the requesting software actually needs, and which part of the system can enforce that limit.
The moment the secret escapes
There's another moment I've come to find interesting: the moment a credential is issued.
Many provider dashboards show an API key once. You generate it, copy it, and move it somewhere for safekeeping. Some command-line tools do the same thing, printing a token and leaving the operator to decide what to do with it.
That moment is often where the first unnecessary copy is created.
Latchkey includes a Safari extension that recognizes the key formats of about twenty providers on the page where the key was made and offers to save it directly into the vault. It also provides an explicit save action and controlled filling of stored values into supported fields.
It isn't a universal detector. The extension depends on page permissions, recognition patterns, and what Safari exposes, and a browser extension becomes part of the security boundary because it can see sensitive information on the page.
The same principle applies to command-line credential issuance, with a catch: a command that has already printed a credential has already exposed it to wherever its output went. Wrapping it afterward doesn't undo that.
Provider-specific issuance could do better. An authorized operation could create a credential, store it directly in Latchkey, and associate it with the right project and environment, and an agent could take part by receiving an identifier for the new credential rather than its value, where the provider's interface allows. That requires distinct permissions for creating credentials, using them, changing their scopes, and revoking them.
The interaction might still require my approval. It shouldn't always require my hands.
Certificates and private keys raise the same question in another form. A certificate generally binds a public key to an identity, and the private key is the material that needs protection. Depending on the protocol and storage, software can sometimes authenticate or sign without ever receiving an exportable copy of the key: an application may need a cryptographic operation, not a key file it can read and keep. Where a tool genuinely requires the file, the system can only reduce exposure through controlled delivery, temporary permissions, and cleanup.
Hardware-backed, non-exportable keys add another constraint: the private material may be bound to one device and cannot simply synchronize to another Mac. So even the original portability goal has limits. Sometimes the right way to move between devices is synchronization. Other times it's establishing a new device identity without transferring the original private key. Those are different operations, and the system should represent them differently.
Back to the new machine
A repository describes the software I want to reproduce. It doesn't necessarily describe the authority that software requires to operate.
Those authorities are dependencies, too. An application depends on a database credential, an external service, or a signing identity just as surely as it depends on a library or a runtime. But we've generally managed those relationships through scattered configuration values and provider dashboards.
Following that problem through led me to a short sequence I didn't expect when I started:
- A reference isn't a secret.
- A secret isn't permission.
- Permission isn't enforcement.
- And an operation that ran isn't proof it did what was intended.
Separating the identity of a credential from its value makes those dependencies easier to represent. A project can declare that it needs a particular credential without storing its value. Latchkey can resolve those references, rebuild the environment from its records, and decide whether to release the values or make them available through a supported intermediary. What happens afterward depends on the access mechanism and the authority the receiving process can exercise.
That gives agents a natural path, too. If a project can describe the credentials and authorities it requires, an agent can inspect those requirements, identify what's missing, rebuild its configuration, and request access without asking me to become a manual courier between systems.
Some requests will still require a person. Some credentials will still need to be delivered directly to processes. Some services won't support narrow delegation, and some identities shouldn't be portable at all. The implementation has to respect those constraints.
But when I moved to a new machine, I discovered that I could reproduce much of my software from its repositories while still having to personally reconstruct the credentials that made it useful.
I'd accepted that as part of development for years.
The goal was never to make copying secrets easier.
It was to ask why I was copying them at all.
Latchkey is a Mac application for managing development credentials through protected storage, portable references, and controlled access for tools and agents. Explore Latchkey.