// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
namespace Microsoft.AspNetCore.Authentication
{
public static class Base64UrlTextEncoder
{
///
/// Encodes supplied data into Base64 and replaces any URL encodable characters into non-URL encodable
/// characters.
///
/// Data to be encoded.
/// Base64 encoded string modified with non-URL encodable characters
public static string Encode(byte[] data)
{
return WebUtilities.Base64UrlTextEncoder.Encode(data);
}
///
/// Decodes supplied string by replacing the non-URL encodable characters with URL encodable characters and
/// then decodes the Base64 string.
///
/// The string to be decoded.
/// The decoded data.
public static byte[] Decode(string text)
{
return WebUtilities.Base64UrlTextEncoder.Decode(text);
}
}
}