typescript-closure-tools
Version:
Command-line tools to convert closure-style JSDoc annotations to typescript, and to convert typescript sources to closure externs files
82 lines (72 loc) • 2.74 kB
TypeScript
/// <reference path="../../../globals.d.ts" />
declare module goog.crypt.base64 {
/**
* Our default alphabet, shared between
* ENCODED_VALS and ENCODED_VALS_WEBSAFE
* @type {string}
*/
var ENCODED_VALS_BASE: string;
/**
* Our default alphabet. Value 64 (=) is special; it means "nothing."
* @type {string}
*/
var ENCODED_VALS: string;
/**
* Our websafe alphabet.
* @type {string}
*/
var ENCODED_VALS_WEBSAFE: string;
/**
* Whether this browser supports the atob and btoa functions. This extension
* started at Mozilla but is now implemented by many browsers. We use the
* ASSUME_* variables to avoid pulling in the full useragent detection library
* but still allowing the standard per-browser compilations.
*
* @type {boolean}
*/
var HAS_NATIVE_SUPPORT: boolean;
/**
* Base64-encode an array of bytes.
*
* @param {Array.<number>|Uint8Array} input An array of bytes (numbers with
* value in [0, 255]) to encode.
* @param {boolean=} opt_webSafe Boolean indicating we should use the
* alternative alphabet.
* @return {string} The base64 encoded string.
*/
function encodeByteArray(input: number[]|Uint8Array, opt_webSafe?: boolean): string;
/**
* Base64-encode a string.
*
* @param {string} input A string to encode.
* @param {boolean=} opt_webSafe If true, we should use the
* alternative alphabet.
* @return {string} The base64 encoded string.
*/
function encodeString(input: string, opt_webSafe?: boolean): string;
/**
* Base64-decode a string.
*
* @param {string} input to decode.
* @param {boolean=} opt_webSafe True if we should use the
* alternative alphabet.
* @return {string} string representing the decoded value.
*/
function decodeString(input: string, opt_webSafe?: boolean): string;
/**
* Base64-decode a string.
*
* In base-64 decoding, groups of four characters are converted into three
* bytes. If the encoder did not apply padding, the input length may not
* be a multiple of 4.
*
* In this case, the last group will have fewer than 4 characters, and
* padding will be inferred. If the group has one or two characters, it decodes
* to one byte. If the group has three characters, it decodes to two bytes.
*
* @param {string} input Input to decode.
* @param {boolean=} opt_webSafe True if we should use the web-safe alphabet.
* @return {!Array} bytes representing the decoded value.
*/
function decodeStringToByteArray(input: string, opt_webSafe?: boolean): any[];
}