Socket
Socket
Sign inDemoInstall

rdf-canonize

Package Overview
Dependencies
1
Maintainers
4
Versions
26
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.0.0 to 3.1.0

12

lib/index.js

@@ -77,2 +77,8 @@ /**

* [useNative] use native implementation (default: false).
* [maxDeepIterations=Infinity] the maximum number of times to run
* deep comparison algorithms (such as the N-Degree Hash Quads
* algorithm used in URDNA2015) before bailing out and throwing an
* error; this is a useful setting for preventing wasted CPU cycles
* or DoS when canonizing meaningless or potentially malicious
* datasets, a recommended value is `1`.
*

@@ -120,2 +126,8 @@ * @return a Promise that resolves to the canonicalized RDF Dataset.

* [useNative] use native implementation (default: false).
* [maxDeepIterations=Infinity] the maximum number of times to run
* deep comparison algorithms (such as the N-Degree Hash Quads
* algorithm used in URDNA2015) before bailing out and throwing an
* error; this is a useful setting for preventing wasted CPU cycles
* or DoS when canonizing meaningless or potentially malicious
* datasets, a recommended value is `1`.
*

@@ -122,0 +134,0 @@ * @return the RDF dataset in canonical form.

14

lib/URDNA2015.js
/*
* Copyright (c) 2016-2021 Digital Bazaar, Inc. All rights reserved.
* Copyright (c) 2016-2022 Digital Bazaar, Inc. All rights reserved.
*/

@@ -12,3 +12,3 @@ 'use strict';

module.exports = class URDNA2015 {
constructor() {
constructor({maxDeepIterations = Infinity} = {}) {
this.name = 'URDNA2015';

@@ -18,3 +18,5 @@ this.blankNodeInfo = new Map();

this.hashAlgorithm = 'sha256';
this.maxDeepIterations = maxDeepIterations;
this.quads = null;
this.deepIterations = null;
}

@@ -24,2 +26,3 @@

async main(dataset) {
this.deepIterations = new Map();
this.quads = dataset;

@@ -249,2 +252,9 @@

async hashNDegreeQuads(id, issuer) {
const deepIterations = this.deepIterations.get(id) || 0;
if(deepIterations > this.maxDeepIterations) {
throw new Error(
`Maximum deep iterations (${this.maxDeepIterations}) exceeded.`);
}
this.deepIterations.set(id, deepIterations + 1);
// 1) Create a hash to related blank nodes map for storing hashes that

@@ -251,0 +261,0 @@ // identify related blank nodes.

/*
* Copyright (c) 2016-2021 Digital Bazaar, Inc. All rights reserved.
* Copyright (c) 2016-2022 Digital Bazaar, Inc. All rights reserved.
*/

@@ -12,3 +12,3 @@ 'use strict';

module.exports = class URDNA2015Sync {
constructor() {
constructor({maxDeepIterations = Infinity} = {}) {
this.name = 'URDNA2015';

@@ -18,3 +18,5 @@ this.blankNodeInfo = new Map();

this.hashAlgorithm = 'sha256';
this.maxDeepIterations = maxDeepIterations;
this.quads = null;
this.deepIterations = null;
}

@@ -24,2 +26,3 @@

main(dataset) {
this.deepIterations = new Map();
this.quads = dataset;

@@ -244,2 +247,9 @@

hashNDegreeQuads(id, issuer) {
const deepIterations = this.deepIterations.get(id) || 0;
if(deepIterations > this.maxDeepIterations) {
throw new Error(
`Maximum deep iterations (${this.maxDeepIterations}) exceeded.`);
}
this.deepIterations.set(id, deepIterations + 1);
// 1) Create a hash to related blank nodes map for storing hashes that

@@ -246,0 +256,0 @@ // identify related blank nodes.

2

package.json
{
"name": "rdf-canonize",
"version": "3.0.0",
"version": "3.1.0",
"description": "An implementation of the RDF Dataset Normalization Algorithm in JavaScript",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/digitalbazaar/rdf-canonize",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc