@azure/attestation 1.0.1-alpha.20250109.1 → 1.0.1-alpha.20250113.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +120 -64
- package/dist/browser/attestationAdministrationClient.d.ts +4 -5
- package/dist/browser/attestationAdministrationClient.d.ts.map +1 -1
- package/dist/browser/attestationAdministrationClient.js +4 -5
- package/dist/browser/attestationAdministrationClient.js.map +1 -1
- package/dist/browser/attestationClient.d.ts +10 -12
- package/dist/browser/attestationClient.d.ts.map +1 -1
- package/dist/browser/attestationClient.js +2 -2
- package/dist/browser/attestationClient.js.map +1 -1
- package/dist/commonjs/attestationAdministrationClient.d.ts +4 -5
- package/dist/commonjs/attestationAdministrationClient.d.ts.map +1 -1
- package/dist/commonjs/attestationAdministrationClient.js +4 -5
- package/dist/commonjs/attestationAdministrationClient.js.map +1 -1
- package/dist/commonjs/attestationClient.d.ts +10 -12
- package/dist/commonjs/attestationClient.d.ts.map +1 -1
- package/dist/commonjs/attestationClient.js +2 -2
- package/dist/commonjs/attestationClient.js.map +1 -1
- package/dist/esm/attestationAdministrationClient.d.ts +4 -5
- package/dist/esm/attestationAdministrationClient.d.ts.map +1 -1
- package/dist/esm/attestationAdministrationClient.js +4 -5
- package/dist/esm/attestationAdministrationClient.js.map +1 -1
- package/dist/esm/attestationClient.d.ts +10 -12
- package/dist/esm/attestationClient.d.ts.map +1 -1
- package/dist/esm/attestationClient.js +2 -2
- package/dist/esm/attestationClient.js.map +1 -1
- package/dist/react-native/attestationAdministrationClient.d.ts +4 -5
- package/dist/react-native/attestationAdministrationClient.d.ts.map +1 -1
- package/dist/react-native/attestationAdministrationClient.js +4 -5
- package/dist/react-native/attestationAdministrationClient.js.map +1 -1
- package/dist/react-native/attestationClient.d.ts +10 -12
- package/dist/react-native/attestationClient.d.ts.map +1 -1
- package/dist/react-native/attestationClient.js +2 -2
- package/dist/react-native/attestationClient.js.map +1 -1
- package/package.json +12 -14
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@ Key links:
|
|
|
17
17
|
- [Source code][source_code]
|
|
18
18
|
- [Package (NPM)][attestation_npm]
|
|
19
19
|
- [API reference documentation][api_reference]
|
|
20
|
-
- [Product documentation](https://
|
|
20
|
+
- [Product documentation](https://learn.microsoft.com/azure/attestation/)
|
|
21
21
|
|
|
22
22
|
## Getting started
|
|
23
23
|
|
|
@@ -43,7 +43,7 @@ npm install @azure/attestation
|
|
|
43
43
|
|
|
44
44
|
### Authenticate the client
|
|
45
45
|
|
|
46
|
-
In order to interact with the Microsoft Azure Attestation service, you'll need to create an instance of the [Attestation Client][attestation_client] or [Attestation Administration Client][attestation_admin_client] class. You need a **attestation instance url**, which will either be the
|
|
46
|
+
In order to interact with the Microsoft Azure Attestation service, you'll need to create an instance of the [Attestation Client][attestation_client] or [Attestation Administration Client][attestation_admin_client] class. You need a **attestation instance url**, which will either be the "Attest URI"
|
|
47
47
|
shown in the portal, or will be one of the shared attestation providers.
|
|
48
48
|
You will also need client credentials to use the Attestation Administration Client or call the `attestTpm` API. Client credentials require **(client id, client secret, tenant id)** to instantiate a client object.
|
|
49
49
|
|
|
@@ -135,7 +135,7 @@ The [`AttestationResponse`][attestation_response] object contains two main attri
|
|
|
135
135
|
|
|
136
136
|
Each attestation service instance has a policy applied to it which defines additional criteria which the customer has defined.
|
|
137
137
|
|
|
138
|
-
For more information on attestation policies, see [Attestation Policy](https://
|
|
138
|
+
For more information on attestation policies, see [Attestation Policy](https://learn.microsoft.com/azure/attestation/author-sign-policy)
|
|
139
139
|
|
|
140
140
|
### Policy Management certificate management
|
|
141
141
|
|
|
@@ -163,7 +163,7 @@ RuntimeData refers to data which is presented to the Intel SGX Quote generation
|
|
|
163
163
|
|
|
164
164
|
InitTime data refers to data which is used to configure the SGX enclave being attested.
|
|
165
165
|
|
|
166
|
-
> Note that InitTime data is not supported on Azure [DCsv2-Series](https://
|
|
166
|
+
> Note that InitTime data is not supported on Azure [DCsv2-Series](https://learn.microsoft.com/azure/virtual-machines/dcv2-series) virtual machines.
|
|
167
167
|
|
|
168
168
|
### Additional concepts
|
|
169
169
|
|
|
@@ -180,9 +180,13 @@ InitTime data refers to data which is used to configure the SGX enclave being at
|
|
|
180
180
|
Creates an instance of the Attestation Client at uri `endpoint`, using the default
|
|
181
181
|
azure credentials (`DefaultAzureCredential`).
|
|
182
182
|
|
|
183
|
-
```ts
|
|
183
|
+
```ts snippet:ReadmeSampleCreateClient_Node
|
|
184
|
+
import { DefaultAzureCredential } from "@azure/identity";
|
|
185
|
+
import { AttestationClient } from "@azure/attestation";
|
|
186
|
+
|
|
187
|
+
const endpoint = "https://<attestation-instance>.<region>.attest.azure.net";
|
|
184
188
|
const credentials = new DefaultAzureCredential();
|
|
185
|
-
const client = new AttestationClient(endpoint,
|
|
189
|
+
const client = new AttestationClient(endpoint, credentials);
|
|
186
190
|
|
|
187
191
|
// Retrieve the set of attestation policy signers from the attestation client.
|
|
188
192
|
const attestationSigners = await client.getAttestationSigners();
|
|
@@ -191,7 +195,10 @@ const attestationSigners = await client.getAttestationSigners();
|
|
|
191
195
|
If you are not calling the `attestTpm` API, you do not need to provide credentials
|
|
192
196
|
to access the attestation client. This means a client can be created simply with:
|
|
193
197
|
|
|
194
|
-
```ts
|
|
198
|
+
```ts snippet:ReadmeSampleCreateClient_Node_NoCreds
|
|
199
|
+
import { AttestationClient } from "@azure/attestation";
|
|
200
|
+
|
|
201
|
+
const endpoint = "https://<attestation-instance>.<region>.attest.azure.net";
|
|
195
202
|
const client = new AttestationClient(endpoint);
|
|
196
203
|
|
|
197
204
|
// Retrieve the set of attestation policy signers from the attestation client.
|
|
@@ -200,14 +207,17 @@ const attestationSigners = await client.getAttestationSigners();
|
|
|
200
207
|
|
|
201
208
|
Creates an instance of the Attestation Administration Client at uri `endpoint`.
|
|
202
209
|
|
|
203
|
-
Note that the administration client
|
|
210
|
+
Note that the administration client _requires_ Azure credentials.
|
|
204
211
|
|
|
205
|
-
```ts
|
|
206
|
-
|
|
212
|
+
```ts snippet:ReadmeSampleCreateAdminClient_Node
|
|
213
|
+
import { AttestationAdministrationClient, KnownAttestationType } from "@azure/attestation";
|
|
214
|
+
import { DefaultAzureCredential } from "@azure/identity";
|
|
207
215
|
|
|
208
|
-
|
|
209
|
-
|
|
216
|
+
const endpoint = "https://<attestation-instance>.<region>.attest.azure.net";
|
|
217
|
+
const client = new AttestationAdministrationClient(endpoint, new DefaultAzureCredential());
|
|
210
218
|
|
|
219
|
+
// Retrieve the SGX policy from the specified attestation instance.
|
|
220
|
+
const policyResponse = await client.getPolicy(KnownAttestationType.SgxEnclave);
|
|
211
221
|
```
|
|
212
222
|
|
|
213
223
|
### Get attestation policy
|
|
@@ -215,14 +225,14 @@ Note that the administration client *requires* Azure credentials.
|
|
|
215
225
|
The `getPolicy` method retrieves the attestation policy from the service.
|
|
216
226
|
Attestation Policies are instanced on a per-attestation type basis, the `AttestationType` parameter defines the type of instance to retrieve.
|
|
217
227
|
|
|
218
|
-
```
|
|
219
|
-
|
|
228
|
+
```ts snippet:ReadmeSampleGetPolicy
|
|
229
|
+
import { AttestationAdministrationClient, KnownAttestationType } from "@azure/attestation";
|
|
230
|
+
import { DefaultAzureCredential } from "@azure/identity";
|
|
220
231
|
|
|
221
|
-
|
|
222
|
-
|
|
232
|
+
const endpoint = "https://<attestation-instance>.<region>.attest.azure.net";
|
|
233
|
+
const client = new AttestationAdministrationClient(endpoint, new DefaultAzureCredential());
|
|
223
234
|
|
|
224
|
-
|
|
225
|
-
// in `policyResult.token`.
|
|
235
|
+
const policyResponse = await client.getPolicy(KnownAttestationType.OpenEnclave);
|
|
226
236
|
```
|
|
227
237
|
|
|
228
238
|
### Set an attestation policy for a specified attestation type
|
|
@@ -231,7 +241,11 @@ If the attestation service instance is running in Isolated mode, the set_policy
|
|
|
231
241
|
|
|
232
242
|
If the service instance is running in AAD mode, the call to setPolicy is as expected:
|
|
233
243
|
|
|
234
|
-
```
|
|
244
|
+
```ts snippet:SetPolicy
|
|
245
|
+
import { AttestationAdministrationClient, KnownAttestationType } from "@azure/attestation";
|
|
246
|
+
import { DefaultAzureCredential } from "@azure/identity";
|
|
247
|
+
|
|
248
|
+
const endpoint = "https://<attestation-instance>.<region>.attest.azure.net";
|
|
235
249
|
const client = new AttestationAdministrationClient(endpoint, new DefaultAzureCredential());
|
|
236
250
|
|
|
237
251
|
const newPolicy = `<New Attestation Policy>`;
|
|
@@ -244,23 +258,23 @@ If the service instance is running in Isolated mode, the call to setPolicy requi
|
|
|
244
258
|
the client be able to prove that they have access to one of the policy management private keys
|
|
245
259
|
and certificates.
|
|
246
260
|
|
|
247
|
-
```
|
|
261
|
+
```ts snippet:SetPolicyIsolated
|
|
262
|
+
import { AttestationAdministrationClient, KnownAttestationType } from "@azure/attestation";
|
|
263
|
+
import { DefaultAzureCredential } from "@azure/identity";
|
|
264
|
+
|
|
265
|
+
const endpoint = "https://<attestation-instance>.<region>.attest.azure.net";
|
|
248
266
|
const client = new AttestationAdministrationClient(endpoint, new DefaultAzureCredential());
|
|
249
267
|
|
|
250
268
|
const newPolicy = `<New Policy Document>`;
|
|
251
269
|
|
|
252
270
|
// Set the new attestation policy. Set the policy as an secured policy.
|
|
253
|
-
const privateKey = <Retrieve isolated mode private key from storage>
|
|
254
|
-
const certificate = <Retrieve certificate associated with that private key>
|
|
271
|
+
const privateKey = "<Retrieve isolated mode private key from storage>";
|
|
272
|
+
const certificate = "<Retrieve certificate associated with that private key>";
|
|
255
273
|
|
|
256
|
-
const setPolicyResult = await client.setPolicy(
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
privateKey: privateKey,
|
|
261
|
-
certificate: certificate
|
|
262
|
-
}
|
|
263
|
-
);
|
|
274
|
+
const setPolicyResult = await client.setPolicy(KnownAttestationType.OpenEnclave, newPolicy, {
|
|
275
|
+
privateKey: privateKey,
|
|
276
|
+
certificate: certificate,
|
|
277
|
+
});
|
|
264
278
|
```
|
|
265
279
|
|
|
266
280
|
Under the covers, the setPolicy APIs create a [JSON Web Token][json_web_token] containing on the policy document `certificate` and signed with the `privateKey` which is then sent to the attestation service.
|
|
@@ -272,18 +286,18 @@ If a client wishes to ensure that the attestation policy document was not modifi
|
|
|
272
286
|
|
|
273
287
|
To verify the hash, clients can create an attestation policy token (a helper class which represents the token used to set the attestation policy) and verify the hash generated from that token:
|
|
274
288
|
|
|
275
|
-
```
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
289
|
+
```ts snippet:CreatePolicyToken
|
|
290
|
+
import { createAttestationPolicyToken } from "@azure/attestation";
|
|
291
|
+
import { createHash } from "node:crypto";
|
|
292
|
+
|
|
293
|
+
// Set the new attestation policy. Set the policy as an secured policy.
|
|
294
|
+
const privateKey = "<Retrieve isolated mode private key from storage>";
|
|
295
|
+
const certificate = "<Retrieve certificate associated with that private key>";
|
|
280
296
|
|
|
281
|
-
|
|
282
|
-
// stringized JWS.
|
|
283
|
-
const expectedHash = generateSha256Hash(expectedPolicy.serialize());
|
|
297
|
+
const expectedPolicy = createAttestationPolicyToken(`<Policy Document>`, privateKey, certificate);
|
|
284
298
|
|
|
285
|
-
//
|
|
286
|
-
|
|
299
|
+
// Use your favorite SHA256 hash generator function to create a hash of the stringified JWS.
|
|
300
|
+
const expectedHash = createHash("sha256").update(expectedPolicy.serialize()).digest("hex");
|
|
287
301
|
```
|
|
288
302
|
|
|
289
303
|
### Attest SGX and Open Enclave
|
|
@@ -306,9 +320,19 @@ This example shows one common pattern of calling into the attestation service to
|
|
|
306
320
|
|
|
307
321
|
This example assumes that you have an existing `AttestationClient` object which is configured with the Attest URI for your endpoint. It also assumes that you have an OpenEnclave report (`report`) generated from within the SGX enclave you are attesting, and "Runtime Data" (`binaryRuntimeData`) which is referenced in the SGX Quote.
|
|
308
322
|
|
|
309
|
-
```ts
|
|
323
|
+
```ts snippet:AttestOpenEnclave_RuntimeData
|
|
324
|
+
import { DefaultAzureCredential } from "@azure/identity";
|
|
325
|
+
import { AttestationClient } from "@azure/attestation";
|
|
326
|
+
|
|
327
|
+
const endpoint = "https://<attestation-instance>.<region>.attest.azure.net";
|
|
328
|
+
const credentials = new DefaultAzureCredential();
|
|
329
|
+
const client = new AttestationClient(endpoint, credentials);
|
|
330
|
+
|
|
331
|
+
const report = new Uint8Array(0); // Report data from the enclave.
|
|
332
|
+
const binaryRuntimeData = new Uint8Array(0); // Runtime data from the enclave.
|
|
333
|
+
|
|
310
334
|
const attestationResult = await client.attestOpenEnclave(report, {
|
|
311
|
-
runTimeData: binaryRuntimeData
|
|
335
|
+
runTimeData: binaryRuntimeData,
|
|
312
336
|
});
|
|
313
337
|
```
|
|
314
338
|
|
|
@@ -316,17 +340,37 @@ It is also possible that the `binaryRuntimeData` sent to the attestation service
|
|
|
316
340
|
intended to be interpreted as JSON data. In that case, the client should specify `runTimeJson` in
|
|
317
341
|
the attest API call:
|
|
318
342
|
|
|
319
|
-
```ts
|
|
343
|
+
```ts snippet:AttestOpenEnclave_RuntimeJson
|
|
344
|
+
import { DefaultAzureCredential } from "@azure/identity";
|
|
345
|
+
import { AttestationClient } from "@azure/attestation";
|
|
346
|
+
|
|
347
|
+
const endpoint = "https://<attestation-instance>.<region>.attest.azure.net";
|
|
348
|
+
const credentials = new DefaultAzureCredential();
|
|
349
|
+
const client = new AttestationClient(endpoint, credentials);
|
|
350
|
+
|
|
351
|
+
const report = new Uint8Array(0); // Report data from the enclave.
|
|
352
|
+
const binaryRuntimeData = new Uint8Array(0); // Runtime JSON data from the enclave.
|
|
353
|
+
|
|
320
354
|
const attestationResult = await client.attestOpenEnclave(report, {
|
|
321
|
-
runTimeJson: binaryRuntimeData
|
|
355
|
+
runTimeJson: binaryRuntimeData,
|
|
322
356
|
});
|
|
323
357
|
```
|
|
324
358
|
|
|
325
359
|
Similarly, if you are using the Intel SDK to generate a "quote", you can validate the quote using:
|
|
326
360
|
|
|
327
|
-
```ts
|
|
361
|
+
```ts snippet:AttestSgxEnclave
|
|
362
|
+
import { DefaultAzureCredential } from "@azure/identity";
|
|
363
|
+
import { AttestationClient } from "@azure/attestation";
|
|
364
|
+
|
|
365
|
+
const endpoint = "https://<attestation-instance>.<region>.attest.azure.net";
|
|
366
|
+
const credentials = new DefaultAzureCredential();
|
|
367
|
+
const client = new AttestationClient(endpoint, credentials);
|
|
368
|
+
|
|
369
|
+
const quote = new Uint8Array(0); // Quote data.
|
|
370
|
+
const binaryRuntimeData = new Uint8Array(0); // Runtime JSON data from the enclave.
|
|
371
|
+
|
|
328
372
|
const attestationResult = await client.attestSgxEnclave(quote, {
|
|
329
|
-
runTimeData: binaryRuntimeData
|
|
373
|
+
runTimeData: binaryRuntimeData,
|
|
330
374
|
});
|
|
331
375
|
```
|
|
332
376
|
|
|
@@ -339,21 +383,33 @@ validate the token returned from the attestation service. Note that this call
|
|
|
339
383
|
creates a client with azure credentials, that is not needed if you are calling
|
|
340
384
|
the `attestSgxEnclave` or `attestOpenEnclave` APIs
|
|
341
385
|
|
|
342
|
-
```ts
|
|
386
|
+
```ts snippet:GetSigningCertificates
|
|
387
|
+
import { DefaultAzureCredential } from "@azure/identity";
|
|
388
|
+
import { AttestationClient } from "@azure/attestation";
|
|
389
|
+
|
|
390
|
+
const endpoint = "https://<attestation-instance>.<region>.attest.azure.net";
|
|
343
391
|
const credentials = new DefaultAzureCredential();
|
|
344
|
-
const client = new AttestationClient(endpoint,
|
|
392
|
+
const client = new AttestationClient(endpoint, credentials);
|
|
345
393
|
|
|
346
394
|
const attestationSigners = await client.getAttestationSigners();
|
|
347
395
|
|
|
348
396
|
console.log(`There are ${attestationSigners.length} signers`);
|
|
349
|
-
|
|
350
397
|
```
|
|
351
398
|
|
|
352
399
|
## Troubleshooting
|
|
353
400
|
|
|
354
401
|
Most Attestation service operations will raise exceptions defined in [Azure Core](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/core/README.md). The attestation service APIs will throw a `RestError` on failure with helpful error codes. Many of these errors are recoverable.
|
|
355
402
|
|
|
356
|
-
```ts
|
|
403
|
+
```ts snippet:Troubleshooting
|
|
404
|
+
import { DefaultAzureCredential } from "@azure/identity";
|
|
405
|
+
import { AttestationClient } from "@azure/attestation";
|
|
406
|
+
|
|
407
|
+
const endpoint = "https://<attestation-instance>.<region>.attest.azure.net";
|
|
408
|
+
const credentials = new DefaultAzureCredential();
|
|
409
|
+
const client = new AttestationClient(endpoint, credentials);
|
|
410
|
+
|
|
411
|
+
const openEnclaveReport = new Uint8Array(0); // Open enclave report data
|
|
412
|
+
|
|
357
413
|
try {
|
|
358
414
|
await client.attestSgxEnclave(openEnclaveReport);
|
|
359
415
|
} catch (error) {
|
|
@@ -365,19 +421,19 @@ try {
|
|
|
365
421
|
|
|
366
422
|
Enabling logging may help uncover useful information about failures. In order to see a log of HTTP requests and responses, set the `AZURE_LOG_LEVEL` environment variable to `info`. Alternatively, logging can be enabled at runtime by calling `setLogLevel` in the `@azure/logger`:
|
|
367
423
|
|
|
368
|
-
```
|
|
369
|
-
|
|
424
|
+
```ts snippet:SetLogLevel
|
|
425
|
+
import { setLogLevel } from "@azure/logger";
|
|
370
426
|
|
|
371
427
|
setLogLevel("info");
|
|
372
428
|
```
|
|
373
429
|
|
|
374
430
|
For more detailed instructions on how to enable logs, you can look at the [@azure/logger package docs](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/logger).
|
|
375
431
|
|
|
376
|
-
Additional troubleshooting information for the MAA service can be found [here](https://
|
|
432
|
+
Additional troubleshooting information for the MAA service can be found [here](https://learn.microsoft.com/azure/attestation/troubleshoot-guide)
|
|
377
433
|
|
|
378
434
|
## Next steps
|
|
379
435
|
|
|
380
|
-
For more information about the Microsoft Azure Attestation service, please see our [documentation page](https://
|
|
436
|
+
For more information about the Microsoft Azure Attestation service, please see our [documentation page](https://learn.microsoft.com/azure/attestation/).
|
|
381
437
|
|
|
382
438
|
## Contributing
|
|
383
439
|
|
|
@@ -398,20 +454,20 @@ section of the project.
|
|
|
398
454
|
<!-- LINKS -->
|
|
399
455
|
|
|
400
456
|
[source_code]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/attestation/attestation
|
|
401
|
-
[azure_identity]: https://
|
|
402
|
-
[defaultazurecredential]: https://
|
|
457
|
+
[azure_identity]: https://learn.microsoft.com/javascript/api/@azure/identity
|
|
458
|
+
[defaultazurecredential]: https://learn.microsoft.com/javascript/api/@azure/identity/defaultazurecredential
|
|
403
459
|
[attestation_policy_result]: https://azuresdkdocs.blob.core.windows.net/$web/javascript/azure-attestation/1.0.0-beta.4/interfaces/policyresult.html
|
|
404
|
-
[attestation_client]: https://
|
|
405
|
-
[attestation_admin_client]: https://
|
|
406
|
-
[attestation_response]: https://
|
|
407
|
-
[attestation_policy_result_parameters]: https://
|
|
408
|
-
[attest_sgx]: https://
|
|
460
|
+
[attestation_client]: https://learn.microsoft.com/javascript/api/@azure/attestation/attestationclient
|
|
461
|
+
[attestation_admin_client]: https://learn.microsoft.com/javascript/api/@azure/attestation/attestationadministrationclient
|
|
462
|
+
[attestation_response]: https://learn.microsoft.com/javascript/api/@azure/attestation/attestationresponse
|
|
463
|
+
[attestation_policy_result_parameters]: https://learn.microsoft.com/javascript/api/@azure/attestation/policyresult#properties
|
|
464
|
+
[attest_sgx]: https://learn.microsoft.com/javascript/api/@azure/attestation/attestationclient#attestSgxEnclave_Uint8Array__AttestSgxEnclaveOptions_
|
|
409
465
|
[attestation_npm]: https://www.npmjs.com/package/@azure/attestation
|
|
410
|
-
[api_reference]: https://
|
|
411
|
-
[style-guide-msft]: https://
|
|
466
|
+
[api_reference]: https://learn.microsoft.com/javascript/api/@azure/attestation
|
|
467
|
+
[style-guide-msft]: https://learn.microsoft.com/style-guide/capitalization
|
|
412
468
|
[style-guide-cloud]: https://aka.ms/azsdk/cloud-style-guide
|
|
413
469
|
[microsoft_code_of_conduct]: https://opensource.microsoft.com/codeofconduct/
|
|
414
|
-
[azure_cli]: https://
|
|
470
|
+
[azure_cli]: https://learn.microsoft.com/cli/azure
|
|
415
471
|
[azure_sub]: https://azure.microsoft.com/free/
|
|
416
472
|
[code_of_conduct]: https://opensource.microsoft.com/codeofconduct/
|
|
417
473
|
[json_web_token]: https://tools.ietf.org/html/rfc7519
|
|
@@ -63,13 +63,12 @@ export declare class AttestationAdministrationClient {
|
|
|
63
63
|
* Creates an instance of AttestationAdministrationClient.
|
|
64
64
|
*
|
|
65
65
|
* Example usage:
|
|
66
|
-
* ```ts
|
|
66
|
+
* ```ts snippet:AttestationAdministrationClient_Constructor
|
|
67
67
|
* import { AttestationAdministrationClient } from "@azure/attestation";
|
|
68
|
+
* import { DefaultAzureCredential } from "@azure/identity";
|
|
68
69
|
*
|
|
69
|
-
* const
|
|
70
|
-
*
|
|
71
|
-
* new TokenCredential("<>")
|
|
72
|
-
* );
|
|
70
|
+
* const endpoint = "https://<attestation-instance>.<region>.attest.azure.net";
|
|
71
|
+
* const client = new AttestationAdministrationClient(endpoint, new DefaultAzureCredential());
|
|
73
72
|
* ```
|
|
74
73
|
*
|
|
75
74
|
* @param endpoint - The attestation instance endpoint, for example https://mytenant.attest.azure.net.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attestationAdministrationClient.d.ts","sourceRoot":"","sources":["../../src/attestationAdministrationClient.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EACV,mBAAmB,EACnB,iBAAiB,EACjB,iCAAiC,EACjC,eAAe,EACf,oCAAoC,EACpC,YAAY,EACb,MAAM,mBAAmB,CAAC;AAG3B,OAAO,KAAK,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAChF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAcxD;;GAEG;AACH,MAAM,WAAW,sCAAuC,SAAQ,mBAAmB;IACjF;;;OAGG;IACH,iBAAiB,CAAC,EAAE,iCAAiC,CAAC;CACvD;AAED;;GAEG;AACH,MAAM,WAAW,+CAAgD,SAAQ,gBAAgB;IACvF;;;OAGG;IACH,iBAAiB,CAAC,EAAE,iCAAiC,CAAC;CACvD;AAED;;GAEG;AACH,MAAM,WAAW,qDACf,SAAQ,+CAA+C;IACvD;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;;;;;OAOG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,gEACf,SAAQ,+CAA+C;CAAG;AAE5D;;;;;;;;;;;GAWG;AACH,qBAAa,+BAA+B;IAC1C
|
|
1
|
+
{"version":3,"file":"attestationAdministrationClient.d.ts","sourceRoot":"","sources":["../../src/attestationAdministrationClient.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EACV,mBAAmB,EACnB,iBAAiB,EACjB,iCAAiC,EACjC,eAAe,EACf,oCAAoC,EACpC,YAAY,EACb,MAAM,mBAAmB,CAAC;AAG3B,OAAO,KAAK,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAChF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAcxD;;GAEG;AACH,MAAM,WAAW,sCAAuC,SAAQ,mBAAmB;IACjF;;;OAGG;IACH,iBAAiB,CAAC,EAAE,iCAAiC,CAAC;CACvD;AAED;;GAEG;AACH,MAAM,WAAW,+CAAgD,SAAQ,gBAAgB;IACvF;;;OAGG;IACH,iBAAiB,CAAC,EAAE,iCAAiC,CAAC;CACvD;AAED;;GAEG;AACH,MAAM,WAAW,qDACf,SAAQ,+CAA+C;IACvD;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;;;;;OAOG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,gEACf,SAAQ,+CAA+C;CAAG;AAE5D;;;;;;;;;;;GAWG;AACH,qBAAa,+BAA+B;IAC1C;;;;;;;;;;;;;;;OAeG;gBAGD,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,eAAe,EAC5B,OAAO,GAA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ient.
|
|
34
34
|
*
|
|
35
35
|
* Example usage:
|
|
36
|
-
* ```ts
|
|
36
|
+
* ```ts snippet:AttestationAdministrationClient_Constructor
|
|
37
37
|
* import { AttestationAdministrationClient } from "@azure/attestation";
|
|
38
|
+
* import { DefaultAzureCredential } from "@azure/identity";
|
|
38
39
|
*
|
|
39
|
-
* const
|
|
40
|
-
*
|
|
41
|
-
* new TokenCredential("<>")
|
|
42
|
-
* );
|
|
40
|
+
* const endpoint = "https://<attestation-instance>.<region>.attest.azure.net";
|
|
41
|
+
* const client = new AttestationAdministrationClient(endpoint, new DefaultAzureCredential());
|
|
43
42
|
* ```
|
|
44
43
|
*
|
|
45
44
|
* @param endpoint - The attestation instance endpoint, for example https://mytenant.attest.azure.net.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attestationAdministrationClient.js","sourceRoot":"","sources":["../../src/attestationAdministrationClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,uDAAuD;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AASrC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAUhD,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAI9E,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,KAAK,OAAO,MAAM,+BAA+B,CAAC;AAEzD,yCAAyC;AACzC,OAAO,KAAK,SAAS,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AACtE,OAAO,EAAE,+BAA+B,EAAE,MAAM,+BAA+B,CAAC;AAChF,OAAO,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,yBAAyB,EAAE,MAAM,i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c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/* eslint-disable @azure/azure-sdk/ts-naming-options */\nimport { GeneratedClient } from \"./generated/generatedClient.js\";\nimport { logger } from \"./logger.js\";\n\nimport type {\n AttestationCertificateManagementBody,\n GeneratedClientOptionalParams,\n JsonWebKey,\n PolicyCertificatesResult,\n} from \"./generated/models/index.js\";\n\nimport { bytesToString } from \"./utils/utf8.js\";\n\nimport type {\n AttestationResponse,\n AttestationSigner,\n AttestationTokenValidationOptions,\n AttestationType,\n PolicyCertificatesModificationResult,\n PolicyResult,\n} from \"./models/index.js\";\nimport { StoredAttestationPolicy } from \"./models/storedAttestationPolicy.js\";\n\nimport type { CommonClientOptions, OperationOptions } from \"@azure/core-client\";\nimport type { TokenCredential } from \"@azure/core-auth\";\nimport { TypeDeserializer } from \"./utils/typeDeserializer.js\";\nimport * as Mappers from \"./generated/models/mappers.js\";\n\n/// <reference path=\"../jsrsasign.d.ts\"/>\nimport * as jsrsasign from \"jsrsasign\";\nimport { hexToBase64 } from \"./utils/helpers.js\";\nimport { _policyResultFromGenerated } from \"./models/policyResult.js\";\nimport { _attestationSignerFromGenerated } from \"./models/attestationSigner.js\";\nimport { verifyAttestationSigningKey } from \"./utils/helpers.js\";\nimport { createAttestationResponse } from \"./models/attestationResponse.js\";\nimport { AttestationTokenImpl } from \"./models/attestationToken.js\";\nimport { tracingClient } from \"./generated/tracing.js\";\n\n/**\n * Attestation Client Construction Options.\n */\nexport interface AttestationAdministrationClientOptions extends CommonClientOptions {\n /**\n * Options to be used globally to validate attestation tokens received from\n * the attestation service.\n */\n validationOptions?: AttestationTokenValidationOptions;\n}\n\n/**\n * Operation options for the Attestation Administration Client operations.\n */\nexport interface AttestationAdministrationClientOperationOptions extends OperationOptions {\n /**\n * Options to be used globally to validate attestation tokens received from\n * the attestation service.\n */\n validationOptions?: AttestationTokenValidationOptions;\n}\n\n/**\n * Operation options for the administration Policy operations.\n */\nexport interface AttestationAdministrationClientPolicyOperationOptions\n extends AttestationAdministrationClientOperationOptions {\n /**\n * Optional Private key used to sign the token sent to the attestation service.\n *\n * Required for Isolated Mode attestation instances.\n */\n privateKey?: string;\n\n /**\n * Optional certificate which can validate the token sent to the attestation service.\n *\n * Required for Isolated Mode attestation instances.\n *\n * If the service instance is in Isolated mode, the certificate *must* be one\n * of the configured policy management certificates.\n */\n certificate?: string;\n}\n\n/**\n * Operation options for the Policy Certificates operations.\n */\nexport interface AttestationAdministrationClientPolicyCertificateOperationOptions\n extends AttestationAdministrationClientOperationOptions {}\n\n/**\n * Attestation Client class.\n *\n * The AttestationClient class enables access to the Attestation related APIs:\n *\n * - getPolicy\n * - setPolicy\n * - resetPolicy\n * - getPolicyManagementCertificates\n * - addPolicyManagementCertificate\n * - removePolicyManagementCertificate\n */\nexport class AttestationAdministrationClient {\n /**\n * Creates an instance of AttestationAdministrationClient.\n *\n * Example usage:\n * ```ts\n * import { AttestationAdministrationClient } from \"@azure/attestation\";\n *\n * const client = new AttestationAdministrationClient(\n * \"<service endpoint>\",\n * new TokenCredential(\"<>\")\n * );\n * ```\n *\n * @param endpoint - The attestation instance endpoint, for example https://mytenant.attest.azure.net.\n * @param credential - Used to authenticate requests to the service.\n * @param options - Used to configure the Form Recognizer client.\n */\n\n constructor(\n endpoint: string,\n credentials: TokenCredential,\n options: AttestationAdministrationClientOptions = {},\n ) {\n this._validationOptions = options.validationOptions;\n\n const internalPipelineOptions: GeneratedClientOptionalParams = {\n ...options,\n ...{\n credential: credentials,\n credentialScopes: [\"https://attest.azure.net/.default\"],\n loggingOptions: {\n logger: logger.info,\n allowedHeaderNames: [\"x-ms-request-id\", \"x-ms-maa-service-version\"],\n },\n },\n };\n\n this._client = new GeneratedClient(endpoint, internalPipelineOptions);\n }\n\n /**\n * Retrieves the attestation policy document from the server, and returns it\n * to the caller.\n *\n * @param attestationType - AttestationType for which to retrieve policy.\n * @param options - Pipeline and client options for the `getPolicy` call.\n * @returns `AttestationResponse<string>` - the `value` property is the\n * attestation policy, the `token` property will be the actual token\n * returned by the attestation service.\n */\n public async getPolicy(\n attestationType: AttestationType,\n options: AttestationAdministrationClientPolicyOperationOptions = {},\n ): Promise<AttestationResponse<string>> {\n return tracingClient.withSpan(\n \"AttestationAdministrationClient-getPolicy\",\n options,\n async (updatedOptions) => {\n const getPolicyResult = await this._client.policy.get(attestationType, updatedOptions);\n\n // The attestation token returned from the service has a PolicyResult\n // object as the body.\n const token = new AttestationTokenImpl(getPolicyResult.token);\n\n // Validate the token returned from the service.\n const problems = token.getTokenProblems(\n await this.signingKeys(),\n options.validationOptions ?? this._validationOptions,\n );\n if (problems.length) {\n throw new Error(problems.join(\";\"));\n }\n\n // Deserialize the PolicyResult object to retrieve the underlying policy\n // token\n const policyResult = _policyResultFromGenerated(token.getBody());\n\n // The policyResult.policy value will be a JSON Web Signature representing\n // the actual policy object being retrieved. Serialize the token to an\n // AttestationToken object so we can access the body properties on the token.\n if (!policyResult.policy) {\n throw Error(\"Server returned an invalid getPolicy response!\");\n }\n\n const policyToken = new AttestationTokenImpl(policyResult.policy);\n\n const storedPolicy = StoredAttestationPolicy.deserialize(policyToken.getBody());\n\n // Finally, retrieve the stored attestationPolicy value and return that\n // as the AttestationResponse to the caller.\n return createAttestationResponse<string>(\n token,\n bytesToString(storedPolicy.attestationPolicy),\n );\n },\n );\n }\n\n /**\n * Sets the attestation policy for the specified {@link attestationType}.\n *\n * @param attestationType - Attestation Type for which to set policy.\n * @param newPolicyDocument - Policy document to be set.\n * @param options - call options.\n * @returns An {@link AttestationResponse} wrapping a {@link PolicyResult}.\n * Clients can use the PolicyResult to validate that the policy was actually\n * set by the attestation service.\n *\n * @remarks\n *\n * Please note that if the attestation service instance is running in \"Isolated\"\n * mode, the {@link signingKey} must be one of the signing keys configured for the\n * service instance.\n *\n * @throws {@link Error} when a private key is specified without a certificate and vice versa.\n * @throws {@link Error} when the key in the certificate provided does not match the private key.\n */\n public async setPolicy(\n attestationType: AttestationType,\n newPolicyDocument: string,\n options: AttestationAdministrationClientPolicyOperationOptions = {},\n ): Promise<AttestationResponse<PolicyResult>> {\n return tracingClient.withSpan(\n \"AttestationAdministrationClient-setPolicy\",\n options,\n async (updatedOptions) => {\n if (\n (!options.privateKey && options.certificate) ||\n (options.privateKey && !options.certificate)\n ) {\n throw new Error(\n \"If privateKey is specified, certificate must also be provided. If certificate is provided, privateKey must also be provided.\",\n );\n }\n\n if (options.privateKey && options.certificate) {\n verifyAttestationSigningKey(options.privateKey, options.certificate);\n }\n\n const storedAttestationPolicy = new StoredAttestationPolicy(newPolicyDocument).serialize();\n const setPolicyToken = AttestationTokenImpl.create({\n body: storedAttestationPolicy,\n ...options,\n });\n\n const setPolicyResult = await this._client.policy.set(\n attestationType,\n setPolicyToken.serialize(),\n updatedOptions,\n );\n\n // The attestation token returned from the service has a PolicyResult\n // object as the body.\n const token = new AttestationTokenImpl(setPolicyResult.token);\n const problems = token.getTokenProblems(\n await this.signingKeys(),\n options.validationOptions ?? this._validationOptions,\n );\n if (problems.length) {\n throw new Error(problems.join(\";\"));\n }\n\n // Deserialize the PolicyResult object to retrieve the underlying policy\n // token\n const policyResult = _policyResultFromGenerated(token.getBody());\n\n // The policyResult.policy value will be a JSON Web Signature representing\n // the actual policy object being retrieved. Serialize the token to an\n // AttestationToken object so we can access the body properties on the token.\n return createAttestationResponse<PolicyResult>(token, policyResult);\n },\n );\n }\n\n /**\n * Resets the attestation policy for the specified {@link attestationType} to\n * the default value.\n *\n * @param attestationType - Attestation Type for which to set policy.\n * @param options - call options.\n * @returns An {@link AttestationResponse} wrapping a {@link PolicyResult}.\n * Clients can use the PolicyResult to validate that the policy was actually\n * reset by the attestation service.\n *\n * @remarks\n *\n * Please note that if the attestation service instance is running in \"Isolated\"\n * mode, the {@link signingKey} must be one of the signing keys configured for the\n * service instance.\n *\n * @throws {@link Error} when a private key is specified without a certificate and vice versa.\n * @throws {@link Error} when the key in the certificate provided does not match the private key.\n */\n\n public async resetPolicy(\n attestationType: AttestationType,\n options: AttestationAdministrationClientPolicyOperationOptions = {},\n ): Promise<AttestationResponse<PolicyResult>> {\n return tracingClient.withSpan(\n \"AttestationAdministrationClient-setPolicy\",\n options,\n async (updatedOptions) => {\n if (\n (!options.privateKey && options.certificate) ||\n (options.privateKey && !options.certificate)\n ) {\n throw new Error(\n \"If privateKey is specified, certificate must also be provided. If certificate is provided, privateKey must also be provided.\",\n );\n }\n\n if (options.privateKey && options.certificate) {\n verifyAttestationSigningKey(options.privateKey, options.certificate);\n }\n\n const resetPolicyToken = AttestationTokenImpl.create({\n privateKey: options.privateKey,\n certificate: options.certificate,\n });\n\n const resetPolicyResult = await this._client.policy.reset(\n attestationType,\n resetPolicyToken.serialize(),\n updatedOptions,\n );\n\n // The attestation token returned from the service has a PolicyResult\n // object as the body.\n const token = new AttestationTokenImpl(resetPolicyResult.token);\n const problems = token.getTokenProblems(\n await this.signingKeys(),\n options.validationOptions ?? this._validationOptions,\n );\n if (problems.length) {\n throw new Error(problems.join(\";\"));\n }\n\n // Deserialize the PolicyResult object to retrieve the underlying policy\n // token\n const policyResult = _policyResultFromGenerated(token.getBody());\n\n // The policyResult.policy value will be a JSON Web Signature representing\n // the actual policy object being retrieved. Serialize the token to an\n // AttestationToken object so we can access the body properties on the token.\n return createAttestationResponse<PolicyResult>(token, policyResult);\n },\n );\n }\n\n /** Returns the set of policy management certificates for this attestation instance.\n *\n * @remarks If the attestation instance is not in `Isolated` mode, this list will\n * always be empty.\n *\n * @param options - Options for the call to the attestation service.\n * @returns AttestationResponse wrapping a list of Attestation Signers.\n */\n public async getPolicyManagementCertificates(\n options: AttestationAdministrationClientPolicyCertificateOperationOptions = {},\n ): Promise<AttestationResponse<AttestationSigner[]>> {\n return tracingClient.withSpan(\n \"AttestationAdministrationClient-getPolicyManagementCertificates\",\n options,\n async (updatedOptions) => {\n const getCertificatesResult = await this._client.policyCertificates.get(updatedOptions);\n // The attestation token returned from the service has a PolicyResult\n // object as the body.\n const token = new AttestationTokenImpl(getCertificatesResult.token);\n const problems = token.getTokenProblems(\n await this.signingKeys(),\n options.validationOptions ?? this._validationOptions,\n );\n if (problems.length) {\n throw new Error(problems.join(\";\"));\n }\n\n // Deserialize the PolicyResult object to retrieve the underlying policy\n // token\n const jwks = TypeDeserializer.deserialize(\n token.getBody(),\n {\n PolicyCertificatesResult: Mappers.PolicyCertificatesResult,\n JsonWebKeySet: Mappers.JsonWebKeySet,\n JsonWebKey: Mappers.JsonWebKey,\n },\n \"PolicyCertificatesResult\",\n ) as PolicyCertificatesResult;\n\n const policyCertificates = new Array<AttestationSigner>();\n jwks.policyCertificates.keys.forEach((jwk) => {\n policyCertificates.push(_attestationSignerFromGenerated(jwk));\n });\n\n return createAttestationResponse<AttestationSigner[]>(token, policyCertificates);\n },\n );\n }\n\n /** Add a new certificate chain to the set of policy management certificates.\n *\n * @param pemCertificate - PEM encoded certificate to add to the set of policy management certificates.\n * @param privateKey - Existing attestation private key used to sign the incoming request.\n * @param certificate - Existing attestation certificate used to verify the incoming request.\n * @param options - Options used in the call to the service.\n * @returns An attestation response including a PolicyCertificatesModificationResult\n *\n * @remarks This API is only supported on `isolated` attestation instances.\n *\n * The signing key MUST be one of the existing attestation signing certificates. The\n * new pemCertificate is signed using the signingKey and the service will validate the\n * signature before allowing the addition.\n *\n * @throws {@link Error} when a private key is specified without a certificate and vice versa.\n * @throws {@link Error} when the key in the certificate provided does not match the private key.\n *\n */\n public async addPolicyManagementCertificate(\n pemCertificate: string,\n privateKey: string,\n certificate: string,\n options: AttestationAdministrationClientPolicyCertificateOperationOptions = {},\n ): Promise<AttestationResponse<PolicyCertificatesModificationResult>> {\n return tracingClient.withSpan(\n \"AttestationAdministrationClient-addPolicyManagementCertificate\",\n options,\n async (updatedOptions) => {\n if ((!privateKey && certificate) || (privateKey && !certificate)) {\n throw new Error(\n \"If privateKey is specified, certificate must also be provided. If certificate is provided, privateKey must also be provided.\",\n );\n }\n\n if (privateKey && certificate) {\n verifyAttestationSigningKey(privateKey, certificate);\n }\n\n const cert = new jsrsasign.X509();\n cert.readCertPEM(pemCertificate);\n const kty = this.keyTypeFromCertificate(cert);\n\n const jwk: JsonWebKey = {\n x5C: [hexToBase64(cert.hex)],\n kty: kty,\n };\n\n const addBody: AttestationCertificateManagementBody = {\n policyCertificate: jwk,\n };\n\n const addCertToken = AttestationTokenImpl.create({\n body: TypeDeserializer.serialize(\n addBody,\n {\n AttestationCertificateManagementBody: Mappers.AttestationCertificateManagementBody,\n JsonWebKey: Mappers.JsonWebKey,\n },\n Mappers.AttestationCertificateManagementBody,\n ),\n privateKey: privateKey,\n certificate: certificate,\n });\n\n const addCertificateResult = await this._client.policyCertificates.add(\n addCertToken.serialize(),\n updatedOptions,\n );\n // The attestation token returned from the service has a PolicyResult\n // object as the body.\n const token = new AttestationTokenImpl(addCertificateResult.token);\n const problems = token.getTokenProblems(\n await this.signingKeys(),\n options.validationOptions ?? this._validationOptions,\n );\n if (problems.length) {\n throw new Error(problems.join(\";\"));\n }\n\n // Deserialize the PolicyCertificatesModificationResult object.\n const result = TypeDeserializer.deserialize(\n token.getBody(),\n {\n PolicyCertificatesModificationResult: Mappers.PolicyCertificatesModificationResult,\n JsonWebKeySet: Mappers.JsonWebKeySet,\n JsonWebKey: Mappers.JsonWebKey,\n },\n \"PolicyCertificatesModificationResult\",\n ) as PolicyCertificatesModificationResult;\n\n return createAttestationResponse<PolicyCertificatesModificationResult>(token, result);\n },\n );\n }\n\n private keyTypeFromCertificate(cert: any): string {\n let kty: string;\n switch (cert.getSignatureAlgorithmName()) {\n case \"SHA256withRSA\":\n case \"SHA384withRSA\":\n case \"SHA512withRSA\":\n kty = \"RSA\";\n break;\n case \"SHA256withECDSA\":\n case \"SHA384withECDSA\":\n kty = \"EC\";\n break;\n default:\n kty = \"RSA\";\n break;\n }\n return kty;\n }\n\n /** Add a new certificate chain to the set of policy management certificates.\n *\n * @param pemCertificate - PEM encoded certificate to add to the set of policy management certificates.\n * @param privateKey - Existing attestation private key used to sign the incoming request.\n * @param certificate - Existing attestation certificate used to verify the incoming request.\n * @param options - Options used in the call to the service.\n * @returns An attestation response including a PolicyCertificatesModificationResult\n *\n * @remarks This API is only supported on `isolated` attestation instances.\n *\n * The signing key MUST be one of the existing attestation signing certificates. The\n * new pemCertificate is signed using the signingKey and the service will validate the\n * signature before allowing the addition.\n *\n * @throws {@link Error} when a private key is specified without a certificate and vice versa.\n * @throws {@link Error} when the key in the certificate provided does not match the private key.\n */\n public async removePolicyManagementCertificate(\n pemCertificate: string,\n privateKey: string,\n certificate: string,\n options: AttestationAdministrationClientPolicyCertificateOperationOptions = {},\n ): Promise<AttestationResponse<PolicyCertificatesModificationResult>> {\n return tracingClient.withSpan(\n \"AttestationAdministrationClient-removePolicyManagementCertificate\",\n options,\n async (updatedOptions) => {\n if ((!privateKey && certificate) || (privateKey && !certificate)) {\n throw new Error(\n \"If privateKey is specified, certificate must also be provided. If certificate is provided, privateKey must also be provided.\",\n );\n }\n\n if (privateKey && certificate) {\n verifyAttestationSigningKey(privateKey, certificate);\n }\n\n const cert = new jsrsasign.X509();\n cert.readCertPEM(pemCertificate);\n const kty = this.keyTypeFromCertificate(cert);\n\n const jwk: JsonWebKey = {\n x5C: [hexToBase64(cert.hex)],\n kty: kty,\n };\n\n const addBody: AttestationCertificateManagementBody = {\n policyCertificate: jwk,\n };\n\n const removeCertToken = AttestationTokenImpl.create({\n body: TypeDeserializer.serialize(\n addBody,\n {\n AttestationCertificateManagementBody: Mappers.AttestationCertificateManagementBody,\n JsonWebKey: Mappers.JsonWebKey,\n },\n Mappers.AttestationCertificateManagementBody,\n ),\n privateKey: privateKey,\n certificate: certificate,\n });\n\n const removeCertificateResult = await this._client.policyCertificates.remove(\n removeCertToken.serialize(),\n updatedOptions,\n );\n // The attestation token returned from the service has a PolicyResult\n // object as the body.\n const token = new AttestationTokenImpl(removeCertificateResult.token);\n const problems = token.getTokenProblems(\n await this.signingKeys(),\n options.validationOptions ?? this._validationOptions,\n );\n if (problems.length) {\n throw new Error(problems.join(\";\"));\n }\n\n // Deserialize the PolicyCertificatesModificationResult object.\n const result = TypeDeserializer.deserialize(\n token.getBody(),\n {\n PolicyCertificatesModificationResult: Mappers.PolicyCertificatesModificationResult,\n JsonWebKeySet: Mappers.JsonWebKeySet,\n JsonWebKey: Mappers.JsonWebKey,\n },\n \"PolicyCertificatesModificationResult\",\n ) as PolicyCertificatesModificationResult;\n\n return createAttestationResponse<PolicyCertificatesModificationResult>(token, result);\n },\n );\n }\n\n private async signingKeys(): Promise<AttestationSigner[]> {\n if (this._signers !== undefined) {\n return this._signers;\n }\n const jwks = await this._client.signingCertificates.get();\n const signers: AttestationSigner[] = new Array();\n jwks.keys?.forEach((element) => {\n signers.push(_attestationSignerFromGenerated(element));\n });\n this._signers = signers;\n return this._signers;\n }\n\n private _client: GeneratedClient;\n private _signers?: AttestationSigner[];\n private _validationOptions?: AttestationTokenValidationOptions;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"attestationAdministrationClient.js","sourceRoot":"","sources":["../../src/attestationAdministrationClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,uDAAuD;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AASrC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAUhD,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAI9E,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,KAAK,OAAO,MAAM,+BAA+B,CAAC;AAEzD,yCAAyC;AACzC,OAAO,KAAK,SAAS,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AACtE,OAAO,EAAE,+BAA+B,EAAE,MAAM,+BAA+B,CAAC;AAChF,OAAO,EAAE,2BAA2B,EAAE,M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I,CAAC,QAAQ,CAAC;IACvB,CAAC;CAKF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/* eslint-disable @azure/azure-sdk/ts-naming-options */\nimport { GeneratedClient } from \"./generated/generatedClient.js\";\nimport { logger } from \"./logger.js\";\n\nimport type {\n AttestationCertificateManagementBody,\n GeneratedClientOptionalParams,\n JsonWebKey,\n PolicyCertificatesResult,\n} from \"./generated/models/index.js\";\n\nimport { bytesToString } from \"./utils/utf8.js\";\n\nimport type {\n AttestationResponse,\n AttestationSigner,\n AttestationTokenValidationOptions,\n AttestationType,\n PolicyCertificatesModificationResult,\n PolicyResult,\n} from \"./models/index.js\";\nimport { StoredAttestationPolicy } from \"./models/storedAttestationPolicy.js\";\n\nimport type { CommonClientOptions, OperationOptions } from \"@azure/core-client\";\nimport type { TokenCredential } from \"@azure/core-auth\";\nimport { TypeDeserializer } from \"./utils/typeDeserializer.js\";\nimport * as Mappers from \"./generated/models/mappers.js\";\n\n/// <reference path=\"../jsrsasign.d.ts\"/>\nimport * as jsrsasign from \"jsrsasign\";\nimport { hexToBase64 } from \"./utils/helpers.js\";\nimport { _policyResultFromGenerated } from \"./models/policyResult.js\";\nimport { _attestationSignerFromGenerated } from \"./models/attestationSigner.js\";\nimport { verifyAttestationSigningKey } from \"./utils/helpers.js\";\nimport { createAttestationResponse } from \"./models/attestationResponse.js\";\nimport { AttestationTokenImpl } from \"./models/attestationToken.js\";\nimport { tracingClient } from \"./generated/tracing.js\";\n\n/**\n * Attestation Client Construction Options.\n */\nexport interface AttestationAdministrationClientOptions extends CommonClientOptions {\n /**\n * Options to be used globally to validate attestation tokens received from\n * the attestation service.\n */\n validationOptions?: AttestationTokenValidationOptions;\n}\n\n/**\n * Operation options for the Attestation Administration Client operations.\n */\nexport interface AttestationAdministrationClientOperationOptions extends OperationOptions {\n /**\n * Options to be used globally to validate attestation tokens received from\n * the attestation service.\n */\n validationOptions?: AttestationTokenValidationOptions;\n}\n\n/**\n * Operation options for the administration Policy operations.\n */\nexport interface AttestationAdministrationClientPolicyOperationOptions\n extends AttestationAdministrationClientOperationOptions {\n /**\n * Optional Private key used to sign the token sent to the attestation service.\n *\n * Required for Isolated Mode attestation instances.\n */\n privateKey?: string;\n\n /**\n * Optional certificate which can validate the token sent to the attestation service.\n *\n * Required for Isolated Mode attestation instances.\n *\n * If the service instance is in Isolated mode, the certificate *must* be one\n * of the configured policy management certificates.\n */\n certificate?: string;\n}\n\n/**\n * Operation options for the Policy Certificates operations.\n */\nexport interface AttestationAdministrationClientPolicyCertificateOperationOptions\n extends AttestationAdministrationClientOperationOptions {}\n\n/**\n * Attestation Client class.\n *\n * The AttestationClient class enables access to the Attestation related APIs:\n *\n * - getPolicy\n * - setPolicy\n * - resetPolicy\n * - getPolicyManagementCertificates\n * - addPolicyManagementCertificate\n * - removePolicyManagementCertificate\n */\nexport class AttestationAdministrationClient {\n /**\n * Creates an instance of AttestationAdministrationClient.\n *\n * Example usage:\n * ```ts snippet:AttestationAdministrationClient_Constructor\n * import { AttestationAdministrationClient } from \"@azure/attestation\";\n * import { DefaultAzureCredential } from \"@azure/identity\";\n *\n * const endpoint = \"https://<attestation-instance>.<region>.attest.azure.net\";\n * const client = new AttestationAdministrationClient(endpoint, new DefaultAzureCredential());\n * ```\n *\n * @param endpoint - The attestation instance endpoint, for example https://mytenant.attest.azure.net.\n * @param credential - Used to authenticate requests to the service.\n * @param options - Used to configure the Form Recognizer client.\n */\n\n constructor(\n endpoint: string,\n credentials: TokenCredential,\n options: AttestationAdministrationClientOptions = {},\n ) {\n this._validationOptions = options.validationOptions;\n\n const internalPipelineOptions: GeneratedClientOptionalParams = {\n ...options,\n ...{\n credential: credentials,\n credentialScopes: [\"https://attest.azure.net/.default\"],\n loggingOptions: {\n logger: logger.info,\n allowedHeaderNames: [\"x-ms-request-id\", \"x-ms-maa-service-version\"],\n },\n },\n };\n\n this._client = new GeneratedClient(endpoint, internalPipelineOptions);\n }\n\n /**\n * Retrieves the attestation policy document from the server, and returns it\n * to the caller.\n *\n * @param attestationType - AttestationType for which to retrieve policy.\n * @param options - Pipeline and client options for the `getPolicy` call.\n * @returns `AttestationResponse<string>` - the `value` property is the\n * attestation policy, the `token` property will be the actual token\n * returned by the attestation service.\n */\n public async getPolicy(\n attestationType: AttestationType,\n options: AttestationAdministrationClientPolicyOperationOptions = {},\n ): Promise<AttestationResponse<string>> {\n return tracingClient.withSpan(\n \"AttestationAdministrationClient-getPolicy\",\n options,\n async (updatedOptions) => {\n const getPolicyResult = await this._client.policy.get(attestationType, updatedOptions);\n\n // The attestation token returned from the service has a PolicyResult\n // object as the body.\n const token = new AttestationTokenImpl(getPolicyResult.token);\n\n // Validate the token returned from the service.\n const problems = token.getTokenProblems(\n await this.signingKeys(),\n options.validationOptions ?? this._validationOptions,\n );\n if (problems.length) {\n throw new Error(problems.join(\";\"));\n }\n\n // Deserialize the PolicyResult object to retrieve the underlying policy\n // token\n const policyResult = _policyResultFromGenerated(token.getBody());\n\n // The policyResult.policy value will be a JSON Web Signature representing\n // the actual policy object being retrieved. Serialize the token to an\n // AttestationToken object so we can access the body properties on the token.\n if (!policyResult.policy) {\n throw Error(\"Server returned an invalid getPolicy response!\");\n }\n\n const policyToken = new AttestationTokenImpl(policyResult.policy);\n\n const storedPolicy = StoredAttestationPolicy.deserialize(policyToken.getBody());\n\n // Finally, retrieve the stored attestationPolicy value and return that\n // as the AttestationResponse to the caller.\n return createAttestationResponse<string>(\n token,\n bytesToString(storedPolicy.attestationPolicy),\n );\n },\n );\n }\n\n /**\n * Sets the attestation policy for the specified {@link attestationType}.\n *\n * @param attestationType - Attestation Type for which to set policy.\n * @param newPolicyDocument - Policy document to be set.\n * @param options - call options.\n * @returns An {@link AttestationResponse} wrapping a {@link PolicyResult}.\n * Clients can use the PolicyResult to validate that the policy was actually\n * set by the attestation service.\n *\n * @remarks\n *\n * Please note that if the attestation service instance is running in \"Isolated\"\n * mode, the {@link signingKey} must be one of the signing keys configured for the\n * service instance.\n *\n * @throws {@link Error} when a private key is specified without a certificate and vice versa.\n * @throws {@link Error} when the key in the certificate provided does not match the private key.\n */\n public async setPolicy(\n attestationType: AttestationType,\n newPolicyDocument: string,\n options: AttestationAdministrationClientPolicyOperationOptions = {},\n ): Promise<AttestationResponse<PolicyResult>> {\n return tracingClient.withSpan(\n \"AttestationAdministrationClient-setPolicy\",\n options,\n async (updatedOptions) => {\n if (\n (!options.privateKey && options.certificate) ||\n (options.privateKey && !options.certificate)\n ) {\n throw new Error(\n \"If privateKey is specified, certificate must also be provided. If certificate is provided, privateKey must also be provided.\",\n );\n }\n\n if (options.privateKey && options.certificate) {\n verifyAttestationSigningKey(options.privateKey, options.certificate);\n }\n\n const storedAttestationPolicy = new StoredAttestationPolicy(newPolicyDocument).serialize();\n const setPolicyToken = AttestationTokenImpl.create({\n body: storedAttestationPolicy,\n ...options,\n });\n\n const setPolicyResult = await this._client.policy.set(\n attestationType,\n setPolicyToken.serialize(),\n updatedOptions,\n );\n\n // The attestation token returned from the service has a PolicyResult\n // object as the body.\n const token = new AttestationTokenImpl(setPolicyResult.token);\n const problems = token.getTokenProblems(\n await this.signingKeys(),\n options.validationOptions ?? this._validationOptions,\n );\n if (problems.length) {\n throw new Error(problems.join(\";\"));\n }\n\n // Deserialize the PolicyResult object to retrieve the underlying policy\n // token\n const policyResult = _policyResultFromGenerated(token.getBody());\n\n // The policyResult.policy value will be a JSON Web Signature representing\n // the actual policy object being retrieved. Serialize the token to an\n // AttestationToken object so we can access the body properties on the token.\n return createAttestationResponse<PolicyResult>(token, policyResult);\n },\n );\n }\n\n /**\n * Resets the attestation policy for the specified {@link attestationType} to\n * the default value.\n *\n * @param attestationType - Attestation Type for which to set policy.\n * @param options - call options.\n * @returns An {@link AttestationResponse} wrapping a {@link PolicyResult}.\n * Clients can use the PolicyResult to validate that the policy was actually\n * reset by the attestation service.\n *\n * @remarks\n *\n * Please note that if the attestation service instance is running in \"Isolated\"\n * mode, the {@link signingKey} must be one of the signing keys configured for the\n * service instance.\n *\n * @throws {@link Error} when a private key is specified without a certificate and vice versa.\n * @throws {@link Error} when the key in the certificate provided does not match the private key.\n */\n\n public async resetPolicy(\n attestationType: AttestationType,\n options: AttestationAdministrationClientPolicyOperationOptions = {},\n ): Promise<AttestationResponse<PolicyResult>> {\n return tracingClient.withSpan(\n \"AttestationAdministrationClient-setPolicy\",\n options,\n async (updatedOptions) => {\n if (\n (!options.privateKey && options.certificate) ||\n (options.privateKey && !options.certificate)\n ) {\n throw new Error(\n \"If privateKey is specified, certificate must also be provided. If certificate is provided, privateKey must also be provided.\",\n );\n }\n\n if (options.privateKey && options.certificate) {\n verifyAttestationSigningKey(options.privateKey, options.certificate);\n }\n\n const resetPolicyToken = AttestationTokenImpl.create({\n privateKey: options.privateKey,\n certificate: options.certificate,\n });\n\n const resetPolicyResult = await this._client.policy.reset(\n attestationType,\n resetPolicyToken.serialize(),\n updatedOptions,\n );\n\n // The attestation token returned from the service has a PolicyResult\n // object as the body.\n const token = new AttestationTokenImpl(resetPolicyResult.token);\n const problems = token.getTokenProblems(\n await this.signingKeys(),\n options.validationOptions ?? this._validationOptions,\n );\n if (problems.length) {\n throw new Error(problems.join(\";\"));\n }\n\n // Deserialize the PolicyResult object to retrieve the underlying policy\n // token\n const policyResult = _policyResultFromGenerated(token.getBody());\n\n // The policyResult.policy value will be a JSON Web Signature representing\n // the actual policy object being retrieved. Serialize the token to an\n // AttestationToken object so we can access the body properties on the token.\n return createAttestationResponse<PolicyResult>(token, policyResult);\n },\n );\n }\n\n /** Returns the set of policy management certificates for this attestation instance.\n *\n * @remarks If the attestation instance is not in `Isolated` mode, this list will\n * always be empty.\n *\n * @param options - Options for the call to the attestation service.\n * @returns AttestationResponse wrapping a list of Attestation Signers.\n */\n public async getPolicyManagementCertificates(\n options: AttestationAdministrationClientPolicyCertificateOperationOptions = {},\n ): Promise<AttestationResponse<AttestationSigner[]>> {\n return tracingClient.withSpan(\n \"AttestationAdministrationClient-getPolicyManagementCertificates\",\n options,\n async (updatedOptions) => {\n const getCertificatesResult = await this._client.policyCertificates.get(updatedOptions);\n // The attestation token returned from the service has a PolicyResult\n // object as the body.\n const token = new AttestationTokenImpl(getCertificatesResult.token);\n const problems = token.getTokenProblems(\n await this.signingKeys(),\n options.validationOptions ?? this._validationOptions,\n );\n if (problems.length) {\n throw new Error(problems.join(\";\"));\n }\n\n // Deserialize the PolicyResult object to retrieve the underlying policy\n // token\n const jwks = TypeDeserializer.deserialize(\n token.getBody(),\n {\n PolicyCertificatesResult: Mappers.PolicyCertificatesResult,\n JsonWebKeySet: Mappers.JsonWebKeySet,\n JsonWebKey: Mappers.JsonWebKey,\n },\n \"PolicyCertificatesResult\",\n ) as PolicyCertificatesResult;\n\n const policyCertificates = new Array<AttestationSigner>();\n jwks.policyCertificates.keys.forEach((jwk) => {\n policyCertificates.push(_attestationSignerFromGenerated(jwk));\n });\n\n return createAttestationResponse<AttestationSigner[]>(token, policyCertificates);\n },\n );\n }\n\n /** Add a new certificate chain to the set of policy management certificates.\n *\n * @param pemCertificate - PEM encoded certificate to add to the set of policy management certificates.\n * @param privateKey - Existing attestation private key used to sign the incoming request.\n * @param certificate - Existing attestation certificate used to verify the incoming request.\n * @param options - Options used in the call to the service.\n * @returns An attestation response including a PolicyCertificatesModificationResult\n *\n * @remarks This API is only supported on `isolated` attestation instances.\n *\n * The signing key MUST be one of the existing attestation signing certificates. The\n * new pemCertificate is signed using the signingKey and the service will validate the\n * signature before allowing the addition.\n *\n * @throws {@link Error} when a private key is specified without a certificate and vice versa.\n * @throws {@link Error} when the key in the certificate provided does not match the private key.\n *\n */\n public async addPolicyManagementCertificate(\n pemCertificate: string,\n privateKey: string,\n certificate: string,\n options: AttestationAdministrationClientPolicyCertificateOperationOptions = {},\n ): Promise<AttestationResponse<PolicyCertificatesModificationResult>> {\n return tracingClient.withSpan(\n \"AttestationAdministrationClient-addPolicyManagementCertificate\",\n options,\n async (updatedOptions) => {\n if ((!privateKey && certificate) || (privateKey && !certificate)) {\n throw new Error(\n \"If privateKey is specified, certificate must also be provided. If certificate is provided, privateKey must also be provided.\",\n );\n }\n\n if (privateKey && certificate) {\n verifyAttestationSigningKey(privateKey, certificate);\n }\n\n const cert = new jsrsasign.X509();\n cert.readCertPEM(pemCertificate);\n const kty = this.keyTypeFromCertificate(cert);\n\n const jwk: JsonWebKey = {\n x5C: [hexToBase64(cert.hex)],\n kty: kty,\n };\n\n const addBody: AttestationCertificateManagementBody = {\n policyCertificate: jwk,\n };\n\n const addCertToken = AttestationTokenImpl.create({\n body: TypeDeserializer.serialize(\n addBody,\n {\n AttestationCertificateManagementBody: Mappers.AttestationCertificateManagementBody,\n JsonWebKey: Mappers.JsonWebKey,\n },\n Mappers.AttestationCertificateManagementBody,\n ),\n privateKey: privateKey,\n certificate: certificate,\n });\n\n const addCertificateResult = await this._client.policyCertificates.add(\n addCertToken.serialize(),\n updatedOptions,\n );\n // The attestation token returned from the service has a PolicyResult\n // object as the body.\n const token = new AttestationTokenImpl(addCertificateResult.token);\n const problems = token.getTokenProblems(\n await this.signingKeys(),\n options.validationOptions ?? this._validationOptions,\n );\n if (problems.length) {\n throw new Error(problems.join(\";\"));\n }\n\n // Deserialize the PolicyCertificatesModificationResult object.\n const result = TypeDeserializer.deserialize(\n token.getBody(),\n {\n PolicyCertificatesModificationResult: Mappers.PolicyCertificatesModificationResult,\n JsonWebKeySet: Mappers.JsonWebKeySet,\n JsonWebKey: Mappers.JsonWebKey,\n },\n \"PolicyCertificatesModificationResult\",\n ) as PolicyCertificatesModificationResult;\n\n return createAttestationResponse<PolicyCertificatesModificationResult>(token, result);\n },\n );\n }\n\n private keyTypeFromCertificate(cert: any): string {\n let kty: string;\n switch (cert.getSignatureAlgorithmName()) {\n case \"SHA256withRSA\":\n case \"SHA384withRSA\":\n case \"SHA512withRSA\":\n kty = \"RSA\";\n break;\n case \"SHA256withECDSA\":\n case \"SHA384withECDSA\":\n kty = \"EC\";\n break;\n default:\n kty = \"RSA\";\n break;\n }\n return kty;\n }\n\n /** Add a new certificate chain to the set of policy management certificates.\n *\n * @param pemCertificate - PEM encoded certificate to add to the set of policy management certificates.\n * @param privateKey - Existing attestation private key used to sign the incoming request.\n * @param certificate - Existing attestation certificate used to verify the incoming request.\n * @param options - Options used in the call to the service.\n * @returns An attestation response including a PolicyCertificatesModificationResult\n *\n * @remarks This API is only supported on `isolated` attestation instances.\n *\n * The signing key MUST be one of the existing attestation signing certificates. The\n * new pemCertificate is signed using the signingKey and the service will validate the\n * signature before allowing the addition.\n *\n * @throws {@link Error} when a private key is specified without a certificate and vice versa.\n * @throws {@link Error} when the key in the certificate provided does not match the private key.\n */\n public async removePolicyManagementCertificate(\n pemCertificate: string,\n privateKey: string,\n certificate: string,\n options: AttestationAdministrationClientPolicyCertificateOperationOptions = {},\n ): Promise<AttestationResponse<PolicyCertificatesModificationResult>> {\n return tracingClient.withSpan(\n \"AttestationAdministrationClient-removePolicyManagementCertificate\",\n options,\n async (updatedOptions) => {\n if ((!privateKey && certificate) || (privateKey && !certificate)) {\n throw new Error(\n \"If privateKey is specified, certificate must also be provided. If certificate is provided, privateKey must also be provided.\",\n );\n }\n\n if (privateKey && certificate) {\n verifyAttestationSigningKey(privateKey, certificate);\n }\n\n const cert = new jsrsasign.X509();\n cert.readCertPEM(pemCertificate);\n const kty = this.keyTypeFromCertificate(cert);\n\n const jwk: JsonWebKey = {\n x5C: [hexToBase64(cert.hex)],\n kty: kty,\n };\n\n const addBody: AttestationCertificateManagementBody = {\n policyCertificate: jwk,\n };\n\n const removeCertToken = AttestationTokenImpl.create({\n body: TypeDeserializer.serialize(\n addBody,\n {\n AttestationCertificateManagementBody: Mappers.AttestationCertificateManagementBody,\n JsonWebKey: Mappers.JsonWebKey,\n },\n Mappers.AttestationCertificateManagementBody,\n ),\n privateKey: privateKey,\n certificate: certificate,\n });\n\n const removeCertificateResult = await this._client.policyCertificates.remove(\n removeCertToken.serialize(),\n updatedOptions,\n );\n // The attestation token returned from the service has a PolicyResult\n // object as the body.\n const token = new AttestationTokenImpl(removeCertificateResult.token);\n const problems = token.getTokenProblems(\n await this.signingKeys(),\n options.validationOptions ?? this._validationOptions,\n );\n if (problems.length) {\n throw new Error(problems.join(\";\"));\n }\n\n // Deserialize the PolicyCertificatesModificationResult object.\n const result = TypeDeserializer.deserialize(\n token.getBody(),\n {\n PolicyCertificatesModificationResult: Mappers.PolicyCertificatesModificationResult,\n JsonWebKeySet: Mappers.JsonWebKeySet,\n JsonWebKey: Mappers.JsonWebKey,\n },\n \"PolicyCertificatesModificationResult\",\n ) as PolicyCertificatesModificationResult;\n\n return createAttestationResponse<PolicyCertificatesModificationResult>(token, result);\n },\n );\n }\n\n private async signingKeys(): Promise<AttestationSigner[]> {\n if (this._signers !== undefined) {\n return this._signers;\n }\n const jwks = await this._client.signingCertificates.get();\n const signers: AttestationSigner[] = new Array();\n jwks.keys?.forEach((element) => {\n signers.push(_attestationSignerFromGenerated(element));\n });\n this._signers = signers;\n return this._signers;\n }\n\n private _client: GeneratedClient;\n private _signers?: AttestationSigner[];\n private _validationOptions?: AttestationTokenValidationOptions;\n}\n"]}
|
|
@@ -103,12 +103,11 @@ export declare class AttestationClient {
|
|
|
103
103
|
* Creates an instance of AttestationClient.
|
|
104
104
|
*
|
|
105
105
|
* Example usage:
|
|
106
|
-
* ```ts
|
|
106
|
+
* ```ts snippet:Attestation_Constructor_NoCreds
|
|
107
107
|
* import { AttestationClient } from "@azure/attestation";
|
|
108
108
|
*
|
|
109
|
-
* const
|
|
110
|
-
*
|
|
111
|
-
* );
|
|
109
|
+
* const endpoint = "https://<attestation-instance>.<region>.attest.azure.net";
|
|
110
|
+
* const client = new AttestationClient(endpoint);
|
|
112
111
|
* ```
|
|
113
112
|
*
|
|
114
113
|
* @param endpoint - The attestation instance base URI, for example https://mytenant.attest.azure.net.
|
|
@@ -120,14 +119,13 @@ export declare class AttestationClient {
|
|
|
120
119
|
* Creates an instance of AttestationClient with options and credentials.
|
|
121
120
|
*
|
|
122
121
|
* Example usage:
|
|
123
|
-
* ```ts
|
|
122
|
+
* ```ts snippet:Attestation_Constructor_Creds
|
|
123
|
+
* import { DefaultAzureCredential } from "@azure/identity";
|
|
124
124
|
* import { AttestationClient } from "@azure/attestation";
|
|
125
125
|
*
|
|
126
|
-
* const
|
|
127
|
-
*
|
|
128
|
-
*
|
|
129
|
-
* { tokenValidationOptions: { validateToken: false } }
|
|
130
|
-
* );
|
|
126
|
+
* const endpoint = "https://<attestation-instance>.<region>.attest.azure.net";
|
|
127
|
+
* const credentials = new DefaultAzureCredential();
|
|
128
|
+
* const client = new AttestationClient(endpoint, credentials);
|
|
131
129
|
* ```
|
|
132
130
|
*
|
|
133
131
|
* Note that credentials are required to call the `attestTpm` API.
|
|
@@ -162,7 +160,7 @@ export declare class AttestationClient {
|
|
|
162
160
|
attestSgxEnclave(quote: Uint8Array | Buffer | Blob, options?: AttestSgxEnclaveOptions): Promise<AttestationResponse<AttestationResult>>;
|
|
163
161
|
/** Attest a TPM based enclave.
|
|
164
162
|
|
|
165
|
-
* See the {@link https://
|
|
163
|
+
* See the {@link https://learn.microsoft.com/en-us/azure/attestation/virtualization-based-security-protocol | TPM Attestation Protocol Reference} for more information.
|
|
166
164
|
*
|
|
167
165
|
* @param request - Incoming request to send to the TPM attestation service, Utf8 encoded.
|
|
168
166
|
* @param options - Pipeline options for TPM attestation request.
|
|
@@ -175,7 +173,7 @@ export declare class AttestationClient {
|
|
|
175
173
|
* @example
|
|
176
174
|
* For example, the initial call for a TPM attestation operation is:
|
|
177
175
|
*
|
|
178
|
-
* ```
|
|
176
|
+
* ```snippet:AttestationClient_AttestTpm
|
|
179
177
|
* const encodedPayload = JSON.stringify({ payload: { type: "aikcert" } });
|
|
180
178
|
* const result = await client.attestTpm(encodedPayload);
|
|
181
179
|
* ```
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attestationClient.d.ts","sourceRoot":"","sources":["../../src/attestationClient.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,iB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