pub struct RepoParams {
pub prefix: String,
}Expand description
Initial parameters, immutable, part of the contract key via
BLAKE3(BLAKE3(WASM) || Parameters).
The parameters carry only the prefix — the first N base58
characters of the owner’s ed25519 public key. The owner pubkey
itself lives in RepoState (state.owner) and is checked by
validate_state against this prefix.
This means the URL — which is just the prefix — is short and
readable, but anyone who has the URL plus the bundled contract WASM
can compute the full contract key (BLAKE3(BLAKE3(WASM) || CBOR({prefix}))). Two different prefix lengths produce two
different contract keys, so the same owner can have many repos at
different prefix lengths — though in practice we always use
limits::DEFAULT_PREFIX_LEN.
Fields§
§prefix: StringBase58 prefix of the owner’s ed25519 public key. Length must be
in the [MIN_PREFIX_LEN..=MAX_PREFIX_LEN] range.
Implementations§
Source§impl RepoParams
impl RepoParams
Sourcepub fn from_owner(owner: &PublicKey, len: usize) -> Self
pub fn from_owner(owner: &PublicKey, len: usize) -> Self
Construct parameters from an owner pubkey and prefix length.
Caller must ensure len is in the valid range; consumers
double-check via validate_state.
Sourcepub fn to_bytes(&self) -> Vec<u8> ⓘ
pub fn to_bytes(&self) -> Vec<u8> ⓘ
Encode as bytes for use as the Parameters payload of the contract.
Sourcepub fn from_bytes(bytes: &[u8]) -> Result<Self, ValidateError>
pub fn from_bytes(bytes: &[u8]) -> Result<Self, ValidateError>
Decode from a Parameters payload.
Trait Implementations§
Source§impl Clone for RepoParams
impl Clone for RepoParams
Source§fn clone(&self) -> RepoParams
fn clone(&self) -> RepoParams
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 RepoParams
impl Debug for RepoParams
Source§impl<'de> Deserialize<'de> for RepoParams
impl<'de> Deserialize<'de> for RepoParams
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 RepoParams
impl PartialEq for RepoParams
Source§fn eq(&self, other: &RepoParams) -> bool
fn eq(&self, other: &RepoParams) -> bool
self and other values to be equal, and is used by ==.