Closed allibell closed 2 years ago
as discussed, retitled BaseKeyPair
->KeyPair
and KeyPair
->PatchedKeyPair
. This makes it clearer what the wrapper struct is for. it also has the nice effects of 1) making this PR smaller and 2) reducing breaking changes for people relying on KeyPair
object internals. tests still happy.
From #8: implement support per the IETF JSON patch DID extension. This enables us to modify/patch DID documents using JWS payloads.
Notes
PatchedKeyPair
struct which wrapsKeyPair
. this is intuitive, self-explanatory, and minimizes breaking changes a bit.PatchedKeyPair
. we are not performing a DID update operation and the responsibility to manage state (check for DID diffs, maintain patches) falls squarely to the callers.get_did_document
requests still fail silently; a bad request will return the original document without warning. this is to maintain the existing contract of not throwing errors. on the other hand,resolve
requests with bad patches throw an error instead of returning the key. this seems to make sense sinceresolve
is more "internal", i.e. the caller intends to managePatchedKeyPair
state so they should be informed whether that struct has the patches they expectVerificationMethod
s/KeyFormat
s. we'd previously getError("missing field 'key_type'", line: 0, column: 0)
orError("invalid value: map, expected map with a single key", line: 0, column: 0)
due to custom serializingdid_url
andbls12_381_plus
seem to be similar maturity, albeit more necessary). I am open to reimplementing that boilerplate if the tradeoff of minimal dependencies is more important here.Tests new chunky unit tests. snipped output from
test_json_patch_demo
:full output: https://pastebin.com/HNSDybQz
Follow-ups