Commit 0c8475a1 authored by sajolida's avatar sajolida
Browse files

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) { (function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object') if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(); module.exports = factory();
...@@ -736,7 +736,7 @@ util.ByteStringBuffer.prototype.fillWithByte = function(b, n) { ...@@ -736,7 +736,7 @@ util.ByteStringBuffer.prototype.fillWithByte = function(b, n) {
/** /**
* Puts bytes in this buffer. * 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. * @return this buffer.
*/ */
...@@ -1024,11 +1024,13 @@ util.ByteStringBuffer.prototype.getSignedInt = function(n) { ...@@ -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. * @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) { util.ByteStringBuffer.prototype.getBytes = function(count) {
var rval; var rval;
...@@ -1048,12 +1050,12 @@ util.ByteStringBuffer.prototype.getBytes = function(count) { ...@@ -1048,12 +1050,12 @@ util.ByteStringBuffer.prototype.getBytes = function(count) {
}; };
/** /**
* Gets a UTF-8 encoded string of the bytes from this buffer without modifying * Gets a binary encoded string of the bytes from this buffer without
* the read pointer. * modifying the read pointer.
* *
* @param count the number of bytes to get, omit to get all. * @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) { util.ByteStringBuffer.prototype.bytes = function(count) {
return (typeof(count) === 'undefined' ? return (typeof(count) === 'undefined' ?
...@@ -1685,11 +1687,12 @@ util.DataBuffer.prototype.getSignedInt = function(n) { ...@@ -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. * @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) { util.DataBuffer.prototype.getBytes = function(count) {
// TODO: deprecate this method, it is poorly named and // TODO: deprecate this method, it is poorly named and
...@@ -1712,12 +1715,12 @@ util.DataBuffer.prototype.getBytes = function(count) { ...@@ -1712,12 +1715,12 @@ util.DataBuffer.prototype.getBytes = function(count) {
}; };
/** /**
* Gets a UTF-8 encoded string of the bytes from this buffer without modifying * Gets a binary encoded string of the bytes from this buffer without
* the read pointer. * modifying the read pointer.
* *
* @param count the number of bytes to get, omit to get all. * @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) { util.DataBuffer.prototype.bytes = function(count) {
// TODO: deprecate this method, it is poorly named, add "getString()" // TODO: deprecate this method, it is poorly named, add "getString()"
...@@ -1864,12 +1867,13 @@ util.DataBuffer.prototype.toString = function(encoding) { ...@@ -1864,12 +1867,13 @@ util.DataBuffer.prototype.toString = function(encoding) {
/** End Buffer w/UInt8Array backing */ /** End Buffer w/UInt8Array backing */
/** /**
* Creates a buffer that stores bytes. A value may be given to put into the * Creates a buffer that stores bytes. A value may be given to populate the
* buffer that is either a string of bytes or a UTF-16 string that will * buffer with data. This value can either be string of encoded bytes or a
* be encoded using UTF-8 (to do the latter, specify 'utf8' as the encoding). * 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 * @param [input] a string with encoded bytes to store in the buffer.
* as UTF-8.
* @param [encoding] (default: 'raw', other: 'utf8'). * @param [encoding] (default: 'raw', other: 'utf8').
*/ */
util.createBuffer = function(input, encoding) { util.createBuffer = function(input, encoding) {
...@@ -2098,24 +2102,27 @@ util.decode64 = function(input) { ...@@ -2098,24 +2102,27 @@ util.decode64 = function(input) {
}; };
/** /**
* UTF-8 encodes the given UTF-16 encoded string (a standard JavaScript * Encodes the given string of characters (a standard JavaScript
* string). Non-ASCII characters will be encoded as multiple bytes according * string) as a binary encoded string where the bytes represent
* to UTF-8. * 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) { util.encodeUtf8 = function(str) {
return unescape(encodeURIComponent(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) { util.decodeUtf8 = function(str) {
return decodeURIComponent(escape(str)); return decodeURIComponent(escape(str));
...@@ -2970,6 +2977,9 @@ util.makeLink = function(path, query, fragment) { ...@@ -2970,6 +2977,9 @@ util.makeLink = function(path, query, fragment) {
* leaf nodes are given as non-final path keys. * leaf nodes are given as non-final path keys.
* Used to avoid exceptions from missing parts of the path. * 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 object the starting object.
* @param keys an array of string keys. * @param keys an array of string keys.
* @param value the value to set. * @param value the value to set.
...@@ -3672,4 +3682,4 @@ function _encodeWithByteBuffer(input, alphabet) { ...@@ -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