Skip to content

Rust SDK

pore-sdk is the official Rust client. It shares types with pore-core, so in-process integrations pay no serialization cost.

Terminal window
cargo add pore-sdk
use pore_sdk::Pore;
let pore = Pore::builder()
.api_key(std::env::var("PORE_API_KEY")?)
.build()?;
use pore_sdk::{GrantInput, CheckInput};
pore.grants_create(GrantInput {
subject: "user:alice".parse()?,
relation: "owner".parse()?,
object: "document:42".parse()?,
}).await?;
let result = pore.check(CheckInput {
subject: "user:alice".parse()?,
relation: "editor".parse()?,
object: "document:42".parse()?,
}).await?;
assert!(result.authorized);

Errors are returned as Result<T, pore_sdk::Error>. Error is a structured enum; pattern-match on it rather than stringifying.