From 784cac0c3fda51114288918a83040b2ac78c78aa Mon Sep 17 00:00:00 2001 From: Bill Barman Date: Tue, 20 Nov 2018 18:23:27 +0800 Subject: [PATCH] remove extra array init --- src/libDDO/DDO.ts | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/src/libDDO/DDO.ts b/src/libDDO/DDO.ts index 4c2f661..d75519e 100644 --- a/src/libDDO/DDO.ts +++ b/src/libDDO/DDO.ts @@ -23,27 +23,13 @@ export default class DDO { public static validateSignature(text: string, keyValue: string, signature: string, authenticationType: string) { if ( authenticationType === Authentication.TYPE_RSA ) { -// var key = ursa.createPublicKey(keyValue, "utf8") -// var signatureBuffer = new Buffer(signature, 'ascii') -// var textBuffer = new Buffer(text, 'ascii') // FIXME: python does PKCS1_v1_5 padding, but this does not seem to be // supported in ursa (only PKCS1_v1). +// var key = ursa.createPublicKey(keyValue, "utf8") // return key.hashAndVerify("sha256", text, signature, "utf8", ursa.RSA_NO_PADDING) -/* - // setup with SHA256 RSA - var sig = new jsr.crypto.Signature({"alg": "SHA256withRSA"}) - // init with public PEM key - sig.init(keyValue) - // add the hash text - sig.updateString(text) - // convert the signature to hex - var buffer = new Buffer(signature, 'ascii') - // verify the signature - return sig.verify(buffer.toString('hex')) -*/ } return false } @@ -94,22 +80,18 @@ export default class DDO { this.context = data["@context"] } - this.publicKeys = [] - if ( data.hasOwnProperty("publicKey") ) { data.publicKey.forEach(function(value) { this.publicKeys.push(new PublicKey(value)) }, this) } - this.authentications = [] if ( data.hasOwnProperty("authentication") ) { data.authentication.forEach(function(value) { this.authentications.push(new Authentication(value)) }, this) } - this.services = [] if ( data.hasOwnProperty("service") ) { data.service.forEach(function(value) { this.services.push(new Service(value))