@@ -88,15 +88,15 @@ pub struct SignedPolicy {
8888/// let signed_policy = get_signed_policy("https://example.com", &options).unwrap();
8989pub fn get_signed_policy (
9090 url : & str ,
91- options : & SignedOptions
91+ options : & SignedOptions ,
9292) -> Result < SignedPolicy , EncodingError > {
9393 let p0 = get_custom_policy ( url, options) ;
9494 let s0 = create_policy_signature ( & p0, & options. private_key ) ?;
9595
9696 let p1 = STANDARD . encode ( p0. as_bytes ( ) ) ;
9797 let policy = normalize_base64 ( & p1) ;
9898 let signature = normalize_base64 ( & s0) ;
99- Ok ( SignedPolicy { policy, signature} )
99+ Ok ( SignedPolicy { policy, signature } )
100100}
101101
102102/// Create a custom policy valid until a unix timestamp (s)
@@ -203,21 +203,14 @@ fn normalize_base64(input: &str) -> String {
203203/// };
204204/// let signed_url = get_signed_url("https://example.com", &options).unwrap();
205205/// ```
206- pub fn get_signed_url (
207- url : & str ,
208- options : & SignedOptions
209- ) -> Result < String , EncodingError > {
206+ pub fn get_signed_url ( url : & str , options : & SignedOptions ) -> Result < String , EncodingError > {
210207 let separator = if url. contains ( '?' ) { '&' } else { '?' } ;
211208 // policy is needed for signing but we do not have to include it into final url
212209 let policy = get_signed_policy ( url, options) ?;
213210
214211 Ok ( format ! (
215212 "{}{}Policy={}&Signature={}&Key-Pair-Id={}" ,
216- url,
217- separator,
218- policy. policy,
219- policy. signature,
220- options. key_pair_id
213+ url, separator, policy. policy, policy. signature, options. key_pair_id
221214 ) )
222215}
223216
0 commit comments