All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.github.sgtsilvio.oci.registry.OciDigest.kt Maven / Gradle / Ivy

Go to download

OCI registry Java library that allows serving OCI artifacts to pull operations

There is a newer version: 0.4.1
Show newest version
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