Skip to main content

PluginTrustPolicy

Struct PluginTrustPolicy 

Source
pub struct PluginTrustPolicy {
    pub official_key_fingerprints: &'static [&'static str],
    pub revoked: &'static [PluginRevocation],
    pub require_digest: bool,
}
Expand description

A small, dependency-free trust policy for plugin bytes. 一个零依赖的插件字节信任策略。

This is intentionally a checksum and key-fingerprint policy, not a home-grown signature scheme. Signature verification belongs in the adapter that loads a plugin; NichLink only decides whether the verified identity is allowed to enter this registry. 这里刻意只做摘要和公钥指纹策略,不伪造签名算法。真正的签名校验由加载插件的 adapter 完成,NichLink 只判断已校验身份是否可以进入注册树。

Fields§

§official_key_fingerprints: &'static [&'static str]

SHA-256 fingerprints of keys trusted to sign official plugins. 被信任可为官方插件签名的密钥 SHA-256 指纹。

§revoked: &'static [PluginRevocation]

Revocations that refuse a package/version pair outright. 直接拒绝某个包/版本组合的撤销条目。

§require_digest: bool

Whether the manifest checksum must be a SHA-256 digest. manifest 摘要是否必须是 SHA-256 值。

Implementations§

Source§

impl PluginTrustPolicy

Source

pub const fn open() -> PluginTrustPolicy

Development policy: no trusted keys and no digest requirement. 开发态策略:没有信任密钥,也不强制摘要。

Source

pub const fn official( keys: &'static [&'static str], revoked: &'static [PluginRevocation], ) -> PluginTrustPolicy

Policy that requires a digest and trusts only the listed official keys. 强制摘要、且只信任所列官方密钥的策略。

Source

pub fn verify( self, manifest: PluginManifest, bytes: &[u8], key_fingerprint: Option<&str>, ) -> Result<(), PluginTrustError>

Run the checksum, revocation, and official-key checks; does no signature work. 执行摘要、撤销与官方密钥检查;本身不做签名运算。

Source

pub fn verify_with<V>( self, manifest: PluginManifest, bytes: &[u8], key_fingerprint: Option<&str>, verifier: &V, ) -> Result<(), PluginTrustError>

Verify metadata and delegate the actual signature operation to the host. 校验元数据,并把真正的签名操作委托给宿主。

Trait Implementations§

Source§

impl Clone for PluginTrustPolicy

Source§

fn clone(&self) -> PluginTrustPolicy

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for PluginTrustPolicy

Source§

impl Debug for PluginTrustPolicy

Source§

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

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

impl Eq for PluginTrustPolicy

Source§

impl PartialEq for PluginTrustPolicy

Source§

fn eq(&self, other: &PluginTrustPolicy) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for PluginTrustPolicy

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.