Skip to content

Commit 89fd1a4

Browse files
committed
Add x25519_pubkey field to ValidatorInfo and ValidatorResponse
Prepares for X25519-based API key encryption where validators publish their X25519 public key derived from sr25519 seed
1 parent 45eb856 commit 89fd1a4

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

crates/core/src/types.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,9 @@ pub struct ValidatorInfo {
132132
pub is_active: bool,
133133
pub last_seen: chrono::DateTime<chrono::Utc>,
134134
pub peer_id: Option<String>,
135+
/// X25519 public key for API key encryption (hex, 32 bytes)
136+
#[serde(skip_serializing_if = "Option::is_none")]
137+
pub x25519_pubkey: Option<String>,
135138
}
136139

137140
impl ValidatorInfo {
@@ -142,6 +145,7 @@ impl ValidatorInfo {
142145
is_active: true,
143146
last_seen: chrono::Utc::now(),
144147
peer_id: None,
148+
x25519_pubkey: None,
145149
}
146150
}
147151
}

crates/rpc-server/src/handlers.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ pub async fn validators_handler(
9797
is_active: v.is_active,
9898
last_seen: v.last_seen,
9999
peer_id: v.peer_id.clone(),
100+
x25519_pubkey: v.x25519_pubkey.clone(),
100101
})
101102
.collect();
102103

@@ -389,6 +390,7 @@ pub async fn sync_handler(State(state): State<Arc<RpcState>>) -> Json<RpcRespons
389390
is_active: v.is_active,
390391
last_seen: v.last_seen,
391392
peer_id: v.peer_id.clone(),
393+
x25519_pubkey: v.x25519_pubkey.clone(),
392394
})
393395
.collect();
394396

crates/rpc-server/src/types.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ pub struct ValidatorResponse {
6363
pub is_active: bool,
6464
pub last_seen: DateTime<Utc>,
6565
pub peer_id: Option<String>,
66+
/// X25519 public key for API key encryption (hex, 32 bytes)
67+
/// Derived from validator's sr25519 seed
68+
#[serde(skip_serializing_if = "Option::is_none")]
69+
pub x25519_pubkey: Option<String>,
6670
}
6771

6872
/// Challenge info for RPC

0 commit comments

Comments
 (0)