pub struct OfferedGrant {
pub turtle: String,
pub sha256: Sha256Digest,
pub containers: Vec<OfferedContainer>,
}Expand description
The whole offered grant: the combined text and hash, and each container’s.
On the wire it is the tenant answer’s grant member,
{"turtle":str,"sha256":hex,"containers":[{"path","turtle","sha256"}]}.
Fields§
§turtle: StringThe per-container texts in manifest order, joined by one blank line.
sha256: Sha256DigestThe SHA-256 of turtle; consent must name it.
containers: Vec<OfferedContainer>Each container’s authorisation, in manifest order.
Implementations§
Source§impl OfferedGrant
impl OfferedGrant
Sourcepub fn from_containers(containers: Vec<OfferedContainer>) -> Self
pub fn from_containers(containers: Vec<OfferedContainer>) -> Self
Combines per-container authorisations, as stored, into the grant whose hash consent compares. The containers must be in manifest order.
§Examples
use stratum_node_core::{render_offered, ContainerGrant, DidNostr, OfferedGrant};
let app = DidNostr::from_hex(&"c6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee5")?;
let owner = DidNostr::from_hex(&"79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798")?;
let grants: Vec<ContainerGrant> = serde_json::from_str(
r#"[{"path":"a/","modes":["Read"],"operations":["GET"]},
{"path":"b/","modes":["Read","Write"],"operations":["PUT"]}]"#,
)?;
let offered = render_offered(&app, &owner, &grants);
assert_eq!(OfferedGrant::from_containers(offered.containers.clone()), offered);Trait Implementations§
Source§impl Clone for OfferedGrant
impl Clone for OfferedGrant
Source§impl Debug for OfferedGrant
impl Debug for OfferedGrant
Source§impl<'de> Deserialize<'de> for OfferedGrant
impl<'de> Deserialize<'de> for OfferedGrant
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for OfferedGrant
Source§impl Hash for OfferedGrant
impl Hash for OfferedGrant
Source§impl PartialEq for OfferedGrant
impl PartialEq for OfferedGrant
Source§impl Serialize for OfferedGrant
impl Serialize for OfferedGrant
impl StructuralPartialEq for OfferedGrant
Auto Trait Implementations§
impl Forget for OfferedGrant
impl Freeze for OfferedGrant
impl Move for OfferedGrant
impl RefUnwindSafe for OfferedGrant
impl Send for OfferedGrantwhere
RawVecInner: Send,
impl Sync for OfferedGrantwhere
RawVecInner: Sync,
impl Unpin for OfferedGrant
impl UnsafeUnpin for OfferedGrantwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<OfferedContainer>: UnsafeUnpin,
impl UnwindSafe for OfferedGrantwhere
RawVecInner: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more