diff --git a/vault_contract/README.md b/vault_contract/README.md
index 05cf967..7d01c2a 100644
--- a/vault_contract/README.md
+++ b/vault_contract/README.md
@@ -2,7 +2,9 @@
# Vault Smart Contract
-The Vault smart contract is a secure repository designed to safeguard Verifiable Credentials (VCs) in a blockchain environment. The primary purpose of this contract is to provide a dedicated and secure storage solution for managing Verifiable Credentials associated with decentralized identities (DIDs).
+The Vault smart contract is a secure repository for safeguarding Verifiable Credentials (VCs).
+
+Through the implementation of control access mechanisms, the smart contract authorizes issuers to deposit credentials through issuance contracts. VCs stored within the Vault utilize an encryption mechanism that prioritizes security and data privacy.
## Development
@@ -33,7 +35,7 @@ Before getting started with the development of the Vault smart contract, ensure
## Vault Contract Functions
-The following functions define the behavior of the Vault smart contract, responsible for managing decentralized identities (DIDs) and their associated verifiable credentials (VCs).
+The following functions define the behavior of the Vault smart contract.
### `initialize`
Initializes the Vault Contract by setting the admin and the initial DIDs.
@@ -42,7 +44,6 @@ Initializes the Vault Contract by setting the admin and the initial DIDs.
fn initialize(e: Env, admin: Address, dids: Vec);
```
-
#### Parameters:
- e: Environment object.
@@ -63,7 +64,8 @@ soroban contract invoke \
```
### `authorize_issuer`
-Authorizes an issuer adding it to the issuers map.
+
+Authorizes an issuer to issue verifiable credentials to a specific DID. If the DID is already registered or revoked, a specific error will be returned. The admin account is the only party authorized to invoke this function.
```rust
fn authorize_issuer(e: Env, admin: Address, issuer: Address, did: String);
@@ -91,7 +93,7 @@ soroban contract invoke \
```
### `revoke_issuer`
-Revokes an issuer setting its is_revoked property to true.
+Revokes an issuer to prevent the issuance of verifiable credentials to a specific DID in the vault. The admin account is the only party authorized to invoke this function.
```rust
fn revoke_issuer(e: Env, admin: Address, issuer: Address, did: String);
@@ -119,7 +121,7 @@ soroban contract invoke \
```
### `store_vc`:
-Stores the verifiable credential.
+Stores a verifiable credential related to a holder DID. This function is invoked by the issuer from the vc_issuance_contract smart contract.
```rust
fn store_vc(
@@ -136,7 +138,7 @@ fn store_vc(
- `e`: Environment object.
- `vc_id`: String representing the unique identifier of the verifiable credential.
-- `vc_data`: String containing the verifiable credential data.
+- `vc_data`: String containing the encrypted verifiable credential data.
- `recipient_did`: String representing the DID of the credential recipient.
- `issuer_pk`: Address of the issuer's public key.
- `issuance_contract_address`: Address of the contract responsible for credential issuance.
@@ -150,8 +152,8 @@ soroban contract invoke \
--network testnet \
-- \
store_vc \
- --vc_id "vc_id3" \
- --vc_data "vc_data" \
+ --vc_id "vc_id" \
+ --vc_data "eoZXggNeVDW2g5GeA0G2s0QJBn3SZWzWSE3fXM9V6IB5wWIfFJRxPrTLQRMHulCF62bVQNmZkj7zbSa39fVjAUTtfm6JMio75uMxoDlAN/Y" \
--recipient_did "did:chaincerts:3mtjfbxad3wzh7qa4w5f7q4h" \
--issuer_pk GDSOFBSZMFIY5BMZT3R5FCQK6MJAR2PGDSWHOMHZFGFFGKUO32DBNJKC \
--issuance_contract_address CBRM3HA7GLEI6QQ3O55RUKVRDSQASARUPKK6NXKXKKPWEYLE533GDYQD
@@ -177,11 +179,15 @@ soroban contract invoke \
--network testnet \
-- \
get_vc \
- --vc_id "vc_id"
+ --vc_id "t5iwuct2njbbcdu2nfwr32ib"
+
+# Response: VerifiableCredential
+
+{"data":"eoZXggNeVDW2g5GeA0G2s0QJBn3SZWzWSE3fXM9V6IB5wWIfFJRxPrTLQRMHulCF62bVQNmZkj7zbSa39fVjAUTtfm6JMio75uMxoDlAN/Y","holder_did":"did:chaincerts:3mtjfbxad3wzh7qa4w5f7q4h","id":"t5iwuct2njbbcdu2nfwr32ib","issuance_contract":"CBWDZIBI5NZ77EPSZLJDS3RTM57D3CIBKAIIOFER2TZEZATUYBASYF65"}
```
### `list_vcs`:
-Retrieves the list of verifiable credentials from the storage grouped by DID.
+Retrieves the list of verifiable credentials from the storage grouped by DID. The admin account is the only party authorized to invoke this function.
```rust
fn list_vcs(e: Env) -> Map;
@@ -200,10 +206,13 @@ soroban contract invoke \
--network testnet \
-- \
list_vcs
+
+#Response: Map
+{"\"did:chaincerts:3mtjfbxad3wzh7qa4w5f7q4h\"":{"did":"did:chaincerts:3mtjfbxad3wzh7qa4w5f7q4h","is_revoked":false,"vcs":[{"data":"eoZXggNeVDW2g5GeA0G2s0QJBn3SZWzWSE3fXM9V6IB5wWIfFJRxPrTLQRMHulCF62bVQNmZkj7zbSa39fVjAUTtfm6JMio75uMxoDlAN/Y","holder_did":"did:chaincerts:3mtjfbxad3wzh7qa4w5f7q4h","id":"t5iwuct2njbbcdu2nfwr32ib","issuance_contract":"CBWDZIBI5NZ77EPSZLJDS3RTM57D3CIBKAIIOFER2TZEZATUYBASYF65"}]}}
```
### `revoke_did`:
-Revokes a DID given its DID URI.
+Revokes a DID based on its DID URI to prevent the issuance of verifiable credentials to the specific DID. The admin account is the only party authorized to invoke this function.
```rust
fn revoke_did(e: Env, admin: Address, did: String);
@@ -229,7 +238,7 @@ soroban contract invoke \
```
### `register_did`:
-Registers a new DID given a DID URI.
+Registers a new DID in the vault given a DID URI. The admin account is the only party authorized to invoke this function.
```rust
fn register_did(e: Env, admin: Address, did: String);
diff --git a/vc_issuance_contract/README.md b/vc_issuance_contract/README.md
index 20d9d73..036426d 100644
--- a/vc_issuance_contract/README.md
+++ b/vc_issuance_contract/README.md
@@ -63,8 +63,25 @@ Initializes the VC Issuance Contract by setting the admin.
fn initialize(e: Env, admin: Address);
```
+#### Parameters:
+
+- e: Environment object.
+- admin: Address of the smart contract administrator.
+
+#### Example:
+
+```bash
+soroban contract invoke \
+ --id CONTRACT_ID \
+ --source SOURCE_ACCOUNT_SECRET_KEY \
+ --network testnet \
+ -- \
+ initialize \
+ --admin GC6RRIN6XUZ7NBQS3AYWS6OOWFRLNBOHAYKX3IBYLPKGRODWEANTWJDA
+```
+
### `issue`:
- Issues a new Verifiable Credential and returns the Verifiable Credential id as String.
+ Issues a new Verifiable Credential and returns the Verifiable Credential id as String. The admin account is the only party authorized to invoke this function.
```rust
fn issue(
@@ -83,6 +100,20 @@ fn issue(
- `vc_data`: String representing encrypted Verifiable Credential data.
- `storage_address`: Vault smart contract address
+#### Example:
+
+```bash
+soroban contract invoke \
+ --id CONTRACT_ID \
+ --source SOURCE_ACCOUNT_SECRET_KEY \
+ --network testnet \
+ -- \
+ revoke \
+ --admin GC6RRIN6XUZ7NBQS3AYWS6OOWFRLNBOHAYKX3IBYLPKGRODWEANTWJDA \
+ --vc_data "eoZXggNeVDW2g5GeA0G2s0QJBn3SZWzWSE3fXM9V6IB5wWIfFJRxPrTLQRMHulCF62bVQNmZkj7zbSa39fVjAUTtfm6JMio75uMxoDlAN/Y" \
+ --storage_address GR2RRIN6XUZ7NBQS3AYWS6OOWFRLNBOHAYKX3IBYLPKGRODWEANTWJDA
+```
+
### `verify`
Verifies if the Verifiable Credential has been revoked, it returns a Map with the respective status.
@@ -95,23 +126,65 @@ fn verify(e: Env, vc_id: String) -> Map;
- `e`: Environment object.
- `vc_id`: String representing the VC ID to verify.
+#### Example:
+
+```bash
+soroban contract invoke \
+ --id CONTRACT_ID \
+ --source SOURCE_ACCOUNT_SECRET_KEY \
+ --network testnet \
+ -- \
+ verify \
+ --vc_id "vc_id"
+```
+
### `revoke`
-Revokes a verifiable credential in a specific date.
+Revokes a verifiable credential in a specific date. The admin account is the only party authorized to invoke this function.
```rust
fn revoke(e: Env, admin: Address, vc_id: String, date: String);
```
-Parameters:
+#### Parameters:
- `e`: Environment object.
- `admin`: Address of the smart contract administrator.
- `vc_id`: ID of the VC to be revoked.
- `date`: String representing the date where the VC is revoked.
+#### Example:
+
+```bash
+soroban contract invoke \
+ --id CONTRACT_ID \
+ --source SOURCE_ACCOUNT_SECRET_KEY \
+ --network testnet \
+ -- \
+ revoke \
+ --admin GC6RRIN6XUZ7NBQS3AYWS6OOWFRLNBOHAYKX3IBYLPKGRODWEANTWJDA \
+ --vc_id "vc_id" \
+ --date "01/01/2010 14:10:10"
+```
## Deployment
-...
+
+1. Build the contract:
+ ```
+ soroban contract build
+ ```
+
+ This will generate a WASM file for the contract in the `target/wasm32-unknown-unknown/release/` directory.
+
+2. Deploy using Soroban CLI:
+ ```bash
+ soroban contract deploy \
+ --source-account SOURCE_ACCOUNT_SECRET_KEY \
+ --rpc-url https://rpc-futurenet.stellar.org \
+ --network-passphrase 'Test SDF Network ; October 2022' \
+ --wasm target/wasm32-unknown-unknown/release/vc_issuance_contract.wasm
+
+ CONTRACT_ID
+ ```
## Contract Errors
@@ -119,13 +192,8 @@ Parameters:
| --- | --- | --- |
| 1 | `AlreadyInitialized` | Contract has already been initialized |
| 2 | `NotAuthorized` | Invoker lacks the necessary authorization as the contract administrator |
-| 3 | `EmptyDIDs` | The array of DIDs is empty |
-| 4 | `IssuerNotFound` | The specified issuer was not found |
-| 5 | `DidRevoked` | The DID cannot perform the action because it has been revoked |
-| 6 | `DidNotFound` | The specified DID was not found |
-| 7 | `IssuerRevoked` | The issuer cannot perform the action because it has been revoked |
-| 8 | `VCNotFound` | The Verifiable Credential (VC) was not found |
-| 9 | `DuplicatedDID` | The DID is already registered |
+| 3 | `AmountLimitExceeded` | The amount exceeds the issuance contract's capacity for certificates |
+| 4 | `VCNotFound` | The Verifiable Credential (VC) was not found |
## Changelog
Features and bug fixes are listed in the [CHANGELOG][changelog] file.