1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
//! MuSug Process Context

use crate::PublicKey;
use bacteria::Transcript;
use mohan::dalek::scalar::Scalar;

/// The context for signing - can either be a Multikey or Multimessage context.
pub trait MuSigContext {
    /// Takes a mutable transcript, and commits the internal context to the transcript.
    fn commit(&self, transcript: &mut Transcript);

    /// Takes an index of a public key and mutable transcript,
    /// and returns the suitable challenge for that public key.
    fn challenge(&self, index: usize, transcript: &mut Transcript) -> Scalar;

    /// Length of the number of pubkeys in the context
    fn len(&self) -> usize;

    /// Returns the pubkey for the index i
    fn key(&self, index: usize) -> PublicKey;
}