node-webcrypto-ossl
Advanced tools
Comparing version 1.0.34 to 1.0.35
@@ -23,6 +23,6 @@ "use strict"; | ||
else if (ArrayBuffer.isView(ab)) { | ||
return new Buffer(ab.buffer.slice(0, ab.byteLength)); | ||
return Buffer.from(ab.buffer, ab.byteOffset, ab.byteLength); | ||
} | ||
else { | ||
return new Buffer(ab); | ||
return Buffer.from(ab); | ||
} | ||
@@ -29,0 +29,0 @@ } |
{ | ||
"name": "node-webcrypto-ossl", | ||
"version": "1.0.34", | ||
"version": "1.0.35", | ||
"repository": { | ||
@@ -5,0 +5,0 @@ "type": "git", |
@@ -44,3 +44,28 @@ "use strict"; | ||
}); | ||
context("Array", () => { | ||
it("subarray", (done) => { | ||
const data = new Uint8Array([116, 101, 115, 116, 1, 2, 3, 4, 5]) | ||
webcrypto.subtle.digest("SHA-256", data.subarray(0, 4)) | ||
.then(function (hash) { | ||
assert.equal(Buffer.from(hash).toString("hex").toLowerCase(), vector.algs["SHA-256"]); | ||
}) | ||
.then(done, done); | ||
}); | ||
it("slice", (done) => { | ||
const data = new Uint8Array([116, 101, 115, 116, 1, 2, 3, 4, 5]) | ||
webcrypto.subtle.digest("SHA-256", data.slice(0, 4)) | ||
.then(function (hash) { | ||
assert.equal(Buffer.from(hash).toString("hex").toLowerCase(), vector.algs["SHA-256"]); | ||
}) | ||
.then(done, done); | ||
}); | ||
}); | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
370173
4167