Skip to content

Commit bac8946

Browse files
committed
fix zkdcap attestation command to support update_policy option instead of eary_update
Signed-off-by: Jun Kimura <jun.kimura@datachain.jp>
1 parent ac2623a commit bac8946

File tree

1 file changed

+25
-3
lines changed

1 file changed

+25
-3
lines changed

app/src/commands/attestation.rs

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,30 @@ pub struct SgxCollateralService {
245245
help = "Certs Service URL (default: https://certificates.trustedservices.intel.com/)"
246246
)]
247247
pub certs_service_url: Option<String>,
248-
#[clap(long = "early_update", help = "Enable early update (default: false)")]
249-
pub is_early_update: bool,
248+
#[clap(
249+
long = "update_policy",
250+
default_value = "early",
251+
help = "Update policy (early(default) or standard)"
252+
)]
253+
pub update_policy: UpdatePolicy,
254+
}
255+
256+
#[derive(Clone, Debug, PartialEq)]
257+
pub enum UpdatePolicy {
258+
Early,
259+
Standard,
260+
}
261+
262+
impl FromStr for UpdatePolicy {
263+
type Err = anyhow::Error;
264+
265+
fn from_str(s: &str) -> Result<Self, Self::Err> {
266+
match s.to_lowercase().as_str() {
267+
"early" => Ok(Self::Early),
268+
"standard" => Ok(Self::Standard),
269+
_ => Err(anyhow!("invalid update policy: {}", s)),
270+
}
271+
}
250272
}
251273

252274
impl SgxCollateralService {
@@ -268,7 +290,7 @@ impl From<SgxCollateralService> for PCSClient {
268290
Self::new(
269291
service.get_pccs_url().as_str(),
270292
service.get_certs_service_url().as_str(),
271-
service.is_early_update,
293+
service.update_policy == UpdatePolicy::Early,
272294
)
273295
}
274296
}

0 commit comments

Comments
 (0)