Expand description
Filesystem CertStorage.
Layout under dir: account.json, certs/<cert_id>/{chain.pem,key.pem,meta.json},
challenges/<domain> ({key_auth, expires_at}), leases/<cert_id>
({owner, expires_at}). Every write is temp-file + rename; secret files are
0600 on unix. Expired challenge/lease files read as absent.
StructsΒ§
- Challenge
File π - FsCert
Storage - Lease
File π - Meta
File π - Takeover
Guard π - RAII holder of the exclusive
<lease>.takeovermarker; removes it on drop.
ConstantsΒ§
- TAKEOVER_
MARKER_ πSTALE_ SECS - How long a
<lease>.takeovermarker may exist before it is assumed to belong to a process that died mid-takeover. The marker is held for a couple of filesystem operations, so anything older than this is debris.
StaticsΒ§
- LEASE_
TMP_ πCOUNTER - Per-process, monotonically increasing disambiguator folded into lease temp file names, so two calls in the same process racing in the same nanosecond still canβt collide on the temp path.
FunctionsΒ§
- atomic_
write π - Writes
bytestopathatomically (temp file beside it, then rename).secretfiles get0600on unix before the rename. - create_
marker π - Exclusive create; the content is only ever read by a human debugging.
- expires_
at π - io_err π
- lease_
tmp_ πpath - A temp path beside
lease_paththat is unique to this call: no two concurrent callers (same process or different) land on the same name, so each writes its own temp file undisturbed before attempting to publish it. - read_
opt π - remove_
opt π