public final 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

static final int

A signing key on Ed25519.

static final int

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

Public methods

static final @NonNull IdentityKey
@WorkerThread
createFromPrf(@NonNull byte[] prf, byte[] salt, int keyType)

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

boolean
equals(Object other)
final @NonNull byte[]

The private key, stored as a byte array.

final @NonNull byte[]

The public key, stored as a byte array.

final int

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

int

Constants

IDENTITY_KEY_TYPE_ED25519

public static final int IDENTITY_KEY_TYPE_ED25519 = 6

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

IDENTITY_KEY_TYPE_RESERVED

public static final int IDENTITY_KEY_TYPE_RESERVED = 0

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 methods

createFromPrf

Added in 1.0.0-alpha02
@WorkerThread
public static final @NonNull IdentityKey createFromPrf(@NonNull byte[] prf, byte[] salt, int keyType)

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
@NonNull byte[] prf

The PRF output of WebAuthn used in the key derivation.

byte[] salt

An optional salt used in the key derivation.

int keyType

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

Returns
@NonNull IdentityKey

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

Throws
kotlin.IllegalArgumentException

if the key type is not supported.

equals

public boolean equals(Object other)

getPrivate

Added in 1.0.0-alpha02
public final @NonNull byte[] getPrivate()

The private key, stored as a byte array.

getPublic

Added in 1.0.0-alpha02
public final @NonNull byte[] getPublic()

The public key, stored as a byte array.

getType

Added in 1.0.0-alpha02
public final int getType()

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

hashCode

public int hashCode()