Hi all -
I am building a small proof of concept, which is heavily dependent on using capabilities for ‘access control’. All user data is currently set as ‘private’.
Right now I have a working zome which can make assigned grants, and lets grantees see the grantors source chain entries.
My next TODO is to let the grantors delete/revoke the cap grant. I am using the example delete_cap_grant function here, on line 49:
#[hdk_extern]
pub fn delete_cap_grant(header_hash: HeaderHash) -> ExternResult<HeaderHash> {
hdk::prelude::delete_cap_grant(header_hash)
}
This seems pretty simple. But it requires HeaderHash of the CapGrant element as the input.
My question is - how do I obtain the CapGrant HeaderHash so the user can pass it to the delete_cap_grant function?
entry.rs says that
"Every host function that commits an entry returns the new
HeaderHash
"
and also -
" The header hash can be extracted from the Element as
element.header_hashed().as_hash()
"
So it sounds like it should be easy to access. Can someone please provide an example how to do it?
Thanks for your help, alex.