From 7d0f026c0602a18dea8fd80828bd5074d1a69c98 Mon Sep 17 00:00:00 2001 From: Christina Holland Date: Thu, 6 May 2021 10:32:54 -0700 Subject: [PATCH 1/3] Fix documentation --- packages/app-check-types/index.d.ts | 20 +++++++++++++++++- packages/firebase/index.d.ts | 32 ++++++++++++++++++++++++++--- 2 files changed, 48 insertions(+), 4 deletions(-) diff --git a/packages/app-check-types/index.d.ts b/packages/app-check-types/index.d.ts index db6acdaa417..65fd20bc1e7 100644 --- a/packages/app-check-types/index.d.ts +++ b/packages/app-check-types/index.d.ts @@ -28,17 +28,35 @@ export interface FirebaseAppCheck { siteKeyOrProvider: string | AppCheckProvider, isTokenAutoRefreshEnabled?: boolean ): void; + + /** + * + * @param isTokenAutoRefreshEnabled - If set to true, enables SDK to + * automatically refresh AppCheck token as needed. If false, disables this + * functionality. This overrides any value set during `activate()`. + */ setTokenAutoRefreshEnabled(isTokenAutoRefreshEnabled: boolean): void; } +/** + * An AppCheck provider. This may be either the built-in reCAPTCHA provider + * or a custom provider. For more on custom providers, see + * https://firebase.google.com/docs/app-check/web-custom-provider + */ interface AppCheckProvider { /** - * returns an AppCheck token + * Returns an AppCheck token. */ getToken(): Promise; } +/** + * The token returned from an `AppCheckProvider`. + */ interface AppCheckToken { + /** + * The token string in JWT format. + */ readonly token: string; /** * The local timestamp after which the token will expire. diff --git a/packages/firebase/index.d.ts b/packages/firebase/index.d.ts index 28f51f54314..5525f010d3f 100644 --- a/packages/firebase/index.d.ts +++ b/packages/firebase/index.d.ts @@ -1469,19 +1469,45 @@ declare namespace firebase.appCheck { export interface AppCheck { /** * Activate AppCheck - * @param siteKeyOrOrovider - reCAPTCHA sitekey or custom token provider + * @param siteKeyOrProvider - reCAPTCHA sitekey or custom token provider + * @param isTokenAutoRefreshEnabled - If true, enables SDK to automatically + * refresh AppCheck token as needed. If undefined, the value will default + * to the value of `app.automaticDataCollectionEnabled`. That property + * defaults to false and can be set in the app config. + */ + activate( + siteKeyOrProvider: string | AppCheckProvider, + isTokenAutoRefreshEnabled?: boolean + ): void; + + /** + * + * @param isTokenAutoRefreshEnabled - If set to true, enables SDK to + * automatically refresh AppCheck token as needed. If false, disables this + * functionality. This overrides any value set during `activate()`. */ - activate(siteKeyOrProvider: string | AppCheckProvider): void; + setTokenAutoRefreshEnabled(isTokenAutoRefreshEnabled: boolean): void; } + /** + * An AppCheck provider. This may be either the built-in reCAPTCHA provider + * or a custom provider. For more on custom providers, see + * https://firebase.google.com/docs/app-check/web-custom-provider + */ interface AppCheckProvider { /** - * returns an AppCheck token + * Returns an AppCheck token. */ getToken(): Promise; } + /** + * The token returned from an `AppCheckProvider`. + */ interface AppCheckToken { + /** + * The token string in JWT format. + */ readonly token: string; /** * The local timestamp after which the token will expire. From 4557fbe739927603ecb9acde919d69a42b3e78c2 Mon Sep 17 00:00:00 2001 From: Christina Holland Date: Thu, 6 May 2021 11:12:30 -0700 Subject: [PATCH 2/3] Fix to jsdoc formatting --- packages/firebase/index.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/firebase/index.d.ts b/packages/firebase/index.d.ts index 5525f010d3f..102090a2b72 100644 --- a/packages/firebase/index.d.ts +++ b/packages/firebase/index.d.ts @@ -1469,8 +1469,8 @@ declare namespace firebase.appCheck { export interface AppCheck { /** * Activate AppCheck - * @param siteKeyOrProvider - reCAPTCHA sitekey or custom token provider - * @param isTokenAutoRefreshEnabled - If true, enables SDK to automatically + * @param siteKeyOrProvider reCAPTCHA sitekey or custom token provider + * @param isTokenAutoRefreshEnabled If true, enables SDK to automatically * refresh AppCheck token as needed. If undefined, the value will default * to the value of `app.automaticDataCollectionEnabled`. That property * defaults to false and can be set in the app config. @@ -1482,7 +1482,7 @@ declare namespace firebase.appCheck { /** * - * @param isTokenAutoRefreshEnabled - If set to true, enables SDK to + * @param isTokenAutoRefreshEnabled If set to true, enables SDK to * automatically refresh AppCheck token as needed. If false, disables this * functionality. This overrides any value set during `activate()`. */ @@ -1502,7 +1502,7 @@ declare namespace firebase.appCheck { } /** - * The token returned from an `AppCheckProvider`. + * The token returned from an {@link firebase.appCheck.AppCheckProvider `AppCheckProvider`}. */ interface AppCheckToken { /** From cf07c735d4d3887b4c9583254302338acc54779a Mon Sep 17 00:00:00 2001 From: Christina Holland Date: Thu, 6 May 2021 11:44:38 -0700 Subject: [PATCH 3/3] Apply suggestions from code review Co-authored-by: Kevin Cheung --- packages/app-check-types/index.d.ts | 8 ++++---- packages/firebase/index.d.ts | 21 +++++++++++---------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/packages/app-check-types/index.d.ts b/packages/app-check-types/index.d.ts index 65fd20bc1e7..16fc46f373f 100644 --- a/packages/app-check-types/index.d.ts +++ b/packages/app-check-types/index.d.ts @@ -31,15 +31,15 @@ export interface FirebaseAppCheck { /** * - * @param isTokenAutoRefreshEnabled - If set to true, enables SDK to - * automatically refresh AppCheck token as needed. If false, disables this - * functionality. This overrides any value set during `activate()`. + * @param isTokenAutoRefreshEnabled - If true, the SDK automatically + * refreshes App Check tokens as needed. This overrides any value set + * during `activate()`. */ setTokenAutoRefreshEnabled(isTokenAutoRefreshEnabled: boolean): void; } /** - * An AppCheck provider. This may be either the built-in reCAPTCHA provider + * An App Check provider. This can be either the built-in reCAPTCHA provider * or a custom provider. For more on custom providers, see * https://firebase.google.com/docs/app-check/web-custom-provider */ diff --git a/packages/firebase/index.d.ts b/packages/firebase/index.d.ts index 102090a2b72..42a9571e714 100644 --- a/packages/firebase/index.d.ts +++ b/packages/firebase/index.d.ts @@ -1469,11 +1469,12 @@ declare namespace firebase.appCheck { export interface AppCheck { /** * Activate AppCheck - * @param siteKeyOrProvider reCAPTCHA sitekey or custom token provider - * @param isTokenAutoRefreshEnabled If true, enables SDK to automatically - * refresh AppCheck token as needed. If undefined, the value will default - * to the value of `app.automaticDataCollectionEnabled`. That property - * defaults to false and can be set in the app config. + * @param siteKeyOrProvider reCAPTCHA v3 site key (public key) or + * custom token provider. + * @param isTokenAutoRefreshEnabled If true, the SDK automatically + * refreshes App Check tokens as needed. If undefined, defaults to the + * value of `app.automaticDataCollectionEnabled`, which defaults to + * false and can be set in the app config. */ activate( siteKeyOrProvider: string | AppCheckProvider, @@ -1482,16 +1483,16 @@ declare namespace firebase.appCheck { /** * - * @param isTokenAutoRefreshEnabled If set to true, enables SDK to - * automatically refresh AppCheck token as needed. If false, disables this - * functionality. This overrides any value set during `activate()`. + * @param isTokenAutoRefreshEnabled If true, the SDK automatically + * refreshes App Check tokens as needed. This overrides any value set + * during `activate()`. */ setTokenAutoRefreshEnabled(isTokenAutoRefreshEnabled: boolean): void; } /** - * An AppCheck provider. This may be either the built-in reCAPTCHA provider - * or a custom provider. For more on custom providers, see + * An App Check provider. This can be either the built-in reCAPTCHA + * provider or a custom provider. For more on custom providers, see * https://firebase.google.com/docs/app-check/web-custom-provider */ interface AppCheckProvider {