feat(state): core of reading/writing identities in state #428
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds code and tests for the state core of identities (spec OP043).
There's a new
map[string]*Identity
in state, which is marshalled viamarshalledIdentity
to disk. The marshalling for API requests is done by theapiIdentity
type -- these are separate to ensure that the API (default)MarshalJSON
forIdentity
does not include secrets (in future when we have identity types that include secrets; there's only user-id for now). So that's why there's a few more types and a bit more boilerplate than is necessary right now.The new public
State
methods are:AddIdentities
: add new identities to the systemUpdateIdentities
: update existing identities in the systemReplaceIdentities
: replace the given identities in the system; this allows adding new ones, updating existing ones, and removing identities (nil/null means remove)RemoveIdentities
: remove existing identities in the systemIdentities
: list all identitiesEach of the
FooIdentities
modification functions validates that the identities are valid, and that the user-ids are unique, before applying to state.