Skip to content

Commit eafa579

Browse files
authored
[KeyVault] - Replace keyId: URL with certificateKeyId: string (Azure#13908)
## what - Deprecate `secretProperties.keyId` and replace it with `secretProperties.certificateKeyId` - Remove `dom` from tsconfig ## why `secretProperties.keyId` being a URL is the only reason we need `dom` lib in this library. Even though it has never been populated we cannot remove it because we might break someone's compilation (although it would have never worked at runtime). Instead we'll deprecate it, note that it will always be undefined, and make it an any so we can remove the dependency on `dom`. Refer to Azure#9639 for previous work in this area. Resolves Azure#10726
1 parent 786a2e8 commit eafa579

File tree

6 files changed

+19
-5
lines changed

6 files changed

+19
-5
lines changed

sdk/keyvault/keyvault-secrets/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## 4.2.0-beta.3 (Unreleased)
44

55
- Updated the Latest service version to 7.2.
6+
- Added a `certificateKeyId?: string` secret property to use instead of the deprecated `keyId?: URL` and removed `"lib": ["dom"]` from `tsconfig.json`
67

78
## 4.2.0-beta.2 (2021-02-09)
89

sdk/keyvault/keyvault-secrets/review/keyvault-secrets.api.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,12 +137,14 @@ export interface SecretPollerOptions extends coreHttp.OperationOptions {
137137

138138
// @public
139139
export interface SecretProperties {
140+
readonly certificateKeyId?: string;
140141
contentType?: string;
141142
readonly createdOn?: Date;
142143
enabled?: boolean;
143144
readonly expiresOn?: Date;
144145
id?: string;
145-
readonly keyId?: URL;
146+
// @deprecated
147+
readonly keyId?: unknown;
146148
readonly managed?: boolean;
147149
name: string;
148150
readonly notBefore?: Date;

sdk/keyvault/keyvault-secrets/src/secretsModels.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,18 @@ export interface SecretProperties {
8383
* this field specifies the corresponding key backing the KV certificate.
8484
* **NOTE: This property will not be serialized. It can only be populated by
8585
* the server.**
86+
* @deprecated Please use {@link SecretProperties.certificateKeyId} instead. This field will always be undefined.
8687
*/
87-
readonly keyId?: URL;
88+
readonly keyId?: unknown;
89+
90+
/**
91+
* If this is a secret backing a KV certificate, then
92+
* this field specifies the identifier of the corresponding key backing the KV certificate.
93+
* **NOTE: This property will not be serialized. It can only be populated by
94+
* the server.**
95+
*/
96+
readonly certificateKeyId?: string;
97+
8898
/**
8999
* True if the secret's lifetime is managed by
90100
* key vault. If this is a secret backing a certificate, then managed will be

sdk/keyvault/keyvault-secrets/src/transformations.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ export function getSecretFromSecretBundle(
3838

3939
vaultUrl: parsedId.vaultUrl,
4040
version: parsedId.version,
41-
name: parsedId.name
41+
name: parsedId.name,
42+
certificateKeyId: secretBundle.kid
4243
}
4344
};
4445

sdk/keyvault/keyvault-secrets/test/internal/transformations.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ describe("Transformations", () => {
5050
managed: true,
5151
vaultUrl: "https://azure_keyvault.vault.azure.net",
5252
version: "1",
53-
name: "abc123"
53+
name: "abc123",
54+
certificateKeyId: "test_kid"
5455
}
5556
};
5657

sdk/keyvault/keyvault-secrets/tsconfig.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
"compilerOptions": {
44
"declarationDir": "./types",
55
"outDir": "./dist-esm",
6-
"lib": ["dom"],
76
"resolveJsonModule": true
87
},
98
"exclude": ["node_modules", "../keyvault-common/node_modules", "./samples/**/*.ts"],

0 commit comments

Comments
 (0)