Socket
Socket
Sign inDemoInstall

ion-hash-js

Package Overview
Dependencies
1
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.0 to 2.1.0

.github/workflows/codeql-analysis.yml

6

CONTRIBUTING.md

@@ -14,3 +14,3 @@ # Contributing Guidelines

When filing an issue, please check [existing open](https://github.com/amzn/ion-hash-js/issues), or [recently closed](https://github.com/amzn/ion-hash-js/issues?utf8=%E2%9C%93&q=is%3Aissue%20is%3Aclosed%20), issues to make sure somebody else hasn't already
When filing an issue, please check [existing open](https://github.com/amazon-ion/ion-hash-js/issues), or [recently closed](https://github.com/amazon-ion/ion-hash-js/issues?utf8=%E2%9C%93&q=is%3Aissue%20is%3Aclosed%20), issues to make sure somebody else hasn't already
reported the issue. Please try to include as much information as you can. Details like these are incredibly useful:

@@ -45,3 +45,3 @@

## Finding contributions to work on
Looking at the existing issues is a great way to find something to contribute on. As our projects, by default, use the default GitHub issue labels (enhancement/bug/duplicate/help wanted/invalid/question/wontfix), looking at any ['help wanted'](https://github.com/amzn/ion-hash-js/labels/help%20wanted) issues is a great place to start.
Looking at the existing issues is a great way to find something to contribute on. As our projects, by default, use the default GitHub issue labels (enhancement/bug/duplicate/help wanted/invalid/question/wontfix), looking at any ['help wanted'](https://github.com/amazon-ion/ion-hash-js/labels/help%20wanted) issues is a great place to start.

@@ -61,4 +61,4 @@

See the [LICENSE](https://github.com/amzn/ion-hash-js/blob/master/LICENSE) file for our project's licensing. We will ask you to confirm the licensing of your contribution.
See the [LICENSE](https://github.com/amazon-ion/ion-hash-js/blob/master/LICENSE) file for our project's licensing. We will ask you to confirm the licensing of your contribution.
We may ask you to sign a [Contributor License Agreement (CLA)](http://en.wikipedia.org/wiki/Contributor_License_Agreement) for larger changes.
import { Decimal, IntSize, IonType, Reader, ReaderScalarValue, Timestamp, Writer } from 'ion-js';
import { Hasher, HasherProvider, HashReader, HashWriter } from "../IonHash";
import JSBI from "jsbi";
export declare class _CryptoHasher implements Hasher {

@@ -25,3 +24,3 @@ private readonly algorithm;

annotations(): string[];
bigIntValue(): JSBI | null;
bigIntValue(): bigint | null;
booleanValue(): boolean | null;

@@ -39,2 +38,4 @@ byteValue(): Uint8Array | null;

value(): ReaderScalarValue;
position(): number;
uInt8ArrayValue(): Uint8Array | null;
private _traverse;

@@ -70,3 +71,3 @@ next(): IonType | null;

writeFloat64(value: number | null): void;
writeInt(value: number | JSBI | null): void;
writeInt(value: number | bigint | null): void;
writeNull(type: IonType): void;

@@ -73,0 +74,0 @@ writeString(value: string | null): void;

@@ -6,6 +6,8 @@ "use strict";

({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);

@@ -17,2 +19,3 @@ function __() { this.constructor = d; }

Object.defineProperty(exports, "__esModule", { value: true });
exports._escape = exports._Uint8ArrayComparator = exports._HashWriterImpl = exports._HashReaderImpl = exports._CryptoHasher = void 0;
var ion_js_1 = require("ion-js");

@@ -23,3 +26,3 @@ var crypto_1 = require("crypto");

this.algorithm = algorithm;
this._hash = crypto_1.createHash(algorithm);
this._hash = (0, crypto_1.createHash)(algorithm);
}

@@ -31,3 +34,3 @@ _CryptoHasher.prototype.update = function (bytes) {

var digest = this._hash.digest();
this._hash = crypto_1.createHash(this.algorithm);
this._hash = (0, crypto_1.createHash)(this.algorithm);
return digest;

@@ -48,3 +51,3 @@ };

_HashReaderImpl.prototype.booleanValue = function () { return this._reader.booleanValue(); };
_HashReaderImpl.prototype.byteValue = function () { return this._reader.byteValue(); };
_HashReaderImpl.prototype.byteValue = function () { return this._reader.uInt8ArrayValue(); };
_HashReaderImpl.prototype.decimalValue = function () { return this._reader.decimalValue(); };

@@ -60,2 +63,4 @@ _HashReaderImpl.prototype.depth = function () { return this._reader.depth(); };

_HashReaderImpl.prototype.value = function () { return this._reader.value(); };
_HashReaderImpl.prototype.position = function () { return this._reader.position(); };
_HashReaderImpl.prototype.uInt8ArrayValue = function () { return this._reader.uInt8ArrayValue(); };
_HashReaderImpl.prototype._traverse = function () {

@@ -237,6 +242,6 @@ for (var type = void 0; type = this.next();) {

case ion_js_1.IonTypes.CLOB:
this.writeClob(reader.byteValue());
this.writeClob(reader.uInt8ArrayValue());
break;
case ion_js_1.IonTypes.BLOB:
this.writeBlob(reader.byteValue());
this.writeBlob(reader.uInt8ArrayValue());
break;

@@ -389,3 +394,3 @@ case ion_js_1.IonTypes.LIST:

else {
var writer = ion_js_1.makeBinaryWriter();
var writer = (0, ion_js_1.makeBinaryWriter)();
_Serializer._serializers[type.name](value, writer);

@@ -392,0 +397,0 @@ writer.close();

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.digest = exports.cryptoHasherProvider = exports.makeHashWriter = exports.makeHashReader = void 0;
var ion_js_1 = require("ion-js");

@@ -18,3 +19,3 @@ var IonHashImpl_1 = require("./internal/IonHashImpl");

function digest(value, algorithm) {
var writer = ion_js_1.makeBinaryWriter();
var writer = (0, ion_js_1.makeBinaryWriter)();
var hashProvider = cryptoHasherProvider(algorithm);

@@ -21,0 +22,0 @@ var hashWriter = makeHashWriter(writer, hashProvider);

@@ -52,7 +52,4 @@ /*

hideGenerator: true,
mode: 'file',
module: 'commonjs',
name: 'ion-hash-js',
out: 'docs/api',
target: 'es5',
},

@@ -59,0 +56,0 @@ src: 'src/*.ts',

{
"name": "ion-hash-js",
"version": "2.0.0",
"version": "2.1.0",
"description": "JavaScript implementation of Amazon Ion Hash",

@@ -13,3 +13,3 @@ "main": "dist/commonjs/es5/IonHash.js",

"type": "git",
"url": "https://github.com/amzn/ion-hash-js.git"
"url": "https://github.com/amazon-ion/ion-hash-js.git"
},

@@ -20,24 +20,22 @@ "keywords": [

],
"author": "The Ion Team <ion-team@amazon.com> (https://amzn.github.io/ion-docs/)",
"author": "The Ion Team <ion-team@amazon.com> (https://amazon-ion.github.io/ion-docs/)",
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/amzn/ion-hash-js/issues"
"url": "https://github.com/amazon-ion/ion-hash-js/issues"
},
"homepage": "https://github.com/amzn/ion-hash-js#readme",
"homepage": "https://github.com/amazon-ion/ion-hash-js#readme",
"devDependencies": {
"grunt": "^1.0.1",
"grunt-contrib-clean": "^1.0.0",
"grunt-ts": "^6.0.0-beta.19",
"grunt": "^1.6.1",
"grunt-contrib-clean": "^1.1.0",
"grunt-ts": "^6.0.0-beta.22",
"grunt-typedoc": "^0.2.4",
"intern": "^4.4.3",
"ion-js": "^4.0.0",
"jsbi": "3.1.1",
"typedoc": "^0.17.3",
"typedoc-plugin-no-inherit": "^1.1.10",
"typescript": "^3.5.3"
"intern": "^4.10.1",
"ion-js": "^5.2.0",
"typedoc": "^0.25.3",
"typedoc-plugin-no-inherit": "^1.4.0",
"typescript": "^5.2.2"
},
"peerDependencies": {
"ion-js": "^4.0.0",
"jsbi": "^3.1.1"
"ion-js": "^5.2.0"
}
}
# Amazon Ion Hash JavaScript
An implementation of [Amazon Ion Hash](http://amzn.github.io/ion-hash) in JavaScript.
An implementation of [Amazon Ion Hash](https://amazon-ion.github.io/ion-hash) in JavaScript.
[![Build Status](https://travis-ci.org/amzn/ion-hash-js.svg?branch=master)](https://travis-ci.org/amzn/ion-hash-js)
[![npm version](https://img.shields.io/npm/v/ion-hash-js.svg)](https://www.npmjs.com/package/ion-hash-js)
[![license](https://img.shields.io/hexpm/l/plug.svg)](https://github.com/amzn/ion-hash-js/blob/master/LICENSE)
[![docs](https://img.shields.io/badge/docs-api-green.svg?style=flat-square)](https://amzn.github.io/ion-hash-js/api)
[![license](https://img.shields.io/hexpm/l/plug.svg)](https://github.com/amazon-ion/ion-hash-js/blob/master/LICENSE)
[![docs](https://img.shields.io/badge/docs-api-green.svg?style=flat-square)](https://amazon-ion.github.io/ion-hash-js/api)

@@ -18,5 +18,3 @@ ## Getting Started

```
npm install --save-dev ion-hash-js
npm install --save-dev ion-js
npm install --save-dev jsbi
npm install --save ion-hash-js ion-js
```

@@ -105,3 +103,3 @@

```
$ git clone --recursive https://github.com/amzn/ion-hash-js.git ion-hash-js
$ git clone --recursive https://github.com/amazon-ion/ion-hash-js.git ion-hash-js
```

@@ -120,3 +118,3 @@

Any tests commented out in [tests/ion_hash_tests.ion](https://github.com/amzn/ion-hash-js/blob/master/tests/ion_hash_tests.ion)
Any tests commented out in [tests/ion_hash_tests.ion](https://github.com/amazon-ion/ion-hash-js/blob/master/tests/ion_hash_tests.ion)
are not expected to work at this time.

@@ -123,0 +121,0 @@

@@ -22,3 +22,2 @@ /*

import {Hasher, HasherProvider, HashReader, HashWriter} from "../IonHash";
import JSBI from "jsbi";

@@ -61,5 +60,5 @@ export class _CryptoHasher implements Hasher {

annotations() : string[] { return this._reader.annotations() }
bigIntValue() : JSBI | null { return this._reader.bigIntValue() }
bigIntValue() : bigint | null { return this._reader.bigIntValue() }
booleanValue() : boolean | null { return this._reader.booleanValue() }
byteValue() : Uint8Array | null { return this._reader.byteValue() }
byteValue() : Uint8Array | null { return this._reader.uInt8ArrayValue() }
decimalValue() : Decimal | null { return this._reader.decimalValue() }

@@ -75,2 +74,4 @@ depth() : number { return this._reader.depth() }

value() : ReaderScalarValue { return this._reader.value() }
position() : number { return this._reader.position() }
uInt8ArrayValue(): Uint8Array | null { return this._reader.uInt8ArrayValue() }

@@ -188,3 +189,3 @@ private _traverse() {

}
writeInt(value: number | JSBI | null): void {
writeInt(value: number | bigint | null): void {
this._hashScalar(IonTypes.INT, value);

@@ -260,4 +261,4 @@ this._writer.writeInt(value);

case IonTypes.STRING: this.writeString(reader.stringValue()); break;
case IonTypes.CLOB: this.writeClob(reader.byteValue()); break;
case IonTypes.BLOB: this.writeBlob(reader.byteValue()); break;
case IonTypes.CLOB: this.writeClob(reader.uInt8ArrayValue()); break;
case IonTypes.BLOB: this.writeBlob(reader.uInt8ArrayValue()); break;
case IonTypes.LIST: this.stepIn(IonTypes.LIST); break;

@@ -264,0 +265,0 @@ case IonTypes.SEXP: this.stepIn(IonTypes.SEXP); break;

@@ -46,3 +46,3 @@ /*

*
* @see [Reader](https://amzn.github.io/ion-js/api/interfaces/_ionreader_.reader.html)
* @see [Reader](https://amazon-ion.github.io/ion-js/api/interfaces/_ionreader_.reader.html)
* @noInheritDoc

@@ -68,3 +68,3 @@ */

*
* @see [Writer](https://amzn.github.io/ion-js/api/interfaces/_ionwriter_.writer.html)
* @see [Writer](https://amazon-ion.github.io/ion-js/api/interfaces/_ionwriter_.writer.html)
* @noInheritDoc

@@ -71,0 +71,0 @@ */

@@ -16,3 +16,3 @@ /*

import JSBI from "jsbi";
import intern from 'intern';

@@ -43,3 +43,3 @@ const {registerSuite} = intern.getPlugin('interface.object');

}
bigIntValue(): JSBI | null {
bigIntValue(): bigint | null {
assert.deepEqual(this.readerA.bigIntValue(), this.readerB.bigIntValue());

@@ -53,4 +53,4 @@ return this.readerA.bigIntValue();

byteValue(): Uint8Array | null {
assert.deepEqual(this.readerA.byteValue(), this.readerB.byteValue());
return this.readerA.byteValue()
assert.deepEqual(this.readerA.uInt8ArrayValue(), this.readerB.uInt8ArrayValue());
return this.readerA.uInt8ArrayValue()
}

@@ -114,2 +114,12 @@ decimalValue(): Decimal | null {

}
position(): number {
assert.deepEqual(this.readerA.position(), this.readerB.position());
return this.readerA.position()
}
uInt8ArrayValue(): Uint8Array | null {
assert.deepEqual(this.readerA.uInt8ArrayValue(), this.readerB.uInt8ArrayValue());
return this.readerA.uInt8ArrayValue()
}
}

@@ -128,4 +138,4 @@

case IonTypes.STRING: { reader.stringValue(); break }
case IonTypes.CLOB: { reader.byteValue(); break }
case IonTypes.BLOB: { reader.byteValue(); break }
case IonTypes.CLOB: { reader.uInt8ArrayValue(); break }
case IonTypes.BLOB: { reader.uInt8ArrayValue(); break }
}

@@ -132,0 +142,0 @@ reader.isNull();

@@ -6,2 +6,3 @@ {

"declaration": true,
"esModuleInterop": true,
"noImplicitAny": true,

@@ -11,5 +12,6 @@ "sourceMap": true,

"strictPropertyInitialization": true,
"verbose": true
// TODO: Temporarily skipping the type checking of all declaration files in the node_modules directory. More investigations required to resolve the compiling error when setting this option as false
"skipLibCheck": true
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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