diff --git a/sdk/attestation/attestation/CHANGELOG.md b/sdk/attestation/attestation/CHANGELOG.md new file mode 100644 index 000000000000..a51ed0221df2 --- /dev/null +++ b/sdk/attestation/attestation/CHANGELOG.md @@ -0,0 +1,7 @@ +# Release History + +## 1.0.0-beta.1 (unreleased) + +Initial early preview release for MAA Data Plane SDK Demonstrates use of the machine generated MAA APIs. + +- Initial Release diff --git a/sdk/attestation/attestation/package.json b/sdk/attestation/attestation/package.json index 5caf2e52df01..b18137a713d3 100644 --- a/sdk/attestation/attestation/package.json +++ b/sdk/attestation/attestation/package.json @@ -13,7 +13,8 @@ "azure", "typescript", "browser", - "isomorphic" + "isomorphic", + "cloud" ], "license": "MIT", "main": "./dist/index.js", @@ -59,13 +60,11 @@ "rollup-plugin-sourcemaps": "^0.4.2", "safe-buffer": "^5.2.1", "ts-node": "^8.3.0", - "typescript": "4.1.2" - }, - "homepage": "https://github.com/Azure/azure-sdk-for-js", - "repository": { - "type": "git", - "url": "https://github.com/Azure/azure-sdk-for-js.git" + "typescript": "4.1.2", + "typedoc": "0.15.0" }, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/attestation/attestation/README.md", + "repository": "github:Azure/azure-sdk-for-js", "bugs": { "url": "https://github.com/Azure/azure-sdk-for-js/issues" }, @@ -77,20 +76,29 @@ "LICENSE" ], "scripts": { + "audit": "node ../../../common/scripts/rush-audit.js && rimraf node_modules package-lock.json && npm i --package-lock-only 2>&1 && npm audit", "build": "tsc -p . && rollup -c 2>&1 && api-extractor run --local", "build:samples": "echo skipped", "build:test": "tsc -p . && rollup -c 2>&1", + "check-format": "prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"", "clean": "rimraf dist dist-esm dist-test temp types *.tgz *.log", + "execute:samples": "echo skipped", "extract-api": "api-extractor run --local", + "format": "prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"", + "integration-test:browser": "karma start --single-run", + "integration-test:node": "nyc mocha -r esm --require source-map-support/register --reporter ../../../common/tools/mocha-multi-reporter.js --timeout 5000000 --full-trace \"dist-esm/test/{,!(browser)/**/}*.spec.js\"", + "integration-test": "npm run integration-test:node && npm run integration-test:browser", + "lint:fix": "echo skipped", "lint": "echo skipped", - "prepack": "npm install && npm run build", + "pack": "npm pack 2>&1", + "prebuild": "npm run clean", "test": "npm run clean && npm run build:test && npm run unit-test", "unit-test:browser": "karma start --single-run", "unit-test:node": "mocha -r esm --require ts-node/register --reporter ../../../common/tools/mocha-multi-reporter.js --timeout 1200000 --full-trace \"test/{,!(browser)/**/}*.spec.ts\"", - "unit-test": "npm run unit-test:node && npm run unit-test:browser" + "unit-test": "npm run unit-test:node && npm run unit-test:browser", + "docs": "typedoc --excludePrivate --excludeNotExported --excludeExternals --mode file --out ./dist/docs ./src" }, "sideEffects": false, - "autoPublish": true, "browser": { "./dist-esm/test/utils/base64url.js": "./dist-esm/test/utils/base64url.browser.js", "./dist-esm/test/utils/Buffer.js": "./dist-esm/test/utils/Buffer.browser.js", diff --git a/sdk/attestation/attestation/test/public/attestationTests.spec.ts b/sdk/attestation/attestation/test/public/attestationTests.spec.ts index a79f99cac563..a98319589dd2 100644 --- a/sdk/attestation/attestation/test/public/attestationTests.spec.ts +++ b/sdk/attestation/attestation/test/public/attestationTests.spec.ts @@ -8,7 +8,6 @@ chaiUse(chaiPromises); import { isPlaybackMode, Recorder } from "@azure/test-utils-recorder"; import { createRecordedClient, createRecorder } from "../utils/recordedClient"; -import { AttestationClient } from "../../src"; import * as base64url from "../utils/base64url"; import { verifyAttestationToken } from "../utils/helpers"; @@ -119,8 +118,7 @@ describe("[AAD] Attestation Client", function() { "PQotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCgA"; it("#AttestSgxShared", async () => { - let client: AttestationClient; - client = createRecordedClient("Shared"); + const client = createRecordedClient("Shared"); const binaryRuntimeData = base64url.decodeString(_runtimeData); const attestationResult = await client.attestation.attestSgxEnclave({ quote: base64url.decodeString(_sgxQuote), @@ -137,8 +135,7 @@ describe("[AAD] Attestation Client", function() { } }); it("#AttestSgxAad", async () => { - let client: AttestationClient; - client = createRecordedClient("AAD"); + const client = createRecordedClient("AAD"); const binaryRuntimeData = base64url.decodeString(_runtimeData); const attestationResult = await client.attestation.attestSgxEnclave({ quote: base64url.decodeString(_sgxQuote), @@ -156,8 +153,7 @@ describe("[AAD] Attestation Client", function() { }); it("#AttestSgxIsolated", async () => { - let client: AttestationClient; - client = createRecordedClient("AAD"); + const client = createRecordedClient("AAD"); const binaryRuntimeData = base64url.decodeString(_runtimeData); const attestationResult = await client.attestation.attestSgxEnclave({ quote: base64url.decodeString(_sgxQuote), diff --git a/sdk/attestation/attestation/test/public/policyGetSetTests.spec.ts b/sdk/attestation/attestation/test/public/policyGetSetTests.spec.ts index 46b13cb7e1eb..cb26556db09a 100644 --- a/sdk/attestation/attestation/test/public/policyGetSetTests.spec.ts +++ b/sdk/attestation/attestation/test/public/policyGetSetTests.spec.ts @@ -8,7 +8,7 @@ chaiUse(chaiPromises); import { isPlaybackMode, Recorder } from "@azure/test-utils-recorder"; import { createRecordedClient, createRecorder } from "../utils/recordedClient"; -import { AttestationClient, KnownAttestationType } from "../../src"; +import { KnownAttestationType } from "../../src"; import { verifyAttestationToken } from "../utils/helpers"; describe("PolicyGetSetTests ", function() { @@ -24,8 +24,7 @@ describe("PolicyGetSetTests ", function() { }); it("#GetPolicyAad", async () => { - let client: AttestationClient; - client = createRecordedClient("AAD"); + const client = createRecordedClient("AAD"); const policyResult = await client.policy.get(KnownAttestationType.SgxEnclave); const result = policyResult.token; assert(result, "Expected a token from the service but did not receive one"); @@ -35,8 +34,7 @@ describe("PolicyGetSetTests ", function() { }); it("#GetPolicyIsolated", async () => { - let client: AttestationClient; - client = createRecordedClient("Isolated"); + const client = createRecordedClient("Isolated"); const policyResult = await client.policy.get(KnownAttestationType.SgxEnclave); const result = policyResult.token; assert(result, "Expected a token from the service but did not receive one"); @@ -46,8 +44,7 @@ describe("PolicyGetSetTests ", function() { }); it("#GetPolicyShared", async () => { - let client: AttestationClient; - client = createRecordedClient("Shared"); + const client = createRecordedClient("Shared"); const policyResult = await client.policy.get(KnownAttestationType.SgxEnclave); const result = policyResult.token; assert(result, "Expected a token from the service but did not receive one"); diff --git a/sdk/attestation/attestation/test/public/policyManagementGetSetTests.spec.ts b/sdk/attestation/attestation/test/public/policyManagementGetSetTests.spec.ts index cf3bc329a257..fa9e9081aac7 100644 --- a/sdk/attestation/attestation/test/public/policyManagementGetSetTests.spec.ts +++ b/sdk/attestation/attestation/test/public/policyManagementGetSetTests.spec.ts @@ -8,7 +8,6 @@ chaiUse(chaiPromises); import { isPlaybackMode, Recorder } from "@azure/test-utils-recorder"; import { createRecordedClient, createRecorder } from "../utils/recordedClient"; -import { AttestationClient } from "../../src"; import { verifyAttestationToken } from "../utils/helpers"; describe("PolicyManagementTests ", function() { @@ -24,8 +23,7 @@ describe("PolicyManagementTests ", function() { }); it("#GetPolicyManagementCertificatesAad", async () => { - let client: AttestationClient; - client = createRecordedClient("AAD"); + const client = createRecordedClient("AAD"); const policyResult = await client.policyCertificates.get(); const result = policyResult.token; @@ -41,8 +39,7 @@ describe("PolicyManagementTests ", function() { }); it("#GetPolicyShared", async () => { - let client: AttestationClient; - client = createRecordedClient("Shared"); + const client = createRecordedClient("Shared"); const policyResult = await client.policyCertificates.get(); const result = policyResult.token; @@ -58,8 +55,7 @@ describe("PolicyManagementTests ", function() { }); it("#GetPolicyIsolated", async () => { - let client: AttestationClient; - client = createRecordedClient("Isolated"); + const client = createRecordedClient("Isolated"); const policyResult = await client.policyCertificates.get(); const result = policyResult.token; diff --git a/sdk/attestation/attestation/test/public/tokenCertTests.spec.ts b/sdk/attestation/attestation/test/public/tokenCertTests.spec.ts index ed27fb14db29..c2b0ad00e2d6 100644 --- a/sdk/attestation/attestation/test/public/tokenCertTests.spec.ts +++ b/sdk/attestation/attestation/test/public/tokenCertTests.spec.ts @@ -8,7 +8,6 @@ chaiUse(chaiPromises); import { Recorder } from "@azure/test-utils-recorder"; import { createRecordedClient, createRecorder } from "../utils/recordedClient"; -import { AttestationClient } from "../../src"; import { Buffer } from "../utils/Buffer"; describe("TokenCertTests", function() { @@ -24,8 +23,7 @@ describe("TokenCertTests", function() { }); it("#GetCertificatesAAD", async () => { - let client: AttestationClient; - client = createRecordedClient("AAD"); + const client = createRecordedClient("AAD"); const signingCertificates = await client.signingCertificates.get(); const certs = signingCertificates.keys!; assert(certs.length > 0); @@ -38,8 +36,7 @@ describe("TokenCertTests", function() { } }); it("#GetCertificatesIsolated", async () => { - let client: AttestationClient; - client = createRecordedClient("Isolated"); + const client = createRecordedClient("Isolated"); const signingCertificates = await client.signingCertificates.get(); const certs = signingCertificates.keys!; assert(certs.length > 0); @@ -53,8 +50,7 @@ describe("TokenCertTests", function() { }); it("#GetCertificatesShared", async () => { - let client: AttestationClient; - client = createRecordedClient("Shared"); + const client = createRecordedClient("Shared"); const signingCertificates = await client.signingCertificates.get(); const certs = signingCertificates.keys!; assert(certs.length > 0); diff --git a/sdk/attestation/attestation/test/utils/base64url.browser.ts b/sdk/attestation/attestation/test/utils/base64url.browser.ts index f8302c32a493..ff8ce79bedfa 100644 --- a/sdk/attestation/attestation/test/utils/base64url.browser.ts +++ b/sdk/attestation/attestation/test/utils/base64url.browser.ts @@ -5,7 +5,7 @@ /** * Encodes a string in base64 format. - * @param value the string to encode + * @param value - the string to encode */ export function encodeString(value: string): string { return btoa(value); @@ -13,7 +13,7 @@ export function encodeString(value: string): string { /** * Encodes a byte array in base64 format. - * @param value the Uint8Array to encode + * @param value - the Uint8Array to encode */ export function encodeByteArray(value: Uint8Array): string { let str = ""; @@ -25,7 +25,7 @@ export function encodeByteArray(value: Uint8Array): string { /** * Decodes a base64 string into a byte array. - * @param value the base64 string to decode + * @param value - the base64 string to decode */ function decodeStringFromBase64(value: string): Uint8Array { const byteString = atob(value); @@ -38,8 +38,8 @@ function decodeStringFromBase64(value: string): Uint8Array { /** * Adds missing padding to a Base64 encoded string - * @param unpadded The unpadded input string - * @return The padded string + * @param unpadded - The unpadded input string + * @returns The padded string */ function fixPadding(unpadded: string): string { const count = 3 - ((unpadded.length + 3) % 4); @@ -48,7 +48,7 @@ function fixPadding(unpadded: string): string { /** * Decodes a base64url string into a byte array. - * @param value the base64url string to decode + * @param value - the base64url string to decode */ export function decodeString(value: string): Uint8Array { const encoded = value.replace(/-/g, "+").replace(/_/g, "/"); diff --git a/sdk/attestation/attestation/test/utils/base64url.ts b/sdk/attestation/attestation/test/utils/base64url.ts index 8f68c813f809..7c87929d0264 100644 --- a/sdk/attestation/attestation/test/utils/base64url.ts +++ b/sdk/attestation/attestation/test/utils/base64url.ts @@ -3,7 +3,7 @@ /** * Encodes a string in base64 format. - * @param value the string to encode + * @param value - the string to encode */ export function encodeString(value: string): string { return Buffer.from(value).toString("base64"); @@ -11,7 +11,7 @@ export function encodeString(value: string): string { /** * Encodes a byte array in base64 format. - * @param value the Uint8Array to encode + * @param value - the Uint8Array to encode */ export function encodeByteArray(value: Uint8Array): string { // Buffer.from accepts | -- the TypeScript definition is off here @@ -22,7 +22,7 @@ export function encodeByteArray(value: Uint8Array): string { /** * Decodes a base64 string into a byte array. - * @param value the base64 string to decode + * @param value - the base64 string to decode */ function decodeStringFromBase64(value: string): Uint8Array { return Buffer.from(value, "base64"); @@ -30,8 +30,8 @@ function decodeStringFromBase64(value: string): Uint8Array { /** * Adds missing padding to a Base64 encoded string - * @param unpadded The unpadded input string - * @return The padded string + * @param unpadded - The unpadded input string + * @returns The padded string */ function fixPadding(unpadded: string): string { const count = 3 - ((unpadded.length + 3) % 4); @@ -40,7 +40,7 @@ function fixPadding(unpadded: string): string { /** * Decodes a base64url string into a byte array. - * @param value the base64url string to decode + * @param value - the base64url string to decode */ export function decodeString(value: string): Uint8Array { const encoded = value.replace(/-/g, "+").replace(/_/g, "/"); diff --git a/sdk/attestation/attestation/test/utils/decodeJWT.ts b/sdk/attestation/attestation/test/utils/decodeJWT.ts index 1ab5ac719e48..e787f3b468e9 100644 --- a/sdk/attestation/attestation/test/utils/decodeJWT.ts +++ b/sdk/attestation/attestation/test/utils/decodeJWT.ts @@ -2,6 +2,7 @@ // Licensed under the MIT license. // typed implementation of jwsDecode, copied from here: https://github.com/auth0/node-jws/blob/master/lib/verify-stream.js +/* eslint-disable */ import { Buffer } from "./Buffer"; diff --git a/sdk/attestation/attestation/tsdoc.json b/sdk/attestation/attestation/tsdoc.json new file mode 100644 index 000000000000..81c5a8a2aa2f --- /dev/null +++ b/sdk/attestation/attestation/tsdoc.json @@ -0,0 +1,4 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/tsdoc/v0/tsdoc.schema.json", + "extends": ["../../../tsdoc.json"] +}