-
Notifications
You must be signed in to change notification settings - Fork 6
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
feat!: update session API #227
Conversation
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.
LGTM! Great work
packages/principal/src/account.js
Outdated
* @template {UCAN.DID} ID | ||
* @implements {UCAN.Signer<ID, Signature.NON_STANDARD>} | ||
*/ | ||
class Account { |
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.
nit: if possible I'd avoid using Account
at all here (it's too easy to misinterpret) and call this something like NonStandardSigner
. just a thought
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.
Renamed it to Absentee
which I think reflect the better than either misleading Account
or NonStandardSigner
which isn't specific enough. I'll assume it's ok, if not we can rename in the followup change.
Co-authored-by: Benjamin Goering <[email protected]>
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.
LGTM 👍
Fixes #226
Overview
Changes in this PR update our session logic which previously just assigned a
did:key
to adid:mailto
principal in the validation context.Instead now we have
ucan/attest
capability that can be used to attest to the fact that specific delegation (that has nondid:key
issuer) has been authorized by the user. In other words when we perform interactive authorization flow like withaccess/authorize
we can delegateucan/attest
to the agent been authorized that proofs that we performed an out-of-bound authorization flow in which user has authorized delegation we're attesting to.Now instead of assigning a key we setauthorization
CID, that corresponds to the UCAN Delegation withoutproofs
andsignature
. With this changes when validator encounters delegation issued by principal other than did:key e.g did:mailto it will attempt to find corresponding./update
capability proof that setspermit
to a CID derived from delegation. If such (valid) delegation is found, validator will not check signature and continue with UCAN verification process. If (session) delegation is found, validator falls back to doing key resolution instead.All in all this gives us a way to authorize agent with a specific set of capabilities as opposed to giving it a sudo capabilities as it used to be the case previously.P.S: I had to update Link schema so that validator could look for./update
with a very specific CID in it as opposed to finding a mismatching one, which could be problem if there were multiple./update
proofs, because validator stops as soon as it finds success path.Link to the updated spec