Skip to content

Commit

Permalink
Revert "[KeyVault] - Add key_ops to JWK and deprecate keyOps (Azure#1…
Browse files Browse the repository at this point in the history
…7914)"

This reverts commit 0ad4ea3.
  • Loading branch information
maorleger committed Oct 22, 2021
1 parent c52e8a2 commit 8c42c20
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 17 deletions.
1 change: 0 additions & 1 deletion sdk/keyvault/keyvault-keys/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
- Added support for automated key rotation in Azure Key Vault.
- Added `KeyClient.rotateKey` to rotate a key on-demand.
- Added `KeyClient.updateKeyRotationPolicy` to update a key's automated rotation policy.
- Added `JsonWebKey.key_ops` property to `JsonWebKey` in addition to the existing `JsonWebKey.keyOps` property in order to comply with the JSON Web Key spec.

## 4.4.0-beta.1 (2021-08-10)

Expand Down
2 changes: 0 additions & 2 deletions sdk/keyvault/keyvault-keys/review/keyvault-keys.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,6 @@ interface JsonWebKey_2 {
dq?: Uint8Array;
e?: Uint8Array;
k?: Uint8Array;
key_ops?: KeyOperation[];
// @deprecated
keyOps?: KeyOperation[];
kid?: string;
kty?: KeyType_2;
Expand Down
3 changes: 2 additions & 1 deletion sdk/keyvault/keyvault-keys/src/cryptographyClientModels.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

import { CryptographyOptions, KeyVaultKey, JsonWebKey } from "./keysModels";
import { CryptographyOptions, KeyVaultKey } from "./keysModels";

import {
JsonWebKey,
JsonWebKeyCurveName as KeyCurveName,
KnownJsonWebKeyCurveName as KnownKeyCurveNames,
JsonWebKeyEncryptionAlgorithm as EncryptionAlgorithm,
Expand Down
7 changes: 0 additions & 7 deletions sdk/keyvault/keyvault-keys/src/keysModels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,8 @@ export interface JsonWebKey {
/**
* Json web key operations. For more
* information on possible key operations, see KeyOperation.
*
* @deprecated Use {@link key_ops} instead. keyOps will be removed in version 5.x of `@azure/keyvault-keys`.
*/
keyOps?: KeyOperation[];
/**
* Json web key operations. For more
* information on possible key operations, see KeyOperation.
*/
key_ops?: KeyOperation[];
/**
* RSA modulus.
*/
Expand Down
6 changes: 4 additions & 2 deletions sdk/keyvault/keyvault-keys/src/transformations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import { parseKeyVaultKeyIdentifier } from "./identifier";
import {
DeletedKey,
KeyVaultKey,
JsonWebKey,
KeyOperation,
KeyProperties,
KeyRotationPolicy,
KeyRotationPolicyProperties
Expand All @@ -35,10 +37,10 @@ export function getKeyFromKeyBundle(
delete keyBundle.attributes;

const resultObject: KeyVaultKey | DeletedKey = {
key: { ...keyBundle.key, key_ops: keyBundle.key?.keyOps },
key: keyBundle.key as JsonWebKey,
id: keyBundle.key ? keyBundle.key.kid : undefined,
name: parsedId.name,
keyOperations: keyBundle.key ? keyBundle.key.keyOps : undefined,
keyOperations: keyBundle.key ? (keyBundle.key.keyOps as KeyOperation[]) : undefined,
keyType: keyBundle.key ? keyBundle.key.kty : undefined,
properties: {
tags: keyBundle.tags,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@ describe("Transformations", () => {
kid:
"https://azure_managedhsm.managedhsm.azure.net/keys/transformations/f03e8b3d76554e8b9749994bcf72fc61",
kty: "oct-HSM",
keyOps: ["encrypt", "decrypt"],
key_ops: ["encrypt", "decrypt"]
keyOps: ["encrypt", "decrypt"]
},
name: "transformations",
id:
Expand Down Expand Up @@ -127,8 +126,7 @@ describe("Transformations", () => {
kid:
"https://azure_managedhsm.managedhsm.azure.net/keys/transformations/f03e8b3d76554e8b9749994bcf72fc61",
kty: "oct-HSM",
keyOps: ["encrypt", "decrypt"],
key_ops: ["encrypt", "decrypt"]
keyOps: ["encrypt", "decrypt"]
},
name: "transformations",
id:
Expand Down

0 comments on commit 8c42c20

Please sign in to comment.