@xyo-network/bound-witness
Advanced tools
Comparing version 0.23.0 to 0.24.0
@@ -1,2 +0,1 @@ | ||
/// <reference types="node" /> | ||
import { IXyoSignature, IXyoPublicKey } from '@xyo-network/signing'; | ||
@@ -3,0 +2,0 @@ import { IXyoSerializableObject } from '@xyo-network/serialization'; |
export { IXyoBoundWitness, IXyoFetter, IXyoFetterSet, IXyoWitness, IXyoWitnessSet, IXyoBoundWitnessFragment, IXyoKeySet, IXyoSignatureSet, FetterOrWitness, IXyoPayload, IXyoBoundWitnessParty } from './@types'; | ||
export { XyoBoundWitnessValidator } from './xyo-bound-witness-validator'; | ||
export { XyoBoundWitnessValidator, IXyoBoundWitnessValidationOptions } from './xyo-bound-witness-validator'; | ||
export { XyoBoundWitness } from './xyo-bound-witness'; | ||
@@ -4,0 +4,0 @@ export { XyoKeySet } from './xyo-keyset'; |
@@ -8,3 +8,3 @@ "use strict"; | ||
* @Last modified by: ryanxyo | ||
* @Last modified time: Wednesday, 23rd January 2019 2:20:48 pm | ||
* @Last modified time: Friday, 8th February 2019 2:33:07 pm | ||
* @License: All Rights Reserved | ||
@@ -11,0 +11,0 @@ * @Copyright: Copyright XY | The Findables Company |
@@ -5,12 +5,14 @@ import { IXyoHash } from "@xyo-network/hashing"; | ||
export declare class XyoBoundWitnessValidator extends XyoBase { | ||
private readonly options; | ||
constructor(options: { | ||
checkPartyLengths: boolean; | ||
checkIndexExists: boolean; | ||
checkCountOfSignaturesMatchPublicKeysCount: boolean; | ||
validateSignatures: boolean; | ||
validateHash: boolean; | ||
}); | ||
private options; | ||
constructor(options?: IXyoBoundWitnessValidationOptions); | ||
setValidationOptions(validationOptions: IXyoBoundWitnessValidationOptions): void; | ||
validateBoundWitness(hash: IXyoHash, originBlock: IXyoBoundWitness): Promise<void>; | ||
} | ||
export interface IXyoBoundWitnessValidationOptions { | ||
checkPartyLengths: boolean; | ||
checkIndexExists: boolean; | ||
checkCountOfSignaturesMatchPublicKeysCount: boolean; | ||
validateSignatures: boolean; | ||
validateHash: boolean; | ||
} | ||
//# sourceMappingURL=xyo-bound-witness-validator.d.ts.map |
@@ -8,3 +8,3 @@ "use strict"; | ||
* @Last modified by: ryanxyo | ||
* @Last modified time: Monday, 10th December 2018 4:36:43 pm | ||
* @Last modified time: Thursday, 14th February 2019 2:01:15 pm | ||
* @License: All Rights Reserved | ||
@@ -28,4 +28,13 @@ * @Copyright: Copyright XY | The Findables Company | ||
super(); | ||
this.options = options; | ||
this.options = options || { | ||
checkPartyLengths: true, | ||
checkIndexExists: true, | ||
checkCountOfSignaturesMatchPublicKeysCount: true, | ||
validateSignatures: true, | ||
validateHash: true | ||
}; | ||
} | ||
setValidationOptions(validationOptions) { | ||
this.options = validationOptions; | ||
} | ||
validateBoundWitness(hash, originBlock) { | ||
@@ -38,3 +47,2 @@ return __awaiter(this, void 0, void 0, function* () { | ||
const signingData = originBlock.getSigningData(); | ||
this.logInfo(`Signing data`, signingData.toString('hex')); | ||
if (this.options.validateHash) { | ||
@@ -74,5 +82,2 @@ const validates = yield hash.verifyHash(signingData); | ||
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); | ||
@@ -79,0 +84,0 @@ } |
@@ -1,2 +0,1 @@ | ||
/// <reference types="node" /> | ||
import { IXyoBoundWitness, FetterOrWitness, IXyoKeySet, IXyoSignatureSet, IXyoBoundWitnessParty } from "./@types"; | ||
@@ -3,0 +2,0 @@ import { XyoBaseSerializable, IXyoDeserializer, IXyoSerializableObject } from '@xyo-network/serialization'; |
@@ -1,2 +0,1 @@ | ||
/// <reference types="node" /> | ||
import { IXyoFetterSet, IXyoFetter } from './@types'; | ||
@@ -3,0 +2,0 @@ import { XyoBaseSerializable, IXyoDeserializer, IXyoSerializationService } from '@xyo-network/serialization'; |
@@ -1,2 +0,1 @@ | ||
/// <reference types="node" /> | ||
import { IXyoFetter, IXyoKeySet } from "./@types"; | ||
@@ -3,0 +2,0 @@ import { XyoBaseSerializable, IXyoSerializableObject, IXyoDeserializer } from "@xyo-network/serialization"; |
@@ -1,2 +0,1 @@ | ||
/// <reference types="node" /> | ||
import { IXyoWitness, IXyoWitnessSet } from './@types'; | ||
@@ -3,0 +2,0 @@ import { XyoBaseSerializable, IXyoDeserializer, IXyoSerializationService } from '@xyo-network/serialization'; |
@@ -1,2 +0,1 @@ | ||
/// <reference types="node" /> | ||
import { IXyoSignatureSet, IXyoWitness } from "./@types"; | ||
@@ -3,0 +2,0 @@ import { XyoBaseSerializable, IXyoSerializableObject, IXyoDeserializer } from "@xyo-network/serialization"; |
{ | ||
"name": "@xyo-network/bound-witness", | ||
"version": "0.23.0", | ||
"version": "0.24.0", | ||
"description": "BoundWitness description, interfaces and services for XYO Network", | ||
@@ -10,9 +10,9 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"@xyo-network/base": "^0.23.0", | ||
"@xyo-network/buffer-utils": "^0.23.0", | ||
"@xyo-network/errors": "^0.23.0", | ||
"@xyo-network/hashing": "^0.23.0", | ||
"@xyo-network/serialization": "^0.23.0", | ||
"@xyo-network/serialization-schema": "^0.23.0", | ||
"@xyo-network/signing": "^0.23.0" | ||
"@xyo-network/base": "^0.24.0", | ||
"@xyo-network/buffer-utils": "^0.24.0", | ||
"@xyo-network/errors": "^0.24.0", | ||
"@xyo-network/hashing": "^0.24.0", | ||
"@xyo-network/serialization": "^0.24.0", | ||
"@xyo-network/serialization-schema": "^0.24.0", | ||
"@xyo-network/signing": "^0.24.0" | ||
}, | ||
@@ -28,3 +28,3 @@ "devDependencies": { | ||
}, | ||
"gitHead": "451c89a026f13eed645b676f7073b3cffce955c5" | ||
"gitHead": "629618ae9a38cc374b662561d1786827b618c2fd" | ||
} |
@@ -7,3 +7,3 @@ /* | ||
* @Last modified by: ryanxyo | ||
* @Last modified time: Wednesday, 23rd January 2019 2:20:48 pm | ||
* @Last modified time: Friday, 8th February 2019 2:33:07 pm | ||
* @License: All Rights Reserved | ||
@@ -26,3 +26,3 @@ * @Copyright: Copyright XY | The Findables Company | ||
} from './@types' | ||
export { XyoBoundWitnessValidator } from './xyo-bound-witness-validator' | ||
export { XyoBoundWitnessValidator, IXyoBoundWitnessValidationOptions } from './xyo-bound-witness-validator' | ||
export { XyoBoundWitness } from './xyo-bound-witness' | ||
@@ -29,0 +29,0 @@ export { XyoKeySet } from './xyo-keyset' |
@@ -7,3 +7,3 @@ /* | ||
* @Last modified by: ryanxyo | ||
* @Last modified time: Monday, 10th December 2018 4:36:43 pm | ||
* @Last modified time: Thursday, 14th February 2019 2:01:15 pm | ||
* @License: All Rights Reserved | ||
@@ -22,13 +22,19 @@ * @Copyright: Copyright XY | The Findables Company | ||
constructor( | ||
private readonly options: { | ||
checkPartyLengths: boolean, | ||
checkIndexExists: boolean, | ||
checkCountOfSignaturesMatchPublicKeysCount: boolean, | ||
validateSignatures: boolean, | ||
validateHash: boolean | ||
}) { | ||
private options: IXyoBoundWitnessValidationOptions | ||
constructor(options?: IXyoBoundWitnessValidationOptions) { | ||
super() | ||
this.options = options || { | ||
checkPartyLengths: true, | ||
checkIndexExists: true, | ||
checkCountOfSignaturesMatchPublicKeysCount: true, | ||
validateSignatures: true, | ||
validateHash: true | ||
} | ||
} | ||
public setValidationOptions(validationOptions: IXyoBoundWitnessValidationOptions) { | ||
this.options = validationOptions | ||
} | ||
public async validateBoundWitness(hash: IXyoHash, originBlock: IXyoBoundWitness): Promise<void> { | ||
@@ -41,3 +47,2 @@ const signaturesLength = originBlock.signatures.length | ||
this.logInfo(`Signing data`, signingData.toString('hex')) | ||
if (this.options.validateHash) { | ||
@@ -95,6 +100,2 @@ const validates = await hash.verifyHash(signingData) | ||
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( | ||
@@ -108,1 +109,9 @@ `Could not validate signature at index [${outerIndex}][${innerIndex}]`, XyoErrors.INVALID_PARAMETERS | ||
} | ||
export interface IXyoBoundWitnessValidationOptions { | ||
checkPartyLengths: boolean, | ||
checkIndexExists: boolean, | ||
checkCountOfSignaturesMatchPublicKeysCount: boolean, | ||
validateSignatures: boolean, | ||
validateHash: boolean | ||
} |
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
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
98046
1678
+ Added@xyo-network/base@0.24.0(transitive)
+ Added@xyo-network/buffer-utils@0.24.0(transitive)
+ Added@xyo-network/errors@0.24.0(transitive)
+ Added@xyo-network/hashing@0.24.0(transitive)
+ Added@xyo-network/serialization@0.24.0(transitive)
+ Added@xyo-network/serialization-schema@0.24.0(transitive)
+ Added@xyo-network/signing@0.24.0(transitive)
- Removed@xyo-network/base@0.23.0(transitive)
- Removed@xyo-network/buffer-utils@0.23.0(transitive)
- Removed@xyo-network/errors@0.23.0(transitive)
- Removed@xyo-network/hashing@0.23.0(transitive)
- Removed@xyo-network/serialization@0.23.0(transitive)
- Removed@xyo-network/serialization-schema@0.23.0(transitive)
- Removed@xyo-network/signing@0.23.0(transitive)
Updated@xyo-network/base@^0.24.0
Updated@xyo-network/errors@^0.24.0
Updated@xyo-network/hashing@^0.24.0
Updated@xyo-network/signing@^0.24.0