Debian Codegraph @

third_party/rust/mls-rs-identity-x509/src/util.rs

raw
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 mls_rs_core::identity::Credential;
6
7 use crate::{CertificateChain, X509IdentityError};
8
9 pub(crate) fn credential_to_chain(
10 credential: &Credential,
11 ) -> Result<CertificateChain, X509IdentityError> {
12 credential
13 .as_x509()
14 .ok_or_else(|| X509IdentityError::UnsupportedCredentialType(credential.credential_type()))
15 .cloned()
16 }