macaroons 0.3.0

Cookie-like bearer credentials with caveats for distributed authorization
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13

use std::marker::Sized;

use caveat::Caveat;
use error::Result;

pub trait Token {
    fn new(key: &[u8], identifier: Vec<u8>, location: Option<Vec<u8>>) -> Self;
    fn deserialize(macaroon: Vec<u8>) -> Result<Self> where Self: Sized;
    fn serialize(&self) -> Result<Vec<u8>>;
    fn add_caveat(&self, caveat: &Caveat) -> Self;
    fn verify(&self, key: &[u8]) -> Result<()>;
}