|
|
@ -88,7 +88,7 @@
|
|
|
|
return crypto.createHash(algorithm).update(message, 'utf8').digest('hex');
|
|
|
|
return crypto.createHash(algorithm).update(message, 'utf8').digest('hex');
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
if (message === null || message === undefined) {
|
|
|
|
if (message === null || message === undefined) {
|
|
|
|
throw ERROR;
|
|
|
|
throw new Error(ERROR);
|
|
|
|
} else if (message.constructor === ArrayBuffer) {
|
|
|
|
} else if (message.constructor === ArrayBuffer) {
|
|
|
|
message = new Uint8Array(message);
|
|
|
|
message = new Uint8Array(message);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -169,16 +169,16 @@
|
|
|
|
if (type !== 'string') {
|
|
|
|
if (type !== 'string') {
|
|
|
|
if (type === 'object') {
|
|
|
|
if (type === 'object') {
|
|
|
|
if (message === null) {
|
|
|
|
if (message === null) {
|
|
|
|
throw ERROR;
|
|
|
|
throw new Error(ERROR);
|
|
|
|
} else if (ARRAY_BUFFER && message.constructor === ArrayBuffer) {
|
|
|
|
} else if (ARRAY_BUFFER && message.constructor === ArrayBuffer) {
|
|
|
|
message = new Uint8Array(message);
|
|
|
|
message = new Uint8Array(message);
|
|
|
|
} else if (!Array.isArray(message)) {
|
|
|
|
} else if (!Array.isArray(message)) {
|
|
|
|
if (!ARRAY_BUFFER || !ArrayBuffer.isView(message)) {
|
|
|
|
if (!ARRAY_BUFFER || !ArrayBuffer.isView(message)) {
|
|
|
|
throw ERROR;
|
|
|
|
throw new Error(ERROR);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
throw ERROR;
|
|
|
|
throw new Error(ERROR);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
notString = true;
|
|
|
|
notString = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -453,16 +453,16 @@
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
if (type === 'object') {
|
|
|
|
if (type === 'object') {
|
|
|
|
if (key === null) {
|
|
|
|
if (key === null) {
|
|
|
|
throw ERROR;
|
|
|
|
throw new Error(ERROR);
|
|
|
|
} else if (ARRAY_BUFFER && key.constructor === ArrayBuffer) {
|
|
|
|
} else if (ARRAY_BUFFER && key.constructor === ArrayBuffer) {
|
|
|
|
key = new Uint8Array(key);
|
|
|
|
key = new Uint8Array(key);
|
|
|
|
} else if (!Array.isArray(key)) {
|
|
|
|
} else if (!Array.isArray(key)) {
|
|
|
|
if (!ARRAY_BUFFER || !ArrayBuffer.isView(key)) {
|
|
|
|
if (!ARRAY_BUFFER || !ArrayBuffer.isView(key)) {
|
|
|
|
throw ERROR;
|
|
|
|
throw new Error(ERROR);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
throw ERROR;
|
|
|
|
throw new Error(ERROR);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|