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.
5 #ifndef COMPONENTS_PROXIMITY_BASE64URL_H
6 #define COMPONENTS_PROXIMITY_BASE64URL_H
10 namespace proximity_auth
{
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
);
23 // The inverse operation for the base64url encoding above.
24 bool Base64UrlDecode(const std::string
& encoded_input
,
25 std::string
* decoded_output
);
27 } // namespace proximity_auth
29 #endif // COMPONENTS_PROXIMITY_BASE64URL_H