MCPcopy Index your code
hub / github.com/bcgit/bc-java / commit

Method commit

mls/src/main/java/org/bouncycastle/mls/protocol/Group.java:1020–1160  ·  view source on GitHub ↗
(Secret leafSecret, CommitOptions commitOptions, MessageOptions msgOptions, CommitParameters params)

Source from the content-addressed store, hash-verified

1018 }
1019
1020 public GroupWithMessage commit(Secret leafSecret, CommitOptions commitOptions, MessageOptions msgOptions, CommitParameters params)
1021 throws Exception
1022 {
1023 Commit commit = new Commit();
1024 List<KeyPackage> joiners = new ArrayList<KeyPackage>();
1025 for (CachedProposal cached : pendingProposals)
1026 {
1027 if (cached.proposal.getProposalType() == ProposalType.ADD)
1028 {
1029 joiners.add(cached.proposal.getAdd().keyPackage);
1030 }
1031
1032 commit.getProposals().add(ProposalOrRef.forRef(cached.proposalRef));
1033 }
1034
1035 // add the extra proposals to those we had cached
1036 if (commitOptions != null)
1037 {
1038 for (Proposal p : commitOptions.extraProposals)
1039 {
1040 if (p.getProposalType() == ProposalType.ADD)
1041 {
1042 joiners.add(p.getAdd().keyPackage);
1043 }
1044
1045 commit.getProposals().add(ProposalOrRef.forProposal(p));
1046 }
1047 }
1048
1049 // for external commit insert an external init proposal
1050 byte[] forceInitSecret = null;
1051 if (params.paramID == EXTERNAL_COMMIT_PARAMS)
1052 {
1053 forceInitSecret = params.forceInitSecret.value().clone();
1054 }
1055
1056 // Apply proposals
1057 Group next = successor();
1058
1059 List<CachedProposal> proposals = mustResolve(commit.getProposals(), index); // check should just send index.value()
1060 if (!validateCachedProposals(proposals, index, params))
1061 {
1062 throw new Exception("Invalid proposal list");
1063 }
1064
1065 JoinersWithPSKS joinersWithpsks = next.apply(proposals);
1066 if (params.paramID == EXTERNAL_COMMIT_PARAMS)
1067 {
1068 next.index = next.tree.addLeaf(params.joinerKeyPackage.getLeafNode());
1069 }
1070
1071 // If this is an external commit, indicate it in the sender field
1072 Sender sender = Sender.forMember(index);
1073 if (params.paramID == EXTERNAL_COMMIT_PARAMS)
1074 {
1075 sender = Sender.forNewMemberCommit();
1076 }
1077

Callers 4

createWelcomeMethod · 0.95
createBranchMethod · 0.95
externalJoinMethod · 0.95
reinitCommitMethod · 0.95

Calls 15

addMethod · 0.95
getProposalsMethod · 0.95
forRefMethod · 0.95
forProposalMethod · 0.95
valueMethod · 0.95
successorMethod · 0.95
mustResolveMethod · 0.95
applyMethod · 0.95
forMemberMethod · 0.95
forNewMemberCommitMethod · 0.95
zeroMethod · 0.95

Tested by

no test coverage detected