scuttlebutt / org.apache.tuweni.scuttlebutt / Identity

Identity

interface Identity (source)

A Scuttlebutt identity, backed by a public key. Currently supported: Ed25519 and SECP256K1.

Types

Curve

class Curve

Curves supported by those identities.

Functions

curve

abstract fun curve(): Curve

Provides the curve associated with this identity

curveName

open fun curveName(): String

Provides the name of the curve associated with this identity

ed25519PublicKey

abstract fun ed25519PublicKey(): PublicKey

Provides the identity's associated Ed25519 public key.

fromKeyPair

open static fun fromKeyPair(keyPair: KeyPair): Identity

Creates a new Ed25519 identity backed by this key pair.

open static fun fromKeyPair(keyPair: KeyPair): Identity

Creates a new SECP256K1 identity backed by this key pair.

fromPublicKey

open static fun fromPublicKey(publicKey: PublicKey): Identity

Creates a new SECP256K1 identity backed by this public key.

open static fun fromPublicKey(publicKey: PublicKey): Identity

Creates a new Ed25519 identity backed by this public key.

fromSecretKey

open static fun fromSecretKey(secretKey: SecretKey): Identity

Creates a new Ed25519 identity backed by this secret key.

open static fun fromSecretKey(secretKey: SecretKey): Identity

Creates a new SECP256K1 identity backed by this secret key.

publicKeyAsBase64String

abstract fun publicKeyAsBase64String(): String

Provides the base64 encoded representation of the public key of the identity

random

open static fun random(): Identity

Creates a new random Ed25519 identity.

randomEd25519

open static fun randomEd25519(): Identity

Creates a new random Ed25519 identity.

randomSECP256K1

open static fun randomSECP256K1(): Identity

Creates a new random secp251k1 identity.

secp256k1PublicKey

abstract fun secp256k1PublicKey(): PublicKey

Provides the identity's associated SECP256K1 public key.

sign

abstract fun sign(message: Bytes): Bytes

Hashes data using the secret key of the identity.

toCanonicalForm

open fun toCanonicalForm(): String

Encodes the identity into a canonical Scuttlebutt identity string

verify

abstract fun verify(signature: Bytes, message: Bytes): Boolean

Verifies a signature matches a message according to the public key of the identity.