-
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: archive/extract api for delegations #287
Conversation
const variant = await CBOR.write({ | ||
[`ucan@${delegation.version}`]: delegation.root.cid, | ||
}) | ||
store.set(`${variant.cid}`, variant) |
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.
Seems like in CAR.encode
the root blocks are included (i.e. I think you might get the root block twice in the encoded CAR).
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.
No you won't and I plan on changing CAR codec so that roots are no longer blocks but rather CIDs. Current approach of roots been blocks are kind of falling apart if you get a car from someone that has a root that isn't inside the car
} | ||
|
||
export const ArchiveSchema = Schema.variant({ | ||
'ucan@0.9.1': /** @type {Schema.Schema<API.UCANLink>} */ ( |
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.
Should this version number be a constant somewhere?
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.
It is the UCAN.VERSION
, however at some point we'll probably upgrade it to next version, yet version here should remain the same. I'm not sure there is a value in defining a new constant somewhere if this is the only thing referring to it though.
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
For the workshop I have end up implementing these methods so we could archive ucan chains into bytes and extract them back. This pr adds them to the into the ucanto