class IdentityKey


A public-private key pair usable for signing, representing an end user identity in an end-to-end encrypted messaging system.

Summary

Constants

const Int

A signing key on Ed25519.

const Int

The default signing key type, which should not be used.

Public companion functions

IdentityKey
@WorkerThread
createFromPrf(prf: ByteArray, salt: ByteArray?, keyType: Int)

Creates a IdentityKey, a public/private key pair usable for signing.

Public functions

open operator Boolean
equals(other: Any?)
open Int

Public properties

ByteArray

The private key, stored as a byte array.

ByteArray

The public key, stored as a byte array.

Int

The type of signing key, e.g. Ed25519.

Constants

IDENTITY_KEY_TYPE_ED25519

const val IDENTITY_KEY_TYPE_ED25519 = 6: Int

A signing key on Ed25519. The value matches https://www.iana.org/assignments/cose/cose.xhtml#algorithms

IDENTITY_KEY_TYPE_RESERVED

const val IDENTITY_KEY_TYPE_RESERVED = 0: Int

The default signing key type, which should not be used. This is required to match https://www.iana.org/assignments/cose/cose.xhtml#algorithms

Public companion functions

createFromPrf

Added in 1.0.0-alpha02
@WorkerThread
fun createFromPrf(prf: ByteArray, salt: ByteArray?, keyType: Int): IdentityKey

Creates a IdentityKey, a public/private key pair usable for signing. It is intended for use with the WebAuthn PRF extension (https://w3c.github.io/webauthn/#prf-extension). The generated IdentityKey is deterministic given prf and salt, thus the prf value must be kept secret. Currently, only Ed25519 is supported as a key type.

Parameters
prf: ByteArray

The PRF output of WebAuthn used in the key derivation.

salt: ByteArray?

An optional salt used in the key derivation.

keyType: Int

The type of IdentityKey to generate, e.g. Ed25519.

Returns
IdentityKey

a IdentityKey, a public/private key pair usable for signing.

Throws
kotlin.IllegalArgumentException

if the key type is not supported.

Public functions

equals

open operator fun equals(other: Any?): Boolean

hashCode

open fun hashCode(): Int

Public properties

private

Added in 1.0.0-alpha02
val privateByteArray

The private key, stored as a byte array.

public

Added in 1.0.0-alpha02
val publicByteArray

The public key, stored as a byte array.

type

Added in 1.0.0-alpha02
val typeInt

The type of signing key, e.g. Ed25519.