mirror of
https://github.com/kou029w/websri.git
synced 2025-02-22 00:35:57 +00:00
Fixed "Maximum call stack size exceeded" error when using IntegrityMetadataSet#strongest
This commit is contained in:
parent
22450619c4
commit
d0415bbd04
3 changed files with 20 additions and 8 deletions
|
@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
## [Unreleased]
|
||||
|
||||
- Fixed "Maximum call stack size exceeded" error when using `IntegrityMetadataSet#strongest`
|
||||
|
||||
## [1.0.0] - 2025-01-06
|
||||
|
||||
- Change `strongest` property type from `Array<IntegrityMetadata>` to `IntegrityMetadataSet`
|
||||
|
|
|
@ -337,7 +337,7 @@ export class IntegrityMetadataSet {
|
|||
switch (prioritizedHashAlgorithm) {
|
||||
case "":
|
||||
strongest = new IntegrityMetadataSet([
|
||||
...this.strongest,
|
||||
...strongest,
|
||||
integrityMetadata,
|
||||
]);
|
||||
break;
|
||||
|
|
|
@ -4,16 +4,26 @@ import { IntegrityMetadataSet } from "../../src/index.ts";
|
|||
|
||||
test("pick the strongest metadata from set", function () {
|
||||
const integrityMetadataSet = new IntegrityMetadataSet(`
|
||||
sha256-MV9b23bQeMQ7isAGTkoBZGErH853yGk0W/yUx1iU7dM=
|
||||
sha384-VbxVaw0v4Pzlgrpf4Huq//A1ZTY4x6wNVJTCpkwL6hzFczHHwSpFzbyn9MNKCJ7r
|
||||
sha512-wVJ82JPBJHc9gRkRlwyP5uhX1t9dySJr2KFgYUwM2WOk3eorlLt9NgIe+dhl1c6ilKgt1JoLsmn1H256V/eUIQ==
|
||||
sha256-gxZXfeA3KCK+ZyBybEt6liVPg+FWGf/KLVU6rufBujE=
|
||||
sha384-LDW1hUX1OX+VZsNmW+LELiky69a4xF+FfVsTlqZOhqPiPj5YYo20jP6C8H8uXMZf
|
||||
sha512-aqnrVqlE3w/CWs51jb3FHCsFSBwfpecdXHaFFYZNkxfW2Z1qyJm4mA9iCPK11KeWwEa8rbMDq7l6IrnevQuOQw==
|
||||
sha512-P8q/bH6NoZs5MnZKL9D/r/oEZOlyEAmSfuXuJchD2WeXnKbnfcO3fF0WvO6CiqZUGWsEREs9BWLrv1xr3NPOLg==
|
||||
`);
|
||||
|
||||
assert.deepEqual(
|
||||
integrityMetadataSet.strongest,
|
||||
new IntegrityMetadataSet(
|
||||
"sha512-wVJ82JPBJHc9gRkRlwyP5uhX1t9dySJr2KFgYUwM2WOk3eorlLt9NgIe+dhl1c6ilKgt1JoLsmn1H256V/eUIQ==",
|
||||
),
|
||||
[...integrityMetadataSet.strongest],
|
||||
[
|
||||
{
|
||||
alg: "sha512",
|
||||
val: "aqnrVqlE3w/CWs51jb3FHCsFSBwfpecdXHaFFYZNkxfW2Z1qyJm4mA9iCPK11KeWwEa8rbMDq7l6IrnevQuOQw==",
|
||||
opt: [],
|
||||
},
|
||||
{
|
||||
alg: "sha512",
|
||||
val: "P8q/bH6NoZs5MnZKL9D/r/oEZOlyEAmSfuXuJchD2WeXnKbnfcO3fF0WvO6CiqZUGWsEREs9BWLrv1xr3NPOLg==",
|
||||
opt: [],
|
||||
},
|
||||
],
|
||||
);
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue