Commit 0c8475a1 authored by sajolida's avatar sajolida

Update to Forge 0.9.2

parent 2b797d88
/*! Forge v0.8.4 | (c) Digital Bazaar, Inc. */
/*! Forge v0.9.2 | (c) Digital Bazaar, Inc. */
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
......@@ -736,7 +736,7 @@ util.ByteStringBuffer.prototype.fillWithByte = function(b, n) {
/**
* Puts bytes in this buffer.
*
* @param bytes the bytes (as a UTF-8 encoded string) to put.
* @param bytes the bytes (as a binary encoded string) to put.
*
* @return this buffer.
*/
......@@ -1024,11 +1024,13 @@ util.ByteStringBuffer.prototype.getSignedInt = function(n) {
};
/**
* Reads bytes out into a UTF-8 string and clears them from the buffer.
* Reads bytes out as a binary encoded string and clears them from the
* buffer. Note that the resulting string is binary encoded (in node.js this
* encoding is referred to as `binary`, it is *not* `utf8`).
*
* @param count the number of bytes to read, undefined or null for all.
*
* @return a UTF-8 string of bytes.
* @return a binary encoded string of bytes.
*/
util.ByteStringBuffer.prototype.getBytes = function(count) {
var rval;
......@@ -1048,12 +1050,12 @@ util.ByteStringBuffer.prototype.getBytes = function(count) {
};
/**
* Gets a UTF-8 encoded string of the bytes from this buffer without modifying
* the read pointer.
* Gets a binary encoded string of the bytes from this buffer without
* modifying the read pointer.
*
* @param count the number of bytes to get, omit to get all.
*
* @return a string full of UTF-8 encoded characters.
* @return a string full of binary encoded characters.
*/
util.ByteStringBuffer.prototype.bytes = function(count) {
return (typeof(count) === 'undefined' ?
......@@ -1685,11 +1687,12 @@ util.DataBuffer.prototype.getSignedInt = function(n) {
};
/**
* Reads bytes out into a UTF-8 string and clears them from the buffer.
* Reads bytes out as a binary encoded string and clears them from the
* buffer.
*
* @param count the number of bytes to read, undefined or null for all.
*
* @return a UTF-8 string of bytes.
* @return a binary encoded string of bytes.
*/
util.DataBuffer.prototype.getBytes = function(count) {
// TODO: deprecate this method, it is poorly named and
......@@ -1712,12 +1715,12 @@ util.DataBuffer.prototype.getBytes = function(count) {
};
/**
* Gets a UTF-8 encoded string of the bytes from this buffer without modifying
* the read pointer.
* Gets a binary encoded string of the bytes from this buffer without
* modifying the read pointer.
*
* @param count the number of bytes to get, omit to get all.
*
* @return a string full of UTF-8 encoded characters.
* @return a string full of binary encoded characters.
*/
util.DataBuffer.prototype.bytes = function(count) {
// TODO: deprecate this method, it is poorly named, add "getString()"
......@@ -1864,12 +1867,13 @@ util.DataBuffer.prototype.toString = function(encoding) {
/** End Buffer w/UInt8Array backing */
/**
* Creates a buffer that stores bytes. A value may be given to put into the
* buffer that is either a string of bytes or a UTF-16 string that will
* be encoded using UTF-8 (to do the latter, specify 'utf8' as the encoding).
* Creates a buffer that stores bytes. A value may be given to populate the
* buffer with data. This value can either be string of encoded bytes or a
* regular string of characters. When passing a string of binary encoded
* bytes, the encoding `raw` should be given. This is also the default. When
* passing a string of characters, the encoding `utf8` should be given.
*
* @param [input] the bytes to wrap (as a string) or a UTF-16 string to encode
* as UTF-8.
* @param [input] a string with encoded bytes to store in the buffer.
* @param [encoding] (default: 'raw', other: 'utf8').
*/
util.createBuffer = function(input, encoding) {
......@@ -2098,24 +2102,27 @@ util.decode64 = function(input) {
};
/**
* UTF-8 encodes the given UTF-16 encoded string (a standard JavaScript
* string). Non-ASCII characters will be encoded as multiple bytes according
* to UTF-8.
* Encodes the given string of characters (a standard JavaScript
* string) as a binary encoded string where the bytes represent
* a UTF-8 encoded string of characters. Non-ASCII characters will be
* encoded as multiple bytes according to UTF-8.
*
* @param str the string to encode.
* @param str a standard string of characters to encode.
*
* @return the UTF-8 encoded string.
* @return the binary encoded string.
*/
util.encodeUtf8 = function(str) {
return unescape(encodeURIComponent(str));
};
/**
* Decodes a UTF-8 encoded string into a UTF-16 string.
* Decodes a binary encoded string that contains bytes that
* represent a UTF-8 encoded string of characters -- into a
* string of characters (a standard JavaScript string).
*
* @param str the string to decode.
* @param str the binary encoded string to decode.
*
* @return the UTF-16 encoded string (standard JavaScript string).
* @return the resulting standard string of characters.
*/
util.decodeUtf8 = function(str) {
return decodeURIComponent(escape(str));
......@@ -2970,6 +2977,9 @@ util.makeLink = function(path, query, fragment) {
* leaf nodes are given as non-final path keys.
* Used to avoid exceptions from missing parts of the path.
*
* SECURITY NOTE: Do not use unsafe inputs. Doing so could expose a prototype
* pollution security issue.
*
* @param object the starting object.
* @param keys an array of string keys.
* @param value the value to set.
......@@ -3672,4 +3682,4 @@ function _encodeWithByteBuffer(input, alphabet) {
/***/ })
/******/ ]);
});
\ No newline at end of file
});
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment