Skip to content

Commit 19d190c

Browse files
authored
docs: add more details about explicit version management (#156)
As a follow-up to #151, add a bit more prose to the docs about the existence of explicitly-managed version numbers, and some recommendations about when to use them.
1 parent 0931df5 commit 19d190c

File tree

2 files changed

+45
-11
lines changed

2 files changed

+45
-11
lines changed

docs/README.md

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Setec is a lightweight secrets management service that uses Tailscale for access
2121
- [Operations and Maintenance](#operations-and-maintenance)
2222
- [Secret Rotation](#secret-rotation)
2323
- [Automatic Updates](#automatic-updates)
24+
- [Explicit Version Management](#explicit-version-management)
2425
- [Bootstrapping and Availability](#bootstrapping-and-availability)
2526
- [Testing](#testing)
2627

@@ -93,14 +94,24 @@ secret.
9394
version**. The active version is reported by default from the `get` method if
9495
the caller does not specify a specific version.
9596

96-
- When a secret is first created, its initial value (version 1) becomes its
97-
current active version.
97+
- When a secret is first created, its initial value becomes its current active
98+
version.
99+
100+
The `put` API method assigns sequential versions starting from the largest
101+
previously used (initially 1, for a new secret).
102+
The `create-version` API method uses the version number specified by the caller.
103+
104+
- Thereafter, the active version changes in the following ways:
105+
106+
The `activate` method updates the current active version to a specific
107+
existing value.
108+
109+
A successful `create-version` method call automatically activates the new
110+
version of the secret that it created.
111+
112+
Note that `put` does _not_ automatically update the active version, except
113+
when creating the initial value of a new secret.
98114

99-
- Thereafter, the `activate` method must be used to update the current active
100-
version. This ensures the operator of the service has precise control over
101-
which version of a secret should be used at a time.
102-
- The special `create-version` method automatically activates the set
103-
version and does not require a call to `activate`.
104115

105116
### Deleting Values
106117

@@ -422,6 +433,26 @@ effects a poll of all known secrets synchronously. It is safe for the client to
422433
do this concurrently with a background poll; the store will coalesce the
423434
operations.
424435

436+
### Explicit Version Management
437+
438+
For some use cases, the caller may wish to explicitly control the version
439+
numbers of a secret. For example, a caller may wish to associate multiple
440+
secret values with one or more timestamps or other identifying values.
441+
442+
To support this, the [API](api.md) supports a `create-version` method, allowing
443+
the caller to explicitly choose the version number assigned to a secret value.
444+
The `create-version` method automatically activates a newly-created version,
445+
but such values are otherwise normal, and can be fetched and deleted in the
446+
usual way. Note, however, that a particular version number cannot be reused
447+
once created, even if it is later deleted.
448+
449+
Although it is safe to mix `put`, `activate` and `create-version` calls on the
450+
same secret, for clarity of use we recommend using _either_ `create-version`
451+
alone, _or_ `put` and `activate` together, but not both. Regardless which
452+
version management style you use, secret values can be [updated
453+
automatically](#automatic-updates) in the usual way.
454+
455+
425456
### Bootstrapping and Availability
426457

427458
A reasonable concern when fetching secrets from a network service is what

docs/api.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# setec API
22

33
> WARNING: This API is still under active development, and subject to change.
4-
> This document is up-to-date as of 11-May-2024.
4+
> This document is up-to-date as of 15-Jan-2026.
55
66
The setec service exports an API over HTTPS. All methods of the API are called
77
via HTTPS POST, with request and response payloads transmitted as JSON.
@@ -33,8 +33,8 @@ The service defines named _actions_ that are subject to access control:
3333

3434
- `put`: Denotes permission to put a new value of a secret.
3535

36-
- `create-version`: Denotes permission to create a specific version of a secret, but not
37-
override an existing version.
36+
- `create-version`: Denotes permission to create a specific version of a
37+
secret, but not overwrite an existing version.
3838

3939
- `activate`: Denotes permission to set one one of of the available versions of
4040
a secret as the active one.
@@ -130,7 +130,10 @@ The service defines named _actions_ that are subject to access control:
130130
secret, the server reports the existing active version without modifying the
131131
store.
132132

133-
- `/api/create-version`: Creates a specific version of a secret, sets its value and immediately activates that version. It fails if this version of the secret already has a value. The specified version must be > 0.
133+
- `/api/create-version`: Creates a new version of a secret, sets its value and
134+
immediately activates that version. It fails if the specified version number
135+
has already been used for this secret (even if deleted). The specified
136+
version number must be > 0.
134137

135138
**Requires:** `create-version` permission for the specified name.
136139

0 commit comments

Comments
 (0)