jsonld-signatures
Advanced tools
Comparing version 2.2.2 to 2.3.0
# jsonld-signatures ChangeLog | ||
## 2.3.0 - 2018-03-20 | ||
### Added | ||
- Add in-browser support for ed25519. | ||
## 2.2.2 - 2018-03-08 | ||
@@ -4,0 +9,0 @@ |
@@ -64,12 +64,13 @@ /** | ||
} else { | ||
throw new Error('Not implemented'); | ||
/* | ||
// browser or other environment | ||
const privateKey = forge.pki.privateKeyFromPem(options.privateKeyPem); | ||
const md = forge.md.sha256.create(); | ||
// decode private key | ||
const privateKey = forge.util.binary.base58.decode(options.privateKeyBase58); | ||
// build signing input per above comment | ||
md.update(encodedHeader + '.', 'utf8'); | ||
md.update(verifyData.data, verifyData.encoding); | ||
const binaryString = privateKey.sign(md); | ||
encodedSignature = util.encodeBase64Url(binaryString, {forge});*/ | ||
const buffer = new forge.util.ByteBuffer(encodedHeader + '.', 'utf8'); | ||
buffer.putBuffer(new forge.util.ByteBuffer(verifyData.data, verifyData.encoding)); | ||
const binaryString = forge.ed25519.sign({ | ||
message: buffer, | ||
privateKey | ||
}).toString('binary'); | ||
encodedSignature = util.encodeBase64Url(binaryString, { forge }); | ||
} | ||
@@ -130,11 +131,12 @@ | ||
throw new Error('Not implemented'); | ||
/* | ||
// browser or other environment | ||
const publicKey = forge.pki.publicKeyFromPem(publicKeyPem); | ||
const md = forge.md.sha256.create(); | ||
const publicKey = forge.util.binary.base58.decode(publicKeyBase58); | ||
// rebuild signing input per JWS spec | ||
md.update(encodedHeader + '.', 'utf8'); | ||
md.update(verifyData.data, verifyData.encoding); | ||
return publicKey.verify(md.digest().bytes(), rawSignature);*/ | ||
const buffer = new forge.util.ByteBuffer(encodedHeader + '.', 'utf8'); | ||
buffer.putBuffer(new forge.util.ByteBuffer(verifyData.data, verifyData.encoding)); | ||
return forge.ed25519.verify({ | ||
message: buffer, | ||
signature: rawSignature, | ||
publicKey | ||
}); | ||
})(); | ||
@@ -141,0 +143,0 @@ } |
@@ -59,12 +59,15 @@ /** | ||
} else { | ||
throw new Error('Not implemented'); | ||
/* | ||
// browser or other environment | ||
const privateKey = forge.pki.privateKeyFromPem(options.privateKeyPem); | ||
const md = forge.md.sha256.create(); | ||
// decode private key | ||
const privateKey = forge.util.binary.base58.decode( | ||
options.privateKeyBase58); | ||
// build signing input per above comment | ||
md.update(encodedHeader + '.', 'utf8'); | ||
md.update(verifyData.data, verifyData.encoding); | ||
const binaryString = privateKey.sign(md); | ||
encodedSignature = util.encodeBase64Url(binaryString, {forge});*/ | ||
const buffer = new forge.util.ByteBuffer(encodedHeader + '.', 'utf8'); | ||
buffer.putBuffer(new forge.util.ByteBuffer( | ||
verifyData.data, verifyData.encoding)); | ||
const binaryString = forge.ed25519.sign({ | ||
message: buffer, | ||
privateKey | ||
}).toString('binary'); | ||
encodedSignature = util.encodeBase64Url(binaryString, {forge}); | ||
} | ||
@@ -120,11 +123,13 @@ | ||
throw new Error('Not implemented'); | ||
/* | ||
// browser or other environment | ||
const publicKey = forge.pki.publicKeyFromPem(publicKeyPem); | ||
const md = forge.md.sha256.create(); | ||
const publicKey = forge.util.binary.base58.decode(publicKeyBase58); | ||
// rebuild signing input per JWS spec | ||
md.update(encodedHeader + '.', 'utf8'); | ||
md.update(verifyData.data, verifyData.encoding); | ||
return publicKey.verify(md.digest().bytes(), rawSignature);*/ | ||
const buffer = new forge.util.ByteBuffer(encodedHeader + '.', 'utf8'); | ||
buffer.putBuffer(new forge.util.ByteBuffer( | ||
verifyData.data, verifyData.encoding)); | ||
return forge.ed25519.verify({ | ||
message: buffer, | ||
signature: rawSignature, | ||
publicKey | ||
}); | ||
} | ||
@@ -131,0 +136,0 @@ |
{ | ||
"name": "jsonld-signatures", | ||
"version": "2.2.2", | ||
"version": "2.3.0", | ||
"description": "An implementation of the Linked Data Signatures specifications for JSON-LD in JavaScript.", | ||
@@ -39,3 +39,3 @@ "homepage": "https://github.com/digitalbazaar/jsonld-signatures", | ||
"jsonld": "^1.0.1", | ||
"node-forge": "^0.7.1", | ||
"node-forge": "^0.7.4", | ||
"semver": "^5.5.0" | ||
@@ -42,0 +42,0 @@ }, |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
421360
8148
Updatednode-forge@^0.7.4