parse 8.6.0 → 8.6.1-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/parse.js +1100 -29
- package/dist/parse.min.js +44 -19
- package/dist/parse.weapp.js +1100 -29
- package/dist/parse.weapp.min.js +44 -19
- package/lib/browser/CoreManager.js +1 -1
- package/lib/node/CoreManager.js +1 -1
- package/lib/react-native/CoreManager.js +1 -1
- package/lib/weapp/CoreManager.js +1 -1
- package/package.json +11 -11
package/dist/parse.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Parse JavaScript SDK v8.6.
|
|
2
|
+
* Parse JavaScript SDK v8.6.1-alpha.1
|
|
3
3
|
*
|
|
4
4
|
* Copyright 2015-present Parse Platform
|
|
5
5
|
* All rights reserved.
|
|
@@ -21,8 +21,15 @@
|
|
|
21
21
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
22
22
|
var __getProtoOf = Object.getPrototypeOf;
|
|
23
23
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
24
|
-
var __esmMin = (fn, res) => () =>
|
|
25
|
-
|
|
24
|
+
var __esmMin = (fn, res, err) => () => {
|
|
25
|
+
if (err) throw err[0];
|
|
26
|
+
try {
|
|
27
|
+
return fn && (res = fn(fn = 0)), res;
|
|
28
|
+
} catch (e) {
|
|
29
|
+
throw err = [e], e;
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
26
33
|
var __exportAll = (all, no_symbols) => {
|
|
27
34
|
let target = {};
|
|
28
35
|
for (var name in all) __defProp(target, name, {
|
|
@@ -179,7 +186,7 @@
|
|
|
179
186
|
return 0;
|
|
180
187
|
};
|
|
181
188
|
browserExports = browser.exports;
|
|
182
|
-
process$1 =
|
|
189
|
+
process$1 = /*@__PURE__*/ getDefaultExportFromCjs(browserExports);
|
|
183
190
|
}));
|
|
184
191
|
//#endregion
|
|
185
192
|
//#region src/CoreManager.ts
|
|
@@ -192,7 +199,7 @@
|
|
|
192
199
|
SERVER_URL: "https://api.parse.com/1",
|
|
193
200
|
LIVEQUERY_SERVER_URL: null,
|
|
194
201
|
ENCRYPTED_KEY: null,
|
|
195
|
-
VERSION: "js8.6.
|
|
202
|
+
VERSION: "js8.6.1-alpha.1",
|
|
196
203
|
APPLICATION_ID: null,
|
|
197
204
|
JAVASCRIPT_KEY: null,
|
|
198
205
|
MAINTENANCE_KEY: null,
|
|
@@ -5608,7 +5615,7 @@
|
|
|
5608
5615
|
function copyBuffer(src, target, offset) {
|
|
5609
5616
|
Buffer.prototype.copy.call(src, target, offset);
|
|
5610
5617
|
}
|
|
5611
|
-
module.exports =
|
|
5618
|
+
module.exports = /*#__PURE__*/ function() {
|
|
5612
5619
|
function BufferList() {
|
|
5613
5620
|
_classCallCheck(this, BufferList);
|
|
5614
5621
|
this.head = null;
|
|
@@ -5865,7 +5872,7 @@
|
|
|
5865
5872
|
if (typeof message === "string") return message;
|
|
5866
5873
|
else return message(arg1, arg2, arg3);
|
|
5867
5874
|
}
|
|
5868
|
-
var NodeError =
|
|
5875
|
+
var NodeError = /*#__PURE__*/ function(_Base) {
|
|
5869
5876
|
_inheritsLoose(NodeError, _Base);
|
|
5870
5877
|
function NodeError(arg1, arg2, arg3) {
|
|
5871
5878
|
return _Base.call(this, getMessage(arg1, arg2, arg3)) || this;
|
|
@@ -6037,7 +6044,15 @@
|
|
|
6037
6044
|
}
|
|
6038
6045
|
var destroyImpl = require_destroy$1();
|
|
6039
6046
|
var getHighWaterMark = require_state().getHighWaterMark;
|
|
6040
|
-
var _require$codes = require_errors_browser().codes
|
|
6047
|
+
var _require$codes = require_errors_browser().codes;
|
|
6048
|
+
var ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE;
|
|
6049
|
+
var ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED;
|
|
6050
|
+
var ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK;
|
|
6051
|
+
var ERR_STREAM_CANNOT_PIPE = _require$codes.ERR_STREAM_CANNOT_PIPE;
|
|
6052
|
+
var ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED;
|
|
6053
|
+
var ERR_STREAM_NULL_VALUES = _require$codes.ERR_STREAM_NULL_VALUES;
|
|
6054
|
+
var ERR_STREAM_WRITE_AFTER_END = _require$codes.ERR_STREAM_WRITE_AFTER_END;
|
|
6055
|
+
var ERR_UNKNOWN_ENCODING = _require$codes.ERR_UNKNOWN_ENCODING;
|
|
6041
6056
|
var errorOrDestroy = destroyImpl.errorOrDestroy;
|
|
6042
6057
|
require_inherits_browser()(Writable, Stream);
|
|
6043
6058
|
function nop() {}
|
|
@@ -6054,7 +6069,8 @@
|
|
|
6054
6069
|
this.ended = false;
|
|
6055
6070
|
this.finished = false;
|
|
6056
6071
|
this.destroyed = false;
|
|
6057
|
-
|
|
6072
|
+
var noDecode = options.decodeStrings === false;
|
|
6073
|
+
this.decodeStrings = !noDecode;
|
|
6058
6074
|
this.defaultEncoding = options.defaultEncoding || "utf8";
|
|
6059
6075
|
this.length = 0;
|
|
6060
6076
|
this.writing = false;
|
|
@@ -7043,7 +7059,11 @@
|
|
|
7043
7059
|
var BufferList = require_buffer_list();
|
|
7044
7060
|
var destroyImpl = require_destroy$1();
|
|
7045
7061
|
var getHighWaterMark = require_state().getHighWaterMark;
|
|
7046
|
-
var _require$codes = require_errors_browser().codes
|
|
7062
|
+
var _require$codes = require_errors_browser().codes;
|
|
7063
|
+
var ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE;
|
|
7064
|
+
var ERR_STREAM_PUSH_AFTER_EOF = _require$codes.ERR_STREAM_PUSH_AFTER_EOF;
|
|
7065
|
+
var ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED;
|
|
7066
|
+
var ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;
|
|
7047
7067
|
var StringDecoder;
|
|
7048
7068
|
var createReadableStreamAsyncIterator;
|
|
7049
7069
|
var from;
|
|
@@ -7675,7 +7695,11 @@
|
|
|
7675
7695
|
//#region node_modules/readable-stream/lib/_stream_transform.js
|
|
7676
7696
|
var require__stream_transform$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
7677
7697
|
module.exports = Transform;
|
|
7678
|
-
var _require$codes = require_errors_browser().codes
|
|
7698
|
+
var _require$codes = require_errors_browser().codes;
|
|
7699
|
+
var ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED;
|
|
7700
|
+
var ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK;
|
|
7701
|
+
var ERR_TRANSFORM_ALREADY_TRANSFORMING = _require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING;
|
|
7702
|
+
var ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0;
|
|
7679
7703
|
var Duplex = require__stream_duplex$1();
|
|
7680
7704
|
require_inherits_browser()(Transform, Duplex);
|
|
7681
7705
|
function afterTransform(er, data) {
|
|
@@ -7780,7 +7804,9 @@
|
|
|
7780
7804
|
callback.apply(void 0, arguments);
|
|
7781
7805
|
};
|
|
7782
7806
|
}
|
|
7783
|
-
var _require$codes = require_errors_browser().codes
|
|
7807
|
+
var _require$codes = require_errors_browser().codes;
|
|
7808
|
+
var ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS;
|
|
7809
|
+
var ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED;
|
|
7784
7810
|
function noop(err) {
|
|
7785
7811
|
if (err) throw err;
|
|
7786
7812
|
}
|
|
@@ -8255,7 +8281,8 @@
|
|
|
8255
8281
|
}
|
|
8256
8282
|
if (!this._url) throw new Error("Cannot retrieve data for unsaved ParseFile.");
|
|
8257
8283
|
options.requestTask = (task) => this._requestTask = task;
|
|
8258
|
-
|
|
8284
|
+
const result = await CoreManager.getFileController().download(this._url, options);
|
|
8285
|
+
this._data = result.base64;
|
|
8259
8286
|
return this._data;
|
|
8260
8287
|
}
|
|
8261
8288
|
/**
|
|
@@ -13997,7 +14024,8 @@
|
|
|
13997
14024
|
}
|
|
13998
14025
|
exports.instantiate = instantiate;
|
|
13999
14026
|
proto._cbcInit = function _cbcInit() {
|
|
14000
|
-
|
|
14027
|
+
var state = new CBCState(this.options.iv);
|
|
14028
|
+
this._cbcState = state;
|
|
14001
14029
|
};
|
|
14002
14030
|
proto._update = function _update(inp, inOff, out, outOff) {
|
|
14003
14031
|
var state = this._cbcState;
|
|
@@ -14057,7 +14085,8 @@
|
|
|
14057
14085
|
}
|
|
14058
14086
|
function EDE(options) {
|
|
14059
14087
|
Cipher.call(this, options);
|
|
14060
|
-
|
|
14088
|
+
var state = new EDEState(this.type, this.options.key);
|
|
14089
|
+
this._edeState = state;
|
|
14061
14090
|
}
|
|
14062
14091
|
inherits(EDE, Cipher);
|
|
14063
14092
|
module.exports = EDE;
|
|
@@ -20968,7 +20997,8 @@
|
|
|
20968
20997
|
this.ended = false;
|
|
20969
20998
|
this.finished = false;
|
|
20970
20999
|
this.destroyed = false;
|
|
20971
|
-
|
|
21000
|
+
var noDecode = options.decodeStrings === false;
|
|
21001
|
+
this.decodeStrings = !noDecode;
|
|
20972
21002
|
this.defaultEncoding = options.defaultEncoding || "utf8";
|
|
20973
21003
|
this.length = 0;
|
|
20974
21004
|
this.writing = false;
|
|
@@ -22552,7 +22582,8 @@
|
|
|
22552
22582
|
assert(byteLength <= reqLength, "byte array longer than desired length");
|
|
22553
22583
|
assert(reqLength > 0, "Requested array length <= 0");
|
|
22554
22584
|
var res = allocate(ArrayType, reqLength);
|
|
22555
|
-
|
|
22585
|
+
var postfix = endian === "le" ? "LE" : "BE";
|
|
22586
|
+
this["_toArrayLike" + postfix](res, byteLength);
|
|
22556
22587
|
return res;
|
|
22557
22588
|
};
|
|
22558
22589
|
BN.prototype._toArrayLikeLE = function _toArrayLikeLE(res, byteLength) {
|
|
@@ -40993,7 +41024,7 @@
|
|
|
40993
41024
|
var cryptoSecureRandomInt = function() {
|
|
40994
41025
|
if (crypto) {
|
|
40995
41026
|
if (typeof crypto.getRandomValues === "function") try {
|
|
40996
|
-
return crypto.getRandomValues(new Uint32Array(1))[0];
|
|
41027
|
+
return crypto.getRandomValues(/* @__PURE__ */ new Uint32Array(1))[0];
|
|
40997
41028
|
} catch (err) {}
|
|
40998
41029
|
if (typeof crypto.randomBytes === "function") try {
|
|
40999
41030
|
return crypto.randomBytes(4).readInt32LE();
|
|
@@ -41024,6 +41055,24 @@
|
|
|
41024
41055
|
*/
|
|
41025
41056
|
var Base = C_lib.Base = function() {
|
|
41026
41057
|
return {
|
|
41058
|
+
/**
|
|
41059
|
+
* Creates a new object that inherits from this object.
|
|
41060
|
+
*
|
|
41061
|
+
* @param {Object} overrides Properties to copy into the new object.
|
|
41062
|
+
*
|
|
41063
|
+
* @return {Object} The new object.
|
|
41064
|
+
*
|
|
41065
|
+
* @static
|
|
41066
|
+
*
|
|
41067
|
+
* @example
|
|
41068
|
+
*
|
|
41069
|
+
* var MyType = CryptoJS.lib.Base.extend({
|
|
41070
|
+
* field: 'value',
|
|
41071
|
+
*
|
|
41072
|
+
* method: function () {
|
|
41073
|
+
* }
|
|
41074
|
+
* });
|
|
41075
|
+
*/
|
|
41027
41076
|
extend: function(overrides) {
|
|
41028
41077
|
var subtype = create(this);
|
|
41029
41078
|
if (overrides) subtype.mixIn(overrides);
|
|
@@ -41034,16 +41083,60 @@
|
|
|
41034
41083
|
subtype.$super = this;
|
|
41035
41084
|
return subtype;
|
|
41036
41085
|
},
|
|
41086
|
+
/**
|
|
41087
|
+
* Extends this object and runs the init method.
|
|
41088
|
+
* Arguments to create() will be passed to init().
|
|
41089
|
+
*
|
|
41090
|
+
* @return {Object} The new object.
|
|
41091
|
+
*
|
|
41092
|
+
* @static
|
|
41093
|
+
*
|
|
41094
|
+
* @example
|
|
41095
|
+
*
|
|
41096
|
+
* var instance = MyType.create();
|
|
41097
|
+
*/
|
|
41037
41098
|
create: function() {
|
|
41038
41099
|
var instance = this.extend();
|
|
41039
41100
|
instance.init.apply(instance, arguments);
|
|
41040
41101
|
return instance;
|
|
41041
41102
|
},
|
|
41103
|
+
/**
|
|
41104
|
+
* Initializes a newly created object.
|
|
41105
|
+
* Override this method to add some logic when your objects are created.
|
|
41106
|
+
*
|
|
41107
|
+
* @example
|
|
41108
|
+
*
|
|
41109
|
+
* var MyType = CryptoJS.lib.Base.extend({
|
|
41110
|
+
* init: function () {
|
|
41111
|
+
* // ...
|
|
41112
|
+
* }
|
|
41113
|
+
* });
|
|
41114
|
+
*/
|
|
41042
41115
|
init: function() {},
|
|
41116
|
+
/**
|
|
41117
|
+
* Copies properties into this object.
|
|
41118
|
+
*
|
|
41119
|
+
* @param {Object} properties The properties to mix in.
|
|
41120
|
+
*
|
|
41121
|
+
* @example
|
|
41122
|
+
*
|
|
41123
|
+
* MyType.mixIn({
|
|
41124
|
+
* field: 'value'
|
|
41125
|
+
* });
|
|
41126
|
+
*/
|
|
41043
41127
|
mixIn: function(properties) {
|
|
41044
41128
|
for (var propertyName in properties) if (properties.hasOwnProperty(propertyName)) this[propertyName] = properties[propertyName];
|
|
41045
41129
|
if (properties.hasOwnProperty("toString")) this.toString = properties.toString;
|
|
41046
41130
|
},
|
|
41131
|
+
/**
|
|
41132
|
+
* Creates a copy of this object.
|
|
41133
|
+
*
|
|
41134
|
+
* @return {Object} The clone.
|
|
41135
|
+
*
|
|
41136
|
+
* @example
|
|
41137
|
+
*
|
|
41138
|
+
* var clone = instance.clone();
|
|
41139
|
+
*/
|
|
41047
41140
|
clone: function() {
|
|
41048
41141
|
return this.init.prototype.extend(this);
|
|
41049
41142
|
}
|
|
@@ -41056,14 +41149,50 @@
|
|
|
41056
41149
|
* @property {number} sigBytes The number of significant bytes in this word array.
|
|
41057
41150
|
*/
|
|
41058
41151
|
var WordArray = C_lib.WordArray = Base.extend({
|
|
41152
|
+
/**
|
|
41153
|
+
* Initializes a newly created word array.
|
|
41154
|
+
*
|
|
41155
|
+
* @param {Array} words (Optional) An array of 32-bit words.
|
|
41156
|
+
* @param {number} sigBytes (Optional) The number of significant bytes in the words.
|
|
41157
|
+
*
|
|
41158
|
+
* @example
|
|
41159
|
+
*
|
|
41160
|
+
* var wordArray = CryptoJS.lib.WordArray.create();
|
|
41161
|
+
* var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607]);
|
|
41162
|
+
* var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6);
|
|
41163
|
+
*/
|
|
41059
41164
|
init: function(words, sigBytes) {
|
|
41060
41165
|
words = this.words = words || [];
|
|
41061
41166
|
if (sigBytes != undefined) this.sigBytes = sigBytes;
|
|
41062
41167
|
else this.sigBytes = words.length * 4;
|
|
41063
41168
|
},
|
|
41169
|
+
/**
|
|
41170
|
+
* Converts this word array to a string.
|
|
41171
|
+
*
|
|
41172
|
+
* @param {Encoder} encoder (Optional) The encoding strategy to use. Default: CryptoJS.enc.Hex
|
|
41173
|
+
*
|
|
41174
|
+
* @return {string} The stringified word array.
|
|
41175
|
+
*
|
|
41176
|
+
* @example
|
|
41177
|
+
*
|
|
41178
|
+
* var string = wordArray + '';
|
|
41179
|
+
* var string = wordArray.toString();
|
|
41180
|
+
* var string = wordArray.toString(CryptoJS.enc.Utf8);
|
|
41181
|
+
*/
|
|
41064
41182
|
toString: function(encoder) {
|
|
41065
41183
|
return (encoder || Hex).stringify(this);
|
|
41066
41184
|
},
|
|
41185
|
+
/**
|
|
41186
|
+
* Concatenates a word array to this word array.
|
|
41187
|
+
*
|
|
41188
|
+
* @param {WordArray} wordArray The word array to append.
|
|
41189
|
+
*
|
|
41190
|
+
* @return {WordArray} This word array.
|
|
41191
|
+
*
|
|
41192
|
+
* @example
|
|
41193
|
+
*
|
|
41194
|
+
* wordArray1.concat(wordArray2);
|
|
41195
|
+
*/
|
|
41067
41196
|
concat: function(wordArray) {
|
|
41068
41197
|
var thisWords = this.words;
|
|
41069
41198
|
var thatWords = wordArray.words;
|
|
@@ -41078,17 +41207,46 @@
|
|
|
41078
41207
|
this.sigBytes += thatSigBytes;
|
|
41079
41208
|
return this;
|
|
41080
41209
|
},
|
|
41210
|
+
/**
|
|
41211
|
+
* Removes insignificant bits.
|
|
41212
|
+
*
|
|
41213
|
+
* @example
|
|
41214
|
+
*
|
|
41215
|
+
* wordArray.clamp();
|
|
41216
|
+
*/
|
|
41081
41217
|
clamp: function() {
|
|
41082
41218
|
var words = this.words;
|
|
41083
41219
|
var sigBytes = this.sigBytes;
|
|
41084
41220
|
words[sigBytes >>> 2] &= 4294967295 << 32 - sigBytes % 4 * 8;
|
|
41085
41221
|
words.length = Math.ceil(sigBytes / 4);
|
|
41086
41222
|
},
|
|
41223
|
+
/**
|
|
41224
|
+
* Creates a copy of this word array.
|
|
41225
|
+
*
|
|
41226
|
+
* @return {WordArray} The clone.
|
|
41227
|
+
*
|
|
41228
|
+
* @example
|
|
41229
|
+
*
|
|
41230
|
+
* var clone = wordArray.clone();
|
|
41231
|
+
*/
|
|
41087
41232
|
clone: function() {
|
|
41088
41233
|
var clone = Base.clone.call(this);
|
|
41089
41234
|
clone.words = this.words.slice(0);
|
|
41090
41235
|
return clone;
|
|
41091
41236
|
},
|
|
41237
|
+
/**
|
|
41238
|
+
* Creates a word array filled with random bytes.
|
|
41239
|
+
*
|
|
41240
|
+
* @param {number} nBytes The number of random bytes to generate.
|
|
41241
|
+
*
|
|
41242
|
+
* @return {WordArray} The random word array.
|
|
41243
|
+
*
|
|
41244
|
+
* @static
|
|
41245
|
+
*
|
|
41246
|
+
* @example
|
|
41247
|
+
*
|
|
41248
|
+
* var wordArray = CryptoJS.lib.WordArray.random(16);
|
|
41249
|
+
*/
|
|
41092
41250
|
random: function(nBytes) {
|
|
41093
41251
|
var words = [];
|
|
41094
41252
|
for (var i = 0; i < nBytes; i += 4) words.push(cryptoSecureRandomInt());
|
|
@@ -41103,6 +41261,19 @@
|
|
|
41103
41261
|
* Hex encoding strategy.
|
|
41104
41262
|
*/
|
|
41105
41263
|
var Hex = C_enc.Hex = {
|
|
41264
|
+
/**
|
|
41265
|
+
* Converts a word array to a hex string.
|
|
41266
|
+
*
|
|
41267
|
+
* @param {WordArray} wordArray The word array.
|
|
41268
|
+
*
|
|
41269
|
+
* @return {string} The hex string.
|
|
41270
|
+
*
|
|
41271
|
+
* @static
|
|
41272
|
+
*
|
|
41273
|
+
* @example
|
|
41274
|
+
*
|
|
41275
|
+
* var hexString = CryptoJS.enc.Hex.stringify(wordArray);
|
|
41276
|
+
*/
|
|
41106
41277
|
stringify: function(wordArray) {
|
|
41107
41278
|
var words = wordArray.words;
|
|
41108
41279
|
var sigBytes = wordArray.sigBytes;
|
|
@@ -41114,6 +41285,19 @@
|
|
|
41114
41285
|
}
|
|
41115
41286
|
return hexChars.join("");
|
|
41116
41287
|
},
|
|
41288
|
+
/**
|
|
41289
|
+
* Converts a hex string to a word array.
|
|
41290
|
+
*
|
|
41291
|
+
* @param {string} hexStr The hex string.
|
|
41292
|
+
*
|
|
41293
|
+
* @return {WordArray} The word array.
|
|
41294
|
+
*
|
|
41295
|
+
* @static
|
|
41296
|
+
*
|
|
41297
|
+
* @example
|
|
41298
|
+
*
|
|
41299
|
+
* var wordArray = CryptoJS.enc.Hex.parse(hexString);
|
|
41300
|
+
*/
|
|
41117
41301
|
parse: function(hexStr) {
|
|
41118
41302
|
var hexStrLength = hexStr.length;
|
|
41119
41303
|
var words = [];
|
|
@@ -41125,6 +41309,19 @@
|
|
|
41125
41309
|
* Latin1 encoding strategy.
|
|
41126
41310
|
*/
|
|
41127
41311
|
var Latin1 = C_enc.Latin1 = {
|
|
41312
|
+
/**
|
|
41313
|
+
* Converts a word array to a Latin1 string.
|
|
41314
|
+
*
|
|
41315
|
+
* @param {WordArray} wordArray The word array.
|
|
41316
|
+
*
|
|
41317
|
+
* @return {string} The Latin1 string.
|
|
41318
|
+
*
|
|
41319
|
+
* @static
|
|
41320
|
+
*
|
|
41321
|
+
* @example
|
|
41322
|
+
*
|
|
41323
|
+
* var latin1String = CryptoJS.enc.Latin1.stringify(wordArray);
|
|
41324
|
+
*/
|
|
41128
41325
|
stringify: function(wordArray) {
|
|
41129
41326
|
var words = wordArray.words;
|
|
41130
41327
|
var sigBytes = wordArray.sigBytes;
|
|
@@ -41135,6 +41332,19 @@
|
|
|
41135
41332
|
}
|
|
41136
41333
|
return latin1Chars.join("");
|
|
41137
41334
|
},
|
|
41335
|
+
/**
|
|
41336
|
+
* Converts a Latin1 string to a word array.
|
|
41337
|
+
*
|
|
41338
|
+
* @param {string} latin1Str The Latin1 string.
|
|
41339
|
+
*
|
|
41340
|
+
* @return {WordArray} The word array.
|
|
41341
|
+
*
|
|
41342
|
+
* @static
|
|
41343
|
+
*
|
|
41344
|
+
* @example
|
|
41345
|
+
*
|
|
41346
|
+
* var wordArray = CryptoJS.enc.Latin1.parse(latin1String);
|
|
41347
|
+
*/
|
|
41138
41348
|
parse: function(latin1Str) {
|
|
41139
41349
|
var latin1StrLength = latin1Str.length;
|
|
41140
41350
|
var words = [];
|
|
@@ -41146,6 +41356,19 @@
|
|
|
41146
41356
|
* UTF-8 encoding strategy.
|
|
41147
41357
|
*/
|
|
41148
41358
|
var Utf8 = C_enc.Utf8 = {
|
|
41359
|
+
/**
|
|
41360
|
+
* Converts a word array to a UTF-8 string.
|
|
41361
|
+
*
|
|
41362
|
+
* @param {WordArray} wordArray The word array.
|
|
41363
|
+
*
|
|
41364
|
+
* @return {string} The UTF-8 string.
|
|
41365
|
+
*
|
|
41366
|
+
* @static
|
|
41367
|
+
*
|
|
41368
|
+
* @example
|
|
41369
|
+
*
|
|
41370
|
+
* var utf8String = CryptoJS.enc.Utf8.stringify(wordArray);
|
|
41371
|
+
*/
|
|
41149
41372
|
stringify: function(wordArray) {
|
|
41150
41373
|
try {
|
|
41151
41374
|
return decodeURIComponent(escape(Latin1.stringify(wordArray)));
|
|
@@ -41153,6 +41376,19 @@
|
|
|
41153
41376
|
throw new Error("Malformed UTF-8 data");
|
|
41154
41377
|
}
|
|
41155
41378
|
},
|
|
41379
|
+
/**
|
|
41380
|
+
* Converts a UTF-8 string to a word array.
|
|
41381
|
+
*
|
|
41382
|
+
* @param {string} utf8Str The UTF-8 string.
|
|
41383
|
+
*
|
|
41384
|
+
* @return {WordArray} The word array.
|
|
41385
|
+
*
|
|
41386
|
+
* @static
|
|
41387
|
+
*
|
|
41388
|
+
* @example
|
|
41389
|
+
*
|
|
41390
|
+
* var wordArray = CryptoJS.enc.Utf8.parse(utf8String);
|
|
41391
|
+
*/
|
|
41156
41392
|
parse: function(utf8Str) {
|
|
41157
41393
|
return Latin1.parse(unescape(encodeURIComponent(utf8Str)));
|
|
41158
41394
|
}
|
|
@@ -41165,15 +41401,46 @@
|
|
|
41165
41401
|
* @property {number} _minBufferSize The number of blocks that should be kept unprocessed in the buffer. Default: 0
|
|
41166
41402
|
*/
|
|
41167
41403
|
var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm = Base.extend({
|
|
41404
|
+
/**
|
|
41405
|
+
* Resets this block algorithm's data buffer to its initial state.
|
|
41406
|
+
*
|
|
41407
|
+
* @example
|
|
41408
|
+
*
|
|
41409
|
+
* bufferedBlockAlgorithm.reset();
|
|
41410
|
+
*/
|
|
41168
41411
|
reset: function() {
|
|
41169
41412
|
this._data = new WordArray.init();
|
|
41170
41413
|
this._nDataBytes = 0;
|
|
41171
41414
|
},
|
|
41415
|
+
/**
|
|
41416
|
+
* Adds new data to this block algorithm's buffer.
|
|
41417
|
+
*
|
|
41418
|
+
* @param {WordArray|string} data The data to append. Strings are converted to a WordArray using UTF-8.
|
|
41419
|
+
*
|
|
41420
|
+
* @example
|
|
41421
|
+
*
|
|
41422
|
+
* bufferedBlockAlgorithm._append('data');
|
|
41423
|
+
* bufferedBlockAlgorithm._append(wordArray);
|
|
41424
|
+
*/
|
|
41172
41425
|
_append: function(data) {
|
|
41173
41426
|
if (typeof data == "string") data = Utf8.parse(data);
|
|
41174
41427
|
this._data.concat(data);
|
|
41175
41428
|
this._nDataBytes += data.sigBytes;
|
|
41176
41429
|
},
|
|
41430
|
+
/**
|
|
41431
|
+
* Processes available data blocks.
|
|
41432
|
+
*
|
|
41433
|
+
* This method invokes _doProcessBlock(offset), which must be implemented by a concrete subtype.
|
|
41434
|
+
*
|
|
41435
|
+
* @param {boolean} doFlush Whether all blocks and partial blocks should be processed.
|
|
41436
|
+
*
|
|
41437
|
+
* @return {WordArray} The processed data.
|
|
41438
|
+
*
|
|
41439
|
+
* @example
|
|
41440
|
+
*
|
|
41441
|
+
* var processedData = bufferedBlockAlgorithm._process();
|
|
41442
|
+
* var processedData = bufferedBlockAlgorithm._process(!!'flush');
|
|
41443
|
+
*/
|
|
41177
41444
|
_process: function(doFlush) {
|
|
41178
41445
|
var processedWords;
|
|
41179
41446
|
var data = this._data;
|
|
@@ -41192,6 +41459,15 @@
|
|
|
41192
41459
|
}
|
|
41193
41460
|
return new WordArray.init(processedWords, nBytesReady);
|
|
41194
41461
|
},
|
|
41462
|
+
/**
|
|
41463
|
+
* Creates a copy of this object.
|
|
41464
|
+
*
|
|
41465
|
+
* @return {Object} The clone.
|
|
41466
|
+
*
|
|
41467
|
+
* @example
|
|
41468
|
+
*
|
|
41469
|
+
* var clone = bufferedBlockAlgorithm.clone();
|
|
41470
|
+
*/
|
|
41195
41471
|
clone: function() {
|
|
41196
41472
|
var clone = Base.clone.call(this);
|
|
41197
41473
|
clone._data = this._data.clone();
|
|
@@ -41200,30 +41476,101 @@
|
|
|
41200
41476
|
_minBufferSize: 0
|
|
41201
41477
|
});
|
|
41202
41478
|
C_lib.Hasher = BufferedBlockAlgorithm.extend({
|
|
41479
|
+
/**
|
|
41480
|
+
* Configuration options.
|
|
41481
|
+
*/
|
|
41203
41482
|
cfg: Base.extend(),
|
|
41483
|
+
/**
|
|
41484
|
+
* Initializes a newly created hasher.
|
|
41485
|
+
*
|
|
41486
|
+
* @param {Object} cfg (Optional) The configuration options to use for this hash computation.
|
|
41487
|
+
*
|
|
41488
|
+
* @example
|
|
41489
|
+
*
|
|
41490
|
+
* var hasher = CryptoJS.algo.SHA256.create();
|
|
41491
|
+
*/
|
|
41204
41492
|
init: function(cfg) {
|
|
41205
41493
|
this.cfg = this.cfg.extend(cfg);
|
|
41206
41494
|
this.reset();
|
|
41207
41495
|
},
|
|
41496
|
+
/**
|
|
41497
|
+
* Resets this hasher to its initial state.
|
|
41498
|
+
*
|
|
41499
|
+
* @example
|
|
41500
|
+
*
|
|
41501
|
+
* hasher.reset();
|
|
41502
|
+
*/
|
|
41208
41503
|
reset: function() {
|
|
41209
41504
|
BufferedBlockAlgorithm.reset.call(this);
|
|
41210
41505
|
this._doReset();
|
|
41211
41506
|
},
|
|
41507
|
+
/**
|
|
41508
|
+
* Updates this hasher with a message.
|
|
41509
|
+
*
|
|
41510
|
+
* @param {WordArray|string} messageUpdate The message to append.
|
|
41511
|
+
*
|
|
41512
|
+
* @return {Hasher} This hasher.
|
|
41513
|
+
*
|
|
41514
|
+
* @example
|
|
41515
|
+
*
|
|
41516
|
+
* hasher.update('message');
|
|
41517
|
+
* hasher.update(wordArray);
|
|
41518
|
+
*/
|
|
41212
41519
|
update: function(messageUpdate) {
|
|
41213
41520
|
this._append(messageUpdate);
|
|
41214
41521
|
this._process();
|
|
41215
41522
|
return this;
|
|
41216
41523
|
},
|
|
41524
|
+
/**
|
|
41525
|
+
* Finalizes the hash computation.
|
|
41526
|
+
* Note that the finalize operation is effectively a destructive, read-once operation.
|
|
41527
|
+
*
|
|
41528
|
+
* @param {WordArray|string} messageUpdate (Optional) A final message update.
|
|
41529
|
+
*
|
|
41530
|
+
* @return {WordArray} The hash.
|
|
41531
|
+
*
|
|
41532
|
+
* @example
|
|
41533
|
+
*
|
|
41534
|
+
* var hash = hasher.finalize();
|
|
41535
|
+
* var hash = hasher.finalize('message');
|
|
41536
|
+
* var hash = hasher.finalize(wordArray);
|
|
41537
|
+
*/
|
|
41217
41538
|
finalize: function(messageUpdate) {
|
|
41218
41539
|
if (messageUpdate) this._append(messageUpdate);
|
|
41219
41540
|
return this._doFinalize();
|
|
41220
41541
|
},
|
|
41221
41542
|
blockSize: 512 / 32,
|
|
41543
|
+
/**
|
|
41544
|
+
* Creates a shortcut function to a hasher's object interface.
|
|
41545
|
+
*
|
|
41546
|
+
* @param {Hasher} hasher The hasher to create a helper for.
|
|
41547
|
+
*
|
|
41548
|
+
* @return {Function} The shortcut function.
|
|
41549
|
+
*
|
|
41550
|
+
* @static
|
|
41551
|
+
*
|
|
41552
|
+
* @example
|
|
41553
|
+
*
|
|
41554
|
+
* var SHA256 = CryptoJS.lib.Hasher._createHelper(CryptoJS.algo.SHA256);
|
|
41555
|
+
*/
|
|
41222
41556
|
_createHelper: function(hasher) {
|
|
41223
41557
|
return function(message, cfg) {
|
|
41224
41558
|
return new hasher.init(cfg).finalize(message);
|
|
41225
41559
|
};
|
|
41226
41560
|
},
|
|
41561
|
+
/**
|
|
41562
|
+
* Creates a shortcut function to the HMAC's object interface.
|
|
41563
|
+
*
|
|
41564
|
+
* @param {Hasher} hasher The hasher to use in this HMAC helper.
|
|
41565
|
+
*
|
|
41566
|
+
* @return {Function} The shortcut function.
|
|
41567
|
+
*
|
|
41568
|
+
* @static
|
|
41569
|
+
*
|
|
41570
|
+
* @example
|
|
41571
|
+
*
|
|
41572
|
+
* var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256);
|
|
41573
|
+
*/
|
|
41227
41574
|
_createHmacHelper: function(hasher) {
|
|
41228
41575
|
return function(message, key) {
|
|
41229
41576
|
return new C_algo.HMAC.init(hasher, key).finalize(message);
|
|
@@ -41252,6 +41599,19 @@
|
|
|
41252
41599
|
var WordArray = C.lib.WordArray;
|
|
41253
41600
|
var C_enc = C.enc;
|
|
41254
41601
|
C_enc.Base64 = {
|
|
41602
|
+
/**
|
|
41603
|
+
* Converts a word array to a Base64 string.
|
|
41604
|
+
*
|
|
41605
|
+
* @param {WordArray} wordArray The word array.
|
|
41606
|
+
*
|
|
41607
|
+
* @return {string} The Base64 string.
|
|
41608
|
+
*
|
|
41609
|
+
* @static
|
|
41610
|
+
*
|
|
41611
|
+
* @example
|
|
41612
|
+
*
|
|
41613
|
+
* var base64String = CryptoJS.enc.Base64.stringify(wordArray);
|
|
41614
|
+
*/
|
|
41255
41615
|
stringify: function(wordArray) {
|
|
41256
41616
|
var words = wordArray.words;
|
|
41257
41617
|
var sigBytes = wordArray.sigBytes;
|
|
@@ -41269,6 +41629,19 @@
|
|
|
41269
41629
|
if (paddingChar) while (base64Chars.length % 4) base64Chars.push(paddingChar);
|
|
41270
41630
|
return base64Chars.join("");
|
|
41271
41631
|
},
|
|
41632
|
+
/**
|
|
41633
|
+
* Converts a Base64 string to a word array.
|
|
41634
|
+
*
|
|
41635
|
+
* @param {string} base64Str The Base64 string.
|
|
41636
|
+
*
|
|
41637
|
+
* @return {WordArray} The word array.
|
|
41638
|
+
*
|
|
41639
|
+
* @static
|
|
41640
|
+
*
|
|
41641
|
+
* @example
|
|
41642
|
+
*
|
|
41643
|
+
* var wordArray = CryptoJS.enc.Base64.parse(base64String);
|
|
41644
|
+
*/
|
|
41272
41645
|
parse: function(base64Str) {
|
|
41273
41646
|
var base64StrLength = base64Str.length;
|
|
41274
41647
|
var map = this._map;
|
|
@@ -41626,6 +41999,16 @@
|
|
|
41626
41999
|
var Utf8 = C.enc.Utf8;
|
|
41627
42000
|
var C_algo = C.algo;
|
|
41628
42001
|
C_algo.HMAC = Base.extend({
|
|
42002
|
+
/**
|
|
42003
|
+
* Initializes a newly created HMAC.
|
|
42004
|
+
*
|
|
42005
|
+
* @param {Hasher} hasher The hash algorithm to use.
|
|
42006
|
+
* @param {WordArray|string} key The secret key.
|
|
42007
|
+
*
|
|
42008
|
+
* @example
|
|
42009
|
+
*
|
|
42010
|
+
* var hmacHasher = CryptoJS.algo.HMAC.create(CryptoJS.algo.SHA256, key);
|
|
42011
|
+
*/
|
|
41629
42012
|
init: function(hasher, key) {
|
|
41630
42013
|
hasher = this._hasher = new hasher.init();
|
|
41631
42014
|
if (typeof key == "string") key = Utf8.parse(key);
|
|
@@ -41644,15 +42027,48 @@
|
|
|
41644
42027
|
oKey.sigBytes = iKey.sigBytes = hasherBlockSizeBytes;
|
|
41645
42028
|
this.reset();
|
|
41646
42029
|
},
|
|
42030
|
+
/**
|
|
42031
|
+
* Resets this HMAC to its initial state.
|
|
42032
|
+
*
|
|
42033
|
+
* @example
|
|
42034
|
+
*
|
|
42035
|
+
* hmacHasher.reset();
|
|
42036
|
+
*/
|
|
41647
42037
|
reset: function() {
|
|
41648
42038
|
var hasher = this._hasher;
|
|
41649
42039
|
hasher.reset();
|
|
41650
42040
|
hasher.update(this._iKey);
|
|
41651
42041
|
},
|
|
42042
|
+
/**
|
|
42043
|
+
* Updates this HMAC with a message.
|
|
42044
|
+
*
|
|
42045
|
+
* @param {WordArray|string} messageUpdate The message to append.
|
|
42046
|
+
*
|
|
42047
|
+
* @return {HMAC} This HMAC instance.
|
|
42048
|
+
*
|
|
42049
|
+
* @example
|
|
42050
|
+
*
|
|
42051
|
+
* hmacHasher.update('message');
|
|
42052
|
+
* hmacHasher.update(wordArray);
|
|
42053
|
+
*/
|
|
41652
42054
|
update: function(messageUpdate) {
|
|
41653
42055
|
this._hasher.update(messageUpdate);
|
|
41654
42056
|
return this;
|
|
41655
42057
|
},
|
|
42058
|
+
/**
|
|
42059
|
+
* Finalizes the HMAC computation.
|
|
42060
|
+
* Note that the finalize operation is effectively a destructive, read-once operation.
|
|
42061
|
+
*
|
|
42062
|
+
* @param {WordArray|string} messageUpdate (Optional) A final message update.
|
|
42063
|
+
*
|
|
42064
|
+
* @return {WordArray} The HMAC.
|
|
42065
|
+
*
|
|
42066
|
+
* @example
|
|
42067
|
+
*
|
|
42068
|
+
* var hmac = hmacHasher.finalize();
|
|
42069
|
+
* var hmac = hmacHasher.finalize('message');
|
|
42070
|
+
* var hmac = hmacHasher.finalize(wordArray);
|
|
42071
|
+
*/
|
|
41656
42072
|
finalize: function(messageUpdate) {
|
|
41657
42073
|
var hasher = this._hasher;
|
|
41658
42074
|
var innerHash = hasher.finalize(messageUpdate);
|
|
@@ -41687,14 +42103,44 @@
|
|
|
41687
42103
|
* www.openssl.org/docs/crypto/EVP_BytesToKey.html
|
|
41688
42104
|
*/
|
|
41689
42105
|
var EvpKDF = C_algo.EvpKDF = Base.extend({
|
|
42106
|
+
/**
|
|
42107
|
+
* Configuration options.
|
|
42108
|
+
*
|
|
42109
|
+
* @property {number} keySize The key size in words to generate. Default: 4 (128 bits)
|
|
42110
|
+
* @property {Hasher} hasher The hash algorithm to use. Default: MD5
|
|
42111
|
+
* @property {number} iterations The number of iterations to perform. Default: 1
|
|
42112
|
+
*/
|
|
41690
42113
|
cfg: Base.extend({
|
|
41691
42114
|
keySize: 128 / 32,
|
|
41692
42115
|
hasher: MD5,
|
|
41693
42116
|
iterations: 1
|
|
41694
42117
|
}),
|
|
42118
|
+
/**
|
|
42119
|
+
* Initializes a newly created key derivation function.
|
|
42120
|
+
*
|
|
42121
|
+
* @param {Object} cfg (Optional) The configuration options to use for the derivation.
|
|
42122
|
+
*
|
|
42123
|
+
* @example
|
|
42124
|
+
*
|
|
42125
|
+
* var kdf = CryptoJS.algo.EvpKDF.create();
|
|
42126
|
+
* var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8 });
|
|
42127
|
+
* var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8, iterations: 1000 });
|
|
42128
|
+
*/
|
|
41695
42129
|
init: function(cfg) {
|
|
41696
42130
|
this.cfg = this.cfg.extend(cfg);
|
|
41697
42131
|
},
|
|
42132
|
+
/**
|
|
42133
|
+
* Derives a key from a password.
|
|
42134
|
+
*
|
|
42135
|
+
* @param {WordArray|string} password The password.
|
|
42136
|
+
* @param {WordArray|string} salt A salt.
|
|
42137
|
+
*
|
|
42138
|
+
* @return {WordArray} The derived key.
|
|
42139
|
+
*
|
|
42140
|
+
* @example
|
|
42141
|
+
*
|
|
42142
|
+
* var key = kdf.compute(password, salt);
|
|
42143
|
+
*/
|
|
41698
42144
|
compute: function(password, salt) {
|
|
41699
42145
|
var block;
|
|
41700
42146
|
var cfg = this.cfg;
|
|
@@ -41771,27 +42217,104 @@
|
|
|
41771
42217
|
* @property {number} _DEC_XFORM_MODE A constant representing decryption mode.
|
|
41772
42218
|
*/
|
|
41773
42219
|
var Cipher = C_lib.Cipher = BufferedBlockAlgorithm.extend({
|
|
42220
|
+
/**
|
|
42221
|
+
* Configuration options.
|
|
42222
|
+
*
|
|
42223
|
+
* @property {WordArray} iv The IV to use for this operation.
|
|
42224
|
+
*/
|
|
41774
42225
|
cfg: Base.extend(),
|
|
42226
|
+
/**
|
|
42227
|
+
* Creates this cipher in encryption mode.
|
|
42228
|
+
*
|
|
42229
|
+
* @param {WordArray} key The key.
|
|
42230
|
+
* @param {Object} cfg (Optional) The configuration options to use for this operation.
|
|
42231
|
+
*
|
|
42232
|
+
* @return {Cipher} A cipher instance.
|
|
42233
|
+
*
|
|
42234
|
+
* @static
|
|
42235
|
+
*
|
|
42236
|
+
* @example
|
|
42237
|
+
*
|
|
42238
|
+
* var cipher = CryptoJS.algo.AES.createEncryptor(keyWordArray, { iv: ivWordArray });
|
|
42239
|
+
*/
|
|
41775
42240
|
createEncryptor: function(key, cfg) {
|
|
41776
42241
|
return this.create(this._ENC_XFORM_MODE, key, cfg);
|
|
41777
42242
|
},
|
|
42243
|
+
/**
|
|
42244
|
+
* Creates this cipher in decryption mode.
|
|
42245
|
+
*
|
|
42246
|
+
* @param {WordArray} key The key.
|
|
42247
|
+
* @param {Object} cfg (Optional) The configuration options to use for this operation.
|
|
42248
|
+
*
|
|
42249
|
+
* @return {Cipher} A cipher instance.
|
|
42250
|
+
*
|
|
42251
|
+
* @static
|
|
42252
|
+
*
|
|
42253
|
+
* @example
|
|
42254
|
+
*
|
|
42255
|
+
* var cipher = CryptoJS.algo.AES.createDecryptor(keyWordArray, { iv: ivWordArray });
|
|
42256
|
+
*/
|
|
41778
42257
|
createDecryptor: function(key, cfg) {
|
|
41779
42258
|
return this.create(this._DEC_XFORM_MODE, key, cfg);
|
|
41780
42259
|
},
|
|
42260
|
+
/**
|
|
42261
|
+
* Initializes a newly created cipher.
|
|
42262
|
+
*
|
|
42263
|
+
* @param {number} xformMode Either the encryption or decryption transormation mode constant.
|
|
42264
|
+
* @param {WordArray} key The key.
|
|
42265
|
+
* @param {Object} cfg (Optional) The configuration options to use for this operation.
|
|
42266
|
+
*
|
|
42267
|
+
* @example
|
|
42268
|
+
*
|
|
42269
|
+
* var cipher = CryptoJS.algo.AES.create(CryptoJS.algo.AES._ENC_XFORM_MODE, keyWordArray, { iv: ivWordArray });
|
|
42270
|
+
*/
|
|
41781
42271
|
init: function(xformMode, key, cfg) {
|
|
41782
42272
|
this.cfg = this.cfg.extend(cfg);
|
|
41783
42273
|
this._xformMode = xformMode;
|
|
41784
42274
|
this._key = key;
|
|
41785
42275
|
this.reset();
|
|
41786
42276
|
},
|
|
42277
|
+
/**
|
|
42278
|
+
* Resets this cipher to its initial state.
|
|
42279
|
+
*
|
|
42280
|
+
* @example
|
|
42281
|
+
*
|
|
42282
|
+
* cipher.reset();
|
|
42283
|
+
*/
|
|
41787
42284
|
reset: function() {
|
|
41788
42285
|
BufferedBlockAlgorithm.reset.call(this);
|
|
41789
42286
|
this._doReset();
|
|
41790
42287
|
},
|
|
42288
|
+
/**
|
|
42289
|
+
* Adds data to be encrypted or decrypted.
|
|
42290
|
+
*
|
|
42291
|
+
* @param {WordArray|string} dataUpdate The data to encrypt or decrypt.
|
|
42292
|
+
*
|
|
42293
|
+
* @return {WordArray} The data after processing.
|
|
42294
|
+
*
|
|
42295
|
+
* @example
|
|
42296
|
+
*
|
|
42297
|
+
* var encrypted = cipher.process('data');
|
|
42298
|
+
* var encrypted = cipher.process(wordArray);
|
|
42299
|
+
*/
|
|
41791
42300
|
process: function(dataUpdate) {
|
|
41792
42301
|
this._append(dataUpdate);
|
|
41793
42302
|
return this._process();
|
|
41794
42303
|
},
|
|
42304
|
+
/**
|
|
42305
|
+
* Finalizes the encryption or decryption process.
|
|
42306
|
+
* Note that the finalize operation is effectively a destructive, read-once operation.
|
|
42307
|
+
*
|
|
42308
|
+
* @param {WordArray|string} dataUpdate The final data to encrypt or decrypt.
|
|
42309
|
+
*
|
|
42310
|
+
* @return {WordArray} The data after final processing.
|
|
42311
|
+
*
|
|
42312
|
+
* @example
|
|
42313
|
+
*
|
|
42314
|
+
* var encrypted = cipher.finalize();
|
|
42315
|
+
* var encrypted = cipher.finalize('data');
|
|
42316
|
+
* var encrypted = cipher.finalize(wordArray);
|
|
42317
|
+
*/
|
|
41795
42318
|
finalize: function(dataUpdate) {
|
|
41796
42319
|
if (dataUpdate) this._append(dataUpdate);
|
|
41797
42320
|
return this._doFinalize();
|
|
@@ -41800,6 +42323,19 @@
|
|
|
41800
42323
|
ivSize: 128 / 32,
|
|
41801
42324
|
_ENC_XFORM_MODE: 1,
|
|
41802
42325
|
_DEC_XFORM_MODE: 2,
|
|
42326
|
+
/**
|
|
42327
|
+
* Creates shortcut functions to a cipher's object interface.
|
|
42328
|
+
*
|
|
42329
|
+
* @param {Cipher} cipher The cipher to create a helper for.
|
|
42330
|
+
*
|
|
42331
|
+
* @return {Object} An object with encrypt and decrypt shortcut functions.
|
|
42332
|
+
*
|
|
42333
|
+
* @static
|
|
42334
|
+
*
|
|
42335
|
+
* @example
|
|
42336
|
+
*
|
|
42337
|
+
* var AES = CryptoJS.lib.Cipher._createHelper(CryptoJS.algo.AES);
|
|
42338
|
+
*/
|
|
41803
42339
|
_createHelper: function() {
|
|
41804
42340
|
function selectCipherStrategy(key) {
|
|
41805
42341
|
if (typeof key == "string") return PasswordBasedCipher;
|
|
@@ -41831,12 +42367,46 @@
|
|
|
41831
42367
|
* Abstract base block cipher mode template.
|
|
41832
42368
|
*/
|
|
41833
42369
|
var BlockCipherMode = C_lib.BlockCipherMode = Base.extend({
|
|
42370
|
+
/**
|
|
42371
|
+
* Creates this mode for encryption.
|
|
42372
|
+
*
|
|
42373
|
+
* @param {Cipher} cipher A block cipher instance.
|
|
42374
|
+
* @param {Array} iv The IV words.
|
|
42375
|
+
*
|
|
42376
|
+
* @static
|
|
42377
|
+
*
|
|
42378
|
+
* @example
|
|
42379
|
+
*
|
|
42380
|
+
* var mode = CryptoJS.mode.CBC.createEncryptor(cipher, iv.words);
|
|
42381
|
+
*/
|
|
41834
42382
|
createEncryptor: function(cipher, iv) {
|
|
41835
42383
|
return this.Encryptor.create(cipher, iv);
|
|
41836
42384
|
},
|
|
42385
|
+
/**
|
|
42386
|
+
* Creates this mode for decryption.
|
|
42387
|
+
*
|
|
42388
|
+
* @param {Cipher} cipher A block cipher instance.
|
|
42389
|
+
* @param {Array} iv The IV words.
|
|
42390
|
+
*
|
|
42391
|
+
* @static
|
|
42392
|
+
*
|
|
42393
|
+
* @example
|
|
42394
|
+
*
|
|
42395
|
+
* var mode = CryptoJS.mode.CBC.createDecryptor(cipher, iv.words);
|
|
42396
|
+
*/
|
|
41837
42397
|
createDecryptor: function(cipher, iv) {
|
|
41838
42398
|
return this.Decryptor.create(cipher, iv);
|
|
41839
42399
|
},
|
|
42400
|
+
/**
|
|
42401
|
+
* Initializes a newly created mode.
|
|
42402
|
+
*
|
|
42403
|
+
* @param {Cipher} cipher A block cipher instance.
|
|
42404
|
+
* @param {Array} iv The IV words.
|
|
42405
|
+
*
|
|
42406
|
+
* @example
|
|
42407
|
+
*
|
|
42408
|
+
* var mode = CryptoJS.mode.CBC.Encryptor.create(cipher, iv.words);
|
|
42409
|
+
*/
|
|
41840
42410
|
init: function(cipher, iv) {
|
|
41841
42411
|
this._cipher = cipher;
|
|
41842
42412
|
this._iv = iv;
|
|
@@ -41853,7 +42423,18 @@
|
|
|
41853
42423
|
/**
|
|
41854
42424
|
* CBC encryptor.
|
|
41855
42425
|
*/
|
|
41856
|
-
CBC.Encryptor = CBC.extend({
|
|
42426
|
+
CBC.Encryptor = CBC.extend({
|
|
42427
|
+
/**
|
|
42428
|
+
* Processes the data block at offset.
|
|
42429
|
+
*
|
|
42430
|
+
* @param {Array} words The data words to operate on.
|
|
42431
|
+
* @param {number} offset The offset where the block starts.
|
|
42432
|
+
*
|
|
42433
|
+
* @example
|
|
42434
|
+
*
|
|
42435
|
+
* mode.processBlock(data.words, offset);
|
|
42436
|
+
*/
|
|
42437
|
+
processBlock: function(words, offset) {
|
|
41857
42438
|
var cipher = this._cipher;
|
|
41858
42439
|
var blockSize = cipher.blockSize;
|
|
41859
42440
|
xorBlock.call(this, words, offset, blockSize);
|
|
@@ -41863,7 +42444,18 @@
|
|
|
41863
42444
|
/**
|
|
41864
42445
|
* CBC decryptor.
|
|
41865
42446
|
*/
|
|
41866
|
-
CBC.Decryptor = CBC.extend({
|
|
42447
|
+
CBC.Decryptor = CBC.extend({
|
|
42448
|
+
/**
|
|
42449
|
+
* Processes the data block at offset.
|
|
42450
|
+
*
|
|
42451
|
+
* @param {Array} words The data words to operate on.
|
|
42452
|
+
* @param {number} offset The offset where the block starts.
|
|
42453
|
+
*
|
|
42454
|
+
* @example
|
|
42455
|
+
*
|
|
42456
|
+
* mode.processBlock(data.words, offset);
|
|
42457
|
+
*/
|
|
42458
|
+
processBlock: function(words, offset) {
|
|
41867
42459
|
var cipher = this._cipher;
|
|
41868
42460
|
var blockSize = cipher.blockSize;
|
|
41869
42461
|
var thisBlock = words.slice(offset, offset + blockSize);
|
|
@@ -41890,6 +42482,18 @@
|
|
|
41890
42482
|
* PKCS #5/7 padding strategy.
|
|
41891
42483
|
*/
|
|
41892
42484
|
var Pkcs7 = C_pad.Pkcs7 = {
|
|
42485
|
+
/**
|
|
42486
|
+
* Pads data using the algorithm defined in PKCS #5/7.
|
|
42487
|
+
*
|
|
42488
|
+
* @param {WordArray} data The data to pad.
|
|
42489
|
+
* @param {number} blockSize The multiple that the data should be padded to.
|
|
42490
|
+
*
|
|
42491
|
+
* @static
|
|
42492
|
+
*
|
|
42493
|
+
* @example
|
|
42494
|
+
*
|
|
42495
|
+
* CryptoJS.pad.Pkcs7.pad(wordArray, 4);
|
|
42496
|
+
*/
|
|
41893
42497
|
pad: function(data, blockSize) {
|
|
41894
42498
|
var blockSizeBytes = blockSize * 4;
|
|
41895
42499
|
var nPaddingBytes = blockSizeBytes - data.sigBytes % blockSizeBytes;
|
|
@@ -41899,12 +42503,29 @@
|
|
|
41899
42503
|
var padding = WordArray.create(paddingWords, nPaddingBytes);
|
|
41900
42504
|
data.concat(padding);
|
|
41901
42505
|
},
|
|
42506
|
+
/**
|
|
42507
|
+
* Unpads data that had been padded using the algorithm defined in PKCS #5/7.
|
|
42508
|
+
*
|
|
42509
|
+
* @param {WordArray} data The data to unpad.
|
|
42510
|
+
*
|
|
42511
|
+
* @static
|
|
42512
|
+
*
|
|
42513
|
+
* @example
|
|
42514
|
+
*
|
|
42515
|
+
* CryptoJS.pad.Pkcs7.unpad(wordArray);
|
|
42516
|
+
*/
|
|
41902
42517
|
unpad: function(data) {
|
|
41903
42518
|
var nPaddingBytes = data.words[data.sigBytes - 1 >>> 2] & 255;
|
|
41904
42519
|
data.sigBytes -= nPaddingBytes;
|
|
41905
42520
|
}
|
|
41906
42521
|
};
|
|
41907
42522
|
C_lib.BlockCipher = Cipher.extend({
|
|
42523
|
+
/**
|
|
42524
|
+
* Configuration options.
|
|
42525
|
+
*
|
|
42526
|
+
* @property {Mode} mode The block mode to use. Default: CBC
|
|
42527
|
+
* @property {Padding} padding The padding strategy to use. Default: Pkcs7
|
|
42528
|
+
*/
|
|
41908
42529
|
cfg: Cipher.cfg.extend({
|
|
41909
42530
|
mode: CBC,
|
|
41910
42531
|
padding: Pkcs7
|
|
@@ -41957,9 +42578,43 @@
|
|
|
41957
42578
|
* @property {Format} formatter The default formatting strategy to convert this cipher params object to a string.
|
|
41958
42579
|
*/
|
|
41959
42580
|
var CipherParams = C_lib.CipherParams = Base.extend({
|
|
42581
|
+
/**
|
|
42582
|
+
* Initializes a newly created cipher params object.
|
|
42583
|
+
*
|
|
42584
|
+
* @param {Object} cipherParams An object with any of the possible cipher parameters.
|
|
42585
|
+
*
|
|
42586
|
+
* @example
|
|
42587
|
+
*
|
|
42588
|
+
* var cipherParams = CryptoJS.lib.CipherParams.create({
|
|
42589
|
+
* ciphertext: ciphertextWordArray,
|
|
42590
|
+
* key: keyWordArray,
|
|
42591
|
+
* iv: ivWordArray,
|
|
42592
|
+
* salt: saltWordArray,
|
|
42593
|
+
* algorithm: CryptoJS.algo.AES,
|
|
42594
|
+
* mode: CryptoJS.mode.CBC,
|
|
42595
|
+
* padding: CryptoJS.pad.PKCS7,
|
|
42596
|
+
* blockSize: 4,
|
|
42597
|
+
* formatter: CryptoJS.format.OpenSSL
|
|
42598
|
+
* });
|
|
42599
|
+
*/
|
|
41960
42600
|
init: function(cipherParams) {
|
|
41961
42601
|
this.mixIn(cipherParams);
|
|
41962
42602
|
},
|
|
42603
|
+
/**
|
|
42604
|
+
* Converts this cipher params object to a string.
|
|
42605
|
+
*
|
|
42606
|
+
* @param {Format} formatter (Optional) The formatting strategy to use.
|
|
42607
|
+
*
|
|
42608
|
+
* @return {string} The stringified cipher params.
|
|
42609
|
+
*
|
|
42610
|
+
* @throws Error If neither the formatter nor the default formatter is set.
|
|
42611
|
+
*
|
|
42612
|
+
* @example
|
|
42613
|
+
*
|
|
42614
|
+
* var string = cipherParams + '';
|
|
42615
|
+
* var string = cipherParams.toString();
|
|
42616
|
+
* var string = cipherParams.toString(CryptoJS.format.OpenSSL);
|
|
42617
|
+
*/
|
|
41963
42618
|
toString: function(formatter) {
|
|
41964
42619
|
return (formatter || this.formatter).stringify(this);
|
|
41965
42620
|
}
|
|
@@ -41972,6 +42627,19 @@
|
|
|
41972
42627
|
* OpenSSL formatting strategy.
|
|
41973
42628
|
*/
|
|
41974
42629
|
var OpenSSLFormatter = C_format.OpenSSL = {
|
|
42630
|
+
/**
|
|
42631
|
+
* Converts a cipher params object to an OpenSSL-compatible string.
|
|
42632
|
+
*
|
|
42633
|
+
* @param {CipherParams} cipherParams The cipher params object.
|
|
42634
|
+
*
|
|
42635
|
+
* @return {string} The OpenSSL-compatible string.
|
|
42636
|
+
*
|
|
42637
|
+
* @static
|
|
42638
|
+
*
|
|
42639
|
+
* @example
|
|
42640
|
+
*
|
|
42641
|
+
* var openSSLString = CryptoJS.format.OpenSSL.stringify(cipherParams);
|
|
42642
|
+
*/
|
|
41975
42643
|
stringify: function(cipherParams) {
|
|
41976
42644
|
var wordArray;
|
|
41977
42645
|
var ciphertext = cipherParams.ciphertext;
|
|
@@ -41980,6 +42648,19 @@
|
|
|
41980
42648
|
else wordArray = ciphertext;
|
|
41981
42649
|
return wordArray.toString(Base64);
|
|
41982
42650
|
},
|
|
42651
|
+
/**
|
|
42652
|
+
* Converts an OpenSSL-compatible string to a cipher params object.
|
|
42653
|
+
*
|
|
42654
|
+
* @param {string} openSSLStr The OpenSSL-compatible string.
|
|
42655
|
+
*
|
|
42656
|
+
* @return {CipherParams} The cipher params object.
|
|
42657
|
+
*
|
|
42658
|
+
* @static
|
|
42659
|
+
*
|
|
42660
|
+
* @example
|
|
42661
|
+
*
|
|
42662
|
+
* var cipherParams = CryptoJS.format.OpenSSL.parse(openSSLString);
|
|
42663
|
+
*/
|
|
41983
42664
|
parse: function(openSSLStr) {
|
|
41984
42665
|
var salt;
|
|
41985
42666
|
var ciphertext = Base64.parse(openSSLStr);
|
|
@@ -41999,7 +42680,30 @@
|
|
|
41999
42680
|
* A cipher wrapper that returns ciphertext as a serializable cipher params object.
|
|
42000
42681
|
*/
|
|
42001
42682
|
var SerializableCipher = C_lib.SerializableCipher = Base.extend({
|
|
42683
|
+
/**
|
|
42684
|
+
* Configuration options.
|
|
42685
|
+
*
|
|
42686
|
+
* @property {Formatter} format The formatting strategy to convert cipher param objects to and from a string. Default: OpenSSL
|
|
42687
|
+
*/
|
|
42002
42688
|
cfg: Base.extend({ format: OpenSSLFormatter }),
|
|
42689
|
+
/**
|
|
42690
|
+
* Encrypts a message.
|
|
42691
|
+
*
|
|
42692
|
+
* @param {Cipher} cipher The cipher algorithm to use.
|
|
42693
|
+
* @param {WordArray|string} message The message to encrypt.
|
|
42694
|
+
* @param {WordArray} key The key.
|
|
42695
|
+
* @param {Object} cfg (Optional) The configuration options to use for this operation.
|
|
42696
|
+
*
|
|
42697
|
+
* @return {CipherParams} A cipher params object.
|
|
42698
|
+
*
|
|
42699
|
+
* @static
|
|
42700
|
+
*
|
|
42701
|
+
* @example
|
|
42702
|
+
*
|
|
42703
|
+
* var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key);
|
|
42704
|
+
* var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv });
|
|
42705
|
+
* var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv, format: CryptoJS.format.OpenSSL });
|
|
42706
|
+
*/
|
|
42003
42707
|
encrypt: function(cipher, message, key, cfg) {
|
|
42004
42708
|
cfg = this.cfg.extend(cfg);
|
|
42005
42709
|
var encryptor = cipher.createEncryptor(key, cfg);
|
|
@@ -42016,11 +42720,43 @@
|
|
|
42016
42720
|
formatter: cfg.format
|
|
42017
42721
|
});
|
|
42018
42722
|
},
|
|
42723
|
+
/**
|
|
42724
|
+
* Decrypts serialized ciphertext.
|
|
42725
|
+
*
|
|
42726
|
+
* @param {Cipher} cipher The cipher algorithm to use.
|
|
42727
|
+
* @param {CipherParams|string} ciphertext The ciphertext to decrypt.
|
|
42728
|
+
* @param {WordArray} key The key.
|
|
42729
|
+
* @param {Object} cfg (Optional) The configuration options to use for this operation.
|
|
42730
|
+
*
|
|
42731
|
+
* @return {WordArray} The plaintext.
|
|
42732
|
+
*
|
|
42733
|
+
* @static
|
|
42734
|
+
*
|
|
42735
|
+
* @example
|
|
42736
|
+
*
|
|
42737
|
+
* var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, key, { iv: iv, format: CryptoJS.format.OpenSSL });
|
|
42738
|
+
* var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, key, { iv: iv, format: CryptoJS.format.OpenSSL });
|
|
42739
|
+
*/
|
|
42019
42740
|
decrypt: function(cipher, ciphertext, key, cfg) {
|
|
42020
42741
|
cfg = this.cfg.extend(cfg);
|
|
42021
42742
|
ciphertext = this._parse(ciphertext, cfg.format);
|
|
42022
42743
|
return cipher.createDecryptor(key, cfg).finalize(ciphertext.ciphertext);
|
|
42023
42744
|
},
|
|
42745
|
+
/**
|
|
42746
|
+
* Converts serialized ciphertext to CipherParams,
|
|
42747
|
+
* else assumed CipherParams already and returns ciphertext unchanged.
|
|
42748
|
+
*
|
|
42749
|
+
* @param {CipherParams|string} ciphertext The ciphertext.
|
|
42750
|
+
* @param {Formatter} format The formatting strategy to use to parse serialized ciphertext.
|
|
42751
|
+
*
|
|
42752
|
+
* @return {CipherParams} The unserialized ciphertext.
|
|
42753
|
+
*
|
|
42754
|
+
* @static
|
|
42755
|
+
*
|
|
42756
|
+
* @example
|
|
42757
|
+
*
|
|
42758
|
+
* var ciphertextParams = CryptoJS.lib.SerializableCipher._parse(ciphertextStringOrParams, format);
|
|
42759
|
+
*/
|
|
42024
42760
|
_parse: function(ciphertext, format) {
|
|
42025
42761
|
if (typeof ciphertext == "string") return format.parse(ciphertext, this);
|
|
42026
42762
|
else return ciphertext;
|
|
@@ -42033,7 +42769,25 @@
|
|
|
42033
42769
|
/**
|
|
42034
42770
|
* OpenSSL key derivation function.
|
|
42035
42771
|
*/
|
|
42036
|
-
var OpenSSLKdf = C_kdf.OpenSSL = {
|
|
42772
|
+
var OpenSSLKdf = C_kdf.OpenSSL = {
|
|
42773
|
+
/**
|
|
42774
|
+
* Derives a key and IV from a password.
|
|
42775
|
+
*
|
|
42776
|
+
* @param {string} password The password to derive from.
|
|
42777
|
+
* @param {number} keySize The size in words of the key to generate.
|
|
42778
|
+
* @param {number} ivSize The size in words of the IV to generate.
|
|
42779
|
+
* @param {WordArray|string} salt (Optional) A 64-bit salt to use. If omitted, a salt will be generated randomly.
|
|
42780
|
+
*
|
|
42781
|
+
* @return {CipherParams} A cipher params object with the key, IV, and salt.
|
|
42782
|
+
*
|
|
42783
|
+
* @static
|
|
42784
|
+
*
|
|
42785
|
+
* @example
|
|
42786
|
+
*
|
|
42787
|
+
* var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32);
|
|
42788
|
+
* var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32, 'saltsalt');
|
|
42789
|
+
*/
|
|
42790
|
+
execute: function(password, keySize, ivSize, salt, hasher) {
|
|
42037
42791
|
if (!salt) salt = WordArray.random(64 / 8);
|
|
42038
42792
|
if (!hasher) var key = EvpKDF.create({ keySize: keySize + ivSize }).compute(password, salt);
|
|
42039
42793
|
else var key = EvpKDF.create({
|
|
@@ -42053,7 +42807,29 @@
|
|
|
42053
42807
|
* and returns ciphertext as a serializable cipher params object.
|
|
42054
42808
|
*/
|
|
42055
42809
|
var PasswordBasedCipher = C_lib.PasswordBasedCipher = SerializableCipher.extend({
|
|
42810
|
+
/**
|
|
42811
|
+
* Configuration options.
|
|
42812
|
+
*
|
|
42813
|
+
* @property {KDF} kdf The key derivation function to use to generate a key and IV from a password. Default: OpenSSL
|
|
42814
|
+
*/
|
|
42056
42815
|
cfg: SerializableCipher.cfg.extend({ kdf: OpenSSLKdf }),
|
|
42816
|
+
/**
|
|
42817
|
+
* Encrypts a message using a password.
|
|
42818
|
+
*
|
|
42819
|
+
* @param {Cipher} cipher The cipher algorithm to use.
|
|
42820
|
+
* @param {WordArray|string} message The message to encrypt.
|
|
42821
|
+
* @param {string} password The password.
|
|
42822
|
+
* @param {Object} cfg (Optional) The configuration options to use for this operation.
|
|
42823
|
+
*
|
|
42824
|
+
* @return {CipherParams} A cipher params object.
|
|
42825
|
+
*
|
|
42826
|
+
* @static
|
|
42827
|
+
*
|
|
42828
|
+
* @example
|
|
42829
|
+
*
|
|
42830
|
+
* var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password');
|
|
42831
|
+
* var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password', { format: CryptoJS.format.OpenSSL });
|
|
42832
|
+
*/
|
|
42057
42833
|
encrypt: function(cipher, message, password, cfg) {
|
|
42058
42834
|
cfg = this.cfg.extend(cfg);
|
|
42059
42835
|
var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize, cfg.salt, cfg.hasher);
|
|
@@ -42062,6 +42838,23 @@
|
|
|
42062
42838
|
ciphertext.mixIn(derivedParams);
|
|
42063
42839
|
return ciphertext;
|
|
42064
42840
|
},
|
|
42841
|
+
/**
|
|
42842
|
+
* Decrypts serialized ciphertext using a password.
|
|
42843
|
+
*
|
|
42844
|
+
* @param {Cipher} cipher The cipher algorithm to use.
|
|
42845
|
+
* @param {CipherParams|string} ciphertext The ciphertext to decrypt.
|
|
42846
|
+
* @param {string} password The password.
|
|
42847
|
+
* @param {Object} cfg (Optional) The configuration options to use for this operation.
|
|
42848
|
+
*
|
|
42849
|
+
* @return {WordArray} The plaintext.
|
|
42850
|
+
*
|
|
42851
|
+
* @static
|
|
42852
|
+
*
|
|
42853
|
+
* @example
|
|
42854
|
+
*
|
|
42855
|
+
* var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, 'password', { format: CryptoJS.format.OpenSSL });
|
|
42856
|
+
* var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, 'password', { format: CryptoJS.format.OpenSSL });
|
|
42857
|
+
*/
|
|
42065
42858
|
decrypt: function(cipher, ciphertext, password, cfg) {
|
|
42066
42859
|
cfg = this.cfg.extend(cfg);
|
|
42067
42860
|
ciphertext = this._parse(ciphertext, cfg.format);
|
|
@@ -45404,7 +46197,10 @@
|
|
|
45404
46197
|
else if (typeof objectClass === "function") {
|
|
45405
46198
|
const objClass = objectClass;
|
|
45406
46199
|
if (typeof objClass.className === "string") this.className = objClass.className;
|
|
45407
|
-
else
|
|
46200
|
+
else {
|
|
46201
|
+
const obj = new objClass();
|
|
46202
|
+
this.className = obj.className;
|
|
46203
|
+
}
|
|
45408
46204
|
} else throw new TypeError("A ParseQuery must be constructed with a ParseObject or class name.");
|
|
45409
46205
|
this._where = {};
|
|
45410
46206
|
this._watch = [];
|
|
@@ -46697,7 +47493,8 @@
|
|
|
46697
47493
|
* @returns {Parse.Query} The query that is the OR of the passed in queries.
|
|
46698
47494
|
*/
|
|
46699
47495
|
static or(...queries) {
|
|
46700
|
-
const
|
|
47496
|
+
const className = _getClassNameFromQueries(queries);
|
|
47497
|
+
const query = new ParseQuery(className);
|
|
46701
47498
|
query._orQuery(queries);
|
|
46702
47499
|
return query;
|
|
46703
47500
|
}
|
|
@@ -46714,7 +47511,8 @@
|
|
|
46714
47511
|
* @returns {Parse.Query} The query that is the AND of the passed in queries.
|
|
46715
47512
|
*/
|
|
46716
47513
|
static and(...queries) {
|
|
46717
|
-
const
|
|
47514
|
+
const className = _getClassNameFromQueries(queries);
|
|
47515
|
+
const query = new ParseQuery(className);
|
|
46718
47516
|
query._andQuery(queries);
|
|
46719
47517
|
return query;
|
|
46720
47518
|
}
|
|
@@ -46731,7 +47529,8 @@
|
|
|
46731
47529
|
* @returns {Parse.Query} The query that is the NOR of the passed in queries.
|
|
46732
47530
|
*/
|
|
46733
47531
|
static nor(...queries) {
|
|
46734
|
-
const
|
|
47532
|
+
const className = _getClassNameFromQueries(queries);
|
|
47533
|
+
const query = new ParseQuery(className);
|
|
46735
47534
|
query._norQuery(queries);
|
|
46736
47535
|
return query;
|
|
46737
47536
|
}
|
|
@@ -46894,12 +47693,43 @@
|
|
|
46894
47693
|
* @static
|
|
46895
47694
|
*/
|
|
46896
47695
|
var EventuallyQueue = {
|
|
47696
|
+
/**
|
|
47697
|
+
* Add object to queue with save operation.
|
|
47698
|
+
*
|
|
47699
|
+
* @function save
|
|
47700
|
+
* @name Parse.EventuallyQueue.save
|
|
47701
|
+
* @param {ParseObject} object Parse.Object to be saved eventually
|
|
47702
|
+
* @param {object} [serverOptions] See {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.Object.html#save Parse.Object.save} options.
|
|
47703
|
+
* @returns {Promise} A promise that is fulfilled if object is added to queue.
|
|
47704
|
+
* @static
|
|
47705
|
+
* @see Parse.Object#saveEventually
|
|
47706
|
+
*/
|
|
46897
47707
|
save(object, serverOptions) {
|
|
46898
47708
|
return this.enqueue("save", object, serverOptions);
|
|
46899
47709
|
},
|
|
47710
|
+
/**
|
|
47711
|
+
* Add object to queue with save operation.
|
|
47712
|
+
*
|
|
47713
|
+
* @function destroy
|
|
47714
|
+
* @name Parse.EventuallyQueue.destroy
|
|
47715
|
+
* @param {ParseObject} object Parse.Object to be destroyed eventually
|
|
47716
|
+
* @param {object} [serverOptions] See {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.Object.html#destroy Parse.Object.destroy} options
|
|
47717
|
+
* @returns {Promise} A promise that is fulfilled if object is added to queue.
|
|
47718
|
+
* @static
|
|
47719
|
+
* @see Parse.Object#destroyEventually
|
|
47720
|
+
*/
|
|
46900
47721
|
destroy(object, serverOptions) {
|
|
46901
47722
|
return this.enqueue("destroy", object, serverOptions);
|
|
46902
47723
|
},
|
|
47724
|
+
/**
|
|
47725
|
+
* Generate unique identifier to avoid duplicates and maintain previous state.
|
|
47726
|
+
*
|
|
47727
|
+
* @param {string} action save / destroy
|
|
47728
|
+
* @param {object} object Parse.Object to be queued
|
|
47729
|
+
* @returns {string}
|
|
47730
|
+
* @static
|
|
47731
|
+
* @ignore
|
|
47732
|
+
*/
|
|
46903
47733
|
generateQueueId(action, object) {
|
|
46904
47734
|
object._getId();
|
|
46905
47735
|
const { className, id, _localId } = object;
|
|
@@ -46910,6 +47740,16 @@
|
|
|
46910
47740
|
object.get("hash") || _localId
|
|
46911
47741
|
].join("_");
|
|
46912
47742
|
},
|
|
47743
|
+
/**
|
|
47744
|
+
* Build queue object and add to queue.
|
|
47745
|
+
*
|
|
47746
|
+
* @param {string} action save / destroy
|
|
47747
|
+
* @param {object} object Parse.Object to be queued
|
|
47748
|
+
* @param {object} [serverOptions]
|
|
47749
|
+
* @returns {Promise} A promise that is fulfilled if object is added to queue.
|
|
47750
|
+
* @static
|
|
47751
|
+
* @ignore
|
|
47752
|
+
*/
|
|
46913
47753
|
async enqueue(action, object, serverOptions) {
|
|
46914
47754
|
const queueData = await this.getQueue();
|
|
46915
47755
|
const queueId = this.generateQueueId(action, object);
|
|
@@ -46935,6 +47775,14 @@
|
|
|
46935
47775
|
load() {
|
|
46936
47776
|
return Storage.getItemAsync(QUEUE_KEY);
|
|
46937
47777
|
},
|
|
47778
|
+
/**
|
|
47779
|
+
* Sets the in-memory queue from local storage and returns.
|
|
47780
|
+
*
|
|
47781
|
+
* @function getQueue
|
|
47782
|
+
* @name Parse.EventuallyQueue.getQueue
|
|
47783
|
+
* @returns {Promise<Queue>}
|
|
47784
|
+
* @static
|
|
47785
|
+
*/
|
|
46938
47786
|
async getQueue() {
|
|
46939
47787
|
if (dirtyCache) {
|
|
46940
47788
|
queueCache = JSON.parse(await this.load() || "[]");
|
|
@@ -46942,10 +47790,26 @@
|
|
|
46942
47790
|
}
|
|
46943
47791
|
return queueCache;
|
|
46944
47792
|
},
|
|
47793
|
+
/**
|
|
47794
|
+
* Saves the queue to local storage
|
|
47795
|
+
*
|
|
47796
|
+
* @param {Queue} queue Queue containing Parse.Object data.
|
|
47797
|
+
* @returns {Promise} A promise that is fulfilled when queue is stored.
|
|
47798
|
+
* @static
|
|
47799
|
+
* @ignore
|
|
47800
|
+
*/
|
|
46945
47801
|
setQueue(queue) {
|
|
46946
47802
|
queueCache = queue;
|
|
46947
47803
|
return this.store(queueCache);
|
|
46948
47804
|
},
|
|
47805
|
+
/**
|
|
47806
|
+
* Removes Parse.Object data from queue.
|
|
47807
|
+
*
|
|
47808
|
+
* @param {string} queueId Unique identifier for Parse.Object data.
|
|
47809
|
+
* @returns {Promise} A promise that is fulfilled when queue is stored.
|
|
47810
|
+
* @static
|
|
47811
|
+
* @ignore
|
|
47812
|
+
*/
|
|
46949
47813
|
async remove(queueId) {
|
|
46950
47814
|
const queueData = await this.getQueue();
|
|
46951
47815
|
const index = this.queueItemExists(queueData, queueId);
|
|
@@ -46954,16 +47818,49 @@
|
|
|
46954
47818
|
await this.setQueue(queueData);
|
|
46955
47819
|
}
|
|
46956
47820
|
},
|
|
47821
|
+
/**
|
|
47822
|
+
* Removes all objects from queue.
|
|
47823
|
+
*
|
|
47824
|
+
* @function clear
|
|
47825
|
+
* @name Parse.EventuallyQueue.clear
|
|
47826
|
+
* @returns {Promise} A promise that is fulfilled when queue is cleared.
|
|
47827
|
+
* @static
|
|
47828
|
+
*/
|
|
46957
47829
|
clear() {
|
|
46958
47830
|
queueCache = [];
|
|
46959
47831
|
return this.store([]);
|
|
46960
47832
|
},
|
|
47833
|
+
/**
|
|
47834
|
+
* Return the index of a queueId in the queue. Returns -1 if not found.
|
|
47835
|
+
*
|
|
47836
|
+
* @param {Queue} queue Queue containing Parse.Object data.
|
|
47837
|
+
* @param {string} queueId Unique identifier for Parse.Object data.
|
|
47838
|
+
* @returns {number}
|
|
47839
|
+
* @static
|
|
47840
|
+
* @ignore
|
|
47841
|
+
*/
|
|
46961
47842
|
queueItemExists(queue, queueId) {
|
|
46962
47843
|
return queue.findIndex((data) => data.queueId === queueId);
|
|
46963
47844
|
},
|
|
47845
|
+
/**
|
|
47846
|
+
* Return the number of objects in the queue.
|
|
47847
|
+
*
|
|
47848
|
+
* @function length
|
|
47849
|
+
* @name Parse.EventuallyQueue.length
|
|
47850
|
+
* @returns {Promise<number>}
|
|
47851
|
+
* @static
|
|
47852
|
+
*/
|
|
46964
47853
|
async length() {
|
|
46965
47854
|
return (await this.getQueue()).length;
|
|
46966
47855
|
},
|
|
47856
|
+
/**
|
|
47857
|
+
* Sends the queue to the server.
|
|
47858
|
+
*
|
|
47859
|
+
* @function sendQueue
|
|
47860
|
+
* @name Parse.EventuallyQueue.sendQueue
|
|
47861
|
+
* @returns {Promise<boolean>} Returns true if queue was sent successfully.
|
|
47862
|
+
* @static
|
|
47863
|
+
*/
|
|
46967
47864
|
async sendQueue() {
|
|
46968
47865
|
const queueData = [...await this.getQueue()];
|
|
46969
47866
|
if (queueData.length === 0) return false;
|
|
@@ -46977,6 +47874,15 @@
|
|
|
46977
47874
|
}
|
|
46978
47875
|
return true;
|
|
46979
47876
|
},
|
|
47877
|
+
/**
|
|
47878
|
+
* Build queue object and add to queue.
|
|
47879
|
+
*
|
|
47880
|
+
* @param {ParseObject} object Parse.Object to be processed
|
|
47881
|
+
* @param {QueueObject} queueObject Parse.Object data from the queue
|
|
47882
|
+
* @returns {Promise} A promise that is fulfilled when operation is performed.
|
|
47883
|
+
* @static
|
|
47884
|
+
* @ignore
|
|
47885
|
+
*/
|
|
46980
47886
|
async sendQueueCallback(object, queueObject) {
|
|
46981
47887
|
if (!object) return this.remove(queueObject.queueId);
|
|
46982
47888
|
switch (queueObject.action) {
|
|
@@ -46999,6 +47905,15 @@
|
|
|
46999
47905
|
break;
|
|
47000
47906
|
}
|
|
47001
47907
|
},
|
|
47908
|
+
/**
|
|
47909
|
+
* Start polling server for network connection.
|
|
47910
|
+
* Will send queue if connection is established.
|
|
47911
|
+
*
|
|
47912
|
+
* @function poll
|
|
47913
|
+
* @name Parse.EventuallyQueue.poll
|
|
47914
|
+
* @param [ms] Milliseconds to ping the server. Default 2000ms
|
|
47915
|
+
* @static
|
|
47916
|
+
*/
|
|
47002
47917
|
poll(ms) {
|
|
47003
47918
|
if (polling) return;
|
|
47004
47919
|
polling = setInterval(() => {
|
|
@@ -47010,10 +47925,25 @@
|
|
|
47010
47925
|
}).catch((e) => e);
|
|
47011
47926
|
}, ms || 2e3);
|
|
47012
47927
|
},
|
|
47928
|
+
/**
|
|
47929
|
+
* Turns off polling.
|
|
47930
|
+
*
|
|
47931
|
+
* @function stopPoll
|
|
47932
|
+
* @name Parse.EventuallyQueue.stopPoll
|
|
47933
|
+
* @static
|
|
47934
|
+
*/
|
|
47013
47935
|
stopPoll() {
|
|
47014
47936
|
clearInterval(polling);
|
|
47015
47937
|
polling = void 0;
|
|
47016
47938
|
},
|
|
47939
|
+
/**
|
|
47940
|
+
* Return true if pinging the server.
|
|
47941
|
+
*
|
|
47942
|
+
* @function isPolling
|
|
47943
|
+
* @name Parse.EventuallyQueue.isPolling
|
|
47944
|
+
* @returns {boolean}
|
|
47945
|
+
* @static
|
|
47946
|
+
*/
|
|
47017
47947
|
isPolling() {
|
|
47018
47948
|
return !!polling;
|
|
47019
47949
|
},
|
|
@@ -48728,18 +49658,56 @@
|
|
|
48728
49658
|
* @static
|
|
48729
49659
|
*/
|
|
48730
49660
|
var AnonymousUtils = {
|
|
49661
|
+
/**
|
|
49662
|
+
* Gets whether the user has their account linked to anonymous user.
|
|
49663
|
+
*
|
|
49664
|
+
* @function isLinked
|
|
49665
|
+
* @name Parse.AnonymousUtils.isLinked
|
|
49666
|
+
* @param {Parse.User} user User to check for.
|
|
49667
|
+
* The user must be logged in on this device.
|
|
49668
|
+
* @returns {boolean} <code>true</code> if the user has their account
|
|
49669
|
+
* linked to an anonymous user.
|
|
49670
|
+
* @static
|
|
49671
|
+
*/
|
|
48731
49672
|
isLinked(user) {
|
|
48732
49673
|
const provider = this._getAuthProvider();
|
|
48733
49674
|
return user._isLinked(provider.getAuthType());
|
|
48734
49675
|
},
|
|
49676
|
+
/**
|
|
49677
|
+
* Logs in a user Anonymously.
|
|
49678
|
+
*
|
|
49679
|
+
* @function logIn
|
|
49680
|
+
* @name Parse.AnonymousUtils.logIn
|
|
49681
|
+
* @param {object} options MasterKey / SessionToken.
|
|
49682
|
+
* @returns {Promise} Logged in user
|
|
49683
|
+
* @static
|
|
49684
|
+
*/
|
|
48735
49685
|
logIn(options) {
|
|
48736
49686
|
const provider = this._getAuthProvider();
|
|
48737
49687
|
return ParseUser.logInWith(provider.getAuthType(), provider.getAuthData(), options);
|
|
48738
49688
|
},
|
|
49689
|
+
/**
|
|
49690
|
+
* Links Anonymous User to an existing PFUser.
|
|
49691
|
+
*
|
|
49692
|
+
* @function link
|
|
49693
|
+
* @name Parse.AnonymousUtils.link
|
|
49694
|
+
* @param {Parse.User} user User to link. This must be the current user.
|
|
49695
|
+
* @param {object} options MasterKey / SessionToken.
|
|
49696
|
+
* @returns {Promise} Linked with User
|
|
49697
|
+
* @static
|
|
49698
|
+
*/
|
|
48739
49699
|
link(user, options) {
|
|
48740
49700
|
const provider = this._getAuthProvider();
|
|
48741
49701
|
return user.linkWith(provider.getAuthType(), provider.getAuthData(), options);
|
|
48742
49702
|
},
|
|
49703
|
+
/**
|
|
49704
|
+
* Returns true if Authentication Provider has been registered for use.
|
|
49705
|
+
*
|
|
49706
|
+
* @function isRegistered
|
|
49707
|
+
* @name Parse.AnonymousUtils.isRegistered
|
|
49708
|
+
* @returns {boolean}
|
|
49709
|
+
* @static
|
|
49710
|
+
*/
|
|
48743
49711
|
isRegistered() {
|
|
48744
49712
|
return registered;
|
|
48745
49713
|
},
|
|
@@ -49614,6 +50582,24 @@
|
|
|
49614
50582
|
* @hideconstructor
|
|
49615
50583
|
*/
|
|
49616
50584
|
var FacebookUtils = {
|
|
50585
|
+
/**
|
|
50586
|
+
* Initializes Parse Facebook integration. Call this function after you
|
|
50587
|
+
* have loaded the Facebook Javascript SDK with the same parameters
|
|
50588
|
+
* as you would pass to<code>
|
|
50589
|
+
* <a href=
|
|
50590
|
+
* "https://developers.facebook.com/docs/reference/javascript/FB.init/">
|
|
50591
|
+
* FB.init()</a></code>. Parse.FacebookUtils will invoke FB.init() for you
|
|
50592
|
+
* with these arguments.
|
|
50593
|
+
*
|
|
50594
|
+
* @function init
|
|
50595
|
+
* @name Parse.FacebookUtils.init
|
|
50596
|
+
* @param {object} options Facebook options argument as described here:
|
|
50597
|
+
* <a href=
|
|
50598
|
+
* "https://developers.facebook.com/docs/reference/javascript/FB.init/">
|
|
50599
|
+
* FB.init()</a>. The status flag will be coerced to 'false' because it
|
|
50600
|
+
* interferes with Parse Facebook integration. Call FB.getLoginStatus()
|
|
50601
|
+
* explicitly if this behavior is required by your application.
|
|
50602
|
+
*/
|
|
49617
50603
|
init(options) {
|
|
49618
50604
|
if (typeof FB === "undefined") throw new Error("The Facebook JavaScript SDK must be loaded before calling init.");
|
|
49619
50605
|
initOptions = {};
|
|
@@ -49624,9 +50610,43 @@
|
|
|
49624
50610
|
ParseUser._registerAuthenticationProvider(provider);
|
|
49625
50611
|
initialized = true;
|
|
49626
50612
|
},
|
|
50613
|
+
/**
|
|
50614
|
+
* Gets whether the user has their account linked to Facebook.
|
|
50615
|
+
*
|
|
50616
|
+
* @function isLinked
|
|
50617
|
+
* @name Parse.FacebookUtils.isLinked
|
|
50618
|
+
* @param {Parse.User} user User to check for a facebook link.
|
|
50619
|
+
* The user must be logged in on this device.
|
|
50620
|
+
* @returns {boolean} <code>true</code> if the user has their account
|
|
50621
|
+
* linked to Facebook.
|
|
50622
|
+
*/
|
|
49627
50623
|
isLinked(user) {
|
|
49628
50624
|
return user._isLinked("facebook");
|
|
49629
50625
|
},
|
|
50626
|
+
/**
|
|
50627
|
+
* Logs in a user using Facebook. This method delegates to the Facebook
|
|
50628
|
+
* SDK to authenticate the user, and then automatically logs in (or
|
|
50629
|
+
* creates, in the case where it is a new user) a Parse.User.
|
|
50630
|
+
*
|
|
50631
|
+
* Standard API:
|
|
50632
|
+
*
|
|
50633
|
+
* <code>logIn(permission: string, authData: Object);</code>
|
|
50634
|
+
*
|
|
50635
|
+
* Advanced API: Used for handling your own oAuth tokens
|
|
50636
|
+
* {@link https://docs.parseplatform.org/rest/guide/#linking-users}
|
|
50637
|
+
*
|
|
50638
|
+
* <code>logIn(authData: Object, options?: Object);</code>
|
|
50639
|
+
*
|
|
50640
|
+
* @function logIn
|
|
50641
|
+
* @name Parse.FacebookUtils.logIn
|
|
50642
|
+
* @param {(string | object)} permissions The permissions required for Facebook
|
|
50643
|
+
* log in. This is a comma-separated string of permissions.
|
|
50644
|
+
* Alternatively, supply a Facebook authData object as described in our
|
|
50645
|
+
* REST API docs if you want to handle getting facebook auth tokens
|
|
50646
|
+
* yourself.
|
|
50647
|
+
* @param {object} options MasterKey / SessionToken. Alternatively can be used for authData if permissions is a string
|
|
50648
|
+
* @returns {Promise}
|
|
50649
|
+
*/
|
|
49630
50650
|
logIn(permissions, options) {
|
|
49631
50651
|
if (!permissions || typeof permissions === "string") {
|
|
49632
50652
|
if (!initialized) throw new Error("You must initialize FacebookUtils before calling logIn.");
|
|
@@ -49636,6 +50656,32 @@
|
|
|
49636
50656
|
const authData = { authData: permissions };
|
|
49637
50657
|
return ParseUser.logInWith("facebook", authData, options);
|
|
49638
50658
|
},
|
|
50659
|
+
/**
|
|
50660
|
+
* Links Facebook to an existing PFUser. This method delegates to the
|
|
50661
|
+
* Facebook SDK to authenticate the user, and then automatically links
|
|
50662
|
+
* the account to the Parse.User.
|
|
50663
|
+
*
|
|
50664
|
+
* Standard API:
|
|
50665
|
+
*
|
|
50666
|
+
* <code>link(user: Parse.User, permission: string, authData?: Object);</code>
|
|
50667
|
+
*
|
|
50668
|
+
* Advanced API: Used for handling your own oAuth tokens
|
|
50669
|
+
* {@link https://docs.parseplatform.org/rest/guide/#linking-users}
|
|
50670
|
+
*
|
|
50671
|
+
* <code>link(user: Parse.User, authData: Object, options?: FullOptions);</code>
|
|
50672
|
+
*
|
|
50673
|
+
* @function link
|
|
50674
|
+
* @name Parse.FacebookUtils.link
|
|
50675
|
+
* @param {Parse.User} user User to link to Facebook. This must be the
|
|
50676
|
+
* current user.
|
|
50677
|
+
* @param {(string | object)} permissions The permissions required for Facebook
|
|
50678
|
+
* log in. This is a comma-separated string of permissions.
|
|
50679
|
+
* Alternatively, supply a Facebook authData object as described in our
|
|
50680
|
+
* REST API docs if you want to handle getting facebook auth tokens
|
|
50681
|
+
* yourself.
|
|
50682
|
+
* @param {object} options MasterKey / SessionToken. Alternatively can be used for authData if permissions is a string
|
|
50683
|
+
* @returns {Promise}
|
|
50684
|
+
*/
|
|
49639
50685
|
link(user, permissions, options) {
|
|
49640
50686
|
if (!permissions || typeof permissions === "string") {
|
|
49641
50687
|
if (!initialized) throw new Error("You must initialize FacebookUtils before calling link.");
|
|
@@ -49645,6 +50691,17 @@
|
|
|
49645
50691
|
const authData = { authData: permissions };
|
|
49646
50692
|
return user.linkWith("facebook", authData, options);
|
|
49647
50693
|
},
|
|
50694
|
+
/**
|
|
50695
|
+
* Unlinks the Parse.User from a Facebook account.
|
|
50696
|
+
*
|
|
50697
|
+
* @function unlink
|
|
50698
|
+
* @name Parse.FacebookUtils.unlink
|
|
50699
|
+
* @param {Parse.User} user User to unlink from Facebook. This must be the
|
|
50700
|
+
* current user.
|
|
50701
|
+
* @param {object} options Standard options object with success and error
|
|
50702
|
+
* callbacks.
|
|
50703
|
+
* @returns {Promise}
|
|
50704
|
+
*/
|
|
49648
50705
|
unlink: function(user, options) {
|
|
49649
50706
|
if (!initialized) throw new Error("You must initialize FacebookUtils before calling unlink.");
|
|
49650
50707
|
return user._unlinkFrom("facebook", options);
|
|
@@ -49819,7 +50876,7 @@
|
|
|
49819
50876
|
}
|
|
49820
50877
|
const fromPinPromise = this.fromPinWithName(pinName);
|
|
49821
50878
|
const [pinned] = await Promise.all([fromPinPromise, toPinPromises]);
|
|
49822
|
-
const toPin = [
|
|
50879
|
+
const toPin = [.../* @__PURE__ */ new Set([...pinned || [], ...objectKeys])];
|
|
49823
50880
|
return this.pinWithName(pinName, toPin);
|
|
49824
50881
|
},
|
|
49825
50882
|
async _handleUnPinAllWithName(name, objects) {
|
|
@@ -49961,6 +51018,17 @@
|
|
|
49961
51018
|
}
|
|
49962
51019
|
return Promise.all(promises);
|
|
49963
51020
|
},
|
|
51021
|
+
/**
|
|
51022
|
+
* Updates Local Datastore from Server
|
|
51023
|
+
*
|
|
51024
|
+
* <pre>
|
|
51025
|
+
* await Parse.LocalDatastore.updateFromServer();
|
|
51026
|
+
* </pre>
|
|
51027
|
+
*
|
|
51028
|
+
* @function updateFromServer
|
|
51029
|
+
* @name Parse.LocalDatastore.updateFromServer
|
|
51030
|
+
* @static
|
|
51031
|
+
*/
|
|
49964
51032
|
async updateFromServer() {
|
|
49965
51033
|
if (!this.checkIfEnabled() || this.isSyncing) return;
|
|
49966
51034
|
const localDatastore = await this._getAllContents();
|
|
@@ -50647,7 +51715,8 @@
|
|
|
50647
51715
|
this.subscribePromise = resolvingPromise();
|
|
50648
51716
|
this.unsubscribePromise = resolvingPromise();
|
|
50649
51717
|
this.subscribed = false;
|
|
50650
|
-
|
|
51718
|
+
const Emitter = CoreManager.getEventEmitter();
|
|
51719
|
+
this.emitter = new Emitter();
|
|
50651
51720
|
this.on = (eventName, listener) => this.emitter.on(eventName, listener);
|
|
50652
51721
|
this.emit = (eventName, ...args) => this.emitter.emit(eventName, ...args);
|
|
50653
51722
|
this.on("error", () => {});
|
|
@@ -50794,7 +51863,8 @@
|
|
|
50794
51863
|
this.connectPromise = resolvingPromise();
|
|
50795
51864
|
this.subscriptions = /* @__PURE__ */ new Map();
|
|
50796
51865
|
this.state = CLIENT_STATE.INITIALIZED;
|
|
50797
|
-
|
|
51866
|
+
const EventEmitter = CoreManager.getEventEmitter();
|
|
51867
|
+
this.emitter = new EventEmitter();
|
|
50798
51868
|
this.on = (eventName, listener) => this.emitter.on(eventName, listener);
|
|
50799
51869
|
this.emit = (eventName, ...args) => this.emitter.emit(eventName, ...args);
|
|
50800
51870
|
this.on("error", () => {});
|
|
@@ -51087,7 +52157,8 @@
|
|
|
51087
52157
|
*/
|
|
51088
52158
|
var LiveQuery = class {
|
|
51089
52159
|
constructor() {
|
|
51090
|
-
|
|
52160
|
+
const Emitter = CoreManager.getEventEmitter();
|
|
52161
|
+
this.emitter = new Emitter();
|
|
51091
52162
|
this.on = (eventName, listener) => this.emitter.on(eventName, listener);
|
|
51092
52163
|
this.emit = (eventName, ...args) => this.emitter.emit(eventName, ...args);
|
|
51093
52164
|
this.on("error", () => {});
|