// Generated by Lisette bindgen
// Source: crypto/ed25519 (Go stdlib)
// Go: 1.25.10
// Lisette: 0.2.1

import "go:crypto"
import "go:io"

/// GenerateKey generates a public/private key pair using entropy from rand.
/// If rand is nil, [crypto/rand.Reader] will be used.
/// 
/// The output of this function is deterministic, and equivalent to reading
/// [SeedSize] bytes from rand, and passing them to [NewKeyFromSeed].
pub fn GenerateKey(rand: io.Reader) -> Result<(PublicKey, PrivateKey), error>

/// NewKeyFromSeed calculates a private key from a seed. It will panic if
/// len(seed) is not [SeedSize]. This function is provided for interoperability
/// with RFC 8032. RFC 8032's private keys correspond to seeds in this
/// package.
pub fn NewKeyFromSeed(seed: Slice<byte>) -> PrivateKey

/// Sign signs the message with privateKey and returns a signature. It will
/// panic if len(privateKey) is not [PrivateKeySize].
pub fn Sign(privateKey: PrivateKey, message: Slice<byte>) -> Slice<byte>

/// Verify reports whether sig is a valid signature of message by publicKey. It
/// will panic if len(publicKey) is not [PublicKeySize].
/// 
/// The inputs are not considered confidential, and may leak through timing side
/// channels, or if an attacker has control of part of the inputs.
pub fn Verify(publicKey: PublicKey, message: Slice<byte>, sig: Slice<byte>) -> bool

/// VerifyWithOptions reports whether sig is a valid signature of message by
/// publicKey. A valid signature is indicated by returning a nil error. It will
/// panic if len(publicKey) is not [PublicKeySize].
/// 
/// If opts.Hash is [crypto.SHA512], the pre-hashed variant Ed25519ph is used and
/// message is expected to be a SHA-512 hash, otherwise opts.Hash must be
/// [crypto.Hash](0) and the message must not be hashed, as Ed25519 performs two
/// passes over messages to be signed.
/// 
/// The inputs are not considered confidential, and may leak through timing side
/// channels, or if an attacker has control of part of the inputs.
pub fn VerifyWithOptions(
  publicKey: PublicKey,
  message: Slice<byte>,
  sig: Slice<byte>,
  opts: Ref<Options>,
) -> Result<(), error>

/// Options can be used with [PrivateKey.Sign] or [VerifyWithOptions]
/// to select Ed25519 variants.
pub struct Options {
  pub Hash: crypto.Hash,
  pub Context: string,
}

/// PrivateKey is the type of Ed25519 private keys. It implements [crypto.Signer].
pub struct PrivateKey(Slice<byte>)

/// PublicKey is the type of Ed25519 public keys.
pub struct PublicKey(Slice<byte>)

pub const PrivateKeySize = 64

pub const PublicKeySize = 32

pub const SeedSize = 32

pub const SignatureSize = 64

impl Options {
  /// HashFunc returns o.Hash.
  fn HashFunc(self: Ref<Options>) -> crypto.Hash
}

impl PrivateKey {
  /// Equal reports whether priv and x have the same value.
  fn Equal(self, x: crypto.PrivateKey) -> bool

  /// Public returns the [PublicKey] corresponding to priv.
  fn Public(self) -> crypto.PublicKey

  /// Seed returns the private key seed corresponding to priv. It is provided for
  /// interoperability with RFC 8032. RFC 8032's private keys correspond to seeds
  /// in this package.
  fn Seed(self) -> Slice<byte>

  /// Sign signs the given message with priv. rand is ignored and can be nil.
  /// 
  /// If opts.HashFunc() is [crypto.SHA512], the pre-hashed variant Ed25519ph is used
  /// and message is expected to be a SHA-512 hash, otherwise opts.HashFunc() must
  /// be [crypto.Hash](0) and the message must not be hashed, as Ed25519 performs two
  /// passes over messages to be signed.
  /// 
  /// A value of type [Options] can be used as opts, or crypto.Hash(0) or
  /// crypto.SHA512 directly to select plain Ed25519 or Ed25519ph, respectively.
  fn Sign(self, rand: io.Reader, message: Slice<byte>, opts: crypto.SignerOpts) -> Result<Slice<byte>, error>
}

impl PublicKey {
  /// Equal reports whether pub and x have the same value.
  fn Equal(self, x: crypto.PublicKey) -> bool
}
