| OLD | NEW |
| (Empty) |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef COMPONENTS_PROXIMITY_BASE64URL_H | |
| 6 #define COMPONENTS_PROXIMITY_BASE64URL_H | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 namespace proximity_auth { | |
| 11 | |
| 12 // An implmentation of the base64url encoding. Escapes the unsafe '+' and '/' | |
| 13 // characters with the url-safe alternatives '-' and '_', respectively. For more | |
| 14 // info, see the section on "Base 64 Encoding with URL and Filename Safe | |
| 15 // Alphabet" in http://www.ietf.org/rfc/rfc4648.txt | |
| 16 // NOTE: Unlike many common web-safe encodings, this function does not escape | |
| 17 // the '=' character. This is to match the expectations set by Android. | |
| 18 // TODO(isherman): There are several (semantically slightly different) | |
| 19 // implementations of this within the Chromium codebase. Try to unify them. | |
| 20 void Base64UrlEncode(const std::string& decoded_input, | |
| 21 std::string* encoded_output); | |
| 22 | |
| 23 // The inverse operation for the base64url encoding above. | |
| 24 bool Base64UrlDecode(const std::string& encoded_input, | |
| 25 std::string* decoded_output); | |
| 26 | |
| 27 } // namespace proximity_auth | |
| 28 | |
| 29 #endif // COMPONENTS_PROXIMITY_BASE64URL_H | |
| OLD | NEW |