/ student-intifada / node_modules / @tufjs / canonical-json /

[ICO]NameLast modifiedSizeDescription
[PARENTDIR]Parent Directory  -  
[DIR]lib/10 months ago -  
[   ]LICENSE10 months ago1.1K 
[TXT]README.md10 months ago1.7K595aea1 more query options + view options [كارل مبارك]
[   ]package.json10 months ago771 afd0ccc remove unused [كارل مبارك]
README.md

@tufjs/canonical-json

JSON canonicalization compliant with the OLPC Canonical JSON specification.

Why

If you're looking for RFC 8785 compliant JSON canonicalization there are any number of libraries to choose from. You should only select this library if you know that you specifically need support for the OLPC-style of canonicalization.

One reason you might chose OLPC compliance is for interoperability with The Update Framework which specifically calls out OLPC as the canonicalization standard for computing signatures over TUF metadata.

The canonicalized strings generated by this library are compatible with those generated by the Python-based securesystemslib library and the Go-based go-securesystemslib library.

Installation

npm install @tufjs/canonical-json

Usage

const json = require('@tufjs/canonical-json')

const obj = {
  bool: true,
  num: 42,
  ary: [1, 2, 3],
  str: "foo\\bar"
}

console.log(json.canonicalize(obj))
// output: {"ary":[1,2,3],"bool":true,"num":42,"str":"foo\\bar"}
Apache/2.4.38 (Debian) Server at www.karls.computer Port 80