Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@iota/bundle-validator

Package Overview
Dependencies
Maintainers
6
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@iota/bundle-validator - npm Package Compare versions

Comparing version 1.0.0-beta.23 to 1.0.0-beta.30

.nyc_output/0d68bb05-2dca-498b-a358-ac2a10a9f60f.json

2

.nyc_output/processinfo/index.json

@@ -1,1 +0,1 @@

{"processes":{"2304a6b4-e709-46d8-b01b-84e235e4d330":{"parent":"afd27245-0a78-4fdb-909a-23263b804669","children":[]},"2e5b8dbd-282e-4862-a400-a098da24e796":{"parent":"afd27245-0a78-4fdb-909a-23263b804669","children":[]},"afd27245-0a78-4fdb-909a-23263b804669":{"parent":null,"children":["2304a6b4-e709-46d8-b01b-84e235e4d330","2e5b8dbd-282e-4862-a400-a098da24e796"]}},"files":{"/Users/chris/Desktop/release/iota.js/packages/bundle-validator/out/bundle-validator/src/index.js":["2304a6b4-e709-46d8-b01b-84e235e4d330","2e5b8dbd-282e-4862-a400-a098da24e796"]},"externalIds":{}}
{"processes":{"0d68bb05-2dca-498b-a358-ac2a10a9f60f":{"parent":"18484352-f355-444c-9260-9a62b39485a9","children":[]},"18484352-f355-444c-9260-9a62b39485a9":{"parent":null,"children":["0d68bb05-2dca-498b-a358-ac2a10a9f60f","596c6ae1-192c-4cce-9b3f-f8df5ab38917"]},"596c6ae1-192c-4cce-9b3f-f8df5ab38917":{"parent":"18484352-f355-444c-9260-9a62b39485a9","children":[]}},"files":{"/Users/umairsarfraz/workspace/iota.js/packages/bundle-validator/out/bundle-validator/src/index.js":["0d68bb05-2dca-498b-a358-ac2a10a9f60f","596c6ae1-192c-4cce-9b3f-f8df5ab38917"]},"externalIds":{}}

@@ -23,9 +23,24 @@ "use strict";

/**
* Validates all signatures of a bundle.
*
* @method validateSignatures
* This method takes an array of transaction trytes and checks if the signatures are valid.
*
* @param {Transaction[]} bundle
* ## Related methods
*
* @return {boolean}
* To get a bundle's transaction trytes from the Tangle, use the [`getBundle()`]{@link #module_core.getBundle} method.
*
* @method validateBundleSignatures
*
* @summary Validates the signatures in a given bundle
*
* @memberof module:bundle-validator
*
* @param {Transaction[]} bundle - Transaction trytes
*
* @example
* ```js
* let valid = Validator.validateBundleSignatures(bundle);
* ```
*
* @return {boolean} Whether the signatures are valid
*
*/

@@ -35,4 +50,4 @@ exports.validateBundleSignatures = function (bundle) {

.reduce(function (acc, _a, i) {
var _b, _c;
var address = _a.address, signatureMessageFragment = _a.signatureMessageFragment, value = _a.value;
var _b, _c;
return value < 0

@@ -47,10 +62,28 @@ ? __assign({}, acc, (_b = {}, _b[address] = [converter_1.trits(signatureMessageFragment)], _b)) : value === 0 && acc.hasOwnProperty(address) && address === bundle[i - 1].address

/**
* Checks if a bundle is _syntactically_ valid.
* Validates signatures and overall structure.
* This method takes an array of transaction trytes and validates whether they form a valid bundle by checking the following:
*
* - Addresses in value transactions have a 0 trit at the end, which means they were generated using the Kerl hashing function
* - Transactions in the bundle array are in the same order as their `currentIndex` field
* - The total value of all transactions in the bundle sums to 0
* - The bundle hash is valid
*
* ## Related methods
*
* To get a bundle's transaction trytes from the Tangle, use the [`getBundle()`]{@link #module_core.getBundle} method.
*
* @method isBundle
*
* @param {Transaction[]} bundle
* @summary Validates the structure and contents of a given bundle.
*
* @returns {boolean}
* @memberof module:bundle-validator
*
* @param {Transaction[]} bundle - Transaction trytes
*
* @example
* ```js
* let bundle = Validator.isBundle(bundle);
* ```
*
* @return {boolean} bundle - Whether the bundle is valid
*
*/

@@ -57,0 +90,0 @@ function isBundle(bundle) {

@@ -292,7 +292,2 @@ "use strict";

]; };
exports.getBalancesThresholdValidator = function (threshold) { return [
threshold,
function (t) { return Number.isInteger(t) && t <= 100; },
errors.INVALID_THRESHOLD,
]; };
exports.stringify = function (value) {

@@ -299,0 +294,0 @@ return JSON.stringify(value, null, 1);

@@ -16,3 +16,2 @@ "use strict";

IRICommand["REMOVE_NEIGHBORS"] = "removeNeighbors";
IRICommand["GET_TIPS"] = "getTips";
IRICommand["FIND_TRANSACTIONS"] = "findTransactions";

@@ -19,0 +18,0 @@ IRICommand["GET_TRYTES"] = "getTrytes";

{
"name": "@iota/bundle-validator",
"version": "1.0.0-beta.23",
"version": "1.0.0-beta.30",
"description": "Syntactically validates bundle structure and signatures.",

@@ -67,12 +67,13 @@ "main": "./out/bundle-validator/src/index.js",

"dependencies": {
"@iota/converter": "^1.0.0-beta.23",
"@iota/kerl": "^1.0.0-beta.23",
"@iota/signing": "^1.0.0-beta.23",
"@iota/transaction": "^1.0.0-beta.23",
"@iota/transaction-converter": "^1.0.0-beta.23"
"@iota/converter": "^1.0.0-beta.30",
"@iota/kerl": "^1.0.0-beta.30",
"@iota/signing": "^1.0.0-beta.30",
"@iota/transaction": "^1.0.0-beta.30",
"@iota/transaction-converter": "^1.0.0-beta.30"
},
"devDependencies": {
"@iota/samples": "^1.0.0-beta.12"
"@iota/samples": "^1.0.0-beta.12",
"ava": "^0.25.0"
},
"gitHead": "f299715f6b89deda345c5cb633e400c4423052fd"
"gitHead": "9f37d7e9b4981a9b971f331ccd268646bdbce9a1"
}

@@ -23,27 +23,51 @@ # @iota/bundle-validator

* [~validateSignatures(bundle)](#module_bundle-validator..validateSignatures)
* [.validateBundleSignatures(bundle)](#module_bundle-validator.validateBundleSignatures)
* [~isBundle(bundle)](#module_bundle-validator..isBundle)
* [.isBundle(bundle)](#module_bundle-validator.isBundle)
<a name="module_bundle-validator..validateSignatures"></a>
<a name="module_bundle-validator.validateBundleSignatures"></a>
### *bundle-validator*~validateSignatures(bundle)
### *bundle-validator*.validateBundleSignatures(bundle)
**Summary**: Validates the signatures in a given bundle
| Param | Type |
| --- | --- |
| bundle | <code>Array.&lt;Transaction&gt;</code> |
| Param | Type | Description |
| --- | --- | --- |
| bundle | <code>Array.&lt;Transaction&gt;</code> | Transaction trytes |
Validates all signatures of a bundle.
This method takes an array of transaction trytes and checks if the signatures are valid.
<a name="module_bundle-validator..isBundle"></a>
## Related methods
### *bundle-validator*~isBundle(bundle)
To get a bundle's transaction trytes from the Tangle, use the [`getBundle()`](#module_core.getBundle) method.
| Param | Type |
| --- | --- |
| bundle | <code>Array.&lt;Transaction&gt;</code> |
**Returns**: <code>boolean</code> - Whether the signatures are valid
**Example**
```js
let valid = Validator.validateBundleSignatures(bundle);
```
<a name="module_bundle-validator.isBundle"></a>
Checks if a bundle is _syntactically_ valid.
Validates signatures and overall structure.
### *bundle-validator*.isBundle(bundle)
**Summary**: Validates the structure and contents of a given bundle.
| Param | Type | Description |
| --- | --- | --- |
| bundle | <code>Array.&lt;Transaction&gt;</code> | Transaction trytes |
This method takes an array of transaction trytes and validates whether they form a valid bundle by checking the following:
- Addresses in value transactions have a 0 trit at the end, which means they were generated using the Kerl hashing function
- Transactions in the bundle array are in the same order as their `currentIndex` field
- The total value of all transactions in the bundle sums to 0
- The bundle hash is valid
## Related methods
To get a bundle's transaction trytes from the Tangle, use the [`getBundle()`](#module_core.getBundle) method.
**Returns**: <code>boolean</code> - bundle - Whether the bundle is valid
**Example**
```js
let bundle = Validator.isBundle(bundle);
```

@@ -18,11 +18,25 @@ /** @module bundle-validator */

const HASH_TRITS_SIZE = 243
/**
* Validates all signatures of a bundle.
*
* This method takes an array of transaction trytes and checks if the signatures are valid.
*
* ## Related methods
*
* To get a bundle's transaction trytes from the Tangle, use the [`getBundle()`]{@link #module_core.getBundle} method.
*
* @method validateBundleSignatures
*
* @summary Validates the signatures in a given bundle
*
* @memberof module:bundle-validator
*
* @method validateSignatures
* @param {Transaction[]} bundle - Transaction trytes
*
* @example
* ```js
* let valid = Validator.validateBundleSignatures(bundle);
* ```
*
* @param {Transaction[]} bundle
*
* @return {boolean}
* @return {boolean} Whether the signatures are valid
*
*/

@@ -54,10 +68,28 @@ export const validateBundleSignatures = (bundle: Bundle): boolean => {

/**
* Checks if a bundle is _syntactically_ valid.
* Validates signatures and overall structure.
* This method takes an array of transaction trytes and validates whether they form a valid bundle by checking the following:
*
* - Addresses in value transactions have a 0 trit at the end, which means they were generated using the Kerl hashing function
* - Transactions in the bundle array are in the same order as their `currentIndex` field
* - The total value of all transactions in the bundle sums to 0
* - The bundle hash is valid
*
* ## Related methods
*
* To get a bundle's transaction trytes from the Tangle, use the [`getBundle()`]{@link #module_core.getBundle} method.
*
* @method isBundle
*
* @summary Validates the structure and contents of a given bundle.
*
* @memberof module:bundle-validator
*
* @param {Transaction[]} bundle
* @param {Transaction[]} bundle - Transaction trytes
*
* @example
* ```js
* let bundle = Validator.isBundle(bundle);
* ```
*
* @returns {boolean}
* @return {boolean} bundle - Whether the bundle is valid
*
*/

@@ -64,0 +96,0 @@ export default function isBundle(bundle: Bundle) {

@@ -7,22 +7,55 @@ /** @module bundle-validator */

/**
* Validates all signatures of a bundle.
*
* @method validateSignatures
* This method takes an array of transaction trytes and checks if the signatures are valid.
*
* @param {Transaction[]} bundle
* ## Related methods
*
* @return {boolean}
* To get a bundle's transaction trytes from the Tangle, use the [`getBundle()`]{@link #module_core.getBundle} method.
*
* @method validateBundleSignatures
*
* @summary Validates the signatures in a given bundle
*
* @memberof module:bundle-validator
*
* @param {Transaction[]} bundle - Transaction trytes
*
* @example
* ```js
* let valid = Validator.validateBundleSignatures(bundle);
* ```
*
* @return {boolean} Whether the signatures are valid
*
*/
export declare const validateBundleSignatures: (bundle: ReadonlyArray<Transaction>) => boolean;
export declare const validateBundleSignatures: (bundle: readonly Transaction[]) => boolean;
/**
* Checks if a bundle is _syntactically_ valid.
* Validates signatures and overall structure.
* This method takes an array of transaction trytes and validates whether they form a valid bundle by checking the following:
*
* - Addresses in value transactions have a 0 trit at the end, which means they were generated using the Kerl hashing function
* - Transactions in the bundle array are in the same order as their `currentIndex` field
* - The total value of all transactions in the bundle sums to 0
* - The bundle hash is valid
*
* ## Related methods
*
* To get a bundle's transaction trytes from the Tangle, use the [`getBundle()`]{@link #module_core.getBundle} method.
*
* @method isBundle
*
* @param {Transaction[]} bundle
* @summary Validates the structure and contents of a given bundle.
*
* @returns {boolean}
* @memberof module:bundle-validator
*
* @param {Transaction[]} bundle - Transaction trytes
*
* @example
* ```js
* let bundle = Validator.isBundle(bundle);
* ```
*
* @return {boolean} bundle - Whether the bundle is valid
*
*/
export default function isBundle(bundle: Bundle): boolean;
export declare const bundleValidator: Validator<Bundle>;

@@ -126,3 +126,3 @@ import { Address, Hash, Transfer } from './types';

}) => boolean;
export declare const isArray: (f: (x: any) => boolean) => (x: ReadonlyArray<any>) => boolean;
export declare const isArray: (f: (x: any) => boolean) => (x: readonly any[]) => boolean;
export declare type Validatable<T = any> = [T, (x: T) => boolean, string];

@@ -156,3 +156,3 @@ export declare type Validator<T> = (x: T, err?: string) => Validatable<T>;

export declare const validate: (...validators: (false | [any, (x: any) => boolean, string])[]) => boolean;
export declare const arrayValidator: <T>(validator: Validator<T>) => Validator<ReadonlyArray<T>>;
export declare const arrayValidator: <T>(validator: Validator<T>) => Validator<readonly T[]>;
export declare const depthValidator: Validator<number>;

@@ -174,3 +174,2 @@ export declare const minWeightMagnitudeValidator: Validator<number>;

export declare const getInputsThresholdValidator: Validator<number>;
export declare const getBalancesThresholdValidator: Validator<number>;
export declare const stringify: (value: any) => string;

@@ -69,3 +69,2 @@ /// <reference types="node" />

REMOVE_NEIGHBORS = "removeNeighbors",
GET_TIPS = "getTips",
FIND_TRANSACTIONS = "findTransactions",

@@ -133,3 +132,2 @@ GET_TRYTES = "getTrytes",

readonly addresses: ReadonlyArray<Hash>;
readonly threshold: number;
readonly tips?: ReadonlyArray<Hash>;

@@ -151,3 +149,2 @@ }

readonly transactions: ReadonlyArray<Hash>;
readonly tips: ReadonlyArray<Hash>;
}

@@ -186,9 +183,2 @@ export interface GetInclusionStatesResponse {

}
export interface GetTipsCommand extends BaseCommand {
command: IRICommand.GET_TIPS;
}
export interface GetTipsResponse {
readonly hashes: ReadonlyArray<Hash>;
readonly duration: number;
}
export interface TransactionsToApprove {

@@ -240,3 +230,3 @@ readonly trunkTransaction: Hash;

export declare type NativeGenerateSignatureFunction = (seed: number[], index: number, numberOfFragments: number, bundle: number[]) => Promise<number[]>;
export declare const asArray: <T>(x: T | ReadonlyArray<T>) => ReadonlyArray<T>;
export declare const asArray: <T>(x: T | readonly T[]) => readonly T[];
export declare const getOptionsWithDefaults: <T>(defaults: Readonly<T>) => (options: Readonly<Partial<T>>) => Readonly<T>;

@@ -243,0 +233,0 @@ export declare type CreatePersistence<K, V> = (adapter: PersistenceAdapter<K, V>) => Persistence<K, V>;

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc