Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[KeyVault] Regenerate @azure/keyvault to address customer issues #6187

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/@azure/keyvault/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2018 Microsoft
Copyright (c) 2019 Microsoft

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
207 changes: 105 additions & 102 deletions packages/@azure/keyvault/README.md
Original file line number Diff line number Diff line change
@@ -1,102 +1,105 @@
## Azure KeyVaultClient SDK for JavaScript

This package contains an isomorphic SDK for KeyVaultClient.

### Currently supported environments

- Node.js version 6.x.x or higher
- Browser JavaScript

### How to Install

```
npm install @azure/keyvault
```

### How to use

#### nodejs - Authentication, client creation and getKey as an example written in TypeScript.

##### Install @azure/ms-rest-nodeauth

```
npm install @azure/ms-rest-nodeauth
```

##### Sample code

```ts
import * as msRest from "@azure/ms-rest-js";
import * as msRestAzure from "@azure/ms-rest-azure-js";
import * as msRestNodeAuth from "@azure/ms-rest-nodeauth";
import { KeyVaultClient, KeyVaultModels, KeyVaultMappers } from "@azure/keyvault";
const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"];

msRestNodeAuth.interactiveLogin().then((creds) => {
const client = new KeyVaultClient(creds, subscriptionId);
const vaultBaseUrl = "testvaultBaseUrl";
const keyName = "testkeyName";
const keyVersion = "testkeyVersion";
client.getKey(vaultBaseUrl, keyName, keyVersion).then((result) => {
console.log("The result is:");
console.log(result);
});
}).catch((err) => {
console.error(err);
});
```

#### browser - Authentication, client creation and getKey as an example written in JavaScript.

##### Install @azure/ms-rest-browserauth

```
npm install @azure/ms-rest-browserauth
```

##### Sample code

See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to Azure in the browser.

- index.html
```html
<!DOCTYPE html>
<html lang="en">
<head>
<title>@azure/keyvault sample</title>
<script src="node_modules/@azure/ms-rest-js/dist/msRest.browser.js"></script>
<script src="node_modules/@azure/ms-rest-azure-js/dist/msRestAzure.js"></script>
<script src="node_modules/@azure/ms-rest-browserauth/dist/msAuth.js"></script>
<script src="node_modules/@azure/keyvault/dist/keyvault.js"></script>
<script type="text/javascript">
const subscriptionId = "<Subscription_Id>";
const authManager = new msAuth.AuthManager({
clientId: "<client id for your Azure AD app>",
tenant: "<optional tenant for your organization>"
});
authManager.finalizeLogin().then((res) => {
if (!res.isLoggedIn) {
// may cause redirects
authManager.login();
}
const client = new Azure.Keyvault.KeyVaultClient(res.creds, subscriptionId);
const vaultBaseUrl = "testvaultBaseUrl";
const keyName = "testkeyName";
const keyVersion = "testkeyVersion";
client.getKey(vaultBaseUrl, keyName, keyVersion).then((result) => {
console.log("The result is:");
console.log(result);
}).catch((err) => {
console.log("An error occurred:");
console.error(err);
});
});
</script>
</head>
<body></body>
</html>
```

## Related projects

- [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js)
## Azure KeyVaultClient SDK for JavaScript

This package contains an isomorphic SDK for KeyVaultClient.

### Currently supported environments

- Node.js version 6.x.x or higher
- Browser JavaScript

### How to Install

```bash
npm install @azure/keyvault
```

### How to use

#### nodejs - Authentication, client creation and getKey as an example written in TypeScript.

##### Install @azure/ms-rest-nodeauth

- Please install minimum version of `"@azure/ms-rest-nodeauth": "^3.0.0"`.
```bash
npm install @azure/ms-rest-nodeauth@"^3.0.0"
```

##### Sample code

```typescript
import * as msRest from "@azure/ms-rest-js";
import * as msRestAzure from "@azure/ms-rest-azure-js";
import * as msRestNodeAuth from "@azure/ms-rest-nodeauth";
import { KeyVaultClient, KeyVaultModels, KeyVaultMappers } from "@azure/keyvault";
const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"];

msRestNodeAuth.interactiveLogin().then((creds) => {
const client = new KeyVaultClient(creds, subscriptionId);
const vaultBaseUrl = "testvaultBaseUrl";
const keyName = "testkeyName";
const keyVersion = "testkeyVersion";
client.getKey(vaultBaseUrl, keyName, keyVersion).then((result) => {
console.log("The result is:");
console.log(result);
});
}).catch((err) => {
console.error(err);
});
```

#### browser - Authentication, client creation and getKey as an example written in JavaScript.

##### Install @azure/ms-rest-browserauth

```bash
npm install @azure/ms-rest-browserauth
```

##### Sample code

See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to Azure in the browser.

- index.html
```html
<!DOCTYPE html>
<html lang="en">
<head>
<title>@azure/keyvault sample</title>
<script src="node_modules/@azure/ms-rest-js/dist/msRest.browser.js"></script>
<script src="node_modules/@azure/ms-rest-azure-js/dist/msRestAzure.js"></script>
<script src="node_modules/@azure/ms-rest-browserauth/dist/msAuth.js"></script>
<script src="node_modules/@azure/keyvault/dist/keyvault.js"></script>
<script type="text/javascript">
const subscriptionId = "<Subscription_Id>";
const authManager = new msAuth.AuthManager({
clientId: "<client id for your Azure AD app>",
tenant: "<optional tenant for your organization>"
});
authManager.finalizeLogin().then((res) => {
if (!res.isLoggedIn) {
// may cause redirects
authManager.login();
}
const client = new Azure.Keyvault.KeyVaultClient(res.creds, subscriptionId);
const vaultBaseUrl = "testvaultBaseUrl";
const keyName = "testkeyName";
const keyVersion = "testkeyVersion";
client.getKey(vaultBaseUrl, keyName, keyVersion).then((result) => {
console.log("The result is:");
console.log(result);
}).catch((err) => {
console.log("An error occurred:");
console.error(err);
});
});
</script>
</head>
<body></body>
</html>
```

## Related projects

- [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js)

![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js/sdk/README.png)
2 changes: 1 addition & 1 deletion packages/@azure/keyvault/lib/keyVaultClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ class KeyVaultClient extends KeyVaultClientContext {
* protection with an asymmetric key can be performed using public portion of the key. This
* operation is supported for asymmetric keys as a convenience for callers that have a
* key-reference but do not have access to the public key material. This operation requires the
* keys/encypt permission.
* keys/encrypt permission.
* @summary Encrypts an arbitrary sequence of bytes using an encryption key that is stored in a key
* vault.
* @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
Expand Down
4 changes: 2 additions & 2 deletions packages/@azure/keyvault/lib/keyVaultClientContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import * as msRest from "@azure/ms-rest-js";
import * as msRestAzure from "@azure/ms-rest-azure-js";

const packageName = "@azure/keyvault";
const packageVersion = "0.1.0";
const packageVersion = "0.2.0";

export class KeyVaultClientContext extends msRestAzure.AzureServiceClient {
credentials: msRest.ServiceClientCredentials;
Expand Down Expand Up @@ -41,7 +41,7 @@ export class KeyVaultClientContext extends msRestAzure.AzureServiceClient {
this.apiVersion = '7.0';
this.acceptLanguage = 'en-US';
this.longRunningOperationRetryTimeout = 30;
this.baseUri = '{vaultBaseUrl}';
this.baseUri = "{vaultBaseUrl}";
this.requestContentType = "application/json; charset=utf-8";
this.credentials = credentials;

Expand Down
Loading