Skip to content

Commit 91b7b8a

Browse files
committed
feat(bot): normalize optional license_token fields; sync note with shared copy
1 parent 10e3cda commit 91b7b8a

3 files changed

Lines changed: 11 additions & 5 deletions

File tree

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Closes #____
1313

1414
## Vendored API helper
1515

16-
- [ ] If editing `src/client/licensechainApiNormalize.js`: apply the same change to `LicenseChain-Discord-Bot` and update `api/src/contracts/bot-license-contracts.ts` + tests if shapes change.
16+
- [ ] If editing `src/client/licensechainApiNormalize.js`: mirror the same bytes in `LicenseChain-Discord-Bot`, `Bots/shared/licensechain-api-normalize/index.js`, and `api/src/contracts/bot-license-contracts.ts` + tests if shapes change.
1717

1818
## Verification
1919

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,8 @@ The bot client (`src/client/LicenseChainClient.js`) targets API v1-style routes,
171171
- `GET /v1/apps/:id/licenses`
172172
- `GET /health`
173173

174-
## Vendored API normalize helper
175-
Both bots vendor an identical `src/client/licensechainApiNormalize.js` module to keep Docker builds self-contained (no shared module path). If the normalization logic changes, update both files to be byte-identical.
174+
## API normalize helper (`licensechainApiNormalize.js`)
175+
Vendored at `src/client/licensechainApiNormalize.js` (optional `license_token` / `license_jwks_uri`). The monorepo also keeps a canonical copy under `Bots/shared/licensechain-api-normalize/`**update all copies byte-identically** when the verify response shape changes; keep in sync with `api/src/contracts/bot-license-contracts.ts`.
176176

177177
## Health Endpoints
178178

src/client/licensechainApiNormalize.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
2-
* Vendored copy — keep in sync with:
2+
* Vendored copy — keep byte-identical with:
3+
* - Bots/shared/licensechain-api-normalize/index.js
34
* - Bots/LicenseChain-Discord-Bot/src/client/licensechainApiNormalize.js
4-
* - Bots/LicenseChain-TG-Bot/src/client/licensechainApiNormalize.js
55
* - api/src/contracts/bot-license-contracts.ts
66
*/
77

@@ -56,6 +56,12 @@ function normalizeVerifyPayload(data) {
5656
verificationType: typeof o.verificationType === 'string' ? o.verificationType : o.verificationType,
5757
error: typeof o.error === 'string' ? o.error : o.error,
5858
hardwareId: typeof o.hardwareId === 'string' ? o.hardwareId : o.hardwareId,
59+
license_token: typeof o.license_token === 'string' ? o.license_token : o.license_token,
60+
license_token_expires_at:
61+
typeof o.license_token_expires_at === 'string'
62+
? o.license_token_expires_at
63+
: o.license_token_expires_at,
64+
license_jwks_uri: typeof o.license_jwks_uri === 'string' ? o.license_jwks_uri : o.license_jwks_uri,
5965
};
6066
}
6167

0 commit comments

Comments
 (0)