HdKeyPair

scalus.cardano.wallet.hd.HdKeyPair
See theHdKeyPair companion object
class HdKeyPair(val extendedKey: ExtendedKey, val verificationKey: VerificationKey)(using val signer: Ed25519Signer) extends ExtendedKeyPair

HD wallet key pair backed by BIP32-Ed25519 extended key.

This key pair uses the Cardano-style extended format (96 bytes: 64-byte extended secret key + 32-byte chain code) from BIP32-Ed25519 derivation. Supports both hardened and non-hardened child key derivation for CIP-1852 compatibility.

Value parameters

extendedKey

the BIP32-Ed25519 extended key containing private key components and chain code

verificationKey

the Ed25519 public key derived from the private key

Attributes

Companion
object
Graph
Supertypes
trait KeyPair
class Object
trait Matchable
class Any

Members list

Type members

Types

override type Underlying = ExtendedKey

Value members

Concrete methods

def chainCode: Array[Byte]

The chain code for further derivation.

The chain code for further derivation.

Attributes

def deriveChild(index: Int): HdKeyPair

Derive a child key pair at the given index.

Derive a child key pair at the given index.

Value parameters

index

the child index (hardened if >= 0x80000000, normal otherwise)

Attributes

Returns

the derived child key pair

def deriveHardened(index: Int): HdKeyPair

Derive a hardened child key pair.

Derive a hardened child key pair.

Hardened derivation uses the private key and produces keys that cannot be derived from the parent public key.

Value parameters

index

the child index (will be hardened: index + 0x80000000)

Attributes

Returns

the derived child key pair

def deriveNormal(index: Int): HdKeyPair

Derive a non-hardened (normal) child key pair.

Derive a non-hardened (normal) child key pair.

Non-hardened derivation uses the public key. This is required for CIP-1852 paths where role and index are not hardened.

Value parameters

index

the child index (must be < 0x80000000)

Attributes

Returns

the derived child key pair

override def equals(obj: Any): Boolean

Compares the receiver object (this) with the argument object (that) for equivalence.

Compares the receiver object (this) with the argument object (that) for equivalence.

Any implementation of this method should be an equivalence relation:

  • It is reflexive: for any instance x of type Any, x.equals(x) should return true.
  • It is symmetric: for any instances x and y of type Any, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any instances x, y, and z of type Any if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.

If you override this method, you should verify that your implementation remains an equivalence relation. Additionally, when overriding this method it is usually necessary to override hashCode to ensure that objects which are "equal" (o1.equals(o2) returns true) hash to the same scala.Int. (o1.hashCode.equals(o2.hashCode)).

Value parameters

that

the object to compare against this object for equality.

Attributes

Returns

true if the receiver object is equivalent to the argument; false otherwise.

Definition Classes
Any
override def hashCode(): Int

Calculates a hash code value for the object.

Calculates a hash code value for the object.

The default hashing algorithm is platform dependent.

Note that it is allowed for two objects to have identical hash codes (o1.hashCode.equals(o2.hashCode)) yet not be equal (o1.equals(o2) returns false). A degenerate implementation could always return 0. However, it is required that if two objects are equal (o1.equals(o2) returns true) that they have identical hash codes (o1.hashCode.equals(o2.hashCode)). Therefore, when overriding this method, be sure to verify that the behavior is consistent with the equals method.

Attributes

Returns

the hash code value for this object.

Definition Classes
Any
override def sign(message: ByteString): Signature

Sign a message and return the signature.

Sign a message and return the signature.

Value parameters

message

the message to sign

Attributes

Returns

64-byte Ed25519 signature

Definition Classes
override def underlying: Underlying

Attributes

Definition Classes
override def verify(message: ByteString, signature: Signature): Boolean

Verify a signature.

Verify a signature.

Value parameters

message

the message that was signed

signature

the signature to verify

Attributes

Returns

true if the signature is valid

Definition Classes

Deprecated and Inherited methods

override def privateKeyBytes: Array[Byte]

Attributes

Deprecated
[Since version 0.13.0] Use extendedSigningKey.bytes instead
Definition Classes
Inherited from:
ExtendedKeyPair
def publicKeyBytes: Array[Byte]

Attributes

Deprecated
[Since version 0.13.0] Use verificationKey.bytes instead
Inherited from:
KeyPair
def sign(message: Array[Byte]): Array[Byte]

Attributes

Deprecated
[Since version 0.13.0] Use sign(ByteString) instead
Inherited from:
KeyPair
def toTuple: (Array[Byte], Array[Byte])

Attributes

Deprecated
[Since version 0.13.0] Use verificationKey and signing key directly
Inherited from:
KeyPair
def verify(message: Array[Byte], signature: Array[Byte]): Boolean

Attributes

Deprecated
[Since version 0.13.0] Use verify(ByteString, Signature) instead
Inherited from:
KeyPair

Concrete fields

The extended signing key (kL || kR = 64 bytes).

The extended signing key (kL || kR = 64 bytes).

This is the Cardano-style extended key format used for signing.

Attributes

The standard 32-byte signing key (kL only, without kR).

The standard 32-byte signing key (kL only, without kR).

Attributes

The verification (public) key - 32 bytes.

The verification (public) key - 32 bytes.

Attributes

Givens

Givens