exectx: easy access to the root delegation

This commit is contained in:
Michael Muré
2025-02-26 19:07:10 +01:00
parent 1c4a0a9c81
commit 2d031fdbdb

View File

@@ -92,6 +92,13 @@ func (ctn *UcanCtx) GetDelegation(cid cid.Cid) (*delegation.Token, error) {
return nil, delegation.ErrDelegationNotFound
}
// GetRootDelegation returns the delegation.Token at the root of the proof chain.
func (ctn *UcanCtx) GetRootDelegation() *delegation.Token {
proofs := ctn.inv.Proof()
c := proofs[len(proofs)-1]
return ctn.dlgs[c]
}
// Policies return the full set of policy statements to satisfy.
func (ctn *UcanCtx) Policies() policy.Policy {
return ctn.policies