-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This allows serialisation and deserialisation of the Public and Private structures, which is required for storing these in many database or serialised forms. Signed-off-by: William Brown <[email protected]>
- Loading branch information
Showing
8 changed files
with
86 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
[codespell] | ||
skip = .git,target,Cargo.lock | ||
ignore-words-list = acsend,crate,keypair,daa | ||
ignore-words-list = acsend,crate,keypair,daa,de,ser |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Copyright 2023 Contributors to the Parsec project. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
use serde::{de::DeserializeOwned, Serialize}; | ||
use tss_esapi::traits::{Marshall, UnMarshall}; | ||
|
||
pub fn check_serialise_deserialise< | ||
T: Serialize + DeserializeOwned + Marshall + UnMarshall + Eq + std::fmt::Debug, | ||
>( | ||
val: &T, | ||
) { | ||
let json = serde_json::to_vec(val).expect("Failed to serialise value"); | ||
|
||
let unmarshalled: T = serde_json::from_slice(&json).expect("Failed to deserialise"); | ||
|
||
assert_eq!(val, &unmarshalled); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters