blob: 63d4990d2dcd19f0979eb04f770464539dc668fe [file] [log] [blame]
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <string>
namespace proximity_auth {
// An implmentation of the base64url encoding. Escapes the unsafe '+' and '/'
// characters with the url-safe alternatives '-' and '_', respectively. For more
// info, see the section on "Base 64 Encoding with URL and Filename Safe
// Alphabet" in
// NOTE: Unlike many common web-safe encodings, this function does not escape
// the '=' character. This is to match the expectations set by Android.
// TODO(isherman): There are several (semantically slightly different)
// implementations of this within the Chromium codebase. Try to unify them.
void Base64UrlEncode(const std::string& decoded_input,
std::string* encoded_output);
// The inverse operation for the base64url encoding above.
bool Base64UrlDecode(const std::string& encoded_input,
std::string* decoded_output);
} // namespace proximity_auth