Skip to content
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: display proofs in delegation ls and proof ls #74

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,21 @@ export async function listDelegations (opts) {
console.log(` with: ${capability.with}`)
console.log(` can: ${capability.can}`)
}
if (delegation.proofs.length) {
console.log(' proofs:')
for (const proof of delegation.proofs) {
if (ucanto.isDelegation(proof)) {
console.log(` issuer: ${proof.issuer.did()}`)
console.log(` audience: ${proof.audience.did()}`)
for (const capability of proof.capabilities) {
console.log(` with: ${capability.with}`)
console.log(` can: ${capability.can}`)
}
} else {
console.log(` link: ${proof}`)
}
}
}
}
}
}
Expand Down Expand Up @@ -420,6 +435,21 @@ export async function listProofs (opts) {
console.log(` with: ${capability.with}`)
console.log(` can: ${capability.can}`)
}
if (proof.proofs.length) {
console.log(' proofs:')
for (const inner of proof.proofs) {
if (ucanto.isDelegation(inner)) {
console.log(` issuer: ${inner.issuer.did()}`)
console.log(` audience: ${inner.audience.did()}`)
for (const capability of inner.capabilities) {
console.log(` with: ${capability.with}`)
console.log(` can: ${capability.can}`)
}
} else {
console.log(` link: ${proof}`)
}
}
}
}
}
}
Expand Down