From e6aa426539b69ef386663b0493b40252f80ef37e Mon Sep 17 00:00:00 2001 From: msfcolombo Date: Mon, 22 Jun 2015 18:25:07 -0700 Subject: [PATCH] Fixes on jsdoc and removal of the Jwk namespace --- lib/services/keyVault/lib/jwk.js | 21 +++++++++++++++---- lib/services/keyVault/lib/keyVault.js | 7 +++++-- .../keyVault/lib/keyVaultCredentials.js | 3 ++- .../keyVault/lib/keyVaultInternalClient.js | 6 +++--- lib/services/keyVault/package.json | 2 +- test/services/keyVault/kv-test-utils.js | 3 +-- 6 files changed, 29 insertions(+), 13 deletions(-) diff --git a/lib/services/keyVault/lib/jwk.js b/lib/services/keyVault/lib/jwk.js index 6a04055234..66531a517d 100644 --- a/lib/services/keyVault/lib/jwk.js +++ b/lib/services/keyVault/lib/jwk.js @@ -18,32 +18,45 @@ /* jshint latedef:false */ /* jshint camelcase:false */ -/** @class +/** Constants that identify encryption algorithms. + * @namespace */ function JsonWebKeyEncryptionAlgorithms() { } +/** @inner */ JsonWebKeyEncryptionAlgorithms.RSAOAEP = 'RSA-OAEP'; +/** @inner */ JsonWebKeyEncryptionAlgorithms.RSA15 = 'RSA1_5'; -/** @class +/** Constants that identify signing algorithms. + * @namespace */ function JsonWebKeySignatureAlgorithms() { } +/** @inner */ JsonWebKeySignatureAlgorithms.RS256 = 'RS256'; +/** @inner */ JsonWebKeySignatureAlgorithms.RS384 = 'RS384'; +/** @inner */ JsonWebKeySignatureAlgorithms.RS512 = 'RS512'; -JsonWebKeySignatureAlgorithms.RS256 = 'RSNULL'; +/** @inner */ +JsonWebKeySignatureAlgorithms.RSNULL = 'RSNULL'; -/** @class +/** Constants that identify JWK (Json Web Key) types. + * @namespace */ function JsonWebKeyType() { } +/** @inner */ JsonWebKeyType.EC = 'EC'; +/** @inner */ JsonWebKeyType.RSA = 'RSA'; +/** @inner */ JsonWebKeyType.RSAHSM = 'RSA-HSM'; +/** @inner */ JsonWebKeyType.OCT = 'oct'; /** @class diff --git a/lib/services/keyVault/lib/keyVault.js b/lib/services/keyVault/lib/keyVault.js index 6437d18b42..998b926cab 100644 --- a/lib/services/keyVault/lib/keyVault.js +++ b/lib/services/keyVault/lib/keyVault.js @@ -26,7 +26,9 @@ var kvcreds = require('./keyVaultCredentials'); var exports = module.exports; -exports.Jwk = jwk; +exports.JsonWebKey = jwk.JsonWebKey; +exports.JsonWebKeyEncryptionAlgorithms = jwk.JsonWebKeyEncryptionAlgorithms; +exports.JsonWebKeySignatureAlgorithms = jwk.JsonWebKeySignatureAlgorithms; exports.KeyVaultCredentials = kvcreds.KeyVaultCredentials; /** Identifier of the resource on which Key Vault users and service principals must authenticate. @@ -466,7 +468,8 @@ KeyVaultClient.prototype.getSecretVersionsNext = function(nextLink, callback) { */ /** An identifier for an Azure Key Vault resource. - */ + * @class + */ function ObjectIdentifier(collection, vault, name, version) { /** The vault URI. diff --git a/lib/services/keyVault/lib/keyVaultCredentials.js b/lib/services/keyVault/lib/keyVaultCredentials.js index 8abdb026f7..6c1c1a6030 100644 --- a/lib/services/keyVault/lib/keyVaultCredentials.js +++ b/lib/services/keyVault/lib/keyVaultCredentials.js @@ -24,6 +24,7 @@ var requestPipeline = AzureCommon.requestPipeline; /** * An object that performs authentication for Key Vault. + * @class * @param {KeyVaultCredentials~authRequest} authenticator A callback that receives a challenge and returns an authentication token. */ function KeyVaultCredentials(authenticator) { @@ -127,7 +128,7 @@ KeyVaultCredentials.prototype.addChallengeToCache = function(resource, challenge /** * @callback KeyVaultCredentials~authResponse * @param {object} err An error object. Must be null if the authentication was successful. - * @param {string} authorization The contents of an 'authorization' header that answers the challenge. Typically a string in the format 'Bearer '. + * @param {string} authorization The contents of an 'authorization' header that answers the challenge. Typically a string in the format 'Bearer <token>'. */ module.exports.KeyVaultCredentials = KeyVaultCredentials; diff --git a/lib/services/keyVault/lib/keyVaultInternalClient.js b/lib/services/keyVault/lib/keyVaultInternalClient.js index 1b3fe9f553..ef6ca26723 100644 --- a/lib/services/keyVault/lib/keyVaultInternalClient.js +++ b/lib/services/keyVault/lib/keyVaultInternalClient.js @@ -35,7 +35,7 @@ var DEFAULT_API_VERSION = '2015-06-01'; var API_VERSION_QUERY_PARAM = 'api-version=' + DEFAULT_API_VERSION; var KeyVaultInternalClient = ( /** @lends KeyVaultInternalClient */ function() { - /** + /* (jsdoc off) * @class * Initializes a new instance of the KeyVaultInternalClient class. * @constructor @@ -89,7 +89,7 @@ var KeyVaultInternalClient = ( /** @lends KeyVaultInternalClient */ function() { exports.KeyVaultInternalClient = KeyVaultInternalClient; var KeyOperations = ( /** @lends KeyOperations */ function() { - /** + /* (jsdoc off) * @class * Cryptographic and management operations for keys in a vault * __NOTE__: An instance of this class is automatically created for an @@ -1370,7 +1370,7 @@ var KeyOperations = ( /** @lends KeyOperations */ function() { })(); var SecretOperations = ( /** @lends SecretOperations */ function() { - /** + /* (jsdoc off) * @class * Operations for secrets in a vault * __NOTE__: An instance of this class is automatically created for an diff --git a/lib/services/keyVault/package.json b/lib/services/keyVault/package.json index 8048feab11..e298fc551b 100644 --- a/lib/services/keyVault/package.json +++ b/lib/services/keyVault/package.json @@ -9,7 +9,7 @@ "Zavery, Amar ", "Wang, Yugang " ], - "version": "0.10.0", + "version": "0.10.1", "description": "Microsoft Azure Key Vault Client Library for node", "tags": [ "azure", diff --git a/test/services/keyVault/kv-test-utils.js b/test/services/keyVault/kv-test-utils.js index 4b65eea1c2..d4f07d0a6b 100644 --- a/test/services/keyVault/kv-test-utils.js +++ b/test/services/keyVault/kv-test-utils.js @@ -18,7 +18,6 @@ var Testutil = require('../../util/util'); var KeyVault = Testutil.libRequire('services/keyVault'); -var Jwk = KeyVault.Jwk; var AuthenticationContext = require('adal-node').AuthenticationContext; var Forge = require('node-forge'); var BigInteger = Forge.jsbn.BigInteger; @@ -113,7 +112,7 @@ function clone(obj) { return new Buffer(obj); } if (obj instanceof Object) { - if (obj instanceof Jwk.JsonWebKey) result = new Jwk.JsonWebKey(); + if (obj instanceof KeyVault.JsonWebKey) result = new KeyVault.JsonWebKey(); else if (obj instanceof KeyVault.KeyAttributes) result = new KeyVault.KeyAttributes(); else