Function cloudfront_sign::get_signed_cookie[][src]

pub fn get_signed_cookie(
    url: &str,
    options: &SignedOptions
) -> Result<HashMap<String, String>, EncodingError>

Get a CloudFront signed cookie

Arguments

  • url - A CloudFront URL for which the cookie is generated. Can be a wildcard, e.g. https://some-cf-url.cloudfront.net/key/*

Examples

use std::fs;
use cloudfront_sign::*;
let private_key = fs::read_to_string("tests/data/private_key.pem").unwrap();
let options = SignedOptions {
    key_pair_id: String::from("SOMEKEYPAIRID"),
    private_key: private_key,
    ..Default::default()
};
let cookies = get_signed_cookie("https://example.com", &options).unwrap();