Repository navigation
feat(grant): rotate and revoke principal-bound key delegations #65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
pyropy
merged 9 commits into
srdjan/feat/iam-service-credentials
from
srdjan/feat/iam-invalidation-publisher
Oct 14, 2026
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
f773335
feat(grant): rotate and revoke principal-bound key delegations
pyropy d98c63e
fix(grant): keep a rotation from re-granting a key deleted under its …
pyropy b4addbb
fix(store): bound the memory delegation writers' lock wait
pyropy 92bdf4f
fix(api): read the tenant key only when a deleted access key has dele…
pyropy 063445e
fix(grant): bound each rotation and revocation at BatchTimeout
pyropy f71c076
fix(store): refuse a replacement filed under another audience and joi…
pyropy e388d8e
test(api): a key deletion that fails after the row delete leaves the …
pyropy 65fe54b
fix(grant): bound every revocation publish made under a delegation lock
pyropy 44fb918
refactor(api): follow the access key principalId pointer
pyropy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| package testutil | ||
|
|
||
| import ( | ||
| "context" | ||
| "sync" | ||
|
|
||
| "github.com/fil-forge/ucantone/did" | ||
| "github.com/fil-forge/ucantone/ucan" | ||
| "github.com/ipfs/go-cid" | ||
| ) | ||
|
|
||
| // Revocation is one delegation a [FakeSwarf] was asked to revoke. | ||
| type Revocation struct { | ||
| Revoker did.DID | ||
| Revoked cid.Cid | ||
| Delegation ucan.Delegation | ||
| } | ||
|
|
||
| // FakeSwarf stands in for the revocation service. It records every | ||
| // PublishBatch call, fails each one with Err while it is set, and runs | ||
| // OnPublish after each successful call. | ||
| type FakeSwarf struct { | ||
| Err error | ||
| OnPublish func() | ||
|
|
||
| mu sync.Mutex | ||
| batches [][]Revocation | ||
| } | ||
|
|
||
| func (f *FakeSwarf) PublishBatch(_ context.Context, revoker ucan.Issuer, revoked []ucan.Delegation) error { | ||
| if f.Err != nil { | ||
| return f.Err | ||
| } | ||
| b := make([]Revocation, 0, len(revoked)) | ||
| for _, d := range revoked { | ||
| b = append(b, Revocation{Revoker: revoker.DID(), Revoked: d.Link(), Delegation: d}) | ||
| } | ||
| f.mu.Lock() | ||
| f.batches = append(f.batches, b) | ||
| f.mu.Unlock() | ||
| if f.OnPublish != nil { | ||
| f.OnPublish() | ||
| } | ||
| return nil | ||
| } | ||
|
|
||
| // Reset forgets every recorded call. | ||
| func (f *FakeSwarf) Reset() { | ||
| f.mu.Lock() | ||
| defer f.mu.Unlock() | ||
| f.batches = nil | ||
| } | ||
|
|
||
| // Calls is the number of PublishBatch calls that succeeded. | ||
| func (f *FakeSwarf) Calls() int { return len(f.Batches()) } | ||
|
|
||
| // Batches returns the revocations of each successful call, in call order. | ||
| func (f *FakeSwarf) Batches() [][]Revocation { | ||
| f.mu.Lock() | ||
| defer f.mu.Unlock() | ||
| return append([][]Revocation(nil), f.batches...) | ||
| } | ||
|
|
||
| // Revocations returns every revocation across all calls. | ||
| func (f *FakeSwarf) Revocations() []Revocation { | ||
| var out []Revocation | ||
| for _, b := range f.Batches() { | ||
| out = append(out, b...) | ||
| } | ||
| return out | ||
| } | ||
|
|
||
| // Revoked returns the CID of every revoked delegation across all calls. | ||
| func (f *FakeSwarf) Revoked() []cid.Cid { | ||
| var out []cid.Cid | ||
| for _, r := range f.Revocations() { | ||
| out = append(out, r.Revoked) | ||
| } | ||
| return out | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Known and tracked: the pin is temporary while swarf#22 is open, and the re-pin to the merged revision follows its merge. The merge order is libforge #80, swarf #22, then this stack. Nothing to change in this PR until then.