From fcb14694bf651e531645faad97b7bcd25347bcb7 Mon Sep 17 00:00:00 2001 From: Daniel Wirtz Date: Sun, 10 Mar 2013 23:25:20 +0100 Subject: [PATCH] Consider this done --- README.md | 2 - crypto.js | 174 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 173 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 862d468..bbcf536 100644 --- a/README.md +++ b/README.md @@ -5,8 +5,6 @@ A collection of node.js externs for use with [Closure Compiler](https://develope See: [Advanced Compilation and Externs](https://developers.google.com/closure/compiler/docs/api-tutorial3) for details -If you are sitting on (a bunch of) externs which are not yet included, please drop me a note or a pull request. - #### Naming convention #### * Externs for core components are all lower case diff --git a/crypto.js b/crypto.js index 77626d9..0cd7700 100644 --- a/crypto.js +++ b/crypto.js @@ -241,4 +241,176 @@ crypto.Sign.prototype.sign = function(private_key, output_format) {}; */ crypto.Signer; // Not sure about API docs / source diff -// TODO: Finish... +/** + * @param {string} algorithm + * @return crypto.Verify + */ +crypto.createVerify = function(algorithm) {}; + +/** + * @param {string} algorithm + * @param {Object} options + * @constructor + * @extend stream.Writable + */ +crypto.Verify = function(algorithm, options) {}; + +/** + * @type {crypto.Sign._write} + */ +crypto.Verify.prototype._write; + +/** + * @param {string|buffer.Buffer} data + */ +crypto.Verify.prototype.update = function(data) {}; + +/** + * @param {string} object + * @param {string|buffer.Buffer} signature + * @param {string=} signature_format + * @return {boolean} + */ +crypto.Verify.prototype.verify = function(object, signature, signature_format) {}; + +/** + * @param {number} prime + * @param {string=} encoding + * @return {crypto.DiffieHellman} + */ +crypto.createDiffieHellman = function(prime, encoding) {}; + +/** + * @param {number} sizeOrKey + * @param {string} encoding + * @constructor + */ +crypto.DiffieHellman = function(sizeOrKey, encoding) {}; + +/** + * @param {string=} encoding + * @return {string|buffer.Buffer} + */ +crypto.DiffieHellman.prototype.generateKeys = function(encoding) {}; + +/** + * @param {string|buffer.Buffer} key + * @param {string=} inEnc + * @param {string=} outEnc + * @return {string|buffer.Buffer} + */ +crypto.DiffieHellman.prototype.computeSecret = function(key, inEnc, outEnc) {}; + +/** + * @param {string=} encoding + * @return {string|buffer.Buffer} + */ +crypto.DiffieHellman.prototype.getPrime = function(encoding) {}; + +/** + * @param {string=} encoding + * @return {string|buffer.Buffer} + */ +crypto.DiffieHellman.prototype.getGenerator = function(encoding) {}; + +/** + * @param {string=} encoding + * @return {string|buffer.Buffer} + */ +crypto.DiffieHellman.prototype.getPublicKey = function(encoding) {}; + +/** + * @param {string} encoding + * @return {string|buffer.Buffer} + */ +crypto.DiffieHellman.prototype.getPrivateKey = function(encoding) {} + +/** + * @param {string|buffer.Buffer} key + * @param {string=} encoding + * @return {crypto.DiffieHellman} + */ +crypto.DiffieHellman.prototype.setPublicKey = function(key, encoding) {}; + +/** + * @param {string|buffer.Buffer} key + * @param {string=} encoding + * @return {crypto.DiffieHellman} + */ +crypto.DiffieHellman.prototype.setPrivateKey = function(key, encoding) {}; + +/** + * @param {string} name + * @constructor + */ +crypto.DiffieHellmanGroup = function(name) {}; + +/** + * @type {crypto.DiffieHellman.prototype.generateKeys} + */ +crypto.DiffieHellmanGroup.prototype.generateKeys = crypto.DiffieHellman.prototype.generateKeys; + +/** + * @type {crypto.DiffieHellman.prototype.computeSecret} + */ +crypto.DiffieHellmanGroup.prototype.computeSecret = crypto.DiffieHellman.prototype.computeSecret; + +/** + * @type {crypto.DiffieHellman.prototype.getPrime} + */ +crypto.DiffieHellmanGroup.prototype.getPrime = crypto.DiffieHellman.prototype.getPrime; + +/** + * @type {crypto.DiffieHellman.prototype.getGenerator} + */ +crypto.DiffieHellmanGroup.prototype.getGenerator = crypto.DiffieHellman.prototype.getGenerator; + +/** + * @type {crypto.DiffieHellman.prototype.getPublicKey} + */ +crypto.DiffieHellmanGroup.prototype.getPublicKey = crypto.DiffieHellman.prototype.getPublicKey; + +/** + * @type {crypto.DiffieHellman.prototype.getPrivateKey} + */ +crypto.DiffieHellmanGroup.prototype.getPrivateKey = crypto.DiffieHellman.prototype.getPrivateKey; + +/** + * @type {crypto.DiffieHellman.prototype.setPublicKey} + */ +crypto.DiffieHellmanGroup.prototype.setPublicKey = crypto.DiffieHellman.prototype.setPublicKey; + +/** + * @type {crypto.DiffieHellman.prototype.setPrivateKey} + */ +crypto.DiffieHellmanGroup.prototype.setPrivateKey = crypto.DiffieHellman.prototype.setPrivateKey; + +/** + * @type {*} + */ +crypto.randomBytes; + +/** + * @type {*} + */ +crypto.pseudoRandomBytes; + +/** + * @type {crypto.randomBytes} + */ +crypto.rng = crypto.randomBytes; + +/** + * @type {crypto.pseudoRandomBytes} + */ +crypto.prng = crypto.pseudoRandomBytes; + +/** + * @return {Array.} + */ +crypto.getCiphers = function() {}; + +/** + * @return {Array.} + */ +crypto.getHashes = function() {};