@azure/keyvault-keys
Advanced tools
Comparing version 4.0.0-preview.3 to 4.0.0-preview.5
# Release History | ||
## 4.0.0-preview.5 (2019-09-11) | ||
- Improved the tests, the README and upgraded dependencies. | ||
- Added the browser folder to the released bundle. | ||
## 4.0.0-preview.3 (2019-08-06) | ||
@@ -4,0 +8,0 @@ - Added a new CryptographyClient to handle cryptography tasks. |
@@ -13,3 +13,3 @@ /* | ||
var packageName = "@azure/keyvault-keys"; | ||
var packageVersion = "4.0.0-preview.2"; | ||
var packageVersion = "4.0.0-preview.5"; | ||
var KeyVaultClientContext = /** @class */ (function (_super) { | ||
@@ -16,0 +16,0 @@ tslib_1.__extends(KeyVaultClientContext, _super); |
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. See License.txt in the project root for license information. | ||
export var SDK_VERSION = "4.0.0-preview.2"; | ||
export var SDK_VERSION = "4.0.0-preview.5"; | ||
export var RetryConstants = { | ||
@@ -5,0 +5,0 @@ MIN_RETRY_INTERVAL_MS: 3000 |
@@ -5,5 +5,3 @@ // Copyright (c) Microsoft Corporation. | ||
import * as tslib_1 from "tslib"; | ||
import { isTokenCredential, deserializationPolicy, signingPolicy, exponentialRetryPolicy, redirectPolicy, systemErrorRetryPolicy, generateClientRequestIdPolicy, proxyPolicy, throttlingRetryPolicy, getDefaultProxySettings, isNode, userAgentPolicy } from "@azure/core-http"; | ||
import { TracerProxy, SupportedPlugins } from "@azure/core-tracing"; | ||
import { getDefaultUserAgentValue } from "@azure/core-http"; | ||
import { getDefaultUserAgentValue, isTokenCredential, deserializationPolicy, signingPolicy, exponentialRetryPolicy, redirectPolicy, systemErrorRetryPolicy, generateClientRequestIdPolicy, proxyPolicy, throttlingRetryPolicy, getDefaultProxySettings, isNode, userAgentPolicy, tracingPolicy, TracerProxy, SupportedPlugins } from "@azure/core-http"; | ||
import "@azure/core-paging"; | ||
@@ -17,2 +15,3 @@ import { KeyVaultClient } from "./core/keyVaultClient"; | ||
export { CryptographyClient }; | ||
export { TracerProxy, SupportedPlugins } from "@azure/core-http"; | ||
/** | ||
@@ -75,2 +74,3 @@ * The client to interact with the KeyVault keys functionality | ||
requestPolicyFactories = requestPolicyFactories.concat([ | ||
tracingPolicy(), | ||
userAgentPolicy({ value: userAgentString }), | ||
@@ -77,0 +77,0 @@ generateClientRequestIdPolicy(), |
@@ -5,3 +5,3 @@ { | ||
"author": "Microsoft Corporation", | ||
"version": "4.0.0-preview.3", | ||
"version": "4.0.0-preview.5", | ||
"license": "MIT", | ||
@@ -26,3 +26,3 @@ "description": "Isomorphic client library for Azure KeyVault's keys.", | ||
"engine": { | ||
"node": ">=6.0.0" | ||
"node": ">=8.0.0" | ||
}, | ||
@@ -32,3 +32,4 @@ "files": [ | ||
"README.md", | ||
"types/", | ||
"types/keyvault-keys.d.ts", | ||
"browser/", | ||
"dist/", | ||
@@ -52,12 +53,12 @@ "dist-esm/", | ||
"build": "npm run extract-api && npm run build:samples && npm run build:es6 && npm run build:nodebrowser", | ||
"check-format": "prettier --list-different --config ../../.prettierrc.json \"src/**/*.ts\" \"tests/**/*.ts\" \"*.{js,json}\"", | ||
"clean": "rimraf dist dist-esm dist-test types *.tgz *.log browser statistics.html coverage && rimraf src/**/*.js && rimraf tests/**/*.js", | ||
"check-format": "prettier --list-different --config ../../.prettierrc.json \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"", | ||
"clean": "rimraf dist dist-esm dist-test types *.tgz *.log browser statistics.html coverage && rimraf src/**/*.js && rimraf test/**/*.js", | ||
"extract-api": "tsc -p . && api-extractor run --local", | ||
"format": "prettier --write --config ../../.prettierrc.json \"src/**/*.ts\" \"tests/**/*.ts\" \"*.{js,json}\"", | ||
"format": "prettier --write --config ../../.prettierrc.json \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"", | ||
"integration-test:browser": "karma start --single-run", | ||
"integration-test:node": "nyc mocha --require source-map-support/register --reporter mocha-multi --timeout 1200000 --reporter-options spec=-,mocha-junit-reporter=- --full-trace dist-test/index.node.js", | ||
"integration-test:node": "nyc mocha --require source-map-support/register --reporter mocha-multi --reporter-options spec=-,mocha-junit-reporter=- --timeout 1200000 --full-trace dist-test/index.node.js", | ||
"integration-test": "npm run integration-test:node && npm run integration-test:browser", | ||
"lint:fix": "eslint -c ../../.eslintrc.json src tests samples --ext .ts --fix --fix-type [problem,suggestion]", | ||
"lint": "eslint -c ../../.eslintrc.json src tests samples --ext .ts -f node_modules/eslint-detailed-reporter/lib/detailed.js -o keyvault-keys-lintReport.html || exit 0", | ||
"lint:terminal": "eslint -c ../../.eslintrc.json src tests samples --ext .ts", | ||
"lint:fix": "eslint -c ../../.eslintrc.json src test samples --ext .ts --fix --fix-type [problem,suggestion]", | ||
"lint": "eslint -c ../../.eslintrc.json src test samples --ext .ts -f html -o keyvault-keys-lintReport.html || exit 0", | ||
"lint:terminal": "eslint -c ../../.eslintrc.json src test samples --ext .ts", | ||
"pack": "npm pack 2>&1", | ||
@@ -75,12 +76,12 @@ "prebuild": "npm run clean", | ||
"dependencies": { | ||
"@azure/core-arm": "1.0.0-preview.2", | ||
"@azure/core-http": "1.0.0-preview.2", | ||
"@azure/core-paging": "1.0.0-preview.1", | ||
"@azure/core-tracing": "1.0.0-preview.1", | ||
"@azure/identity": "1.0.0-preview.2", | ||
"tslib": "^1.9.3", | ||
"@trust/keyto": "0.3.7" | ||
"@azure/core-arm": "1.0.0-preview.3", | ||
"@azure/core-http": "1.0.0-preview.3", | ||
"@azure/core-paging": "1.0.0-preview.2", | ||
"@azure/identity": "1.0.0-preview.3", | ||
"@trust/keyto": "0.3.7", | ||
"tslib": "^1.9.3" | ||
}, | ||
"devDependencies": { | ||
"@azure/abort-controller": "1.0.0-preview.1", | ||
"@azure/abort-controller": "1.0.0-preview.2", | ||
"@azure/test-utils-recorder": "1.0.0", | ||
"@microsoft/api-extractor": "^7.1.5", | ||
@@ -91,8 +92,6 @@ "@types/chai": "^4.1.6", | ||
"@types/mocha": "^5.2.5", | ||
"@types/nise": "^1.4.0", | ||
"@types/nock": "^10.0.1", | ||
"@types/node": "^8.0.0", | ||
"@types/query-string": "6.2.0", | ||
"@typescript-eslint/eslint-plugin": "^1.11.0", | ||
"@typescript-eslint/parser": "^1.11.0", | ||
"@typescript-eslint/eslint-plugin": "^2.0.0", | ||
"@typescript-eslint/parser": "^2.0.0", | ||
"assert": "^1.4.1", | ||
@@ -102,5 +101,4 @@ "chai": "^4.2.0", | ||
"dotenv": "^8.0.0", | ||
"eslint": "^5.16.0", | ||
"eslint": "^6.1.0", | ||
"eslint-config-prettier": "^6.0.0", | ||
"eslint-detailed-reporter": "^0.8.0", | ||
"eslint-plugin-no-null": "^1.0.2", | ||
@@ -112,3 +110,3 @@ "eslint-plugin-no-only-tests": "^2.3.0", | ||
"karma-chrome-launcher": "^3.0.0", | ||
"karma-coverage": "^1.1.2", | ||
"karma-coverage": "^2.0.0", | ||
"karma-edge-launcher": "^0.4.2", | ||
@@ -124,7 +122,5 @@ "karma-env-preprocessor": "^0.1.1", | ||
"karma-remap-coverage": "^0.1.5", | ||
"mocha": "^5.2.0", | ||
"mocha": "^6.2.0", | ||
"mocha-junit-reporter": "^1.18.0", | ||
"mocha-multi": "^1.0.1", | ||
"nise": "^1.4.10", | ||
"nock": "^10.0.6", | ||
"mocha-multi": "^1.1.3", | ||
"nyc": "^14.0.0", | ||
@@ -134,3 +130,3 @@ "prettier": "^1.16.4", | ||
"query-string": "^5.0.0", | ||
"rimraf": "^2.6.2", | ||
"rimraf": "^3.0.0", | ||
"rollup": "^1.16.3", | ||
@@ -137,0 +133,0 @@ "rollup-plugin-commonjs": "^10.0.0", |
248
README.md
@@ -1,12 +0,13 @@ | ||
# Azure KeyVault Keys client library for JS | ||
# Azure Key Vault Keys client library for JS | ||
Azure KeyVault is a service that allows you to encrypt authentication | ||
Azure Key Vault is a service that allows you to encrypt authentication | ||
keys, storage account keys, data encryption keys, .pfx files, and | ||
passwords by using keys that are protected by hardware security | ||
modules (HSMs). | ||
modules (HSMs). If you would like to know more about Azure Key Vault, you may | ||
want to review [What is Azure Key Vault?](https://docs.microsoft.com/en-us/azure/key-vault/key-vault-overview). | ||
Azure KeyVault Key management allows you to create and control | ||
Azure Key Vault Key management allows you to create and control | ||
encryption keys that encrypt your data. | ||
Use the client library for Azure KeyVault Keys in your Node.js application to | ||
Use the client library for Azure Key Vault Keys in your Node.js application to | ||
@@ -33,3 +34,3 @@ - Create keys (EC, EC-HSM, RSA, RSA-HSM). | ||
**Please Note:** This is a preview version of the KeyVault Keys library | ||
**Please Note:** This is a preview version of the Key Vault Keys library | ||
@@ -42,3 +43,3 @@ [Source code](https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/keyvault/keyvault-keys) | [Package (npm)](https://www.npmjs.com/package/@azure/keyvault-keys) | [API Reference Documentation](https://azure.github.io/azure-sdk-for-js/keyvault-keys) | [Product documentation](https://azure.microsoft.com/en-us/services/key-vault/) | [Samples](https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/keyvault/keyvault-keys/samples) | ||
Install the Azure Event KeyVault Keys client library using npm | ||
Install the Azure Key Vault Keys client library using npm | ||
@@ -48,3 +49,3 @@ `npm install @azure/keyvault-keys` | ||
**Prerequisites**: You must have an [Azure subscription](https://azure.microsoft.com/free/) and a | ||
[KeyVault resource](https://docs.microsoft.com/en-us/azure/key-vault/quick-create-portal) to use this package. | ||
[Key Vault resource](https://docs.microsoft.com/en-us/azure/key-vault/quick-create-portal) to use this package. | ||
If you are using this package in a Node.js application, then use Node.js 6.x or higher. | ||
@@ -91,7 +92,7 @@ | ||
```Bash | ||
az keyvault set-policy --name <your-key-vault-name> --spn $AZURE_CLIENT_ID --secret-permissions backup delete get list set | ||
az keyvault set-policy --name <your-key-vault-name> --spn $AZURE_CLIENT_ID --secret-permissions backup delete get list create | ||
``` | ||
> --secret-permissions: | ||
> Accepted values: backup, delete, get, list, purge, recover, restore, set | ||
> Accepted values: backup, delete, get, list, purge, recover, restore, create | ||
@@ -103,4 +104,25 @@ - Use the above mentioned Key Vault name to retrieve details of your Vault which also contains your Key Vault URL: | ||
### Authenticate the client | ||
## Key concepts | ||
- The **Keys client** is the primary interface to interact with the API methods | ||
related to keys in the Azure Key Vault API from a JavaScript application. | ||
Once initialized, it provides a basic set of methods that can be used to | ||
create, read, update and delete keys. | ||
- A **Key version** is a version of a key in the Key Vault. | ||
Each time a user assigns a value to a unique key name, a new **version** | ||
of that key is created. Retrieving a key by a name will always return | ||
the latest value assigned, unless a specific version is provided to the | ||
query. | ||
- **Soft delete** allows Key Vaults to support deletion and purging as two | ||
separate steps, so deleted keys are not immediately lost. This only happens if the Key Vault | ||
has [soft-delete](https://docs.microsoft.com/en-us/azure/key-vault/key-vault-ovw-soft-delete) | ||
enabled. | ||
- A **Key backup** can be generated from any created key. These backups come as | ||
binary data, and can only be used to regenerate a previously deleted key. | ||
- The **Cryptography client** is a separate interface that interacts with the | ||
keys API methods in the Key Vault API, ## Authenticating the client. This | ||
client focuses only in the cryptography operations that can be executed using | ||
a key that has been already created in the Key Vault. More about this client | ||
in the [Cryptography](#cryptography) section. | ||
To use the key vault from TypeScript/JavaScript, you need to first authenticate with the key vault service. To authenticate, first we import the identity and KeysClient, which will connect to the key vault. | ||
@@ -130,43 +152,17 @@ | ||
## Key concepts | ||
Azure Key Vault allows you to create and store keys in the key vault. Azure supports RSA keys and elliptic curve keys, each with corresponding support in hardware security modules (HSM). | ||
Multiple keys, and multiple versions of the same key, can be kept in the key vault. Keys can be listed, as well as versions of the same key. Keys can have attributes (Eg, if it is enabled) updated after they are created. Keys can also be deleted, and -- in key vaults with soft delete -- these deleted keys can be recovered. | ||
### Creating keys and key versions | ||
Azure Key Vault allows you to create keys that are stored in the key vault. When a key is first created, it is given a name. This name acts as a way to reach the key later. | ||
Keys in the key vault can have multiple versions of the same key. These are called versions of that key. | ||
Keys can be created using either RSA or elliptic curve algorithms, each with corresponding support for hardware security modules (HSMs). | ||
In addition to creating keys, existing key data can be imported into a key vault. | ||
### Getting keys from the key vault | ||
The simplest way to read keys back from the vault is to get a key by name. This will retrieve the most recent version of the key. You can optionally get a different version of the key if you also know the version you want. | ||
Key vaults also support listing the keys they have, as well as listing the all the versions of the given key. | ||
### Updating key attributes | ||
Once a key is created, it is possible to update attributes of the key. For example, if a key needs to be temporarily unavailable, the `enabled` attribute can be set to false for a time. | ||
### Working with deleted keys | ||
Key vaults allow deleting keys so that they are no longer available. | ||
In key vaults with 'soft delete' enabled, keys are not immediately removed but instead marked simply as 'deleted'. These deleted keys can be listed, purged, and recovered. | ||
## Examples | ||
The following sections provide code snippets that cover some of the common tasks using Azure KeyVault Keys. | ||
The following sections provide code snippets that cover some of the common | ||
tasks using Azure Key Vault Keys. The scenarios that are covered here consist of: | ||
Once you have authenticated and created an instance of an `KeysClient` class (see "Authenticate the client" above), you can create, read, update, and delete keys: | ||
- [Creating a key](#creating-a-key). | ||
- [Getting a key](#getting-a-key). | ||
- [Creating and updating keys with attributes](#creating-and-updating-keys-with-attributes). | ||
- [Deleting a key](#deleting-a-key). | ||
- [Iterating lists of keys](#iterating-lists-of-keys). | ||
### Create a key | ||
### Creating a key | ||
`createKey` creates a Key to be stored in the Azure Key Vault. If a key with the same name already exists, then a new version of the key is created. | ||
`createKey` creates a Key to be stored in the Azure Key Vault. If a key with | ||
the same name already exists, then a new version of the key is created. | ||
@@ -180,52 +176,93 @@ ```javascript | ||
### Get a key | ||
The second parameter sent to `createKey` is the type of the key. Keys can | ||
either be of type: `EC`, `EC-HSM`, `RSA` or `RSA-HSM`. | ||
### Getting a key | ||
The simplest way to read keys back from the vault is to get a key by name. This | ||
will retrieve the most recent version of the key. You can optionally get a | ||
different version of the key if you specify it as part of the optional | ||
parameters. | ||
`getKey` retrieves a key previous stores in the Key Vault. | ||
```javascript | ||
const getResult = await client.getKey(keyName); | ||
console.log("getResult: ", getResult); | ||
const latestKey = await client.getKey(keyName); | ||
console.log(`Latest version of the key ${keyName}: `, getResult); | ||
const specificKey = await client.getKey(keyName, { version: latestKey.version! }); | ||
console.log(`The key ${keyName} at the version ${latestKey.version!}: `, getResult); | ||
``` | ||
### List all versions of a key | ||
### Creating and updating keys with attributes | ||
`listKeyVersions` will list versions of the given key. | ||
The following attributes can also be assigned to any key in a Key Vault: | ||
- `tags`: Any set of key-values that can be used to search and filter keys. | ||
- `keyOps`: An array of the operations that this key will be able to perform (`encrypt`, `decrypt`, `sign`, `verify`, `wrapKey`, `unwrapKey`). | ||
- `enabled`: A boolean value that determines whether the key value can be read or not. | ||
- `notBefore`: A given date after which the key value can be retrieved. | ||
- `expires`: A given date after which the key value cannot be retrieved. | ||
An object with these attributes can be sent as the third parameter of | ||
`createKey`, right after the key's name and value, as follows: | ||
```javascript | ||
for await (let version of client.listKeyVersions(keyName)) { | ||
console.log("version: ", version); | ||
} | ||
const result = await client.createKey(keyName, "RSA", { | ||
enabled: false | ||
}); | ||
``` | ||
### List all keys | ||
This will create a new version of the same key, which will have the latest | ||
provided attributes. | ||
`listKeys` will list all keys in the Key Vault. | ||
Attributes can also be updated to an existing key version with | ||
`updateKey`, as follows: | ||
```javascript | ||
for await (let listedKey of client.listKeys()) { | ||
console.log("key: ", listedKey); | ||
} | ||
const result = client.createKey(keyName, "RSA"); | ||
await client.updateKey(keyName, result.version, { | ||
enabled: false | ||
}); | ||
``` | ||
### Update a key | ||
### Deleting a key | ||
`updateKey` updates the attributes of a key. | ||
The `deleteKey` method sets a key up for deletion. This process will | ||
happen in the background as soon as the necessary resources are available. | ||
```javascript | ||
const updatedKey = await client.updateKey(keyName, result.version, { enabled: false }); | ||
await client.deleteKey(keyName); | ||
``` | ||
### Delete a key | ||
If [soft-delete](https://docs.microsoft.com/en-us/azure/key-vault/key-vault-ovw-soft-delete) | ||
is enabled for the Key Vault, this operation will only label the key as a | ||
_deleted_ key. A deleted key can't be updated. They can only be either | ||
read, recovered or purged. | ||
`deleteKey` deletes a key previously stored in the Key Vault. When [soft-delete](https://docs.microsoft.com/en-us/azure/key-vault/key-vault-ovw-soft-delete) is not enabled for the Key Vault, this operation permanently deletes the key. | ||
```javascript | ||
await client.deleteKey(keyName); | ||
// If soft-delete is enabled, we can eventually do: | ||
await client.getDeletedKey(keyName); | ||
// Deleted keys can also be recovered or purged: | ||
await client.recoverDeletedKey(keyName); | ||
// await client.purgeDeletedKey(keyName); | ||
``` | ||
Since the deletion of a key won't happen instantly, some time is needed | ||
after the `deleteKey` method is called before the deleted key is | ||
available to be read, recovered or purged. | ||
## Cryptography | ||
This library also offers a set of cryptographic utilities available through `CryptographyClient`. Similar to the `KeysClient`, `CryptographyClient` will connect to Azure Key Vault with the provided set of credentials. Once connected, `CryptographyClient` can encrypt, decrypt, sign, verify, wrap keys, and unwrap keys. | ||
This library also offers a set of cryptographic utilities available through | ||
`CryptographyClient`. Similar to the `KeysClient`, `CryptographyClient` will | ||
connect to Azure Key Vault with the provided set of credentials. Once | ||
connected, `CryptographyClient` can encrypt, decrypt, sign, verify, wrap keys, | ||
and unwrap keys. | ||
### Authenticate the client | ||
We can next connect to the key vault service just as we do with the KeysClient. | ||
We'll need to copy some settings from the key vault we are | ||
connecting to into our environment variables. Once they are in our environment, | ||
we can access them with the following code: | ||
@@ -235,7 +272,3 @@ ```typescript | ||
import { KeysClient, CryptographyClient } from "@azure/keyvault-keys"; | ||
``` | ||
Once these are imported, we can next connect to the key vault service. To do this, we'll need to copy some settings from the key vault we are connecting to into our environment variables. Once they are in our environment, we can access them with the following code: | ||
```typescript | ||
// DefaultAzureCredential expects the following three environment variables: | ||
@@ -255,3 +288,3 @@ // * AZURE_TENANT_ID: The tenant ID in Azure Active Directory | ||
// Create or retrieve a key from the keyvault | ||
let myKey = await client.createKey("MyKey", "RSA"); | ||
let myKey = await keysClient.createKey("MyKey", "RSA"); | ||
@@ -314,2 +347,3 @@ // Lastly, create our cryptography client and connect to the service | ||
```javascript | ||
const buffer = Buffer.from("My Message"); | ||
const verifyResult = await cryptoClient.verifyData("RS256", buffer, signature.result); | ||
@@ -342,3 +376,3 @@ console.log("verify result: ", verifyResult); | ||
- Getting debug logs from the KeyVault Keys SDK | ||
- Getting debug logs from the Key Vault Keys SDK | ||
@@ -349,37 +383,2 @@ ```bash | ||
- Getting debug logs from the KeyVault Keys SDK and the protocol level library. | ||
```bash | ||
export DEBUG=azure*,rhea* | ||
``` | ||
- If you are **not interested in viewing the event transformation** (which consumes lot of console/disk space) then you can set the `DEBUG` environment variable as follows: | ||
```bash | ||
export DEBUG=azure*,rhea*,-rhea:raw,-rhea:message,-azure:amqp-common:datatransformer | ||
``` | ||
- If you are interested only in **errors**, then you can set the `DEBUG` environment variable as follows: | ||
```bash | ||
export DEBUG=azure:keyvault-keys:error,azure-amqp-common:error,rhea-promise:error,rhea:events,rhea:frames,rhea:io,rhea:flow | ||
``` | ||
### Logging to a file | ||
- Set the `DEBUG` environment variable as shown above and then run your test script as follows: | ||
- Logging statements from your test script go to `out.log` and logging statements from the sdk go to `debug.log`. | ||
```bash | ||
node your-test-script.js > out.log 2>debug.log | ||
``` | ||
- Logging statements from your test script and the sdk go to the same file `out.log` by redirecting stderr to stdout (&1), and then redirect stdout to a file: | ||
```bash | ||
node your-test-script.js >out.log 2>&1 | ||
``` | ||
- Logging statements from your test script and the sdk go to the same file `out.log`. | ||
```bash | ||
node your-test-script.js &> out.log | ||
``` | ||
## Next steps | ||
@@ -391,16 +390,29 @@ | ||
- [helloWorld.ts](https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/keyvault/keyvault-keys/samples/helloWorld.ts) - Create, read, update, and delete keys | ||
## Contributing | ||
This project welcomes contributions and suggestions. Most contributions require you to agree to a | ||
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us | ||
the rights to use your contribution. For details, visit <https://cla.microsoft.com.> | ||
This project welcomes contributions and suggestions. Please read the | ||
[contributing guidelines](https://github.com/Azure/azure-sdk-for-js/blob/master/CONTRIBUTING.md) | ||
for detailed information about how to contribute and what to expect while contributing. | ||
When you submit a pull request, a CLA-bot will automatically determine whether you need to provide | ||
a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions | ||
provided by the bot. You will only need to do this once across all repos using our CLA. | ||
### Testing | ||
If you'd like to contribute to this library, please read the [contributing guide](../../../CONTRIBUTING.md) to learn more about how to build and test the code. | ||
To run our tests, first install the dependencies (with `npm install` or `rush install`), | ||
then run the unit tests with: `npm run unit-test`. | ||
Our unit tests that target the behavior of our library against remotely | ||
available endpoints are executed using previously recorded HTTP request and | ||
responses. | ||
Our integration tests will run against the live resources, which are determined | ||
by the environment variables you provide. To run the integration tests, you can | ||
run `npm run integration-test`, but make sure to provide the following | ||
environment variables: | ||
- `AZURE_CLIENT_ID`: The Client ID of your Azure account. | ||
- `AZURE_CLIENT_SECRET`: The secret of your Azure account. | ||
- `AZURE_TENANT_ID`: The Tenant ID of your Azure account. | ||
- `KEYVAULT_NAME`: The name of the Key Vault you want to run the tests against. | ||
**WARNING:** | ||
Integration tests will wipe all of the existing records in the targeted Key Vault. | ||
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). | ||
@@ -407,0 +419,0 @@ For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or |
@@ -27,3 +27,3 @@ "use strict"; | ||
var packageName = "@azure/keyvault-keys"; | ||
var packageVersion = "4.0.0-preview.2"; | ||
var packageVersion = "4.0.0-preview.5"; | ||
var KeyVaultClientContext = /** @class */ (function (_super) { | ||
@@ -30,0 +30,0 @@ __extends(KeyVaultClientContext, _super); |
@@ -15,3 +15,3 @@ /* | ||
const packageName = "@azure/keyvault-keys"; | ||
const packageVersion = "4.0.0-preview.2"; | ||
const packageVersion = "4.0.0-preview.5"; | ||
@@ -18,0 +18,0 @@ export class KeyVaultClientContext extends coreArm.AzureServiceClient { |
@@ -5,3 +5,3 @@ "use strict"; | ||
exports.__esModule = true; | ||
exports.SDK_VERSION = "4.0.0-preview.2"; | ||
exports.SDK_VERSION = "4.0.0-preview.5"; | ||
exports.RetryConstants = { | ||
@@ -8,0 +8,0 @@ MIN_RETRY_INTERVAL_MS: 3000 |
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. See License.txt in the project root for license information. | ||
export const SDK_VERSION: string = "4.0.0-preview.2"; | ||
export const SDK_VERSION: string = "4.0.0-preview.5"; | ||
@@ -6,0 +6,0 @@ export const RetryConstants = { |
@@ -72,4 +72,2 @@ "use strict"; | ||
var core_http_1 = require("@azure/core-http"); | ||
var core_tracing_1 = require("@azure/core-tracing"); | ||
var core_http_2 = require("@azure/core-http"); | ||
require("@azure/core-paging"); | ||
@@ -83,2 +81,5 @@ var keyVaultClient_1 = require("./core/keyVaultClient"); | ||
exports.CryptographyClient = cryptographyClient_1.CryptographyClient; | ||
var core_http_2 = require("@azure/core-http"); | ||
exports.TracerProxy = core_http_2.TracerProxy; | ||
exports.SupportedPlugins = core_http_2.SupportedPlugins; | ||
/** | ||
@@ -141,2 +142,3 @@ * The client to interact with the KeyVault keys functionality | ||
requestPolicyFactories = requestPolicyFactories.concat([ | ||
core_http_1.tracingPolicy(), | ||
core_http_1.userAgentPolicy({ value: userAgentString }), | ||
@@ -171,3 +173,3 @@ core_http_1.generateClientRequestIdPolicy(), | ||
} | ||
var defaultUserAgentInfo = core_http_2.getDefaultUserAgentValue(); | ||
var defaultUserAgentInfo = core_http_1.getDefaultUserAgentValue(); | ||
if (userAgentInfo.indexOf(defaultUserAgentInfo) === -1) { | ||
@@ -1121,5 +1123,5 @@ userAgentInfo.push(defaultUserAgentInfo); | ||
KeysClient.prototype.createSpan = function (methodName, requestOptions) { | ||
var tracer = core_tracing_1.TracerProxy.getTracer(); | ||
var tracer = core_http_1.TracerProxy.getTracer(); | ||
var span = tracer.startSpan(methodName, requestOptions.spanOptions); | ||
if (tracer.pluginType !== core_tracing_1.SupportedPlugins.NOOP && | ||
if (tracer.pluginType !== core_http_1.SupportedPlugins.NOOP && | ||
(requestOptions.spanOptions && requestOptions.spanOptions.parent)) { | ||
@@ -1126,0 +1128,0 @@ requestOptions.spanOptions = __assign({}, requestOptions.spanOptions, { parent: span }); |
@@ -6,2 +6,3 @@ // Copyright (c) Microsoft Corporation. | ||
import { | ||
getDefaultUserAgentValue, | ||
TokenCredential, | ||
@@ -21,7 +22,9 @@ isTokenCredential, | ||
userAgentPolicy, | ||
RequestOptionsBase | ||
RequestOptionsBase, | ||
tracingPolicy, | ||
TracerProxy, | ||
Span, | ||
SupportedPlugins | ||
} from "@azure/core-http"; | ||
import { TracerProxy, Span, SupportedPlugins } from "@azure/core-tracing"; | ||
import { getDefaultUserAgentValue } from "@azure/core-http"; | ||
import "@azure/core-paging"; | ||
@@ -116,2 +119,4 @@ import { PageSettings, PagedAsyncIterableIterator } from "@azure/core-paging"; | ||
export { TracerProxy, SupportedPlugins } from "@azure/core-http"; | ||
/** | ||
@@ -148,2 +153,3 @@ * The client to interact with the KeyVault keys functionality | ||
requestPolicyFactories = requestPolicyFactories.concat([ | ||
tracingPolicy(), | ||
userAgentPolicy({ value: userAgentString }), | ||
@@ -150,0 +156,0 @@ generateClientRequestIdPolicy(), |
@@ -128,2 +128,3 @@ // Copyright (c) Microsoft Corporation. | ||
requestOptions?: msRest.RequestOptionsBase; | ||
keySize?: number; | ||
} | ||
@@ -130,0 +131,0 @@ |
@@ -24,3 +24,3 @@ { | ||
"exclude": ["node_modules", "./samples/**/*.ts"], | ||
"include": ["./src/**/*.ts", "./tests/**/*.ts"] | ||
"include": ["./src/**/*.ts", "./test/**/*.ts"] | ||
} |
@@ -8,3 +8,5 @@ import { HttpClient } from '@azure/core-http'; | ||
import { ServiceClientOptions } from '@azure/core-http'; | ||
import { SupportedPlugins } from '@azure/core-http'; | ||
import { TokenCredential } from '@azure/core-http'; | ||
import { TracerProxy } from '@azure/core-http'; | ||
@@ -63,2 +65,3 @@ /** | ||
requestOptions?: msRest.RequestOptionsBase; | ||
keySize?: number; | ||
} | ||
@@ -1027,2 +1030,3 @@ | ||
} | ||
export { SupportedPlugins } | ||
@@ -1032,2 +1036,3 @@ export declare interface TelemetryOptions { | ||
} | ||
export { TracerProxy } | ||
@@ -1034,0 +1039,0 @@ /** |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
3739011
6
55
55863
410
1
88
1
10
121
+ Added@azure/abort-controller@1.0.0-preview.2(transitive)
+ Added@azure/core-arm@1.0.0-preview.3(transitive)
+ Added@azure/core-asynciterator-polyfill@1.0.0-preview.1(transitive)
+ Added@azure/core-auth@1.0.0-preview.3(transitive)
+ Added@azure/core-http@1.0.0-preview.3(transitive)
+ Added@azure/core-paging@1.0.0-preview.2(transitive)
+ Added@azure/core-tracing@1.0.0-preview.2(transitive)
+ Added@azure/identity@1.0.0-preview.3(transitive)
+ Added@types/node-fetch@2.6.12(transitive)
+ Addedcall-bound@1.0.3(transitive)
+ Addedform-data@4.0.2(transitive)
+ Addedmsal@1.4.18(transitive)
+ Addednode-fetch@2.7.0(transitive)
+ Addedobject-inspect@1.13.4(transitive)
+ Addedqs@6.14.0(transitive)
+ Addedside-channel@1.1.0(transitive)
+ Addedside-channel-list@1.0.0(transitive)
+ Addedside-channel-map@1.0.1(transitive)
+ Addedside-channel-weakmap@1.0.2(transitive)
+ Addedtr46@0.0.3(transitive)
+ Addedwebidl-conversions@3.0.1(transitive)
+ Addedwhatwg-url@5.0.0(transitive)
- Removed@azure/core-tracing@1.0.0-preview.1
- Removed@azure/abort-controller@1.0.0-preview.1(transitive)
- Removed@azure/core-arm@1.0.0-preview.2(transitive)
- Removed@azure/core-asynciterator-polyfill@1.0.2(transitive)
- Removed@azure/core-auth@1.0.0-preview.2(transitive)
- Removed@azure/core-http@1.0.0-preview.2(transitive)
- Removed@azure/core-paging@1.0.0-preview.1(transitive)
- Removed@azure/core-tracing@1.0.0-preview.1(transitive)
- Removed@azure/identity@1.0.0-preview.2(transitive)
- Removedaxios@0.19.2(transitive)
- Removedfollow-redirects@1.5.10(transitive)
- Removedjs-base64@2.6.4(transitive)
- Removedmsal@1.0.2(transitive)
- Removedqs@6.7.0(transitive)