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

@xyo-network/bound-witness

Package Overview
Dependencies
Maintainers
4
Versions
62
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@xyo-network/bound-witness - npm Package Compare versions

Comparing version 0.2.1 to 0.3.0

dist/xyo-bound-witness-fragment.d.ts

117

dist/@types/index.d.ts
/// <reference types="node" />
import { IXyoSignature, IXyoPublicKey } from '@xyo-network/signing';
import { IXyoSerializableObject } from '@xyo-network/serialization';
import { IXyoHash } from '@xyo-network/hashing';
/**

@@ -10,71 +11,55 @@ * A payload encapsulates the meta data being shared between parties

*/
export interface IXyoPayload extends IXyoSerializableObject {
/**
* The signed portion of the payload
*
* @type {IXyoSerializableObject[]}
* @memberof IXyoPayload
*/
readonly signedPayload: IXyoSerializableObject[];
/**
* The unsigned portion of the payload
*
* @type {IXyoSerializableObject[]}
* @memberof IXyoPayload
*/
readonly unsignedPayload: IXyoSerializableObject[];
export interface IXyoPayload {
readonly heuristics: IXyoSerializableObject[];
readonly metadata: IXyoSerializableObject[];
}
/**
* A bound-witness is the central data type used to communicate between nodes in the
* XYO network. The structure provides a cryptographically secure way that ensures,
* through public-key cryptography, that two nodes interacted and agreed upon a
* particular payload
*
* This particular structure is forward looking in that it may accommodate a future
* situation where more than two nodes interacted. As such, there exists a positional
* coupling across the fields of the `IXyoBoundWitness`. That is, a party in the
* bound-witness corresponds to a particular index of the fields
*
* - publicKeys
* - signatures
* - payloads
*
* @export
* @interface IXyoBoundWitness
*/
export interface IXyoBoundWitness extends IXyoSerializableObject {
/**
* A collection of publicKey collections associated with the
* bound-witness. The outer-index represents the party. The inner-index
* corresponds to a public-key entry. Parties are allowed to sign with
* multiple key-pairs. The 2-dimensional index of each element corresponds
* directly to the 2-dimensional index of the corresponding signature
*
* @type {IXyoPublicKey[][]}
* @memberof IXyoBoundWitness
*/
readonly publicKeys: IXyoPublicKey[][];
/**
* A collection of signatures collections associated with the
* bound-witness. The outer-index represents the party. The inner-index
* corresponds to a signature entry. Parties are allowed to sign with
* multiple key-pairs. The 2-dimensional index of each element corresponds
* directly to the 2-dimensional index of the corresponding publicKey
*
* @type {IXyoPublicKey[][]}
* @memberof IXyoBoundWitness
*/
readonly signatures: IXyoSignature[][];
/**
* Each party in a bound-witness contributes a payload. The index of
* the payload corresponds to the party-member.
*
* @type {IXyoPayload[]}
* @memberof IXyoBoundWitness
*/
readonly payloads: IXyoPayload[];
export interface IXyoKeySet extends IXyoSerializableObject {
readonly keys: IXyoPublicKey[];
}
export interface IXyoBoundWitnessSigningDataProducer {
getSigningData(boundWitness: IXyoBoundWitness): Buffer;
export interface IXyoSignatureSet extends IXyoSerializableObject {
readonly signatures: IXyoSignature[];
}
export interface IXyoFetter extends IXyoSerializableObject {
readonly keySet: IXyoKeySet;
readonly heuristics: IXyoSerializableObject[];
}
export interface IXyoFetterSet extends IXyoSerializableObject {
readonly fetters: IXyoFetter[];
}
export interface IXyoWitness extends IXyoSerializableObject {
readonly signatureSet: IXyoSignatureSet;
readonly metadata: IXyoSerializableObject[];
}
export interface IXyoWitnessSet extends IXyoSerializableObject {
readonly witnesses: IXyoWitness[];
}
export declare type FetterOrWitness = IXyoFetter | IXyoWitness;
export interface IXyoBoundWitnessFragment extends IXyoSerializableObject {
fetterWitnesses: FetterOrWitness[];
}
export interface IXyoPayloadDataExtractionService {
getIndex(payload: IXyoPayload): number | undefined;
getPreviousHash(payload: IXyoPayload): IXyoHash | undefined;
getNextPublicKey(payload: IXyoPayload): IXyoPublicKey | undefined;
getBridgeHashSet(payload: IXyoPayload): IXyoHash[] | undefined;
getBridgeBlockSet(payload: IXyoPayload): IXyoBoundWitness[] | undefined;
findElementInSignedPayload<T extends IXyoSerializableObject>(payload: IXyoPayload, schemaObjectId: number): T | undefined;
findElementInUnsignedPayload<T extends IXyoSerializableObject>(payload: IXyoPayload, schemaObjectId: number): T | undefined;
}
export interface IXyoBoundWitnessParty {
partyIndex: number;
keySet: IXyoKeySet;
signatureSet: IXyoSignatureSet;
heuristics: IXyoSerializableObject[];
metadata: IXyoSerializableObject[];
}
export interface IXyoBoundWitness extends IXyoSerializableObject, IXyoBoundWitnessFragment {
readonly publicKeys: IXyoKeySet[];
readonly signatures: IXyoSignatureSet[];
readonly heuristics: IXyoSerializableObject[][];
readonly metadata: IXyoSerializableObject[][];
readonly numberOfParties: number;
readonly parties: IXyoBoundWitnessParty[];
getSigningData(): Buffer;
}
//# sourceMappingURL=index.d.ts.map

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

* @Last modified by: ryanxyo
* @Last modified time: Monday, 26th November 2018 3:13:33 pm
* @Last modified time: Monday, 10th December 2018 2:27:42 pm
* @License: All Rights Reserved

@@ -11,0 +11,0 @@ * @Copyright: Copyright XY | The Findables Company

@@ -1,7 +0,11 @@

export { IXyoBoundWitness, IXyoBoundWitnessSigningDataProducer, IXyoPayload } from './@types';
export { XyoBoundWitnessSigningService } from './xyo-bound-witness-signing-service';
export { IXyoBoundWitness, IXyoFetter, IXyoFetterSet, IXyoWitness, IXyoWitnessSet, IXyoBoundWitnessFragment, IXyoKeySet, IXyoSignatureSet, FetterOrWitness, IXyoPayload } from './@types';
export { XyoBoundWitnessValidator } from './xyo-bound-witness-validator';
export { XyoBaseBoundWitness } from './xyo-base-bound-witness';
export { XyoBasePayload } from './xyo-base-payload';
export { XyoBoundWitnessSigningDataProducer } from './xyo-bound-witness-signing-data-producer';
export { XyoBoundWitness } from './xyo-bound-witness';
export { XyoKeySet } from './xyo-keyset';
export { XyoSignatureSet } from './xyo-signature-set';
export { XyoFetter } from './xyo-fetter';
export { XyoWitness } from './xyo-witness';
export { XyoFetterSet } from './xyo-fetter-set';
export { XyoWitnessSet } from './xyo-witness-set';
export { XyoBoundWitnessFragment } from './xyo-bound-witness-fragment';
//# sourceMappingURL=index.d.ts.map

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

* @Last modified by: ryanxyo
* @Last modified time: Thursday, 29th November 2018 9:29:08 am
* @Last modified time: Monday, 10th December 2018 2:24:48 pm
* @License: All Rights Reserved

@@ -14,12 +14,20 @@ * @Copyright: Copyright XY | The Findables Company

Object.defineProperty(exports, "__esModule", { value: true });
var xyo_bound_witness_signing_service_1 = require("./xyo-bound-witness-signing-service");
exports.XyoBoundWitnessSigningService = xyo_bound_witness_signing_service_1.XyoBoundWitnessSigningService;
var xyo_bound_witness_validator_1 = require("./xyo-bound-witness-validator");
exports.XyoBoundWitnessValidator = xyo_bound_witness_validator_1.XyoBoundWitnessValidator;
var xyo_base_bound_witness_1 = require("./xyo-base-bound-witness");
exports.XyoBaseBoundWitness = xyo_base_bound_witness_1.XyoBaseBoundWitness;
var xyo_base_payload_1 = require("./xyo-base-payload");
exports.XyoBasePayload = xyo_base_payload_1.XyoBasePayload;
var xyo_bound_witness_signing_data_producer_1 = require("./xyo-bound-witness-signing-data-producer");
exports.XyoBoundWitnessSigningDataProducer = xyo_bound_witness_signing_data_producer_1.XyoBoundWitnessSigningDataProducer;
var xyo_bound_witness_1 = require("./xyo-bound-witness");
exports.XyoBoundWitness = xyo_bound_witness_1.XyoBoundWitness;
var xyo_keyset_1 = require("./xyo-keyset");
exports.XyoKeySet = xyo_keyset_1.XyoKeySet;
var xyo_signature_set_1 = require("./xyo-signature-set");
exports.XyoSignatureSet = xyo_signature_set_1.XyoSignatureSet;
var xyo_fetter_1 = require("./xyo-fetter");
exports.XyoFetter = xyo_fetter_1.XyoFetter;
var xyo_witness_1 = require("./xyo-witness");
exports.XyoWitness = xyo_witness_1.XyoWitness;
var xyo_fetter_set_1 = require("./xyo-fetter-set");
exports.XyoFetterSet = xyo_fetter_set_1.XyoFetterSet;
var xyo_witness_set_1 = require("./xyo-witness-set");
exports.XyoWitnessSet = xyo_witness_set_1.XyoWitnessSet;
var xyo_bound_witness_fragment_1 = require("./xyo-bound-witness-fragment");
exports.XyoBoundWitnessFragment = xyo_bound_witness_fragment_1.XyoBoundWitnessFragment;
//# sourceMappingURL=index.js.map
import { IXyoHash } from "@xyo-network/hashing";
import { IXyoBoundWitness, IXyoBoundWitnessSigningDataProducer, IXyoPayload } from "./@types";
import { IXyoBoundWitness } from "./@types";
import { XyoBase } from "@xyo-network/base";
export declare class XyoBoundWitnessValidator extends XyoBase {
private readonly boundWitnessSigningDataProducer;
private readonly extractIndexFromPayloadFn;
private readonly options;
constructor(boundWitnessSigningDataProducer: IXyoBoundWitnessSigningDataProducer, extractIndexFromPayloadFn: (payload: IXyoPayload) => number | undefined, options: {
constructor(options: {
checkPartyLengths: boolean;

@@ -10,0 +8,0 @@ checkIndexExists: boolean;

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

* @Last modified by: ryanxyo
* @Last modified time: Friday, 30th November 2018 10:41:05 am
* @Last modified time: Monday, 10th December 2018 4:36:43 pm
* @License: All Rights Reserved

@@ -24,7 +24,6 @@ * @Copyright: Copyright XY | The Findables Company

const base_1 = require("@xyo-network/base");
const serialization_schema_1 = require("@xyo-network/serialization-schema");
class XyoBoundWitnessValidator extends base_1.XyoBase {
constructor(boundWitnessSigningDataProducer, extractIndexFromPayloadFn, options) {
constructor(options) {
super();
this.boundWitnessSigningDataProducer = boundWitnessSigningDataProducer;
this.extractIndexFromPayloadFn = extractIndexFromPayloadFn;
this.options = options;

@@ -35,5 +34,7 @@ }

const signaturesLength = originBlock.signatures.length;
const payloadsLength = originBlock.payloads.length;
const heuristicsLength = originBlock.heuristics.length;
const metadataLength = originBlock.metadata.length;
const keysLength = originBlock.publicKeys.length;
const signingData = this.boundWitnessSigningDataProducer.getSigningData(originBlock);
const signingData = originBlock.getSigningData();
this.logInfo(`Signing data`, signingData.toString('hex'));
if (this.options.validateHash) {

@@ -46,8 +47,11 @@ const validates = yield hash.verifyHash(signingData);

if (this.options.checkPartyLengths &&
(signaturesLength < 1 || (signaturesLength !== payloadsLength) || signaturesLength !== keysLength)) {
(signaturesLength < 1 ||
signaturesLength !== heuristicsLength ||
signaturesLength !== metadataLength ||
signaturesLength !== keysLength)) {
throw new errors_1.XyoError(`Party fields mismatch`, errors_1.XyoErrors.INVALID_PARAMETERS);
}
if (this.options.checkIndexExists) {
originBlock.payloads.forEach((payload, currentIndex) => {
const index = this.extractIndexFromPayloadFn(payload);
originBlock.heuristics.forEach((heuristics, currentIndex) => {
const index = heuristics.find(heuristic => heuristic.schemaObjectId === serialization_schema_1.schema.index.id);
if (index === undefined) {

@@ -61,3 +65,3 @@ throw new errors_1.XyoError(`Each Party must have an index in their signed payload. Failed at index ${currentIndex}`, errors_1.XyoErrors.INVALID_PARAMETERS);

if (this.options.checkCountOfSignaturesMatchPublicKeysCount &&
signatureSet.length !== originBlock.publicKeys[outerIndex].length) {
signatureSet.signatures.length !== originBlock.publicKeys[outerIndex].keys.length) {
throw new errors_1.XyoError(`There was a mismatch in keys and signatures length`, errors_1.XyoErrors.INVALID_PARAMETERS);

@@ -68,6 +72,9 @@ }

}
return signatureSet.reduce((innerPromiseChain, innerSignature, innerIndex) => __awaiter(this, void 0, void 0, function* () {
return signatureSet.signatures.reduce((innerPromiseChain, innerSignature, innerIndex) => __awaiter(this, void 0, void 0, function* () {
yield innerPromiseChain;
const validates = yield innerSignature.verify(signingData, originBlock.publicKeys[outerIndex][innerIndex]);
const validates = yield innerSignature.verify(signingData, originBlock.publicKeys[outerIndex].keys[innerIndex]);
if (!validates) {
this.logError('Signature', innerSignature.serializeHex());
this.logError('Public Key', originBlock.publicKeys[outerIndex].keys[innerIndex].serializeHex());
this.logError('Signing data', signingData.toString('hex'));
throw new errors_1.XyoError(`Could not validate signature at index [${outerIndex}][${innerIndex}]`, errors_1.XyoErrors.INVALID_PARAMETERS);

@@ -74,0 +81,0 @@ }

{
"name": "@xyo-network/bound-witness",
"version": "0.2.1",
"version": "0.3.0",
"description": "BoundWitness description and services for Xyo Network",

@@ -10,9 +10,9 @@ "main": "dist/index.js",

"dependencies": {
"@xyo-network/base": "^0.2.1",
"@xyo-network/errors": "^0.2.1",
"@xyo-network/hashing": "^0.2.1",
"@xyo-network/serialization": "^0.2.1",
"@xyo-network/serialization-schema": "^0.2.1",
"@xyo-network/serialization-utils": "^0.2.1",
"@xyo-network/signing": "^0.2.1"
"@xyo-network/base": "^0.3.0",
"@xyo-network/buffer-utils": "^0.3.0",
"@xyo-network/errors": "^0.3.0",
"@xyo-network/hashing": "^0.3.0",
"@xyo-network/serialization": "^0.3.0",
"@xyo-network/serialization-schema": "^0.3.0",
"@xyo-network/signing": "^0.3.0"
},

@@ -28,3 +28,3 @@ "devDependencies": {

},
"gitHead": "0635d162b742fbb5ee4f09d4e3faf5149b43eaf0"
"gitHead": "55319bda08512a2701fb6494ad2e2526791e6bb7"
}

@@ -7,3 +7,3 @@ /*

* @Last modified by: ryanxyo
* @Last modified time: Monday, 26th November 2018 3:13:33 pm
* @Last modified time: Monday, 10th December 2018 2:27:42 pm
* @License: All Rights Reserved

@@ -15,2 +15,3 @@ * @Copyright: Copyright XY | The Findables Company

import { IXyoSerializableObject } from '@xyo-network/serialization'
import { IXyoHash } from '@xyo-network/hashing'

@@ -23,77 +24,74 @@ /**

*/
export interface IXyoPayload extends IXyoSerializableObject {
export interface IXyoPayload {
readonly heuristics: IXyoSerializableObject[]
readonly metadata: IXyoSerializableObject[]
}
/**
* The signed portion of the payload
*
* @type {IXyoSerializableObject[]}
* @memberof IXyoPayload
*/
readonly signedPayload: IXyoSerializableObject[]
export interface IXyoKeySet extends IXyoSerializableObject {
readonly keys: IXyoPublicKey[]
}
/**
* The unsigned portion of the payload
*
* @type {IXyoSerializableObject[]}
* @memberof IXyoPayload
*/
readonly unsignedPayload: IXyoSerializableObject[]
export interface IXyoSignatureSet extends IXyoSerializableObject {
readonly signatures: IXyoSignature[]
}
/**
* A bound-witness is the central data type used to communicate between nodes in the
* XYO network. The structure provides a cryptographically secure way that ensures,
* through public-key cryptography, that two nodes interacted and agreed upon a
* particular payload
*
* This particular structure is forward looking in that it may accommodate a future
* situation where more than two nodes interacted. As such, there exists a positional
* coupling across the fields of the `IXyoBoundWitness`. That is, a party in the
* bound-witness corresponds to a particular index of the fields
*
* - publicKeys
* - signatures
* - payloads
*
* @export
* @interface IXyoBoundWitness
*/
export interface IXyoBoundWitness extends IXyoSerializableObject {
export interface IXyoFetter extends IXyoSerializableObject {
readonly keySet: IXyoKeySet
readonly heuristics: IXyoSerializableObject[]
}
/**
* A collection of publicKey collections associated with the
* bound-witness. The outer-index represents the party. The inner-index
* corresponds to a public-key entry. Parties are allowed to sign with
* multiple key-pairs. The 2-dimensional index of each element corresponds
* directly to the 2-dimensional index of the corresponding signature
*
* @type {IXyoPublicKey[][]}
* @memberof IXyoBoundWitness
*/
readonly publicKeys: IXyoPublicKey[][]
export interface IXyoFetterSet extends IXyoSerializableObject {
readonly fetters: IXyoFetter[]
}
/**
* A collection of signatures collections associated with the
* bound-witness. The outer-index represents the party. The inner-index
* corresponds to a signature entry. Parties are allowed to sign with
* multiple key-pairs. The 2-dimensional index of each element corresponds
* directly to the 2-dimensional index of the corresponding publicKey
*
* @type {IXyoPublicKey[][]}
* @memberof IXyoBoundWitness
*/
readonly signatures: IXyoSignature[][]
export interface IXyoWitness extends IXyoSerializableObject {
readonly signatureSet: IXyoSignatureSet
readonly metadata: IXyoSerializableObject[]
}
export interface IXyoWitnessSet extends IXyoSerializableObject {
readonly witnesses: IXyoWitness[]
}
/**
* Each party in a bound-witness contributes a payload. The index of
* the payload corresponds to the party-member.
*
* @type {IXyoPayload[]}
* @memberof IXyoBoundWitness
*/
readonly payloads: IXyoPayload[]
export type FetterOrWitness = IXyoFetter | IXyoWitness
export interface IXyoBoundWitnessFragment extends IXyoSerializableObject {
fetterWitnesses: FetterOrWitness[]
}
export interface IXyoBoundWitnessSigningDataProducer {
getSigningData (boundWitness: IXyoBoundWitness): Buffer
export interface IXyoPayloadDataExtractionService {
getIndex(payload: IXyoPayload): number | undefined
getPreviousHash(payload: IXyoPayload): IXyoHash | undefined
getNextPublicKey(payload: IXyoPayload): IXyoPublicKey | undefined
getBridgeHashSet(payload: IXyoPayload): IXyoHash[] | undefined
getBridgeBlockSet(payload: IXyoPayload): IXyoBoundWitness[] | undefined
findElementInSignedPayload<T extends IXyoSerializableObject>(
payload: IXyoPayload,
schemaObjectId: number
): T | undefined
findElementInUnsignedPayload<T extends IXyoSerializableObject>(
payload: IXyoPayload,
schemaObjectId: number
): T | undefined
}
export interface IXyoBoundWitnessParty {
partyIndex: number
keySet: IXyoKeySet
signatureSet: IXyoSignatureSet
heuristics: IXyoSerializableObject[]
metadata: IXyoSerializableObject[]
}
export interface IXyoBoundWitness extends IXyoSerializableObject, IXyoBoundWitnessFragment {
readonly publicKeys: IXyoKeySet[]
readonly signatures: IXyoSignatureSet[]
readonly heuristics: IXyoSerializableObject[][]
readonly metadata: IXyoSerializableObject[][]
readonly numberOfParties: number
readonly parties: IXyoBoundWitnessParty[]
getSigningData(): Buffer
}

@@ -7,3 +7,3 @@ /*

* @Last modified by: ryanxyo
* @Last modified time: Thursday, 29th November 2018 9:29:08 am
* @Last modified time: Monday, 10th December 2018 2:24:48 pm
* @License: All Rights Reserved

@@ -13,7 +13,22 @@ * @Copyright: Copyright XY | The Findables Company

export { IXyoBoundWitness, IXyoBoundWitnessSigningDataProducer, IXyoPayload } from './@types'
export { XyoBoundWitnessSigningService } from './xyo-bound-witness-signing-service'
export {
IXyoBoundWitness,
IXyoFetter,
IXyoFetterSet,
IXyoWitness,
IXyoWitnessSet,
IXyoBoundWitnessFragment,
IXyoKeySet,
IXyoSignatureSet,
FetterOrWitness,
IXyoPayload
} from './@types'
export { XyoBoundWitnessValidator } from './xyo-bound-witness-validator'
export { XyoBaseBoundWitness } from './xyo-base-bound-witness'
export { XyoBasePayload } from './xyo-base-payload'
export { XyoBoundWitnessSigningDataProducer } from './xyo-bound-witness-signing-data-producer'
export { XyoBoundWitness } from './xyo-bound-witness'
export { XyoKeySet } from './xyo-keyset'
export { XyoSignatureSet } from './xyo-signature-set'
export { XyoFetter } from './xyo-fetter'
export { XyoWitness } from './xyo-witness'
export { XyoFetterSet } from './xyo-fetter-set'
export { XyoWitnessSet } from './xyo-witness-set'
export { XyoBoundWitnessFragment } from './xyo-bound-witness-fragment'

@@ -7,3 +7,3 @@ /*

* @Last modified by: ryanxyo
* @Last modified time: Friday, 30th November 2018 10:41:05 am
* @Last modified time: Monday, 10th December 2018 4:36:43 pm
* @License: All Rights Reserved

@@ -15,5 +15,6 @@ * @Copyright: Copyright XY | The Findables Company

import { IXyoHash } from "@xyo-network/hashing"
import { IXyoBoundWitness, IXyoBoundWitnessSigningDataProducer, IXyoPayload } from "./@types"
import { IXyoBoundWitness } from "./@types"
import { IXyoSignature } from "@xyo-network/signing"
import { XyoBase } from "@xyo-network/base"
import { schema } from "@xyo-network/serialization-schema"

@@ -23,4 +24,2 @@ export class XyoBoundWitnessValidator extends XyoBase {

constructor(
private readonly boundWitnessSigningDataProducer: IXyoBoundWitnessSigningDataProducer,
private readonly extractIndexFromPayloadFn: (payload: IXyoPayload) => number | undefined,
private readonly options: {

@@ -38,6 +37,8 @@ checkPartyLengths: boolean,

const signaturesLength = originBlock.signatures.length
const payloadsLength = originBlock.payloads.length
const heuristicsLength = originBlock.heuristics.length
const metadataLength = originBlock.metadata.length
const keysLength = originBlock.publicKeys.length
const signingData = this.boundWitnessSigningDataProducer.getSigningData(originBlock)
const signingData = originBlock.getSigningData()
this.logInfo(`Signing data`, signingData.toString('hex'))
if (this.options.validateHash) {

@@ -52,3 +53,8 @@ const validates = await hash.verifyHash(signingData)

this.options.checkPartyLengths &&
(signaturesLength < 1 || (signaturesLength !== payloadsLength) || signaturesLength !== keysLength)
(
signaturesLength < 1 ||
signaturesLength !== heuristicsLength ||
signaturesLength !== metadataLength ||
signaturesLength !== keysLength
)
) {

@@ -59,4 +65,4 @@ throw new XyoError(`Party fields mismatch`, XyoErrors.INVALID_PARAMETERS)

if (this.options.checkIndexExists) {
originBlock.payloads.forEach((payload, currentIndex) => {
const index = this.extractIndexFromPayloadFn(payload)
originBlock.heuristics.forEach((heuristics, currentIndex) => {
const index = heuristics.find(heuristic => heuristic.schemaObjectId === schema.index.id)
if (index === undefined) {

@@ -75,3 +81,3 @@ throw new XyoError(

this.options.checkCountOfSignaturesMatchPublicKeysCount &&
signatureSet.length !== originBlock.publicKeys[outerIndex].length
signatureSet.signatures.length !== originBlock.publicKeys[outerIndex].keys.length
) {

@@ -85,10 +91,14 @@ throw new XyoError(`There was a mismatch in keys and signatures length`, XyoErrors.INVALID_PARAMETERS)

return signatureSet.reduce(async (innerPromiseChain, innerSignature, innerIndex) => {
return signatureSet.signatures.reduce(async (innerPromiseChain, innerSignature, innerIndex) => {
await innerPromiseChain
const validates = await (innerSignature as IXyoSignature).verify(
signingData,
originBlock.publicKeys[outerIndex][innerIndex]
originBlock.publicKeys[outerIndex].keys[innerIndex]
)
if (!validates) {
this.logError('Signature', innerSignature.serializeHex())
this.logError('Public Key', originBlock.publicKeys[outerIndex].keys[innerIndex].serializeHex())
this.logError('Signing data', signingData.toString('hex'))
throw new XyoError(

@@ -95,0 +105,0 @@ `Could not validate signature at index [${outerIndex}][${innerIndex}]`, XyoErrors.INVALID_PARAMETERS

@@ -30,5 +30,5 @@ {

{ "path": "../serialization-schema" },
{ "path": "../serialization-utils" },
{ "path": "../buffer-utils" },
{ "path": "../serialization" }
]
}
}

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

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