XRPPrivateKey.random constructor

XRPPrivateKey.random({
  1. XRPKeyAlgorithm algorithm = XRPKeyAlgorithm.ed25519,
})

Factory constructor for generating a random XRP private key. algorithm specifies the cryptographic algorithm, with ED25519 being the default.

Implementation

factory XRPPrivateKey.random(
    {XRPKeyAlgorithm algorithm = XRPKeyAlgorithm.ed25519}) {
  /// Generate 16 random bytes as entropy
  final rand = QuickCrypto.generateRandom(16);

  /// Create an XRP private key from the generated entropy
  return XRPPrivateKey.fromEntropy(BytesUtils.toHexString(rand),
      algorithm: algorithm);
}