Skip to content

Commit

Permalink
Document snapshots in biscuit-rust
Browse files Browse the repository at this point in the history
  • Loading branch information
divarvel committed Nov 17, 2023
1 parent dc7577c commit 32eaf20
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion docs/src/usage/rust.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,27 @@ fn authorize(token: &Biscuit) -> Result<(), error::Token> {
// link the token to the authorizer
authorizer.add_token(token)?;

authorizer.authorize()?;
let result = authorizer.authorize();

// store the authorization context
println!("{}", authorizer.to_base64_snapshot()?);

let _ = result?;
Ok(())
}
```

## Restore an authorizer from a snasphot

```rust
use biscuit_auth::Authorizer;

fn display(snapshot: &str) {
let authorizer = Authorizer::from_base64_snapshot(snapshot).unwrap();
println!("{authorizer}");
}
```

## Attenuate a token

```rust
Expand Down

0 comments on commit 32eaf20

Please sign in to comment.