@digitalbazaar/eddsa-rdfc-2022-cryptosuite 1.0.1 → 1.2.0

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.
Files changed (2) hide show
  1. package/lib/canonize.js +15 -5
  2. package/package.json +7 -6
package/lib/canonize.js CHANGED
@@ -1,12 +1,22 @@
1
1
  /*!
2
- * Copyright (c) 2023 Digital Bazaar, Inc. All rights reserved.
2
+ * Copyright (c) 2023-2024 Digital Bazaar, Inc. All rights reserved.
3
3
  */
4
+ import * as rdfCanonize from 'rdf-canonize';
4
5
  import jsonld from 'jsonld';
5
6
 
6
- export function canonize(input, options) {
7
- return jsonld.canonize(input, {
8
- algorithm: 'URDNA2015',
7
+ export async function canonize(input, options) {
8
+ // convert to RDF dataset and do canonicalization
9
+ options = {
10
+ algorithm: 'RDFC-1.0',
9
11
  format: 'application/n-quads',
12
+ base: null,
13
+ safe: true,
10
14
  ...options
11
- });
15
+ };
16
+ const opts = {
17
+ rdfDirection: 'i18n-datatype', ...options, produceGeneralizedRdf: false,
18
+ };
19
+ delete opts.format;
20
+ const dataset = await jsonld.toRDF(input, opts);
21
+ return rdfCanonize.canonize(dataset, options);
12
22
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digitalbazaar/eddsa-rdfc-2022-cryptosuite",
3
- "version": "1.0.1",
3
+ "version": "1.2.0",
4
4
  "description": "An EdDSA-RDFC-2022 Data Integrity cryptosuite for use with jsonld-signatures.",
5
5
  "homepage": "https://github.com/digitalbazaar/eddsa-rdfc-2022-cryptosuite",
6
6
  "repository": {
@@ -15,16 +15,17 @@
15
15
  ],
16
16
  "dependencies": {
17
17
  "@digitalbazaar/ed25519-multikey": "^1.0.0",
18
- "jsonld": "^8.1.0"
18
+ "jsonld": "^8.1.0",
19
+ "rdf-canonize": "^4.0.1"
19
20
  },
20
21
  "devDependencies": {
21
- "@digitalbazaar/ed25519-verification-key-2018": "^4.0.0",
22
- "@digitalbazaar/ed25519-verification-key-2020": "^4.1.0",
23
22
  "@digitalbazaar/data-integrity": "^2.0.0",
24
23
  "@digitalbazaar/data-integrity-context": "^2.0.0",
25
24
  "@digitalbazaar/ed25519-multikey": "^1.0.0",
26
- "@digitalbazaar/multikey-context": "^1.0.0",
27
- "@digitalbazaar/security-document-loader": "^2.0.0",
25
+ "@digitalbazaar/ed25519-verification-key-2018": "^4.0.0",
26
+ "@digitalbazaar/ed25519-verification-key-2020": "^4.1.0",
27
+ "@digitalbazaar/multikey-context": "^2.0.1",
28
+ "@digitalbazaar/security-document-loader": "^3.0.0",
28
29
  "c8": "^7.11.3",
29
30
  "chai": "^4.3.6",
30
31
  "cross-env": "^7.0.3",