Companion

object Companion

Properties

Link copied to clipboard
const val ID_SIZE: Int = 16

The size of a grant id, in bytes.

Link copied to clipboard
const val NO_EXPIRY: Long

A notAfter meaning the grant never expires.

Functions

Link copied to clipboard
fun decode(wire: ByteArray): Grant?

The grant wire holds, or null when it is not exactly a kuilt/grant v1 layout followed by a 64-byte signature: another tag or version, a field of the wrong size, a point that is not compressed, an unknown scope tag, a room id that is not UTF-8, a non-empty parent, or notAfter not after issuedAt.

Link copied to clipboard
suspend fun issue(issuer: DeviceKey, subject: DidKey, scope: GrantScope, issuedAt: Long, notAfter: Long): Grant

issuer's grant letting subject back into scope from issuedAt until notAfter, with a fresh random id from the platform's cryptographically secure source.