Skip to content

Commit

Permalink
Handle change in Verifiable trait
Browse files Browse the repository at this point in the history
  • Loading branch information
neekolas committed Jan 12, 2024
1 parent e299b73 commit d533eff
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions openmls/src/extensions/protected_metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,15 @@ impl Signable for ProtectedMetadataTbs {
/// XXX: This really should not be implemented on [`ProtectedMetadata`] but on
/// the verifiable version.
mod verifiable {
use openmls_traits::crypto::OpenMlsCrypto;

use crate::prelude_test::OpenMlsSignaturePublicKey;

use super::*;

impl Verifiable for ProtectedMetadata {
type VerifiedStruct = ProtectedMetadata;

fn unsigned_payload(&self) -> Result<Vec<u8>, tls_codec::Error> {
self.payload.tls_serialize_detached()
}
Expand All @@ -170,23 +176,22 @@ mod verifiable {
fn label(&self) -> &str {
SIGNATURE_LABEL
}

fn verify(
self,
_crypto: &impl OpenMlsCrypto,
_pk: &OpenMlsSignaturePublicKey,
) -> Result<Self::VerifiedStruct, SignatureError> {
Ok(self)
}
}

impl VerifiedStruct for ProtectedMetadata {}

mod private_mod {
#[derive(Default)]
pub struct Seal;
}

impl VerifiedStruct<ProtectedMetadata> for ProtectedMetadata {
type SealingType = private_mod::Seal;

fn from_verifiable(v: ProtectedMetadata, _seal: Self::SealingType) -> Self {
Self {
payload: v.payload,
signature: v.signature,
}
}
}
}

#[cfg(test)]
Expand Down

0 comments on commit d533eff

Please sign in to comment.