diff --git a/src/main/kotlin/io/github/sgtsilvio/gradle/oci/metadata/OciDescriptor.kt b/src/main/kotlin/io/github/sgtsilvio/gradle/oci/metadata/OciDescriptor.kt index fe680496..b2691997 100644 --- a/src/main/kotlin/io/github/sgtsilvio/gradle/oci/metadata/OciDescriptor.kt +++ b/src/main/kotlin/io/github/sgtsilvio/gradle/oci/metadata/OciDescriptor.kt @@ -22,8 +22,9 @@ internal data class OciDescriptorImpl( internal class OciDataDescriptor( override val mediaType: String, val data: ByteArray, + digestAlgorithm: OciDigestAlgorithm, override val annotations: SortedMap, ) : OciDescriptor { - override val digest = data.calculateOciDigest(OciDigestAlgorithm.SHA_256) + override val digest = data.calculateOciDigest(digestAlgorithm) override val size get() = data.size.toLong() } diff --git a/src/main/kotlin/io/github/sgtsilvio/gradle/oci/metadata/OciMetadataFiles.kt b/src/main/kotlin/io/github/sgtsilvio/gradle/oci/metadata/OciMetadataFiles.kt index d2fbed53..c784c748 100644 --- a/src/main/kotlin/io/github/sgtsilvio/gradle/oci/metadata/OciMetadataFiles.kt +++ b/src/main/kotlin/io/github/sgtsilvio/gradle/oci/metadata/OciMetadataFiles.kt @@ -81,7 +81,12 @@ internal fun createConfig(platform: Platform, variants: List): OciDa } addStringIfNotEmpty("variant", platform.variant) }.toByteArray() - return OciDataDescriptor(CONFIG_MEDIA_TYPE, data, lastVariantMetadata.configDescriptorAnnotations) // TODO lastVariantMetadata? + return OciDataDescriptor( + CONFIG_MEDIA_TYPE, + data, + OciDigestAlgorithm.SHA_256, + lastVariantMetadata.configDescriptorAnnotations, // TODO lastVariantMetadata? + ) } internal fun createManifest(configDescriptor: OciDescriptor, variants: List): OciDataDescriptor { @@ -100,7 +105,12 @@ internal fun createManifest(configDescriptor: OciDescriptor, variants: List): OciDataDescriptor { @@ -124,7 +134,7 @@ internal fun createIndex(platformToImage: Map): OciDataDescr addString("mediaType", INDEX_MEDIA_TYPE) addNumber("schemaVersion", 2) }.toByteArray() - return OciDataDescriptor(INDEX_MEDIA_TYPE, data, TreeMap()) + return OciDataDescriptor(INDEX_MEDIA_TYPE, data, OciDigestAlgorithm.SHA_256, TreeMap()) } private fun JsonObjectStringBuilder.encodeOciDescriptor(descriptor: OciDescriptor) {