diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2026-01-12 15:11:12 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2026-01-12 15:11:12 +0000 |
| commit | f62f3e0109a1f73afbcba8c4eea91aa41ed6f197 (patch) | |
| tree | 0d387d6f2c4299fd888deed18b5f535d63cfbf6a /src | |
| parent | 5148479d76f0958e4a1989a6225a4690292b428f (diff) | |
feat(nip11): advertise GRASP-02 support in relay info
Add GRASP-02 to supported_grasps array in NIP-11 relay information
document to advertise proactive sync capability to clients and tools.
Diffstat (limited to 'src')
| -rw-r--r-- | src/http/nip11.rs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/http/nip11.rs b/src/http/nip11.rs index de714cb..b756d9c 100644 --- a/src/http/nip11.rs +++ b/src/http/nip11.rs | |||
| @@ -74,8 +74,8 @@ impl RelayInformationDocument { | |||
| 74 | }, | 74 | }, |
| 75 | icon: Some(format!("https://{}/icon.png", config.domain)), | 75 | icon: Some(format!("https://{}/icon.png", config.domain)), |
| 76 | 76 | ||
| 77 | // GRASP-01 Extensions | 77 | // GRASP Extensions |
| 78 | supported_grasps: vec!["GRASP-01".to_string()], | 78 | supported_grasps: vec!["GRASP-01".to_string(), "GRASP-02".to_string()], |
| 79 | repo_acceptance_criteria: "None".to_string(), | 79 | repo_acceptance_criteria: "None".to_string(), |
| 80 | curation: None, // Not a curated relay - only SPAM prevention via GRASP-01 policy | 80 | curation: None, // Not a curated relay - only SPAM prevention via GRASP-01 policy |
| 81 | } | 81 | } |
| @@ -112,7 +112,7 @@ mod tests { | |||
| 112 | assert!(doc.supported_nips.contains(&11)); | 112 | assert!(doc.supported_nips.contains(&11)); |
| 113 | assert!(doc.supported_nips.contains(&34)); | 113 | assert!(doc.supported_nips.contains(&34)); |
| 114 | assert!(doc.supported_nips.contains(&77)); | 114 | assert!(doc.supported_nips.contains(&77)); |
| 115 | assert_eq!(doc.supported_grasps, vec!["GRASP-01"]); | 115 | assert_eq!(doc.supported_grasps, vec!["GRASP-01", "GRASP-02"]); |
| 116 | assert!(doc.repo_acceptance_criteria.contains("None")); | 116 | assert!(doc.repo_acceptance_criteria.contains("None")); |
| 117 | assert!(doc.curation.is_none()); | 117 | assert!(doc.curation.is_none()); |
| 118 | assert_eq!( | 118 | assert_eq!( |
| @@ -138,11 +138,13 @@ mod tests { | |||
| 138 | assert!(json.contains("\"supported_grasps\"")); | 138 | assert!(json.contains("\"supported_grasps\"")); |
| 139 | assert!(json.contains("\"repo_acceptance_criteria\"")); | 139 | assert!(json.contains("\"repo_acceptance_criteria\"")); |
| 140 | assert!(json.contains("GRASP-01")); | 140 | assert!(json.contains("GRASP-01")); |
| 141 | assert!(json.contains("GRASP-02")); | ||
| 141 | 142 | ||
| 142 | // Verify it's valid JSON by parsing | 143 | // Verify it's valid JSON by parsing |
| 143 | let parsed: serde_json::Value = serde_json::from_str(&json).expect("Invalid JSON"); | 144 | let parsed: serde_json::Value = serde_json::from_str(&json).expect("Invalid JSON"); |
| 144 | assert_eq!(parsed["name"], "Test Relay"); | 145 | assert_eq!(parsed["name"], "Test Relay"); |
| 145 | assert_eq!(parsed["supported_grasps"][0], "GRASP-01"); | 146 | assert_eq!(parsed["supported_grasps"][0], "GRASP-01"); |
| 147 | assert_eq!(parsed["supported_grasps"][1], "GRASP-02"); | ||
| 146 | assert_eq!(parsed["icon"], "https://relay.example.com/icon.png"); | 148 | assert_eq!(parsed["icon"], "https://relay.example.com/icon.png"); |
| 147 | } | 149 | } |
| 148 | } | 150 | } |