pub struct CreateDIDConfigBuilder<A: Signer = Secret, W: Signer = Secret> { /* private fields */ }Expand description
Builder for constructing a CreateDIDConfig.
Only address, authorization_keys, did_document, and parameters are required.
All other fields have sensible defaults.
§Example
use didwebvh_rs::prelude::*;
let config = CreateDIDConfig::builder()
.address("https://example.com/")
.authorization_key(signing_key)
.did_document(doc)
.parameters(params)
.also_known_as_web(true)
.build()?;Implementations§
Source§impl<A: Signer, W: Signer> CreateDIDConfigBuilder<A, W>
impl<A: Signer, W: Signer> CreateDIDConfigBuilder<A, W>
Sourcepub fn address(self, address: impl Into<String>) -> Self
pub fn address(self, address: impl Into<String>) -> Self
Set the address (URL or DID format). Required.
Add a single authorization key. At least one is required.
Set all authorization keys at once, replacing any previously added.
Sourcepub fn did_document(self, doc: Value) -> Self
pub fn did_document(self, doc: Value) -> Self
Set the DID Document. Required.
Sourcepub fn parameters(self, params: Parameters) -> Self
pub fn parameters(self, params: Parameters) -> Self
Set the Parameters. Required.
Sourcepub fn witness_secret(self, did: impl Into<String>, secret: W) -> Self
pub fn witness_secret(self, did: impl Into<String>, secret: W) -> Self
Add a single witness signer keyed by witness DID.
Sourcepub fn witness_secrets(self, secrets: HashMap<String, W>) -> Self
pub fn witness_secrets(self, secrets: HashMap<String, W>) -> Self
Set all witness signers at once, replacing any previously added.
Sourcepub fn also_known_as_web(self, enabled: bool) -> Self
pub fn also_known_as_web(self, enabled: bool) -> Self
Whether to add did:web to alsoKnownAs. Defaults to false.
Sourcepub fn also_known_as_scid(self, enabled: bool) -> Self
pub fn also_known_as_scid(self, enabled: bool) -> Self
Whether to add did:scid:vh to alsoKnownAs. Defaults to false.
Sourcepub fn version_time(self, version_time: DateTime<FixedOffset>) -> Self
pub fn version_time(self, version_time: DateTime<FixedOffset>) -> Self
Set an explicit versionTime for the genesis log entry (default: now).
Sourcepub fn build(self) -> Result<CreateDIDConfig<A, W>, DIDWebVHError>
pub fn build(self) -> Result<CreateDIDConfig<A, W>, DIDWebVHError>
Build the CreateDIDConfig, returning an error if required fields are missing.