| Crates.io | hodei-hrn |
| lib.rs | hodei-hrn |
| version | 0.1.0 |
| created_at | 2025-10-17 20:55:37.185341+00 |
| updated_at | 2025-10-17 20:55:37.185341+00 |
| description | Hodei Resource Names (HRN) - Unique resource identification system for authorization |
| homepage | https://github.com/Rubentxu/hodei-policies |
| repository | https://github.com/Rubentxu/hodei-policies |
| max_upload_size | |
| id | 1888411 |
| size | 73,668 |
Core types for the Hodei authorization framework.
hodei-authz-sdk-hrn provides fundamental types used across the Hodei framework, most notably the HRN (Hodei Resource Name) - a resource naming system inspired by AWS ARN.
[dependencies]
hodei-authz-sdk-hrn = "0.1"
use hodei_hrn::Hrn;
let hrn = Hrn::builder()
.service("users-api")
.tenant_id("tenant-123")
.resource("user/alice")
.unwrap()
.build()
.unwrap();
println!("{}", hrn);
// Output: hrn:hodei-authz-sdk:users-api:global:tenant-123:user/alice
use hodei_hrn::Hrn;
let hrn: Hrn = "hrn:hodei-authz-sdk:docs:global:tenant-1:document/doc-1"
.parse()
.unwrap();
assert_eq!(hrn.service, "docs");
assert_eq!(hrn.tenant_id, "tenant-1");
assert_eq!(hrn.resource_type, "document");
assert_eq!(hrn.resource_id, "doc-1");
use hodei_hrn::Hrn;
use serde_json;
let hrn = Hrn::builder()
.service("api")
.tenant_id("t1")
.resource("user/1")
.unwrap()
.build()
.unwrap();
let json = serde_json::to_string(&hrn).unwrap();
let deserialized: Hrn = serde_json::from_str(&json).unwrap();
assert_eq!(hrn, deserialized);
hrn:hodei-authz-sdk:{service}:global:{tenant_id}:{resource_type}/{resource_id}
sqlx: Enables PostgreSQL type support for HRN[dependencies]
hodei-authz-sdk-hrn = { version = "0.1", features = ["sqlx"] }
MIT OR Apache-2.0