Skip to content

Commit f3c3426

Browse files
authored
feat: Plat-6681 expose crud api endpoints (#365)
* chore: initial * feat: add repos logic and config processing logic * chore: fixes * chore: imprve env sync_nonce and add service info log * chore: lint * chore: add notifications crud endpoints * chore: add notification request validations * chore: initial work for notificaitons crud * chore: fix openapi generation * chore: improvements * chore: improvements * chore: improvements * chore: impr * chore: intial signers crud impl * chore: improvements * chore: refactor * chore: impr * refactor + remove vault cloud due to deprecation of service * chore: impr * chore: fix clippy * chore: fixes * chore: add noboost comments * chore: typo * chore: stellar * chore: noboost * feat: plat-6845 implement relayer models * chore: improvements * chore: improvements * chore: impr * chore: implement merge patch logic for relayer * chore: improvements * chore: improvements * chore: impr * chore: clippy * chore: cleanup * chore: add controller tests * chore: more contrller tests * chore: resolve bug * chore: tests * chore: more tests * chore: fixes * chore: impr * chore: add nosemgrep rule * feat: securely store secrets in storage * chore: allow starting service with empty config * chore: improvements * chore: clippy * chore: pr suggestions * chore: impr * chore: improvements * chore: format * chore: improvements * feat: plat-6864 impre response schema and revert some model name changes to avoid sdk breaking changes * chore: PR suggestion * chore: imprive lcov ingore rules * chore: fix regex * chore: attempt * chore: attempt * chore: remove empty file
1 parent c4422af commit f3c3426

108 files changed

Lines changed: 19078 additions & 7355 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -231,23 +231,22 @@ jobs:
231231
LLVM_PROFILE_FILE: unit-%p-%m.profraw
232232
RUSTFLAGS: -Cinstrument-coverage
233233
RUST_TEST_THREADS: 1
234-
run: cargo hack llvm-cov --locked --lib --ignore-filename-regex "(.*/relayer_docs\.rs$|src/repositories/.*/.*_redis\.rs$)" --lcov --output-path unit-lcov.info
235-
234+
run: cargo hack llvm-cov --locked --lib --ignore-filename-regex "(src/api/routes/docs/.*_docs\.rs$|src/repositories/.*/.*_redis\.rs$)" --lcov --output-path unit-lcov.info
236235
# Integration tests coverage
237236
- name: Run Integration Tests and Generate Coverage Report
238237
env:
239238
LLVM_PROFILE_FILE: integration-%p-%m.profraw
240239
RUSTFLAGS: -Cinstrument-coverage
241240
RUST_TEST_THREADS: 1
242-
run: cargo hack llvm-cov --locked --ignore-filename-regex ".*/relayer_docs\.rs$" --lcov --output-path integration-lcov.info --test integration
241+
run: cargo hack llvm-cov --locked --ignore-filename-regex "(src/api/routes/docs/.*_docs\.rs$|src/repositories/.*/.*_redis\.rs$)" --lcov --output-path integration-lcov.info --test integration
243242

244243
# Properties tests coverage
245244
- name: Run Properties Tests
246245
env:
247246
LLVM_PROFILE_FILE: properties-%p-%m.profraw
248247
RUSTFLAGS: -Cinstrument-coverage
249248
RUST_TEST_THREADS: 1
250-
run: cargo hack llvm-cov --locked --ignore-filename-regex ".*/relayer_docs\.rs$" --lcov --output-path properties-lcov.info --test properties
249+
run: cargo hack llvm-cov --locked --ignore-filename-regex "(src/api/routes/docs/.*_docs\.rs$|src/repositories/.*/.*_redis\.rs$)" --lcov --output-path properties-lcov.info --test properties
251250

252251
# Upload unit coverage
253252
- name: Upload Unit Coverage to Codecov

Cargo.lock

Lines changed: 48 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ async-trait = "0.1"
2929
actix-rt = "2.0.0"
3030
alloy = { version = "0.9", features = ["full"] }
3131
serde_json = "1"
32+
json-patch = "4.0"
3233
strum = { version = "0.27", default-features = false, features = ["derive"] }
3334
strum_macros = "0.27"
3435
serde = { version = "1.0", features = ["derive", "alloc"] }
@@ -75,6 +76,7 @@ secrets = { version = "1.2"}
7576
libsodium-sys = "0.2.7"
7677
zeroize = "1.8"
7778
subtle = "2.6"
79+
aes-gcm = "0.10"
7880
ed25519-dalek = "2.2"
7981
stellar-strkey = "0.0.13"
8082
soroban-rs = "0.2.5"
@@ -115,6 +117,10 @@ path = "helpers/create_key.rs"
115117
name = "generate_uuid"
116118
path = "helpers/generate_uuid.rs"
117119

120+
[[example]]
121+
name = "generate_encryption_key"
122+
path = "helpers/generate_encyption_key.rs"
123+
118124
[[example]]
119125
name = "generate_openapi"
120126
path = "helpers/generate_openapi.rs"

docs/modules/ROOT/pages/signers.adoc

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ OpenZeppelin Relayer supports the following signer types:
3333

3434
- `local`: Keystore file signer
3535
- `vault`: HashiCorp Vault secret signer
36-
- `vault_cloud`: Hosted HashiCorp Vault secret signer
3736
- `vault_transit`: HashiCorp Vault Transit signer
3837
- `turnkey`: Turnkey signer
3938
- `google_cloud_kms`: Google Cloud KMS signer
@@ -57,11 +56,6 @@ The following table shows which signer types are compatible with each network ty
5756
|✅ Supported
5857
|❌ Not supported
5958

60-
|`vault_cloud`
61-
|✅ Supported
62-
|✅ Supported
63-
|❌ Not supported
64-
6559
|`vault_transit`
6660
|❌ Not supported
6761
|✅ Supported
@@ -214,63 +208,6 @@ Configuration fields:
214208
| The mount point for the Secrets engine in Vault. Defaults to `secret` if not explicitly specified. Optional.
215209
|===
216210

217-
=== Vault Cloud Signer
218-
219-
Uses HashiCorp Vault Cloud (HCP Vault) for key management.
220-
221-
[source,json]
222-
----
223-
{
224-
"id": "vault-cloud-signer",
225-
"type": "vault_cloud",
226-
"config": {
227-
"client_id": "your-client-id",
228-
"client_secret": {
229-
"type": "env",
230-
"value": "VAULT_CLOUD_CLIENT_SECRET"
231-
},
232-
"org_id": "your-org-id",
233-
"project_id": "your-project-id",
234-
"app_name": "relayer-app",
235-
"key_name": "signing-key"
236-
}
237-
}
238-
----
239-
240-
Configuration fields:
241-
[cols="1,1,2"]
242-
|===
243-
|Field |Type |Description
244-
245-
| client_id
246-
| String
247-
| The client identifier used to authenticate with Vault Cloud
248-
249-
| client_secret.type
250-
| String
251-
| Type of value source (`env` or `plain`)
252-
253-
| client_secret.value
254-
| String
255-
| The Vault secret value, or the environment variable name where the secret value is stored
256-
257-
| org_id
258-
| String
259-
| The organization ID for your Vault Cloud account
260-
261-
| project_id
262-
| String
263-
| The project ID that uniquely identifies your Vault Cloud project
264-
265-
| app_name
266-
| String
267-
| The name of the application integrating with Vault Cloud
268-
269-
| key_name
270-
| String
271-
| The name of the cryptographic key used for signing or encryption operations in Vault Cloud
272-
|===
273-
274211
=== Vault Transit Signer
275212

276213
Uses HashiCorp Vault's Transit secrets engine for cryptographic operations.

docs/modules/ROOT/pages/solana.adoc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ For detailed network configuration options, see the xref:network_configuration.a
6464
- `google_cloud_kms` (hosted)
6565
- `local` (local)
6666
- `vault` (local)
67-
- `vault_cloud` (local)
6867

6968
[NOTE]
7069
====

helpers/generate_encyption_key.rs

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
//! Encryption Key Generation Tool
2+
//!
3+
//! This tool generates a random 32-byte base64-encoded encryption key and prints it to the console.
4+
//!
5+
//! Other tools can be used to generate key like:
6+
//!
7+
//! ```bash
8+
//! openssl rand -base64 32
9+
//! ```
10+
//!
11+
//! # Usage
12+
//!
13+
//! ```bash
14+
//! cargo run --example generate_encryption_key
15+
//! ```
16+
use eyre::Result;
17+
use openzeppelin_relayer::utils::generate_encryption_key;
18+
19+
/// Main entry point for encryption key generation tool
20+
fn main() -> Result<()> {
21+
let encryption_key = generate_encryption_key();
22+
println!("Generated new encryption key: {}", encryption_key);
23+
Ok(())
24+
}
25+
26+
#[cfg(test)]
27+
mod tests {
28+
use super::*;
29+
use base64::{engine::general_purpose, Engine as _};
30+
31+
#[test]
32+
fn test_encryption_key_generation() {
33+
let key = generate_encryption_key();
34+
35+
let key_string = key;
36+
assert!(!key_string.is_empty(), "Generated key should not be empty");
37+
38+
// Verify it's valid base64
39+
let decoded = general_purpose::STANDARD.decode(&key_string);
40+
assert!(decoded.is_ok(), "Generated key is not valid base64");
41+
42+
// Verify it's 32 bytes when decoded
43+
let decoded_bytes = decoded.unwrap();
44+
assert_eq!(decoded_bytes.len(), 32, "Decoded key should be 32 bytes");
45+
}
46+
47+
#[test]
48+
fn test_multiple_keys_are_different() {
49+
let key1 = generate_encryption_key();
50+
let key2 = generate_encryption_key();
51+
52+
assert_ne!(key1, key2, "Two generated keys should be different");
53+
}
54+
}

src/api/controllers/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
//!
77
//! * `relayer` - Transaction and relayer management endpoints
88
//! * `plugin` - Plugin endpoints
9+
//! * `notifications` - Notification management endpoints
10+
//! * `signers` - Signer management endpoints
911
12+
pub mod notification;
1013
pub mod plugin;
1114
pub mod relayer;
15+
pub mod signer;

0 commit comments

Comments
 (0)