io.github.sgtsilvio.oci.registry.OciDigest.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of oci-registry Show documentation
Show all versions of oci-registry Show documentation
OCI registry Java library that allows serving OCI artifacts to pull operations
package io.github.sgtsilvio.oci.registry
import java.io.Serializable
/**
* @author Silvio Giebl
*/
internal data class OciDigest(val algorithm: String, val hash: String) : Serializable {
override fun toString() = "$algorithm:$hash"
}
internal fun String.toOciDigest(): OciDigest {
val separator = indexOf(':')
if (separator == -1) throw IllegalArgumentException("'$this' is not an OCI digest")
return OciDigest(substring(0, separator), substring(separator + 1))
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy