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
6
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.34.0 to 0.35.0

3

dist/xyo-bound-witness.d.ts

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

readonly fetterWitnesses: FetterOrWitness[];
private readonly respectSign?;
readonly publicKeys: IXyoKeySet[];

@@ -16,3 +17,3 @@ readonly signatures: IXyoSignatureSet[];

readonly schemaObjectId: number;
constructor(fetterWitnesses: FetterOrWitness[]);
constructor(fetterWitnesses: FetterOrWitness[], respectSign?: Buffer | undefined);
stripMetaData(): IXyoBoundWitness;

@@ -19,0 +20,0 @@ getHeuristicFromParty<T extends IXyoSerializableObject>(partyIndex: number, schemaObjectId: number): T | undefined;

@@ -16,8 +16,10 @@ "use strict";

const xyo_bound_witness_party_1 = require("./xyo-bound-witness-party");
const xyo_fetter_1 = require("./xyo-fetter");
const errors_1 = require("@xyo-network/errors");
const xyo_witness_1 = require("./xyo-witness");
class XyoBoundWitness extends serialization_1.XyoBaseSerializable {
constructor(fetterWitnesses) {
constructor(fetterWitnesses, respectSign) {
super(serialization_schema_1.schema);
this.fetterWitnesses = fetterWitnesses;
this.respectSign = respectSign;
this.schemaObjectId = serialization_schema_1.schema.boundWitness.id;

@@ -46,16 +48,3 @@ }

get fetterWitnessPairs() {
const result = this.fetterWitnesses.reduce((memo, fetterOrWitness, index) => {
if (this.fetterWitnesses[index].schemaObjectId === serialization_schema_1.schema.fetter.id) {
memo.fetters.push(fetterOrWitness);
}
else if (this.fetterWitnesses[index].schemaObjectId === serialization_schema_1.schema.witness.id) {
memo.witnesses.push(fetterOrWitness);
}
return memo;
}, {
fetters: [],
witnesses: []
});
result.witnesses.reverse();
return result.fetters.map((fetter, index) => new FetterWitnessPair(fetter, result.witnesses[index]));
return getFetterWitnessPair(this.fetterWitnesses);
}

@@ -82,7 +71,3 @@ stripMetaData() {

getSigningData() {
const buffers = this.fetterWitnessPairs.reduce((memo, pair) => {
memo.push(pair.fetter.serialize());
return memo;
}, []);
return Buffer.concat(buffers);
return getSigningDataFromFetterWitnesses(this.fetterWitnesses);
}

@@ -122,2 +107,27 @@ getData() {

exports.XyoBoundWitness = XyoBoundWitness;
const getSigningDataFromFetterWitnesses = (fetterWitnessPairs) => {
const buffers = [];
fetterWitnessPairs.forEach((hello) => {
if (hello.schemaObjectId === xyo_fetter_1.XyoFetter.deserializer.schemaObjectId) {
buffers.push(hello.serialize());
}
});
return Buffer.concat(buffers);
};
const getFetterWitnessPair = (fetterOrWitnesses) => {
const result = fetterOrWitnesses.reduce((memo, fetterOrWitness, index) => {
if (index < fetterOrWitnesses.length / 2) {
memo.fetters.push(fetterOrWitness);
}
else {
memo.witnesses.push(fetterOrWitness);
}
return memo;
}, {
fetters: [],
witnesses: []
});
result.witnesses.reverse();
return result.fetters.map((fetter, index) => new FetterWitnessPair(fetter, result.witnesses[index]));
};
// tslint:disable-next-line:max-classes-per-file

@@ -131,5 +141,8 @@ class XyoBoundWitnessDeserializer {

const query = new serialization_1.ParseQuery(parseResult);
const test = query.mapChildren(item => serializationService
.deserialize(item.readData(true))
.hydrate());
return new XyoBoundWitness(query.mapChildren(item => serializationService
.deserialize(item.readData(true))
.hydrate()));
.hydrate()), data);
}

@@ -136,0 +149,0 @@ }

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

/// <reference types="node" />
import { XyoBaseSerializable, IXyoSerializableObject, IXyoDeserializer } from "@xyo-network/serialization";

@@ -7,3 +8,3 @@ import { IXyoPublicKey } from "@xyo-network/signing";

schemaObjectId: number;
constructor(keys: IXyoPublicKey[]);
constructor(keys: IXyoPublicKey[], org?: Buffer);
getData(): IXyoSerializableObject[];

@@ -10,0 +11,0 @@ getReadableValue(): any[];

@@ -16,4 +16,4 @@ "use strict";

class XyoKeySet extends serialization_1.XyoBaseSerializable {
constructor(keys) {
super(serialization_schema_1.schema);
constructor(keys, org) {
super(serialization_schema_1.schema, org);
this.keys = keys;

@@ -39,3 +39,3 @@ this.schemaObjectId = serialization_schema_1.schema.keySet.id;

const keys = query.mapChildren(key => serializationService.deserialize(key.readData(true)).hydrate());
return new XyoKeySet(keys);
return new XyoKeySet(keys, data);
}

@@ -42,0 +42,0 @@ }

{
"name": "@xyo-network/bound-witness",
"version": "0.34.0",
"version": "0.35.0",
"description": "BoundWitness description, interfaces and services for XYO Network",

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

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

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

},
"gitHead": "b29cd20d3043a5788a0249191221a8916bc61d1f"
"gitHead": "1419347e15c9672dbc53e4f48e81d41ddf0cf468"
}

@@ -13,3 +13,3 @@ /*

import { IXyoSignature, IXyoPublicKey } from '@xyo-network/signing'
import { IXyoSerializableObject } from '@xyo-network/serialization'
import { IXyoSerializableObject, XyoSerializationService } from '@xyo-network/serialization'
import { IXyoHash } from '@xyo-network/hashing'

@@ -16,0 +16,0 @@

@@ -13,5 +13,6 @@ /*

import { IXyoBoundWitness, FetterOrWitness, IXyoKeySet, IXyoSignatureSet, IXyoBoundWitnessParty, IXyoFetter, IXyoWitness } from "./@types"
import { XyoBaseSerializable, IXyoDeserializer, IXyoSerializationService, ParseQuery, IXyoSerializableObject } from '@xyo-network/serialization'
import { XyoBaseSerializable, IXyoDeserializer, IXyoSerializationService, ParseQuery, IXyoSerializableObject, IParseResult, XyoSerializationService } from '@xyo-network/serialization'
import { schema } from '@xyo-network/serialization-schema'
import { XyoBoundWitnessParty } from './xyo-bound-witness-party'
import { XyoFetter } from "./xyo-fetter"
import { XyoError } from "@xyo-network/errors"

@@ -49,17 +50,3 @@ import { XyoWitness } from "./xyo-witness"

private get fetterWitnessPairs (): FetterWitnessPair[] {
const result = this.fetterWitnesses.reduce((memo, fetterOrWitness, index) => {
if (this.fetterWitnesses[index].schemaObjectId === schema.fetter.id) {
memo.fetters.push(fetterOrWitness as IXyoFetter)
} else if (this.fetterWitnesses[index].schemaObjectId === schema.witness.id) {
memo.witnesses.push(fetterOrWitness as IXyoWitness)
}
return memo
},
{
fetters: [] as IXyoFetter[],
witnesses: [] as IXyoWitness[]
}
)
result.witnesses.reverse()
return result.fetters.map((fetter, index) => new FetterWitnessPair(fetter, result.witnesses[index]))
return getFetterWitnessPair(this.fetterWitnesses)
}

@@ -70,3 +57,5 @@

constructor(public readonly fetterWitnesses: FetterOrWitness[]) {
constructor(public readonly fetterWitnesses: FetterOrWitness[],
private readonly respectSign?: Buffer) {
super(schema)

@@ -108,8 +97,3 @@ }

public getSigningData(): Buffer {
const buffers = this.fetterWitnessPairs.reduce((memo, pair) => {
memo.push(pair.fetter.serialize())
return memo
}, [] as Buffer[])
return Buffer.concat(buffers)
return getSigningDataFromFetterWitnesses(this.fetterWitnesses)
}

@@ -151,2 +135,32 @@

const getSigningDataFromFetterWitnesses = (fetterWitnessPairs: FetterOrWitness[]) => {
const buffers: Buffer[] = []
fetterWitnessPairs.forEach((hello) => {
if (hello.schemaObjectId === XyoFetter.deserializer.schemaObjectId) {
buffers.push(hello.serialize() as Buffer)
}
})
return Buffer.concat(buffers)
}
const getFetterWitnessPair = (fetterOrWitnesses: FetterOrWitness[]) => {
const result = fetterOrWitnesses.reduce((memo, fetterOrWitness, index) => {
if (index < fetterOrWitnesses.length / 2) {
memo.fetters.push(fetterOrWitness as IXyoFetter)
} else {
memo.witnesses.push(fetterOrWitness as IXyoWitness)
}
return memo
},
{
fetters: [] as IXyoFetter[],
witnesses: [] as IXyoWitness[]
}
)
result.witnesses.reverse()
return result.fetters.map((fetter, index) => new FetterWitnessPair(fetter, result.witnesses[index]))
}
// tslint:disable-next-line:max-classes-per-file

@@ -159,2 +173,9 @@ class XyoBoundWitnessDeserializer implements IXyoDeserializer<IXyoBoundWitness> {

const query = new ParseQuery(parseResult)
const test = query.mapChildren(
item => serializationService
.deserialize(item.readData(true))
.hydrate<IXyoFetter | IXyoWitness>()
)
return new XyoBoundWitness(

@@ -165,3 +186,3 @@ query.mapChildren(

.hydrate<IXyoFetter | IXyoWitness>()
)
), data
)

@@ -168,0 +189,0 @@ }

@@ -24,3 +24,3 @@ /*

public keySet: IXyoKeySet,
public heuristics: IXyoSerializableObject[]
public heuristics: IXyoSerializableObject[],
) {

@@ -27,0 +27,0 @@ super(schema)

@@ -20,4 +20,4 @@ /*

constructor (public readonly keys: IXyoPublicKey[]) {
super(schema)
constructor (public readonly keys: IXyoPublicKey[], org?: Buffer) {
super(schema, org)
}

@@ -42,3 +42,3 @@

const keys = query.mapChildren(key => serializationService.deserialize(key.readData(true)).hydrate<IXyoPublicKey>())
return new XyoKeySet(keys)
return new XyoKeySet(keys, data)
}

@@ -45,0 +45,0 @@ }

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