1 // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2 // Copyright by contributors to this project.
3 // SPDX-License-Identifier: (Apache-2.0 OR MIT)
4 
5 use super::{
6     confirmation_tag::ConfirmationTag, proposal::ReInitProposal,
7     transcript_hash::InterimTranscriptHash,
8 };
9 use crate::group::{GroupContext, TreeKemPublic};
10 
11 #[derive(Clone, Debug, PartialEq)]
12 #[non_exhaustive]
13 pub struct GroupState {
14     #[cfg(feature = "by_ref_proposal")]
15     pub(crate) proposals: crate::group::ProposalCache,
16     pub(crate) context: GroupContext,
17     pub(crate) public_tree: TreeKemPublic,
18     pub(crate) interim_transcript_hash: InterimTranscriptHash,
19     pub(crate) pending_reinit: Option<ReInitProposal>,
20     pub(crate) confirmation_tag: ConfirmationTag,
21 }
22 
23 impl GroupState {
new( context: GroupContext, current_tree: TreeKemPublic, interim_transcript_hash: InterimTranscriptHash, confirmation_tag: ConfirmationTag, ) -> Self24     pub(crate) fn new(
25         context: GroupContext,
26         current_tree: TreeKemPublic,
27         interim_transcript_hash: InterimTranscriptHash,
28         confirmation_tag: ConfirmationTag,
29     ) -> Self {
30         Self {
31             #[cfg(feature = "by_ref_proposal")]
32             proposals: crate::group::ProposalCache::new(
33                 context.protocol_version,
34                 context.group_id.clone(),
35             ),
36             context,
37             public_tree: current_tree,
38             interim_transcript_hash,
39             pending_reinit: None,
40             confirmation_tag,
41         }
42     }
43 }
44