|
| 1 | +### Description |
| 2 | + |
| 3 | +Refactors and standardizes the Firebase CLI App Check debug token workflow under the unified `appcheck:debugtoken` namespace, aligning directly with the backend REST API (`projects.apps.debugTokens`). |
| 4 | + |
| 5 | +Key changes: |
| 6 | +- Unified command registration in `src/commands/index.ts` under `client.appcheck.debugtoken`. |
| 7 | +- Refactored `appcheck:debugtoken` interactive wizard to discover project/app context dynamically, prompt for display names, and register tokens directly with the App Check backend. |
| 8 | +- Added `appcheck:debugtoken:create` for headless/non-interactive script execution and CI/CD automation pipelines. |
| 9 | +- Implemented `appcheck:debugtoken:list` to render registered tokens in tabular format (`Display Name`, `Resource Name`, `Update Time`) with full backend pagination. |
| 10 | +- Implemented `appcheck:debugtoken:delete` to permanently revoke tokens by ID or resource path, supporting interactive confirmation and `--force` flag overrides. |
| 11 | +- Cleaned up obsolete unlinked handlers (`appcheck-debugtokens-get` and `appcheck-debugtokens-update`). |
| 12 | + |
| 13 | +### Scenarios Tested |
| 14 | + |
| 15 | +- **Interactive Wizard (`appcheck:debugtoken`)**: Tested running with no arguments to verify automatic app detection and interactive choice selection. |
| 16 | +- **Explicit Arguments (`appcheck:debugtoken <appId> <debugToken>`)**: Tested supplying `appId` and `debugToken` positional arguments to confirm prompt skipping. |
| 17 | +- **Display Name Collisions**: Verified interactive confirmation prompt asking whether to overwrite when a token with the same display name already exists. |
| 18 | +- **Headless Creation (`appcheck:debugtoken:create`)**: Verified execution with `--non-interactive` flag using fallback defaults without blocking prompts. |
| 19 | +- **Token Listing (`appcheck:debugtoken:list`)**: Verified table rendering of returned tokens and multi-page pagination handling. |
| 20 | +- **Token Revocation (`appcheck:debugtoken:delete`)**: Tested interactive deletion confirmation as well as non-interactive `--force` deletion. |
| 21 | +- **Build & Test Suite**: Ran `npm run build` and `npx mocha src/appcheck/index.spec.ts` & `src/commands/appcheck-debug.spec.ts` (12/12 unit tests passing). |
| 22 | + |
| 23 | +### Sample Commands |
| 24 | + |
| 25 | +```bash |
| 26 | +# Interactive wizard: Register a token copied from SDK logs |
| 27 | +firebase appcheck:debugtoken 1:1234567890:ios:0a1b2c3d4e5f6a7b8c9d0e e3d9b1a0-cf48-4389-8d19-482a177ffec8 |
| 28 | + |
| 29 | +# Interactive wizard: Auto-detect project & prompt for app selection |
| 30 | +firebase appcheck:debugtoken |
| 31 | + |
| 32 | +# Non-interactive creation for CI/CD pipelines |
| 33 | +firebase appcheck:debugtoken:create 1:1234567890:ios:0a1b2c3d4e5f6a7b8c9d0e e3d9b1a0-cf48-4389-8d19-482a177ffec8 --display-name "CI Runner Token" --non-interactive |
| 34 | + |
| 35 | +# List registered tokens for an app |
| 36 | +firebase appcheck:debugtoken:list 1:1234567890:ios:0a1b2c3d4e5f6a7b8c9d0e |
| 37 | + |
| 38 | +# Delete / revoke a token by ID |
| 39 | +firebase appcheck:debugtoken:delete 1:1234567890:ios:0a1b2c3d4e5f6a7b8c9d0e 7890-abcd --force |
| 40 | +``` |
0 commit comments