Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/strmprivacy/rust-driver
the Rust language STRMPrivacy driver
https://github.com/strmprivacy/rust-driver
Last synced: 6 days ago
JSON representation
the Rust language STRMPrivacy driver
- Host: GitHub
- URL: https://github.com/strmprivacy/rust-driver
- Owner: strmprivacy
- License: apache-2.0
- Created: 2022-05-24T08:47:06.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2022-07-14T13:43:28.000Z (over 2 years ago)
- Last Synced: 2024-10-12T04:28:30.110Z (about 1 month ago)
- Language: Rust
- Size: 136 KB
- Stars: 2
- Watchers: 5
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
![Crates.io](https://img.shields.io/crates/v/strm-privacy-driver)
# What is STRM Privacy
[STRMPrivacy](https://strmprivacy.io/) is a privacy (and security) focused data processing platform. Define your data shape and the privacy implications in a data contract, and we take care of all the necessary transformations and split your data into privacy streams, a dedicated purpose-bound data interface that contains, for instance, only anonymized data.## STRMPrivacy rust driver
this crate provides a convenient driver to authenticate and send events to the
STRMPrivacy api.The driver consists out of 2 main components
- `StrmPrivacyClient`: Client to connect to the STRMPrivacy backend
- `StrmPrivacyValue`: Trait to convert structs and schemas into values that the client can send### Generating structure based on a STRMPrivacy schema
When using our `cli` we can generate Rust code based on a `schema` we have created using the following command:
`strm get schema-code <*handle*/*schema_name*/*version*> --language=rust`This will generate a rust project with the necessary scripts to generate a new package to be used in your project
### Example usage
Using and initializing the STRMPrivacy client to send event data to our api.
```rust
use strm_privacy_driver::{StrmPrivacyClient, StrmStatusCode};
use std::env;
use strm_privacy_driver::test::demo::{DemoEvent, StrmMeta};
use strm_privacy_driver::error::Error;#[tokio::main]
async fn main() -> Result<(), Error> {// initialize the env variables
let client_id = env::var("CLIENT_ID").expect("no CLIENT_ID found in environment");
let client_secret = env::var("CLIENT_SECRET").expect("no CLIENT_SECRET found in environment");let mut strm_privacy_client = StrmPrivacyClient::default(client_id, client_secret).await?;
let event = create_event();
// catch specific status_codes and decide what to do
match strm_privacy_client.send_event(event).await? {
(StrmStatusCode::NO_CONTENT, _) => {}
(status_code, message) => {assert!(false)}
}Ok(())
}// create new event based on the example schema
fn create_event() -> DemoEvent {
DemoEvent {
strm_meta: StrmMeta {
event_contract_ref: "strmprivacy/example/1.3.0".to_string(),
nonce: None,
timestamp: None,
key_link: None,
billing_id: None,
consent_levels: vec![0],
},
unique_identifier: Some("unique".to_string()),
consistent_value: "consistent".to_string(),
some_sensitive_value: Some("sensitive".to_string()),
not_sensitive_value: Some("not sensitive".to_string()),
}
}
```# Contributing
If you encounter issues while using the chart, please check whether the issue you encounter has already been listed in the issue list. If not, feel free to create an issue.Pull requests are greatly appreciated.