|
| 1 | +/* |
| 2 | + * Copyright 2012 The Closure Compiler Authors. |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + */ |
| 16 | + |
| 17 | +/** |
| 18 | + * @fileoverfiew Definitions for node's crypto module. |
| 19 | + * @see http://nodejs.org/api/crypto.html |
| 20 | + * @see https://github.com/joyent/node/blob/master/lib/crypto.js |
| 21 | + * @externs |
| 22 | + * @author Daniel Wirtz <[email protected]> |
| 23 | + */ |
| 24 | + |
| 25 | +/** |
| 26 | + BEGIN_NODE_INCLUDE |
| 27 | + var crypto = require('crypto'); |
| 28 | + END_NODE_INCLUDE |
| 29 | + */ |
| 30 | + |
| 31 | +/** |
| 32 | + * @type {Object.<string,*>} |
| 33 | + */ |
| 34 | +var crypto = {}; |
| 35 | + |
| 36 | +/** |
| 37 | + * @typedef {{pfx: string|buffer.Buffer, key: string|buffer.Buffer, passphrase: string, cert: string|buffer.Buffer, ca: Array.<string|buffer.Buffer>, crl: string|Array.<string>, ciphers: string}} |
| 38 | + */ |
| 39 | +crypto.Credentials; |
| 40 | + |
| 41 | +/** |
| 42 | + * @param {Object.<string,string>=} details |
| 43 | + * @return {crypto.Credentials} |
| 44 | + */ |
| 45 | +crypto.createCredentials = function(details) {}; |
| 46 | + |
| 47 | +/** |
| 48 | + * @param {string} algorithm |
| 49 | + * @return {crypto.Hash} |
| 50 | + */ |
| 51 | +crypto.createHash = function(algorithm) {}; |
| 52 | + |
| 53 | +/** |
| 54 | + * @param {string} algorithm |
| 55 | + * @param {Object} options |
| 56 | + * @constructor |
| 57 | + */ |
| 58 | +crypto.Hash = function(algorithm, options) {}; |
| 59 | + |
| 60 | +/** |
| 61 | + * @param {string|buffer.Buffer} data |
| 62 | + * @param {string=} input_encoding |
| 63 | + */ |
| 64 | +crypto.Hash.prototype.update = function(data, input_encoding) {}; |
| 65 | + |
| 66 | +/** |
| 67 | + * @param {string=} encoding |
| 68 | + * @return {string} |
| 69 | + */ |
| 70 | +crypto.Hash.prototype.digest = function(encoding) {}; |
| 71 | + |
| 72 | +/** |
| 73 | + * @param {string} algorithm |
| 74 | + * @param {string|buffer.Buffer} key |
| 75 | + * @return {crypto.Hmac} |
| 76 | + */ |
| 77 | +crypto.createHmac = function(algorithm, key) {}; |
| 78 | + |
| 79 | +/** |
| 80 | + * @param {string} hmac |
| 81 | + * @param {string|buffer.Buffer} key |
| 82 | + * @param {Object} options |
| 83 | + * @constructor |
| 84 | + */ |
| 85 | +crypto.Hmac = function(hmac, key, options) {}; |
| 86 | + |
| 87 | +/** |
| 88 | + * @param {string|buffer.Buffer} data |
| 89 | + */ |
| 90 | +crypto.Hmac.prototype.update = function(data) {}; |
| 91 | + |
| 92 | +/** |
| 93 | + * @param {string} encoding |
| 94 | + */ |
| 95 | +crypto.Hmac.prototype.digest = function(encoding) {}; |
| 96 | + |
| 97 | +// TODO: Finish... |
0 commit comments