Skip to content

Commit 11c68be

Browse files
authored
Merge pull request #341 from adorsys/339-update-readme-files
update README files
2 parents 7ee6f4c + 1a5f87e commit 11c68be

File tree

7 files changed

+45
-43
lines changed

7 files changed

+45
-43
lines changed

crates/database/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@ impl Identifiable for MyEntity {
4141

4242
```rust
4343
struct MyEntityRepository {
44-
collection: Arc<RwLock<Collection<MyEntity>>>,
44+
collection: Collection<MyEntity>,
4545
}
4646

4747
#[async_trait]
4848
impl Repository<MyEntity> for MyEntityRepository {
49-
fn get_collection(&self) -> Arc<RwLock<Collection<MyEntity>>> {
49+
fn get_collection(&self) -> Collection<MyEntity> {
5050
self.collection.clone()
5151
}
5252
}
@@ -57,7 +57,7 @@ impl Repository<MyEntity> for MyEntityRepository {
5757
```rust
5858
let db = get_or_init_database();
5959
let repo = MyEntityRepository {
60-
collection: Arc::new(RwLock::new(db.read().await.collection("my_entities"))),
60+
collection: db.collection("my_entities"),
6161
};
6262
let entity = MyEntity { id: None, name: "example".to_string() };
6363
repo.store(entity).await?;

crates/keystore/README.md

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,22 @@
11
# Keystore Crate
22

3-
The `keystore` crate is a utility library for managing cryptographic secrets. It is used in the [Didcomm Mediator](https://github.com/adorsys/didcomm-mediator-rs/) to store and retrieve cryptographic keys for DIDcomm interactions.
3+
The `keystore` crate is a utility library for managing cryptographic secrets. It is used in the [Didcomm Mediator](https://github.com/adorsys/didcomm-mediator-rs/) to securely store, retrieve and delete cryptographic keys for DIDcomm interactions.
44

55
## Usage
66

77
This crate is internal to the [Didcomm Mediator](https://github.com/adorsys/didcomm-mediator-rs/). Below is an example of interacting with the keystore:
88

99
```rust
10-
use keystore::{KeyStore, Secrets};
11-
use mongodb::bson::{doc, Bson, Document};
10+
use keystore::KeyStore;
1211
use did_utils::jwk::Jwk;
1312

13+
// Create a new AWS KMS client
14+
let config = aws_config::load_from_env().await;
15+
let client = aws_sdk_kms::Client::new(&config);
16+
let key_id = "test-key".to_string();
17+
1418
// Initialize the keystore
15-
let keystore = KeyStore::get();
19+
let keystore = KeyStore::with_aws_kms(client, key_id);
1620

1721
let jwk: Jwk = serde_json::from_str(
1822
r#"{
@@ -25,16 +29,11 @@ let jwk: Jwk = serde_json::from_str(
2529
.unwrap();
2630

2731
// Store a secret
28-
let secret = Secrets {
29-
id: Some(ObjectId::new()),
30-
kid: "key-1".to_string(),
31-
secret_material: jwk,
32-
};
33-
keystore.store(secret).await?;
32+
keystore.store("key-1", &jwk).await?;
3433

3534
// Retrieve a secret by ID
36-
let secret = keystore.find_one(doc! {"kid": "key-1"}).await?;
35+
let secret: Option<Jwk> = keystore.retrieve("key-1").await?;
3736

3837
// Delete a secret by ID
39-
keystore.delete_one(secret.id.unwrap()).await?;
38+
keystore.delete("key-1").await?;
4039
```

crates/plugin-api/README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,24 @@ lazy_static! {
7474
];
7575
}
7676
```
77+
78+
* **Add the plugin in the root `Cargo.toml`**
79+
80+
```toml
81+
[workspace]
82+
members = [
83+
...
84+
"crates/web-plugins/my-plugin-name",
85+
]
86+
87+
[workspace.dependencies]
88+
my-plugin-name = { path = "./crates/web-plugins/my-plugin-name", version = "0.1.0" }
89+
90+
[features]
91+
default = [
92+
...
93+
"plugin-myplugin"
94+
]
95+
96+
plugin-myplugin = [deps:my-plugin-name]
97+
```

crates/web-plugins/did-endpoint/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ let storage_dirpath = std::env::var("STORAGE_DIRPATH").unwrap(),
2020
let server_public_domain = std::env::var("SERVER_PUBLIC_DOMAIN").unwrap();
2121

2222
let mut filesystem = filesystem::StdFileSystem;
23-
let keystore = keystore::KeyStore::get();
23+
let keystore = keystore::KeyStore::with_mongodb();
2424

2525
// Generate and persist a new DID document
2626
didgen::didgen(

crates/web-plugins/didcomm-messaging/did-utils/README.md

Lines changed: 3 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ A Rust library for implementing reusable utility code for DID-based applications
55
## Features
66

77
* Manipulate JSON DID documents.
8-
* Create keys.
9-
* Sign, verify, encrypt, and decrypt DID documents.
8+
* Create and manage cryptographic keys.
9+
* Sign, verify, encrypt, and decrypt content.
10+
* Various DID methods implementations.
1011

1112
## Installation
1213

@@ -17,31 +18,6 @@ Add this to your `Cargo.toml`:
1718
did-utils = "0.1"
1819
```
1920

20-
## Usage
21-
22-
```rust
23-
use did_utils::*;
24-
25-
// Create a DID document.
26-
let did_document = DidDocument::new(
27-
"did:example:1234567890",
28-
"My DID",
29-
"My public key",
30-
);
31-
32-
// Sign the DID document.
33-
let signature = did_document.sign(&my_private_key);
34-
35-
// Verify the signature of the DID document.
36-
let is_valid = did_document.verify_signature(&signature);
37-
38-
// Encrypt the DID document.
39-
let encrypted_did_document = did_document.encrypt(&my_public_key);
40-
41-
// Decrypt the encrypted DID document.
42-
let decrypted_did_document = encrypted_did_document.decrypt(&my_private_key);
43-
```
44-
4521
## Documentation
4622

4723
The documentation for the library is available [here](https://docs.rs/did-utils)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Interface for registering DIDComm messaging protocols as plugins
2+
3+
See the [mock-protocol](../README.md) implementation for an example of how to implement a new protocol in the [project](https://github.com/adorsys/didcomm-mediator-rs).
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# DIDComm Messaging protocols
2+
3+
You can find the list of currently supported protocols in the [README](https://github.com/adorsys/didcomm-mediator-rs#project-feature-implementation-tracker).

0 commit comments

Comments
 (0)