
io.p8e.engine.extension.ProtoExtension.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of p8e-common Show documentation
Show all versions of p8e-common Show documentation
A collection of services and libraries that iteract and run Provenance Java based contracts.
The newest version!
package io.p8e.engine.extension
import com.google.protobuf.Message
import io.p8e.proto.Common.WithAudience
import io.p8e.util.toByteString
import io.provenance.p8e.encryption.ecies.ECUtils
import java.security.PublicKey
fun T.withAudience(audience: Set): WithAudience {
return WithAudience.newBuilder()
.addAllAudience(audience.map { it.toByteString() })
.setMessage(toByteString())
.build()
}
fun ByteArray.withAudience(audience: Set): WithAudience {
return WithAudience.newBuilder()
.addAllAudience(audience.map { it.toByteString() })
.setMessage(toByteString())
.build()
}
fun WithAudience.toAudience(): Set {
return audienceList.map { ECUtils.convertBytesToPublicKey(it.toByteArray()) }.toSet()
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy