Skip to content

Commit 17e2ee2

Browse files
committed
Resurface full interface as part of core
This commit updates the `core` module to resurface the whole parsec interface, making it easier for clients to access the same version of the interface as used in the client internals. Signed-off-by: Ionut Mihalcea <[email protected]>
1 parent 722eba1 commit 17e2ee2

File tree

4 files changed

+20
-14
lines changed

4 files changed

+20
-14
lines changed

Cargo.toml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,15 @@ categories = ["development-tools"]
1212
edition = "2018"
1313

1414
[dependencies]
15-
parsec-interface = "0.13.0"
15+
parsec-interface = "0.14.0"
1616
num = "0.2.1"
1717
rand = "0.7.3"
1818
log = "0.4.8"
19-
derivative = "2.1.0"
19+
derivative = "2.1.1"
2020
uuid = "0.7.4"
2121

2222
[dev-dependencies]
2323
mockstream = "0.0.3"
24+
25+
[features]
26+
testing = ["parsec-interface/testing"]

src/core/basic_client.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// SPDX-License-Identifier: Apache-2.0
33
//! Basic client for Parsec integration
44
use super::operation_client::OperationClient;
5-
use super::{Opcode, ProviderID};
65
use crate::auth::AuthenticationData;
76
use crate::error::{ClientErrorKind, Error, Result};
87
use parsec_interface::operations::list_opcodes::Operation as ListOpcodes;
@@ -17,6 +16,7 @@ use parsec_interface::operations::psa_key_attributes::KeyAttributes;
1716
use parsec_interface::operations::psa_sign_hash::Operation as PsaSignHash;
1817
use parsec_interface::operations::psa_verify_hash::Operation as PsaVerifyHash;
1918
use parsec_interface::operations::{NativeOperation, NativeResult};
19+
use parsec_interface::requests::{Opcode, ProviderID};
2020
use std::collections::HashSet;
2121

2222
/// Core client for Parsec service
@@ -49,7 +49,7 @@ use std::collections::HashSet;
4949
///```no_run
5050
///# use parsec_client::auth::AuthenticationData;
5151
///# use parsec_client::BasicClient;
52-
///# use parsec_client::core::ProviderID;
52+
///# use parsec_client::core::interface::requests::ProviderID;
5353
///# let client: BasicClient = BasicClient::new(AuthenticationData::AppIdentity(String::from("app-name")));
5454
///let res = client.ping();
5555
///
@@ -71,7 +71,7 @@ use std::collections::HashSet;
7171
///```no_run
7272
///# use parsec_client::auth::AuthenticationData;
7373
///# use parsec_client::BasicClient;
74-
///# use parsec_client::core::ProviderID;
74+
///# use parsec_client::core::interface::requests::ProviderID;
7575
///# let client: BasicClient = BasicClient::new(AuthenticationData::AppIdentity(String::from("app-name")));
7676
///use uuid::Uuid;
7777
///
@@ -93,9 +93,9 @@ use std::collections::HashSet;
9393
///```no_run
9494
///# use parsec_client::auth::AuthenticationData;
9595
///# use parsec_client::BasicClient;
96-
///# use parsec_client::core::ProviderID;
96+
///# use parsec_client::core::interface::requests::ProviderID;
9797
///# let mut client: BasicClient = BasicClient::new(AuthenticationData::AppIdentity(String::from("app-name")));
98-
///use parsec_client::core::Opcode;
98+
///use parsec_client::core::interface::requests::Opcode;
9999
///
100100
///let desired_provider = ProviderID::Pkcs11;
101101
///let provider_opcodes = client
@@ -114,10 +114,10 @@ use std::collections::HashSet;
114114
///```no_run
115115
///# use parsec_client::auth::AuthenticationData;
116116
///# use parsec_client::BasicClient;
117-
///# use parsec_client::core::ProviderID;
117+
///# use parsec_client::core::interface::requests::ProviderID;
118118
///# let client: BasicClient = BasicClient::new(AuthenticationData::AppIdentity(String::from("app-name")));
119-
///use parsec_client::core::psa_algorithm::{Algorithm, AsymmetricSignature, Hash};
120-
///use parsec_client::core::psa_key_attributes::{KeyAttributes, KeyPolicy, KeyType, UsageFlags};
119+
///use parsec_client::core::interface::operations::psa_algorithm::{Algorithm, AsymmetricSignature, Hash};
120+
///use parsec_client::core::interface::operations::psa_key_attributes::{KeyAttributes, KeyPolicy, KeyType, UsageFlags};
121121
///
122122
///let key_name = String::from("rusty key 🔑");
123123
///// This algorithm identifier will be used within the key policy (i.e. what

src/core/mod.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
// Copyright 2020 Contributors to the Parsec project.
22
// SPDX-License-Identifier: Apache-2.0
33
//! Core helpers for integration with the Parsec service
4+
//!
5+
//! The `interface` module is a version of the [`parsec-interface`](https://crates.io/crates/parsec-interface)
6+
//! crate and is meant to be used in conjuction with the [basic](basic_client/struct.BasicClient.html),
7+
//! [operation](operation_client/struct.OperationClient.html) and [request](request_client/struct.RequestClient.html)
8+
//! structures.
49
pub mod basic_client;
510
pub mod ipc_handler;
611
pub mod operation_client;
712
pub mod request_client;
813
mod testing;
914

10-
pub use parsec_interface::operations::{psa_algorithm, psa_key_attributes};
11-
pub use parsec_interface::operations_protobuf::ProtobufConverter;
12-
pub use parsec_interface::requests::{Opcode, ProviderID};
15+
pub use parsec_interface as interface;

src/core/testing/core_tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// SPDX-License-Identifier: Apache-2.0
33
use super::{FailingMockIpc, TestBasicClient, DEFAULT_APP_NAME};
44
use crate::auth::AuthenticationData;
5-
use crate::core::ProviderID;
65
use crate::error::{ClientErrorKind, Error};
76
use crate::BasicClient;
87
use mockstream::{FailingMockStream, MockStream};
@@ -13,6 +12,7 @@ use parsec_interface::operations::psa_key_attributes::*;
1312
use parsec_interface::operations::Convert;
1413
use parsec_interface::operations::{NativeOperation, NativeResult};
1514
use parsec_interface::operations_protobuf::ProtobufConverter;
15+
use parsec_interface::requests::ProviderID;
1616
use parsec_interface::requests::Response;
1717
use parsec_interface::requests::ResponseStatus;
1818
use parsec_interface::requests::{request::RequestHeader, Request};

0 commit comments

Comments
 (0)