feat(pl-client): LicensePayload type + decodeLicenseToken + license test - #1776
Open
DenKoren wants to merge 6 commits into
Open
feat(pl-client): LicensePayload type + decodeLicenseToken + license test#1776DenKoren wants to merge 6 commits into
DenKoren wants to merge 6 commits into
Conversation
Define the decoded license-token payload type next to the Maintenance API license() call that returns the raw token, plus a decode helper that validates the required fields. Add a test that pulls the license from a live backend and asserts those fields are always present.
🦋 Changeset detectedLatest commit: 17a7e15 The changes in this PR will be included in the next version bump. This PR includes changesets to release 10 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
It runs at decode time inside decodeLicenseToken, so callers get validation for free — no need to expose it from the package.
'e' (and 'v') describe the short-lived license token, not the license's own validity window: a license valid for a year issued with a 24h token TTL still yields e = issued-at + 86400.
❌ 1 Tests Failed:
View the top 1 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
DenKoren
enabled auto-merge
August 6, 2026 12:53
…ePayload le is the license's own expiration date, independent of e (the short-lived token TTL). Add it to the type, log it in the license test when present.
DenKoren
force-pushed
the
feat/license-payload-type-and-test
branch
from
August 7, 2026 12:38
3ab13a6 to
17a7e15
Compare
blackcat
approved these changes
Aug 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds, in
@milaboratories/pl-client, next to the Maintenance APIlicense()call that returns the raw license token:LicensePayloadtype — the decoded body of a Platforma license token (v,e= expiration,u,mrequired;w/wt/et, monitoring configs, etc. optional). Mirrors the desktop app's local copy and the backendLicensestruct (core/pl/cmd/platforma/license.go).decodeLicenseToken(token)— splits theI.<base64Payload>.<watermark>.<signature>envelope, base64-decodes the payload, and validates required fields (no signature verification — that stays in the desktop's LicenseManager).assertLicensePayload(value)— runtime guard for the required fields.license.test.ts— fetches the license from a live backend (client.license()), decodes it, and asserts the required fields are always present. Also logs the full payload + human-readable expiration, so it doubles as an investigation surface for any backend (point it viaPL_ADDRESS/PL_TEST_USER/PL_TEST_PASSWORD).Why
Puts the license-payload contract next to the code that controls the license communication, and gives us a patchable, backend-agnostic way to inspect a customer's actual license expiration. Supports informing clients about license expiration in advance.
Scope / follow-up
LicensePayloadcopy for now; migrating it to import from pl-client is a separate follow-up (desktop consumes pl-client as a published package, so it can only switch after this ships and the catalog pin is bumped).Test note
license.test.tsrequires a licensed backend to run (it callsclient.license()), same as the existingclient.test.tssuite — it runs in the backend-integration harness, not as a pure unit test.Greptile Summary
Adds public Platforma-license payload types, runtime payload validation, token decoding, and a live-backend contract test to
@milaboratories/pl-client.with_id,no_id, andnonevalues.v,e,u, andmhave their declared primitive types.Confidence Score: 3/5
The PR should not merge until the live-backend test stops exposing complete license payloads in retained test output.
The new decoder and types are generally coherent, but the integration test emits customer and fallback-license data without redaction, and the envelope validator also accepts malformed segment layouts.
Files Needing Attention: lib/node/pl-client/src/core/license.test.ts; lib/node/pl-client/src/core/license.ts
Security Review
The new integration test logs the full decoded license payload, potentially exposing customer identifiers, fallback license credentials, hardware identifiers, and opaque issuer metadata in CI output. How this was verified: The logged object includes every field, while the new type identifies
uas a customer UID andlas a fallback license code.Important Files Changed
Flowchart
%%{init: {'theme': 'neutral'}}%% flowchart LR A[Licensed backend] -->|raw token| B[PlClient.license] B --> C[decodeLicenseToken] C --> D[Validate required field types] D --> E[LicensePayload] E --> F[Consumer] E -->|current integration test| G[Unredacted CI log]Prompt To Fix All With AI
Reviews (1): Last reviewed commit: "feat: add LicensePayload type and decode..." | Re-trigger Greptile
Context used: