tuweni / org.apache.tuweni.scuttlebutt / Identity

Identity

interface Identity (source)

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

Types

Curve

Curves supported by those identities.

class Curve

Functions

curve

Provides the curve associated with this identity

abstract fun curve(): Curve!

curveName

Provides the name of the curve associated with this identity

open fun curveName(): String!

ed25519PublicKey

Provides the identity's associated Ed25519 public key.

abstract fun ed25519PublicKey(): PublicKey!

fromKeyPair

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.

open static fun fromKeyPair(keyPair: KeyPair!): Identity!

fromPublicKey

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.

open static fun fromPublicKey(publicKey: PublicKey!): Identity!

fromSecretKey

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.

open static fun fromSecretKey(secretKey: SecretKey!): Identity!

publicKeyAsBase64String

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

abstract fun publicKeyAsBase64String(): String!

random

Creates a new random Ed25519 identity.

open static fun random(): Identity!

randomEd25519

Creates a new random Ed25519 identity.

open static fun randomEd25519(): Identity!

randomSECP256K1

Creates a new random secp251k1 identity.

open static fun randomSECP256K1(): Identity!

secp256k1PublicKey

Provides the identity's associated SECP256K1 public key.

abstract fun secp256k1PublicKey(): PublicKey!

sign

Hashes data using the secret key of the identity.

abstract fun sign(message: Bytes!): Bytes!

toCanonicalForm

Encodes the identity into a canonical Scuttlebutt identity string

open fun toCanonicalForm(): String!

verify

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

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