diff --git a/components/dep-componentized-oci-client/dep-componentized-oci-client.wkg b/components/dep-componentized-oci-client/dep-componentized-oci-client.wkg index 7e80648..d1c1b50 100644 --- a/components/dep-componentized-oci-client/dep-componentized-oci-client.wkg +++ b/components/dep-componentized-oci-client/dep-componentized-oci-client.wkg @@ -1,2 +1,2 @@ -ghcr.io/componentized/oci/client:0.1.0-dev@sha256:a5c60dc24dea1883e347f67a7f3929694b620c8096fb4afff54cb8b9fbc95004 -ghcr.io/componentized/oci/client:0.1.0-dev_debug@sha256:075eecc73333b82ce0854907e06015296f7c3a839539d7b5457bec31d95e7a00 +ghcr.io/componentized/oci/client:0.1.0-dev@sha256:f8803d55c62f994c2e134e2b821ab8a400bf379179a0941c4396ad54d21664f6 +ghcr.io/componentized/oci/client:0.1.0-dev_debug@sha256:5972e075b6dc9eff04ef7e986b81526ee657fb671ba3c8bec4e3aab61e70f2d6 diff --git a/components/oci-loader/src/lib.rs b/components/oci-loader/src/lib.rs index 1d92e90..d91cccb 100644 --- a/components/oci-loader/src/lib.rs +++ b/components/oci-loader/src/lib.rs @@ -2,6 +2,7 @@ use crate::{ componentized::{ component::types::{ErrorCode, Malformed, Wasm}, oci::client::{self as oci, Digest, Reference}, + oci::media_types, }, exports::componentized::component::path_loader::Guest, }; @@ -23,23 +24,21 @@ async fn load_reference(path: &str) -> Result { oci::Manifest::OciImageV1(oci_image_manifest_v1) => oci_image_manifest_v1, _ => Err(ErrorCode::Other(Some("unexpected manifest".to_string())))?, }; - match manifest.config.media_type { - oci::MediaType::ApplicationVndWasmConfigV0(oci::MediaTypeSuffix::Json) => {} - _ => Err(ErrorCode::Other(Some( + if manifest.config.media_type != media_types::application_vnd_wasm_config_v0_json() { + Err(ErrorCode::Other(Some( "unexpected config media type".to_string(), - )))?, - }; + )))? + } if manifest.layers.len() != 1 { Err(ErrorCode::Other(Some( "unknown artifact layout".to_string(), )))? } let component_descriptor = manifest.layers.first().unwrap(); - match component_descriptor.media_type { - oci::MediaType::ApplicationWasm => {} - _ => Err(ErrorCode::Other(Some( + if component_descriptor.media_type != media_types::application_wasm() { + Err(ErrorCode::Other(Some( "unknown artifact media type".to_string(), - )))?, + )))? } let config_reference = manifest_reference.with_digest(&manifest.config.digest); @@ -54,7 +53,9 @@ async fn load_reference(path: &str) -> Result { let component_reference = manifest_reference.with_digest(&manifest.layers.first().unwrap().digest); - let component = oci::get_blob(component_reference).await?; + let (component, verified) = oci::get_blob(component_reference).await?; + let component = component.collect().await; + verified.await?; if component_descriptor.size != component.len() as u64 { Err(ErrorCode::Malformed(Malformed { name: None, diff --git a/components/test-loader/test-loader.wac b/components/test-loader/test-loader.wac index eff4826..26d474c 100644 --- a/components/test-loader/test-loader.wac +++ b/components/test-loader/test-loader.wac @@ -9,8 +9,8 @@ let oci-client = new local:dep-componentized-oci-client { export new local:test-loader-harness { path-loader: new local:path-loader { - "componentized:http/client@0.1.0": http-client.client, - "componentized:oci/client@0.0.0-dev": oci-client.client, + ...http-client, + ...oci-client, ... }.path-loader, ... diff --git a/components/wit/worlds.wit b/components/wit/worlds.wit index 5b9ead9..bc83d58 100644 --- a/components/wit/worlds.wit +++ b/components/wit/worlds.wit @@ -18,7 +18,8 @@ world http-loader { } world oci-loader { - import componentized:oci/client@0.0.0-dev; + import componentized:oci/client@0.1.0; + import componentized:oci/media-types@0.1.0; import componentized:component/types@0.0.0-dev; export componentized:component/path-loader@0.0.0-dev; } diff --git a/components/wkg.lock b/components/wkg.lock index 36cfa5e..8600d5b 100644 --- a/components/wkg.lock +++ b/components/wkg.lock @@ -20,6 +20,16 @@ requirement = "=0.0.0-dev" version = "0.0.0-dev" digest = "sha256:fe33e6ac5f37a1a5f37b249c382b28e5224d4f2b28a7b6f8499a8bb11762e400" +[[packages.versions]] +requirement = "=0.1.0-dev" +version = "0.1.0-dev" +digest = "sha256:15c5e31aec2cffa766de8d19dfd01cd17cae26528c207a1a13f2958da1304348" + +[[packages.versions]] +requirement = "=0.1.0" +version = "0.1.0" +digest = "sha256:669209f655930f3a48412a6ee4e29371d86db6ba001b3b3d78aff0f1839f6fdb" + [[packages]] name = "wasi:cli" registry = "wasi.dev" diff --git a/tools/Cargo.toml b/tools/Cargo.toml index 59fae24..99fdbee 100644 --- a/tools/Cargo.toml +++ b/tools/Cargo.toml @@ -13,7 +13,7 @@ publish = false path = "lib.rs" [dependencies] -componentized-constants-cli = "=0.1.0-dev" +componentized-constants-cli = "=0.1.1" static-config = "=0.2.0" wac-cli = "=0.12.0" wasm-tools = "=1.261.0"