Skip to main content

IdentityMut

Struct IdentityMut 

Source
pub struct IdentityMut<'a, 'b, Repo, Signer> {
    pub id: ObjectId,
    /* private fields */
}

Fields§

§id: ObjectId

Implementations§

Source§

impl<Repo, Signer> IdentityMut<'_, '_, Repo, Signer>
where Repo: WriteRepository + Store<Namespace = PublicKey>, Signer: Keypair<VerifyingKey = PublicKey> + Signer<Signature> + Signer<ExtendedSignature> + Verifier<Signature>,

Source

pub fn transaction<F>( &mut self, message: &str, operations: F, ) -> Result<Oid, Error>
where F: FnOnce(&mut Transaction<Identity, Repo>, &Repo) -> Result<(), Error>,

Source

pub fn update( &mut self, title: Title, description: impl ToString, doc: &Doc, ) -> Result<Oid, Error>

Update the identity by proposing a new revision. If the signer is the only delegate, the revision is accepted automatically.

Source

pub fn accept(&mut self, revision: &Oid) -> Result<Oid, Error>

Accept an active revision.

Source

pub fn reject(&mut self, revision: Oid) -> Result<Oid, Error>

Reject an active revision.

Source

pub fn redact(&mut self, revision: Oid) -> Result<Oid, Error>

Redact a revision.

Source

pub fn edit( &mut self, revision: Oid, title: Title, description: String, ) -> Result<Oid, Error>

Edit an active revision’s title or description.

Methods from Deref<Target = Identity>§

Source

pub fn id(&self) -> RepoId

The repository identifier.

Source

pub fn doc(&self) -> &Doc

The current document.

Source

pub fn current(&self) -> &Revision

The current revision.

Source

pub fn root(&self) -> &Revision

The initial revision of this identity.

Source

pub fn head(&self) -> Oid

The head of the identity branch. This points to a commit that contains the current document blob.

Source

pub fn revision(&self, revision: &Oid) -> Option<&Revision>

A specific Revision, that may be redacted.

Source

pub fn revisions(&self) -> impl DoubleEndedIterator

All the Revisions that have not been redacted.

Source

pub fn latest_by(&self, who: &Did) -> Option<&Revision>

Methods from Deref<Target = Revision>§

Source

pub fn signatures(&self) -> impl Iterator<Item = (&PublicKey, Signature)>

Source

pub fn is_accepted(&self) -> bool

Source

pub fn is_active(&self) -> bool

Source

pub fn verdicts(&self) -> impl Iterator<Item = (&PublicKey, &Verdict)>

Source

pub fn accepted(&self) -> impl Iterator<Item = Did>

Source

pub fn rejected(&self) -> impl Iterator<Item = Did>

Source

pub fn sign<G>(&self, signer: &G) -> Result<Signature, DocError>
where G: Signer<Signature>,

Methods from Deref<Target = Doc>§

Source

pub fn version(&self) -> &Version

Get the version of the document.

Source

pub fn payload(&self) -> &BTreeMap<PayloadId, Payload>

Return the associated payloads for this Doc.

Source

pub fn project(&self) -> Result<Project, PayloadError>

Get the project payload, if it exists and is valid, out of this document.

Source

pub fn default_branch(&self) -> Result<Qualified<'_>, DefaultBranchError>

Gets the qualified reference name of the default branch, according to payloads xyz.radicle.project and xyz.radicle.crefs in this document.

Source

pub fn canonical_refs(&self) -> Result<CanonicalRefs, CanonicalRefsError>

Construct the canonical references for this document.

Uses the xyz.radicle.crefs payload (if present) and the xyz.radicle.project payload to determine the HEAD symbolic reference and its associated rule.

There are three cases, depending on whether HEAD is already defined in the crefs payload and whether a project payload exists:

  1. Explicit HEAD + project: HEAD must agree with Project::default_branch_qualified, and the matching rule must use delegates with the document’s threshold.
  2. Explicit HEAD, no project: The matching rule must use delegates with the document’s threshold.
  3. No HEAD: A rule and HEAD symbolic reference are synthesized from the project payload (which must exist).

In all cases the result must pass RawCanonicalRefs::try_into_canonical_refs validation. If a rule for HEAD’s target is missing, it will be caught as a dangling reference there.

Source

pub fn visibility(&self) -> &Visibility

Return the associated Visibility of this document.

Source

pub fn is_public(&self) -> bool

Check whether the visibility of the document is public.

Source

pub fn is_private(&self) -> bool

Check whether the visibility of the document is private.

Source

pub fn threshold(&self) -> usize

Return the associated threshold of this document.

Source

pub fn threshold_nonzero(&self) -> &NonZero<usize>

Return the associated threshold of this document in its non-zero format.

Source

pub fn delegates(&self) -> &Delegates

Return the associated delegates of this document.

Source

pub fn is_delegate(&self, did: &Did) -> bool

Check if the did is part of the Doc::delegates set.

Source

pub fn is_visible_to(&self, did: &Did) -> bool

Check whether this document and the associated repository is visible to the given peer.

Source

pub fn verify_signature( &self, key: &PublicKey, signature: &Signature, blob: Oid, ) -> Result<(), PublicKey>

Validate signature using this document’s delegates, against a given document blob.

Source

pub fn is_majority(&self, votes: usize) -> bool

Check the provided votes passes the Doc::majority.

Source

pub fn majority(&self) -> usize

Return the majority number based on the size of the delegates set.

Source

pub fn encode(&self) -> Result<(Oid, Vec<u8>), DocError>

Encode the Doc as canonical JSON, returning the set of bytes and its corresponding Git Oid.

Source

pub fn sign<G>(&self, signer: &G) -> Result<(Oid, Vec<u8>, Signature), DocError>
where G: Signer<Signature>,

Doc::encode and sign the Doc, returning the set of bytes, its corresponding Git Oid and the Signature over the Oid.

Source

pub fn signature_of<G>(&self, signer: &G) -> Result<Signature, DocError>
where G: Signer<Signature>,

Similar to Doc::sign, but only returning the Signature.

Source

pub fn init<G>( &self, repo: &Repository, signer: &Device<G>, ) -> Result<Oid, RepositoryError>
where G: Signer<Signature>,

Initialize an identity::Identity with this Doc as the associated document.

Trait Implementations§

Source§

impl<Repo, Signer> Debug for IdentityMut<'_, '_, Repo, Signer>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<Repo, Signer> Deref for IdentityMut<'_, '_, Repo, Signer>

Source§

type Target = Identity

The resulting type after dereferencing.
Source§

fn deref(&self) -> &<IdentityMut<'_, '_, Repo, Signer> as Deref>::Target

Dereferences the value.

Auto Trait Implementations§

§

impl<'a, 'b, Repo, Signer> Freeze for IdentityMut<'a, 'b, Repo, Signer>

§

impl<'a, 'b, Repo, Signer> RefUnwindSafe for IdentityMut<'a, 'b, Repo, Signer>
where Repo: RefUnwindSafe, Signer: RefUnwindSafe,

§

impl<'a, 'b, Repo, Signer> Send for IdentityMut<'a, 'b, Repo, Signer>
where Repo: Sync, Signer: Sync,

§

impl<'a, 'b, Repo, Signer> Sync for IdentityMut<'a, 'b, Repo, Signer>
where Repo: Sync, Signer: Sync,

§

impl<'a, 'b, Repo, Signer> Unpin for IdentityMut<'a, 'b, Repo, Signer>

§

impl<'a, 'b, Repo, Signer> UnsafeUnpin for IdentityMut<'a, 'b, Repo, Signer>

§

impl<'a, 'b, Repo, Signer> UnwindSafe for IdentityMut<'a, 'b, Repo, Signer>
where Repo: RefUnwindSafe, Signer: RefUnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V