pub struct CreateAuthorization {
pub format_version: u16,
pub id: String,
pub owner: String,
pub workspace: String,
pub base_revision: ContentHash,
pub idempotency_key: String,
pub cone: Vec<String>,
}Expand description
Owner-signed authorization carried into a node-authored physical workspace creation operation.
This is separate from ViewOp: submitting the authorization to the
raw operation endpoint cannot create a directory or a change. The
workspace endpoint first verifies and materializes the exact binding,
then the node wraps it in OpKind::CreateChange under its own key.
Fields§
§format_version: u16Wire-format version; see FORMAT_VERSION.
id: StringStable logical contribution id.
owner: StringOwner channel that must match the signature attribution.
workspace: StringWorkspace being created.
base_revision: ContentHashExact immutable starting revision.
idempotency_key: StringOwner-scoped retry identity.
cone: Vec<String>Directory prefixes the owner declares this change works within; empty means the whole tree.
Covered by the owner’s signature on purpose. The cone lands in the log as part of an op the node authors, so if it were not signed here the node could attach a scope its owner never declared — and a declaration nobody signed is worth no more than the node-side config this was meant to replace. Additive under invariant 1: an empty cone is not serialized, so every authorization signed before this field existed still verifies byte-for-byte.
Implementations§
Source§impl CreateAuthorization
impl CreateAuthorization
Sourcepub fn new(
id: String,
owner: String,
workspace: String,
base_revision: ContentHash,
idempotency_key: String,
) -> Self
pub fn new( id: String, owner: String, workspace: String, base_revision: ContentHash, idempotency_key: String, ) -> Self
Creates an authorization at the current wire-format version.
Sourcepub fn with_cone(self, cone: Vec<String>) -> Self
pub fn with_cone(self, cone: Vec<String>) -> Self
The same authorization, scoped to cone.
A builder rather than a sixth parameter on Self::new, so the
unscoped call sites – which are most of them, and every one
written before cones existed – keep reading as the plain thing
they are.
Sourcepub fn to_payload(&self) -> Vec<u8> ⓘ
pub fn to_payload(&self) -> Vec<u8> ⓘ
Canonical bytes covered by the owner’s submission signature.
Sourcepub fn from_payload(payload: &[u8]) -> Result<Self, ViewError>
pub fn from_payload(payload: &[u8]) -> Result<Self, ViewError>
Decodes signed authorization bytes.
Trait Implementations§
Source§impl Clone for CreateAuthorization
impl Clone for CreateAuthorization
Source§fn clone(&self) -> CreateAuthorization
fn clone(&self) -> CreateAuthorization
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CreateAuthorization
impl Debug for CreateAuthorization
Source§impl<'de> Deserialize<'de> for CreateAuthorization
impl<'de> Deserialize<'de> for CreateAuthorization
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>,
Source§impl PartialEq for CreateAuthorization
impl PartialEq for CreateAuthorization
Source§fn eq(&self, other: &CreateAuthorization) -> bool
fn eq(&self, other: &CreateAuthorization) -> bool
self and other values to be equal, and is used by ==.