cuetra 0.2.0 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli/README.md +21 -15
- package/cli/bin/cuetra.js +6 -5
- package/cli/lib/licence.js +189 -23
- package/cli/lib/pack.js +7 -7
- package/mcp-server/README.md +23 -19
- package/mcp-server/lib/licence.js +189 -23
- package/mcp-server/lib/pack.js +5 -5
- package/mcp-server/lib/tools.js +3 -3
- package/pack/motion/bus.json +1 -1
- package/pack/motion/car.json +1 -1
- package/pack/motion/index.json +1 -1
- package/pack/motion/key.json +1 -1
- package/pack/motion/power.json +1 -1
- package/pack/motion/trash.json +1 -1
- package/pack/motion/x.json +1 -1
- package/pack/tone/bus.json +1 -1
- package/pack/tone/car.json +1 -1
- package/pack/tone/key.json +1 -1
- package/pack/tone/moon.json +1 -1
- package/pack/tone/power.json +1 -1
- package/pack/tone/trash.json +1 -1
- package/pack/tone/users.json +1 -1
- package/pack/tone/x.json +1 -1
- package/package.json +1 -1
- package/src/licence.js +81 -3
package/cli/README.md
CHANGED
|
@@ -16,12 +16,12 @@ node cli/bin/cuetra.js help
|
|
|
16
16
|
- `add` writes the icon's kinetic SVG into `--out` (default `./icons`) and prints its
|
|
17
17
|
motion line. Default keeps all four treatment groups (what the runtime expects);
|
|
18
18
|
`--treatment <name>` extracts one group.
|
|
19
|
-
- `preview` prints the icon's motion map from
|
|
19
|
+
- `preview` prints the icon's motion map from motion.json: archetype, duration,
|
|
20
20
|
amplitude, easing, the full part list, strike timing, coupling and voice.
|
|
21
21
|
- `audit` checks a kinetic SVG file (pack-shipped or customised) against the frozen
|
|
22
22
|
physics bar - 20deg rotation cap incl. followers, visibility floors (rot/skew >= 5deg,
|
|
23
23
|
scale >= 0.10, travel >= 2.0px @24), the 240-420 ms ui band, motion ending exactly at
|
|
24
|
-
rest - and against the motion record its `data-icon` claims (treatments, part
|
|
24
|
+
rest - and against the motion.json record its `data-icon` claims (treatments, part
|
|
25
25
|
counts, per-part delays intact). PASS prints the checked numbers; FAIL lists each
|
|
26
26
|
violated rule and exits non-zero. Strike-on-beat timing is runtime-verified
|
|
27
27
|
separately - not statically checkable from a record + SVG, so audit never judges it.
|
|
@@ -29,7 +29,7 @@ node cli/bin/cuetra.js help
|
|
|
29
29
|
method (icon peak over all parts, PIPE/out/MOTION-CENSUS.md).
|
|
30
30
|
- `--pace ui|showcase` applies the runtime's pace policy (`src/cuetra-motion.js`) to the
|
|
31
31
|
printed duration/amplitude. Every motion value itself is read from the pack's
|
|
32
|
-
motion
|
|
32
|
+
`motion.json` at run time - nothing is duplicated in the CLI.
|
|
33
33
|
- Without a licence key only the free sampler set (`pack/`, 100 icons) is served and the
|
|
34
34
|
CLI says so honestly; a non-free `add` exits non-zero.
|
|
35
35
|
|
|
@@ -42,9 +42,10 @@ node cli/bin/cuetra.js help
|
|
|
42
42
|
| Needs | nothing | `CUETRA_LICENCE_KEY` + the unpacked full pack directory |
|
|
43
43
|
|
|
44
44
|
A key comes from the purchase flow: buy the founding pack at cuetra.com through
|
|
45
|
-
Polar
|
|
46
|
-
Polar keys look like `CUETRA-P-7K2M-9QF3-B9ZX`; Dodo Payments keys are
|
|
47
|
-
five-group codes like `2b1f8e2d-c41e-4e8f-b2d3-d9fd61c38f43
|
|
45
|
+
Polar, Dodo Payments or Creem and the receipt (or cuetra.com/redeem) shows the
|
|
46
|
+
key. Polar keys look like `CUETRA-P-7K2M-9QF3-B9ZX`; Dodo Payments keys are
|
|
47
|
+
five-group codes like `2b1f8e2d-c41e-4e8f-b2d3-d9fd61c38f43`; Creem keys are
|
|
48
|
+
four or five dash-separated groups of uppercase letters and digits (like `ABCDE-FGHIJ-KLMNO-PQRST-UVWXY`) - paste any of the three,
|
|
48
49
|
the CLI routes it to the processor that issued it. The full pack itself is
|
|
49
50
|
delivered at checkout - point `CUETRA_PACK_DIR` (or `--pack`) at the unpacked
|
|
50
51
|
directory you received.
|
|
@@ -55,14 +56,19 @@ A key is read from `--key <key>`, `CUETRA_LICENCE_KEY`, or `cli/licence.json`
|
|
|
55
56
|
|
|
56
57
|
Serving the full pack requires the key to PASS online validation with the
|
|
57
58
|
licence service that issued it - Polar for `CUETRA-...` keys, Dodo Payments for
|
|
58
|
-
its five-group codes
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
59
|
+
its five-group codes, and Creem for its own key format. The Polar and Dodo
|
|
60
|
+
endpoints are public, key-as-credential endpoints - the key itself is the
|
|
61
|
+
credential and no secret ships with the CLI; Creem's licence API needs a
|
|
62
|
+
server-side secret (docs.creem.io), so Creem keys are validated through the
|
|
63
|
+
Cuetra licence proxy - `https://cuetra.com/api/creem-licence` by default,
|
|
64
|
+
overridable with `CUETRA_CREEM_PROXY_URL` (self-hosting, tests). Personal and
|
|
65
|
+
Team keys take one seat on first use (`activate`); Polar Business keys validate
|
|
66
|
+
without consuming a seat, and a Dodo or Creem key of any tier activates once
|
|
67
|
+
per machine and re-validates its stored activation afterwards. A Dodo or Creem
|
|
68
|
+
key spells no tier out, so the tier is read from the product that issued the
|
|
69
|
+
key during the live check and kept in the cache entry. Every successful live
|
|
70
|
+
validation is cached for 7 days in a key-hash-named JSON file under the OS user
|
|
71
|
+
cache dir - never
|
|
66
72
|
inside the repo, and written only after a successful live check - so normal use
|
|
67
73
|
keeps working offline inside that window. Set `CUETRA_LICENCE_CACHE_DIR` to
|
|
68
74
|
move the cache (tests, CI, locked-down machines).
|
|
@@ -73,7 +79,7 @@ Every class is honest and fail-closed to the free set, with the reason on stderr
|
|
|
73
79
|
|---|---|---|
|
|
74
80
|
| `valid` | the issuing service accepted the key just now | served |
|
|
75
81
|
| `cache-valid` | a live check from the last 7 days is reused; no licence server is contacted this run | served, with a notice |
|
|
76
|
-
| `shape-invalid` | the key does not match a known Cuetra shape (Polar or
|
|
82
|
+
| `shape-invalid` | the key does not match a known Cuetra shape (Polar, Dodo or Creem); nothing is sent anywhere | denied |
|
|
77
83
|
| `rejected` | the licence service said no (unknown, revoked, expired, or every seat in use); its reason is shown | denied |
|
|
78
84
|
| `offline-no-cache` | the licence service could not be reached and no fresh validation is cached | denied until one online run |
|
|
79
85
|
|
package/cli/bin/cuetra.js
CHANGED
|
@@ -43,11 +43,12 @@ Licence:
|
|
|
43
43
|
variable, or cli/licence.json ({"key": "..."}). A full pack (--pack or
|
|
44
44
|
CUETRA_PACK_DIR, the unpacked pack you received) is paid content: serving it
|
|
45
45
|
requires the key to PASS online validation with the processor that issued it -
|
|
46
|
-
Polar (CUETRA-... keys)
|
|
47
|
-
services the site's redeem flow uses. Personal and
|
|
48
|
-
first use; every successful validation is cached
|
|
49
|
-
works offline within that window. A malformed key,
|
|
50
|
-
network and no fresh cache falls back to the free set and
|
|
46
|
+
Polar (CUETRA-... keys), Dodo Payments (five-group keys) or Creem (its own key format
|
|
47
|
+
keys), the same licence services the site's redeem flow uses. Personal and
|
|
48
|
+
Team keys take one seat on first use; every successful validation is cached
|
|
49
|
+
for 7 days, so normal use works offline within that window. A malformed key,
|
|
50
|
+
a rejection, or no network and no fresh cache falls back to the free set and
|
|
51
|
+
says exactly why.
|
|
51
52
|
|
|
52
53
|
Pace:
|
|
53
54
|
--pace ui (default) reports the shipped 240-420 ms band; --pace showcase applies
|
package/cli/lib/licence.js
CHANGED
|
@@ -8,14 +8,18 @@
|
|
|
8
8
|
// 1. shape check - the tier-aware parseKey from src/licence.js. A key that
|
|
9
9
|
// does not parse is never sent anywhere. The parser also routes the key:
|
|
10
10
|
// CUETRA-... shapes (and the legacy shape) belong to Polar, UUIDs belong
|
|
11
|
-
// to Dodo Payments
|
|
11
|
+
// to Dodo Payments (the second processor, owner order 2026-11-28), and
|
|
12
|
+
// four dash-separated uppercase alnum groups belong to Creem (the third
|
|
13
|
+
// processor, owner order 2026-11-29); the shape classes are disjoint, so
|
|
14
|
+
// an existing provider's key never routes to Creem or back.
|
|
12
15
|
// 2. offline cache - one small JSON file per key under the OS user cache
|
|
13
16
|
// dir (key-hash-named, never inside the repo), trusted for 7 days and
|
|
14
17
|
// written ONLY after a successful live validation. The cached entry also
|
|
15
|
-
// carries the tier for Dodo keys, whose key
|
|
16
|
-
//
|
|
17
|
-
//
|
|
18
|
-
//
|
|
18
|
+
// carries the tier for Dodo and Creem keys, whose key strings spell no
|
|
19
|
+
// tier out.
|
|
20
|
+
// 3. live POST to the issuing processor - the Polar and Dodo endpoints are
|
|
21
|
+
// public, key-as-credential endpoints, so the key itself is the
|
|
22
|
+
// credential and no secret ships in this package:
|
|
19
23
|
// - Polar: the same unauthenticated customer-portal endpoints
|
|
20
24
|
// cuetra.com/redeem uses, with the same organization id, Polar version
|
|
21
25
|
// and per-tier benefit ids. Personal and Team keys (activation-limited
|
|
@@ -30,6 +34,17 @@
|
|
|
30
34
|
// reply names the issuing product, which is the only place a Dodo key's
|
|
31
35
|
// tier can come from. The reply's customer contact details are never
|
|
32
36
|
// extracted, cached or printed.
|
|
37
|
+
// - Creem: the Cuetra licence proxy, https://cuetra.com/api/creem-licence
|
|
38
|
+
// by default (functions/api/creem-licence.js). Creem's licence API
|
|
39
|
+
// needs a server-side secret (docs.creem.io), so no shipped package can
|
|
40
|
+
// call Creem directly: the proxy takes POST
|
|
41
|
+
// {action:"activate"|"validate", key, instanceName}, holds the secret,
|
|
42
|
+
// and answers with Creem's JSON verbatim, failing closed. The base URL
|
|
43
|
+
// is configurable with CUETRA_CREEM_PROXY_URL (self-hosting, tests, the
|
|
44
|
+
// mock-proxy harness); an unset or malformed override falls back to the
|
|
45
|
+
// documented default. Activation mirrors the Dodo pattern: one seat on
|
|
46
|
+
// first contact, re-validate afterwards, and the tier is read from the
|
|
47
|
+
// product named in the reply (CREEM_PRODUCT_BY_TIER in src/licence.js).
|
|
33
48
|
//
|
|
34
49
|
// validateLicence never throws for the expected classes; it returns
|
|
35
50
|
// { status, detail } where status is one of:
|
|
@@ -47,7 +62,7 @@ import { createHash } from "node:crypto";
|
|
|
47
62
|
import fs from "node:fs";
|
|
48
63
|
import os from "node:os";
|
|
49
64
|
import path from "node:path";
|
|
50
|
-
import { TIER_NAME, parseKey } from "../../src/licence.js";
|
|
65
|
+
import { TIER_NAME, parseKey, creemProductId, creemTierForProduct, creemInstanceId } from "../../src/licence.js";
|
|
51
66
|
|
|
52
67
|
// Endpoints, org id, API version and per-tier benefit ids are the public
|
|
53
68
|
// constants the site's redeem flow already ships (src/redeem.js). They are
|
|
@@ -78,6 +93,23 @@ const DODO_PRODUCT_BY_TIER = {
|
|
|
78
93
|
business: "pdt_0NstEaiJQWZCJqddcNos2",
|
|
79
94
|
};
|
|
80
95
|
|
|
96
|
+
// Creem, the third processor. Its licence API needs a server-side API key
|
|
97
|
+
// (docs.creem.io), so the CLI posts to the Cuetra proxy instead of to Creem.
|
|
98
|
+
// CUETRA_CREEM_PROXY_URL overrides the base URL (self-hosting, tests, the
|
|
99
|
+
// mock-proxy harness); an unset, empty or non-http(s) override falls back to
|
|
100
|
+
// the documented default, so a broken override cannot misroute the POST - it
|
|
101
|
+
// either reaches the real proxy or fails closed as unreachable.
|
|
102
|
+
const CREEM_PROXY_DEFAULT = "https://cuetra.com/api/creem-licence";
|
|
103
|
+
function creemProxyUrl() {
|
|
104
|
+
const override = (process.env.CUETRA_CREEM_PROXY_URL || "").trim();
|
|
105
|
+
if (/^https?:\/\//i.test(override)) return override;
|
|
106
|
+
return CREEM_PROXY_DEFAULT;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// Provider labels for every user-facing message; the keys are the provider
|
|
110
|
+
// ids parseKey returns.
|
|
111
|
+
const SERVICE_BY_PROVIDER = { polar: "Polar", dodo: "Dodo Payments", creem: "Creem" };
|
|
112
|
+
|
|
81
113
|
const CACHE_VERSION = 1;
|
|
82
114
|
const CACHE_TTL_MS = 7 * 24 * 60 * 60 * 1000; // one live validation is trusted for 7 days
|
|
83
115
|
const REQUEST_TIMEOUT_MS = 10000;
|
|
@@ -382,14 +414,145 @@ async function liveDodo(normalized, cachedActivationId) {
|
|
|
382
414
|
}
|
|
383
415
|
}
|
|
384
416
|
|
|
417
|
+
// One POST to the Creem proxy. Same shape as dodoPost: HTTP status, a
|
|
418
|
+
// sanitized detail, and ONLY the licence-relevant fields out of the body. The
|
|
419
|
+
// reply is Creem's JSON verbatim (the proxy does not rewrite it); only the
|
|
420
|
+
// product id, the activation id and the licence status are read - the reply's
|
|
421
|
+
// customer fields are never extracted, cached or printed.
|
|
422
|
+
async function creemPost(action, normalized, instanceId) {
|
|
423
|
+
// activate names the new instance; validate must carry the instance id
|
|
424
|
+
// activate returned (Creem's validate requires instance_id).
|
|
425
|
+
const payload =
|
|
426
|
+
action === "activate"
|
|
427
|
+
? { action, key: normalized, instanceName: `${ACTIVATION_PREFIX} ${os.hostname()}` }
|
|
428
|
+
: { action, key: normalized, instanceId };
|
|
429
|
+
const response = await fetch(creemProxyUrl(), {
|
|
430
|
+
method: "POST",
|
|
431
|
+
headers: { "Content-Type": "application/json" },
|
|
432
|
+
body: JSON.stringify(payload),
|
|
433
|
+
signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS),
|
|
434
|
+
});
|
|
435
|
+
let parsed = null;
|
|
436
|
+
let detail = "";
|
|
437
|
+
try {
|
|
438
|
+
parsed = await response.json();
|
|
439
|
+
const raw =
|
|
440
|
+
typeof parsed?.error === "string" ? parsed.error :
|
|
441
|
+
typeof parsed?.message === "string" ? parsed.message :
|
|
442
|
+
typeof parsed?.detail === "string" ? parsed.detail : "";
|
|
443
|
+
// The key must never appear in a detail string that ends up in a log.
|
|
444
|
+
detail = String(raw).slice(0, MAX_DETAIL_CHARS).split(normalized).join(maskKey(normalized)).trim();
|
|
445
|
+
} catch {
|
|
446
|
+
detail = ""; // a non-JSON body (proxy error page) reads as no detail
|
|
447
|
+
}
|
|
448
|
+
return {
|
|
449
|
+
status: response.status,
|
|
450
|
+
ok: response.ok,
|
|
451
|
+
detail,
|
|
452
|
+
productId: creemProductId(parsed),
|
|
453
|
+
// Creem's `activation` is a COUNT (number); the id to persist is the
|
|
454
|
+
// licence instance id returned under `instance`.
|
|
455
|
+
activationId: creemInstanceId(parsed),
|
|
456
|
+
licenceStatus: typeof parsed?.status === "string" ? parsed.status : null,
|
|
457
|
+
};
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
// One live Creem round for a parsed key, through the proxy. Returns exactly
|
|
461
|
+
// one of:
|
|
462
|
+
// { kind: "valid", activationId, tier } the proxy relayed a Creem yes
|
|
463
|
+
// (tier from the issuing product)
|
|
464
|
+
// { kind: "rejected", detail, seatLimit } Creem, via the proxy, said no
|
|
465
|
+
// { kind: "unreachable" } the proxy could not be reached
|
|
466
|
+
async function liveCreem(normalized, cachedActivationId) {
|
|
467
|
+
// A 2xx only counts when the licence is actually active and the issuing
|
|
468
|
+
// product maps to a Cuetra tier; anything else is a rejection. The
|
|
469
|
+
// fail-closed bar: only an active, mapped licence opens paid content.
|
|
470
|
+
function verdict(response, activationId) {
|
|
471
|
+
// status is a required LicenseEntity field: a missing status is not
|
|
472
|
+
// "active", so it never opens the gate.
|
|
473
|
+
if (response.licenceStatus !== "active") {
|
|
474
|
+
return {
|
|
475
|
+
kind: "rejected",
|
|
476
|
+
detail: response.detail || `the licence reported status "${response.licenceStatus || "unknown"}"`,
|
|
477
|
+
seatLimit: false,
|
|
478
|
+
};
|
|
479
|
+
}
|
|
480
|
+
const tier = creemTierForProduct(response.productId);
|
|
481
|
+
if (!tier) {
|
|
482
|
+
// Fail-closed: an accepted key for an unknown product unlocks nothing.
|
|
483
|
+
return {
|
|
484
|
+
kind: "rejected",
|
|
485
|
+
detail: "the key was accepted, but it does not belong to a Cuetra product - email hello@cuetra.com with your receipt",
|
|
486
|
+
seatLimit: false,
|
|
487
|
+
};
|
|
488
|
+
}
|
|
489
|
+
return { kind: "valid", activationId, tier };
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
async function activateOnce() {
|
|
493
|
+
const response = await creemPost("activate", normalized);
|
|
494
|
+
if (response.ok) {
|
|
495
|
+
const result = verdict(response, response.activationId);
|
|
496
|
+
// Without an instance id no later validate is possible, so the next
|
|
497
|
+
// refresh would take another seat. Fail closed instead of leaking seats.
|
|
498
|
+
if (result.kind === "valid" && !response.activationId) {
|
|
499
|
+
return { kind: "rejected", detail: "the licence server did not return an activation id - email hello@cuetra.com", seatLimit: false };
|
|
500
|
+
}
|
|
501
|
+
return result;
|
|
502
|
+
}
|
|
503
|
+
// A 4xx from the fail-closed proxy is a verdict on the key (unknown,
|
|
504
|
+
// revoked or seat-limited); 5xx/429 means nobody spoke for the key, which
|
|
505
|
+
// is the unreachable class - same split the Dodo branch makes.
|
|
506
|
+
if (response.status >= 400 && response.status < 500) {
|
|
507
|
+
return {
|
|
508
|
+
kind: "rejected",
|
|
509
|
+
detail: response.detail,
|
|
510
|
+
seatLimit: response.status === 403 || response.status === 422 || /limit/i.test(response.detail),
|
|
511
|
+
};
|
|
512
|
+
}
|
|
513
|
+
return { kind: "unreachable" };
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
async function validateOnce() {
|
|
517
|
+
const response = await creemPost("validate", normalized, cachedActivationId);
|
|
518
|
+
if (response.ok) return verdict(response, cachedActivationId);
|
|
519
|
+
if (response.status >= 400 && response.status < 500) {
|
|
520
|
+
return { kind: "rejected", detail: response.detail, seatLimit: false };
|
|
521
|
+
}
|
|
522
|
+
return { kind: "unreachable" };
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
try {
|
|
526
|
+
if (cachedActivationId) {
|
|
527
|
+
// Refresh path: re-validate so a re-check never takes a second seat.
|
|
528
|
+
// If the stored activation is gone (the buyer freed the device), one
|
|
529
|
+
// activate attempt re-takes the freed slot; a revoked key still ends as
|
|
530
|
+
// rejected by that same call.
|
|
531
|
+
const result = await validateOnce();
|
|
532
|
+
if (result.kind !== "rejected") return result;
|
|
533
|
+
const retry = await activateOnce();
|
|
534
|
+
if (retry.kind === "rejected") {
|
|
535
|
+
return { kind: "rejected", detail: retry.detail || result.detail, seatLimit: retry.seatLimit };
|
|
536
|
+
}
|
|
537
|
+
return retry;
|
|
538
|
+
}
|
|
539
|
+
// First contact: take an activation, as redeem does.
|
|
540
|
+
return await activateOnce();
|
|
541
|
+
} catch {
|
|
542
|
+
// fetch only throws for transport-level failures; that is "unreachable",
|
|
543
|
+
// never "rejected" - the proxy said nothing at all.
|
|
544
|
+
return { kind: "unreachable" };
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
|
|
385
548
|
function rejectedDetail(rawKey, live, provider) {
|
|
386
549
|
const mask = maskKey(rawKey);
|
|
387
|
-
const service = provider
|
|
550
|
+
const service = SERVICE_BY_PROVIDER[provider] || "the licence service";
|
|
388
551
|
if (live.seatLimit) {
|
|
389
552
|
const seatAdvice =
|
|
390
|
-
provider === "
|
|
391
|
-
? "
|
|
392
|
-
: "
|
|
553
|
+
provider === "polar"
|
|
554
|
+
? "Deactivate an old device in your Polar customer portal and re-run, or upgrade at cuetra.com/pricing"
|
|
555
|
+
: "Email hello@cuetra.com to free an old device and re-run, or upgrade at cuetra.com/pricing";
|
|
393
556
|
return (
|
|
394
557
|
`${service} rejected the key ${mask}: every activation of this key is already in use` +
|
|
395
558
|
`${live.detail ? ` (${live.detail})` : ""}. ${seatAdvice}`
|
|
@@ -401,8 +564,9 @@ function rejectedDetail(rawKey, live, provider) {
|
|
|
401
564
|
);
|
|
402
565
|
}
|
|
403
566
|
|
|
404
|
-
// Polar keys spell the tier out; a Dodo key's tier lives in the
|
|
405
|
-
// result (or the cache), so anything unknown falls back to the
|
|
567
|
+
// Polar keys spell the tier out; a Dodo or Creem key's tier lives in the
|
|
568
|
+
// validation result (or the cache), so anything unknown falls back to the
|
|
569
|
+
// plain name.
|
|
406
570
|
function tierName(tier) {
|
|
407
571
|
return TIER_NAME[tier] || "Cuetra licence";
|
|
408
572
|
}
|
|
@@ -419,23 +583,23 @@ export async function validateLicence(rawKey) {
|
|
|
419
583
|
if (!parsed) {
|
|
420
584
|
return {
|
|
421
585
|
status: "shape-invalid",
|
|
422
|
-
detail: `the key ${maskKey(rawKey)} did not match the Cuetra key shapes (Polar's CUETRA
|
|
586
|
+
detail: `the key ${maskKey(rawKey)} did not match the Cuetra key shapes (Polar's CUETRA-..., Dodo Payments' five-group code, or Creem's key format), so it was not sent anywhere - copy the key again from your receipt or cuetra.com/redeem`,
|
|
423
587
|
};
|
|
424
588
|
}
|
|
425
589
|
|
|
426
|
-
const provider = parsed.provider; // "polar" | "dodo"
|
|
427
|
-
// Polar keys are sent upper-cased; Dodo UUIDs lower-cased, exactly
|
|
428
|
-
// parseKey normalised them, so the cache hash and the wire format agree.
|
|
590
|
+
const provider = parsed.provider; // "polar" | "dodo" | "creem"
|
|
591
|
+
// Polar and Creem keys are sent upper-cased; Dodo UUIDs lower-cased, exactly
|
|
592
|
+
// as parseKey normalised them, so the cache hash and the wire format agree.
|
|
429
593
|
const normalized = provider === "dodo" ? parsed.key : normalizeKey(rawKey);
|
|
430
|
-
const service = provider
|
|
431
|
-
const serviceHost = provider === "dodo" ? DODO_API_BASE : POLAR_API_BASE;
|
|
594
|
+
const service = SERVICE_BY_PROVIDER[provider] || "the licence service";
|
|
595
|
+
const serviceHost = provider === "dodo" ? DODO_API_BASE : provider === "creem" ? creemProxyUrl() : POLAR_API_BASE;
|
|
432
596
|
|
|
433
597
|
const cached = readCacheEntry(normalized);
|
|
434
598
|
const cacheAge = cached ? Date.now() - cached.validatedAt : null;
|
|
435
599
|
|
|
436
600
|
if (cached && cacheAge <= CACHE_TTL_MS) {
|
|
437
|
-
// A Dodo key spells no tier out, so the cached live validation
|
|
438
|
-
// a Polar key already knows its own.
|
|
601
|
+
// A Dodo or Creem key spells no tier out, so the cached live validation
|
|
602
|
+
// names it; a Polar key already knows its own.
|
|
439
603
|
const tier = parsed.tier || cached.tier;
|
|
440
604
|
return {
|
|
441
605
|
status: "cache-valid",
|
|
@@ -449,11 +613,13 @@ export async function validateLicence(rawKey) {
|
|
|
449
613
|
const live =
|
|
450
614
|
provider === "dodo"
|
|
451
615
|
? await liveDodo(normalized, cached ? cached.activationId : null)
|
|
452
|
-
:
|
|
616
|
+
: provider === "creem"
|
|
617
|
+
? await liveCreem(normalized, cached ? cached.activationId : null)
|
|
618
|
+
: await liveValidate(normalized, parsed, cached ? cached.activationId : null);
|
|
453
619
|
|
|
454
620
|
if (live.kind === "valid") {
|
|
455
|
-
// The tier of a Dodo key comes from the activation reply; on a
|
|
456
|
-
// that only re-validated, the earlier cached tier still names it.
|
|
621
|
+
// The tier of a Dodo or Creem key comes from the activation reply; on a
|
|
622
|
+
// refresh that only re-validated, the earlier cached tier still names it.
|
|
457
623
|
const tier = live.tier || parsed.tier || (cached ? cached.tier : null);
|
|
458
624
|
const wrote = writeCacheEntry(normalized, tier, live.activationId);
|
|
459
625
|
const cacheNote = wrote ? "" : " (the offline cache could not be written, so the next run needs the network again)";
|
package/cli/lib/pack.js
CHANGED
|
@@ -22,11 +22,11 @@ export const TREATMENTS = ["outline", "solid", "duotone", "glass"];
|
|
|
22
22
|
|
|
23
23
|
// A licence key arrives as a personal string from checkout (see licence.html).
|
|
24
24
|
// Resolving it is only the first step: serving paid content requires the key
|
|
25
|
-
// to pass online validation with the processor that issued it - Polar
|
|
26
|
-
// Payments (lib/licence.js - live check, or a cached live check from
|
|
27
|
-
// 7 days). The shape check from src/licence.js (Polar, Dodo or
|
|
28
|
-
// legacy keys checksum-verified) decides early notes and never
|
|
29
|
-
// malformed key near the network.
|
|
25
|
+
// to pass online validation with the processor that issued it - Polar, Dodo
|
|
26
|
+
// Payments or Creem (lib/licence.js - live check, or a cached live check from
|
|
27
|
+
// the last 7 days). The shape check from src/licence.js (Polar, Dodo, Creem or
|
|
28
|
+
// legacy shape, legacy keys checksum-verified) decides early notes and never
|
|
29
|
+
// lets a malformed key near the network.
|
|
30
30
|
export function resolveLicenceKey({ flagKey, cliDir }) {
|
|
31
31
|
if (flagKey) return flagKey;
|
|
32
32
|
if (process.env.CUETRA_LICENCE_KEY) return process.env.CUETRA_LICENCE_KEY;
|
|
@@ -268,7 +268,7 @@ export async function resolvePack({ packFlag, licenceKey }) {
|
|
|
268
268
|
return {
|
|
269
269
|
pack: loadPack(FREE_PACK_DIR),
|
|
270
270
|
source: "free sampler set",
|
|
271
|
-
note: `licence key ${maskKey(licenceKey)} matches the Cuetra shape, but no full pack is configured, so it was not validated - the key is checked online (Polar
|
|
271
|
+
note: `licence key ${maskKey(licenceKey)} matches the Cuetra shape, but no full pack is configured, so it was not validated - the key is checked online (Polar, Dodo Payments or Creem, whichever issued it) when a pack is served. Set CUETRA_PACK_DIR (or use --pack) to the unpacked full pack to serve all 6,646 icons`,
|
|
272
272
|
licensed: false,
|
|
273
273
|
};
|
|
274
274
|
}
|
|
@@ -278,7 +278,7 @@ export async function resolvePack({ packFlag, licenceKey }) {
|
|
|
278
278
|
return {
|
|
279
279
|
pack: loadPack(FREE_PACK_DIR),
|
|
280
280
|
source: "free sampler set",
|
|
281
|
-
note: "the key did not match a known Cuetra key shape (Polar
|
|
281
|
+
note: "the key did not match a known Cuetra key shape (Polar, Dodo Payments or Creem) — serving the free set",
|
|
282
282
|
licensed: false,
|
|
283
283
|
};
|
|
284
284
|
}
|
package/mcp-server/README.md
CHANGED
|
@@ -30,15 +30,16 @@ Tools (as planned on `mcp.html`):
|
|
|
30
30
|
|
|
31
31
|
| | No key (free) | With a validated key |
|
|
32
32
|
|---|---|---|
|
|
33
|
-
| Icons served | bundled free sampler set (`pack/`, 100 icons) | the full pack from `CUETRA_PACK_DIR` (6,646 icons) |
|
|
33
|
+
| Icons served | bundled free sampler set (`mcp-server/pack/`, 100 icons) | the full pack from `CUETRA_PACK_DIR` (6,646 icons) |
|
|
34
34
|
| Network | never - no request is made | one online licence check at startup, or none while the 7-day cache is fresh |
|
|
35
35
|
| Needs | nothing | `CUETRA_LICENCE_KEY` + `CUETRA_PACK_DIR` pointing at the unpacked full pack |
|
|
36
36
|
|
|
37
37
|
A key comes from the purchase flow: buy the founding pack at cuetra.com through
|
|
38
|
-
Polar
|
|
39
|
-
Polar keys look like `CUETRA-P-7K2M-9QF3-B9ZX`; Dodo Payments keys are
|
|
40
|
-
five-group codes like `2b1f8e2d-c41e-4e8f-b2d3-d9fd61c38f43
|
|
41
|
-
|
|
38
|
+
Polar, Dodo Payments or Creem and the receipt (or cuetra.com/redeem) shows the
|
|
39
|
+
key. Polar keys look like `CUETRA-P-7K2M-9QF3-B9ZX`; Dodo Payments keys are
|
|
40
|
+
five-group codes like `2b1f8e2d-c41e-4e8f-b2d3-d9fd61c38f43`; Creem keys are
|
|
41
|
+
four or five dash-separated groups of uppercase letters and digits (like `ABCDE-FGHIJ-KLMNO-PQRST-UVWXY`) - paste any of the three,
|
|
42
|
+
the server routes it to the processor that issued it. The full pack itself
|
|
42
43
|
is delivered at checkout - point `CUETRA_PACK_DIR` at the unpacked directory
|
|
43
44
|
you received.
|
|
44
45
|
|
|
@@ -46,14 +47,19 @@ you received.
|
|
|
46
47
|
|
|
47
48
|
Paid access requires BOTH `CUETRA_LICENCE_KEY` and `CUETRA_PACK_DIR`, and the key must
|
|
48
49
|
PASS online validation with the licence service that issued it - Polar for
|
|
49
|
-
`CUETRA-...` keys, Dodo Payments for its five-group codes
|
|
50
|
-
key
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
50
|
+
`CUETRA-...` keys, Dodo Payments for its five-group codes, and Creem for its
|
|
51
|
+
its own key format. The Polar and Dodo endpoints are public key-as-credential
|
|
52
|
+
endpoints, the key itself is the credential and no secret ships with this
|
|
53
|
+
server; Creem's licence API needs a server-side secret (docs.creem.io), so
|
|
54
|
+
Creem keys are validated through the Cuetra licence proxy -
|
|
55
|
+
`https://cuetra.com/api/creem-licence` by default, overridable with
|
|
56
|
+
`CUETRA_CREEM_PROXY_URL` (self-hosting, tests). Personal and Team keys take one
|
|
57
|
+
seat on first use (`activate`); Polar Business keys validate without consuming
|
|
58
|
+
a seat, and a Dodo or Creem key of any tier activates once per machine and
|
|
59
|
+
re-validates its stored activation afterwards. A Dodo or Creem key spells no
|
|
60
|
+
tier out, so the tier is read from the product that issued the key during the
|
|
61
|
+
live check and kept in the cache entry. Every successful live validation is
|
|
62
|
+
cached for 7 days in a
|
|
57
63
|
key-hash-named JSON file under the OS user cache dir - never inside the repo,
|
|
58
64
|
and written only after a successful live check - so an offline start inside the
|
|
59
65
|
window still serves the full pack. Set `CUETRA_LICENCE_CACHE_DIR` to move the
|
|
@@ -66,15 +72,13 @@ notes; a paid icon name then gets the free-set refusal, never paid content:
|
|
|
66
72
|
|---|---|---|
|
|
67
73
|
| `valid` | the issuing service accepted the key just now | served |
|
|
68
74
|
| `cache-valid` | a live check from the last 7 days is reused; no licence server is contacted this run | served, with a notice |
|
|
69
|
-
| `shape-invalid` | the key does not match a known Cuetra shape (Polar or
|
|
75
|
+
| `shape-invalid` | the key does not match a known Cuetra shape (Polar, Dodo or Creem); nothing is sent anywhere | denied |
|
|
70
76
|
| `rejected` | the licence service said no (unknown, revoked, expired, or every seat in use); its reason is shown | denied |
|
|
71
77
|
| `offline-no-cache` | the licence service could not be reached and no fresh validation is cached | denied until one online start |
|
|
72
78
|
|
|
73
79
|
Keys are masked in every note and error (`CUET...(23 chars)`); the full key never
|
|
74
80
|
appears in server output.
|
|
75
81
|
|
|
76
|
-
Data source: the served pack directory. Default is the bundled free set
|
|
77
|
-
package
|
|
78
|
-
|
|
79
|
-
`motion/<name>.json` per icon, with `tone/<name>.json` merged when present).
|
|
80
|
-
Diagnostics go to stderr; stdout carries protocol messages only.
|
|
82
|
+
Data source: the served pack directory. Default is the bundled free set inside this
|
|
83
|
+
package, so the path is portable. All motion values come from the pack's `motion.json`
|
|
84
|
+
at run time. Diagnostics go to stderr; stdout carries protocol messages only.
|
|
@@ -8,14 +8,18 @@
|
|
|
8
8
|
// 1. shape check - the tier-aware parseKey from src/licence.js. A key that
|
|
9
9
|
// does not parse is never sent anywhere. The parser also routes the key:
|
|
10
10
|
// CUETRA-... shapes (and the legacy shape) belong to Polar, UUIDs belong
|
|
11
|
-
// to Dodo Payments
|
|
11
|
+
// to Dodo Payments (the second processor, owner order 2026-11-28), and
|
|
12
|
+
// four dash-separated uppercase alnum groups belong to Creem (the third
|
|
13
|
+
// processor, owner order 2026-11-29); the shape classes are disjoint, so
|
|
14
|
+
// an existing provider's key never routes to Creem or back.
|
|
12
15
|
// 2. offline cache - one small JSON file per key under the OS user cache
|
|
13
16
|
// dir (key-hash-named, never inside the repo), trusted for 7 days and
|
|
14
17
|
// written ONLY after a successful live validation. The cached entry also
|
|
15
|
-
// carries the tier for Dodo keys, whose key
|
|
16
|
-
//
|
|
17
|
-
//
|
|
18
|
-
//
|
|
18
|
+
// carries the tier for Dodo and Creem keys, whose key strings spell no
|
|
19
|
+
// tier out.
|
|
20
|
+
// 3. live POST to the issuing processor - the Polar and Dodo endpoints are
|
|
21
|
+
// public, key-as-credential endpoints, so the key itself is the
|
|
22
|
+
// credential and no secret ships in this package:
|
|
19
23
|
// - Polar: the same unauthenticated customer-portal endpoints
|
|
20
24
|
// cuetra.com/redeem uses, with the same organization id, Polar version
|
|
21
25
|
// and per-tier benefit ids. Personal and Team keys (activation-limited
|
|
@@ -30,6 +34,17 @@
|
|
|
30
34
|
// reply names the issuing product, which is the only place a Dodo key's
|
|
31
35
|
// tier can come from. The reply's customer contact details are never
|
|
32
36
|
// extracted, cached or printed.
|
|
37
|
+
// - Creem: the Cuetra licence proxy, https://cuetra.com/api/creem-licence
|
|
38
|
+
// by default (functions/api/creem-licence.js). Creem's licence API
|
|
39
|
+
// needs a server-side secret (docs.creem.io), so no shipped package can
|
|
40
|
+
// call Creem directly: the proxy takes POST
|
|
41
|
+
// {action:"activate"|"validate", key, instanceName}, holds the secret,
|
|
42
|
+
// and answers with Creem's JSON verbatim, failing closed. The base URL
|
|
43
|
+
// is configurable with CUETRA_CREEM_PROXY_URL (self-hosting, tests, the
|
|
44
|
+
// mock-proxy harness); an unset or malformed override falls back to the
|
|
45
|
+
// documented default. Activation mirrors the Dodo pattern: one seat on
|
|
46
|
+
// first contact, re-validate afterwards, and the tier is read from the
|
|
47
|
+
// product named in the reply (CREEM_PRODUCT_BY_TIER in src/licence.js).
|
|
33
48
|
//
|
|
34
49
|
// validateLicence never throws for the expected classes; it returns
|
|
35
50
|
// { status, detail } where status is one of:
|
|
@@ -47,7 +62,7 @@ import { createHash } from "node:crypto";
|
|
|
47
62
|
import fs from "node:fs";
|
|
48
63
|
import os from "node:os";
|
|
49
64
|
import path from "node:path";
|
|
50
|
-
import { TIER_NAME, parseKey } from "../../src/licence.js";
|
|
65
|
+
import { TIER_NAME, parseKey, creemProductId, creemTierForProduct, creemInstanceId } from "../../src/licence.js";
|
|
51
66
|
|
|
52
67
|
// Endpoints, org id, API version and per-tier benefit ids are the public
|
|
53
68
|
// constants the site's redeem flow already ships (src/redeem.js). They are
|
|
@@ -78,6 +93,23 @@ const DODO_PRODUCT_BY_TIER = {
|
|
|
78
93
|
business: "pdt_0NstEaiJQWZCJqddcNos2",
|
|
79
94
|
};
|
|
80
95
|
|
|
96
|
+
// Creem, the third processor. Its licence API needs a server-side API key
|
|
97
|
+
// (docs.creem.io), so the CLI posts to the Cuetra proxy instead of to Creem.
|
|
98
|
+
// CUETRA_CREEM_PROXY_URL overrides the base URL (self-hosting, tests, the
|
|
99
|
+
// mock-proxy harness); an unset, empty or non-http(s) override falls back to
|
|
100
|
+
// the documented default, so a broken override cannot misroute the POST - it
|
|
101
|
+
// either reaches the real proxy or fails closed as unreachable.
|
|
102
|
+
const CREEM_PROXY_DEFAULT = "https://cuetra.com/api/creem-licence";
|
|
103
|
+
function creemProxyUrl() {
|
|
104
|
+
const override = (process.env.CUETRA_CREEM_PROXY_URL || "").trim();
|
|
105
|
+
if (/^https?:\/\//i.test(override)) return override;
|
|
106
|
+
return CREEM_PROXY_DEFAULT;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// Provider labels for every user-facing message; the keys are the provider
|
|
110
|
+
// ids parseKey returns.
|
|
111
|
+
const SERVICE_BY_PROVIDER = { polar: "Polar", dodo: "Dodo Payments", creem: "Creem" };
|
|
112
|
+
|
|
81
113
|
const CACHE_VERSION = 1;
|
|
82
114
|
const CACHE_TTL_MS = 7 * 24 * 60 * 60 * 1000; // one live validation is trusted for 7 days
|
|
83
115
|
const REQUEST_TIMEOUT_MS = 10000;
|
|
@@ -382,14 +414,145 @@ async function liveDodo(normalized, cachedActivationId) {
|
|
|
382
414
|
}
|
|
383
415
|
}
|
|
384
416
|
|
|
417
|
+
// One POST to the Creem proxy. Same shape as dodoPost: HTTP status, a
|
|
418
|
+
// sanitized detail, and ONLY the licence-relevant fields out of the body. The
|
|
419
|
+
// reply is Creem's JSON verbatim (the proxy does not rewrite it); only the
|
|
420
|
+
// product id, the activation id and the licence status are read - the reply's
|
|
421
|
+
// customer fields are never extracted, cached or printed.
|
|
422
|
+
async function creemPost(action, normalized, instanceId) {
|
|
423
|
+
// activate names the new instance; validate must carry the instance id
|
|
424
|
+
// activate returned (Creem's validate requires instance_id).
|
|
425
|
+
const payload =
|
|
426
|
+
action === "activate"
|
|
427
|
+
? { action, key: normalized, instanceName: `${ACTIVATION_PREFIX} ${os.hostname()}` }
|
|
428
|
+
: { action, key: normalized, instanceId };
|
|
429
|
+
const response = await fetch(creemProxyUrl(), {
|
|
430
|
+
method: "POST",
|
|
431
|
+
headers: { "Content-Type": "application/json" },
|
|
432
|
+
body: JSON.stringify(payload),
|
|
433
|
+
signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS),
|
|
434
|
+
});
|
|
435
|
+
let parsed = null;
|
|
436
|
+
let detail = "";
|
|
437
|
+
try {
|
|
438
|
+
parsed = await response.json();
|
|
439
|
+
const raw =
|
|
440
|
+
typeof parsed?.error === "string" ? parsed.error :
|
|
441
|
+
typeof parsed?.message === "string" ? parsed.message :
|
|
442
|
+
typeof parsed?.detail === "string" ? parsed.detail : "";
|
|
443
|
+
// The key must never appear in a detail string that ends up in a log.
|
|
444
|
+
detail = String(raw).slice(0, MAX_DETAIL_CHARS).split(normalized).join(maskKey(normalized)).trim();
|
|
445
|
+
} catch {
|
|
446
|
+
detail = ""; // a non-JSON body (proxy error page) reads as no detail
|
|
447
|
+
}
|
|
448
|
+
return {
|
|
449
|
+
status: response.status,
|
|
450
|
+
ok: response.ok,
|
|
451
|
+
detail,
|
|
452
|
+
productId: creemProductId(parsed),
|
|
453
|
+
// Creem's `activation` is a COUNT (number); the id to persist is the
|
|
454
|
+
// licence instance id returned under `instance`.
|
|
455
|
+
activationId: creemInstanceId(parsed),
|
|
456
|
+
licenceStatus: typeof parsed?.status === "string" ? parsed.status : null,
|
|
457
|
+
};
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
// One live Creem round for a parsed key, through the proxy. Returns exactly
|
|
461
|
+
// one of:
|
|
462
|
+
// { kind: "valid", activationId, tier } the proxy relayed a Creem yes
|
|
463
|
+
// (tier from the issuing product)
|
|
464
|
+
// { kind: "rejected", detail, seatLimit } Creem, via the proxy, said no
|
|
465
|
+
// { kind: "unreachable" } the proxy could not be reached
|
|
466
|
+
async function liveCreem(normalized, cachedActivationId) {
|
|
467
|
+
// A 2xx only counts when the licence is actually active and the issuing
|
|
468
|
+
// product maps to a Cuetra tier; anything else is a rejection. The
|
|
469
|
+
// fail-closed bar: only an active, mapped licence opens paid content.
|
|
470
|
+
function verdict(response, activationId) {
|
|
471
|
+
// status is a required LicenseEntity field: a missing status is not
|
|
472
|
+
// "active", so it never opens the gate.
|
|
473
|
+
if (response.licenceStatus !== "active") {
|
|
474
|
+
return {
|
|
475
|
+
kind: "rejected",
|
|
476
|
+
detail: response.detail || `the licence reported status "${response.licenceStatus || "unknown"}"`,
|
|
477
|
+
seatLimit: false,
|
|
478
|
+
};
|
|
479
|
+
}
|
|
480
|
+
const tier = creemTierForProduct(response.productId);
|
|
481
|
+
if (!tier) {
|
|
482
|
+
// Fail-closed: an accepted key for an unknown product unlocks nothing.
|
|
483
|
+
return {
|
|
484
|
+
kind: "rejected",
|
|
485
|
+
detail: "the key was accepted, but it does not belong to a Cuetra product - email hello@cuetra.com with your receipt",
|
|
486
|
+
seatLimit: false,
|
|
487
|
+
};
|
|
488
|
+
}
|
|
489
|
+
return { kind: "valid", activationId, tier };
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
async function activateOnce() {
|
|
493
|
+
const response = await creemPost("activate", normalized);
|
|
494
|
+
if (response.ok) {
|
|
495
|
+
const result = verdict(response, response.activationId);
|
|
496
|
+
// Without an instance id no later validate is possible, so the next
|
|
497
|
+
// refresh would take another seat. Fail closed instead of leaking seats.
|
|
498
|
+
if (result.kind === "valid" && !response.activationId) {
|
|
499
|
+
return { kind: "rejected", detail: "the licence server did not return an activation id - email hello@cuetra.com", seatLimit: false };
|
|
500
|
+
}
|
|
501
|
+
return result;
|
|
502
|
+
}
|
|
503
|
+
// A 4xx from the fail-closed proxy is a verdict on the key (unknown,
|
|
504
|
+
// revoked or seat-limited); 5xx/429 means nobody spoke for the key, which
|
|
505
|
+
// is the unreachable class - same split the Dodo branch makes.
|
|
506
|
+
if (response.status >= 400 && response.status < 500) {
|
|
507
|
+
return {
|
|
508
|
+
kind: "rejected",
|
|
509
|
+
detail: response.detail,
|
|
510
|
+
seatLimit: response.status === 403 || response.status === 422 || /limit/i.test(response.detail),
|
|
511
|
+
};
|
|
512
|
+
}
|
|
513
|
+
return { kind: "unreachable" };
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
async function validateOnce() {
|
|
517
|
+
const response = await creemPost("validate", normalized, cachedActivationId);
|
|
518
|
+
if (response.ok) return verdict(response, cachedActivationId);
|
|
519
|
+
if (response.status >= 400 && response.status < 500) {
|
|
520
|
+
return { kind: "rejected", detail: response.detail, seatLimit: false };
|
|
521
|
+
}
|
|
522
|
+
return { kind: "unreachable" };
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
try {
|
|
526
|
+
if (cachedActivationId) {
|
|
527
|
+
// Refresh path: re-validate so a re-check never takes a second seat.
|
|
528
|
+
// If the stored activation is gone (the buyer freed the device), one
|
|
529
|
+
// activate attempt re-takes the freed slot; a revoked key still ends as
|
|
530
|
+
// rejected by that same call.
|
|
531
|
+
const result = await validateOnce();
|
|
532
|
+
if (result.kind !== "rejected") return result;
|
|
533
|
+
const retry = await activateOnce();
|
|
534
|
+
if (retry.kind === "rejected") {
|
|
535
|
+
return { kind: "rejected", detail: retry.detail || result.detail, seatLimit: retry.seatLimit };
|
|
536
|
+
}
|
|
537
|
+
return retry;
|
|
538
|
+
}
|
|
539
|
+
// First contact: take an activation, as redeem does.
|
|
540
|
+
return await activateOnce();
|
|
541
|
+
} catch {
|
|
542
|
+
// fetch only throws for transport-level failures; that is "unreachable",
|
|
543
|
+
// never "rejected" - the proxy said nothing at all.
|
|
544
|
+
return { kind: "unreachable" };
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
|
|
385
548
|
function rejectedDetail(rawKey, live, provider) {
|
|
386
549
|
const mask = maskKey(rawKey);
|
|
387
|
-
const service = provider
|
|
550
|
+
const service = SERVICE_BY_PROVIDER[provider] || "the licence service";
|
|
388
551
|
if (live.seatLimit) {
|
|
389
552
|
const seatAdvice =
|
|
390
|
-
provider === "
|
|
391
|
-
? "
|
|
392
|
-
: "
|
|
553
|
+
provider === "polar"
|
|
554
|
+
? "Deactivate an old device in your Polar customer portal and re-run, or upgrade at cuetra.com/pricing"
|
|
555
|
+
: "Email hello@cuetra.com to free an old device and re-run, or upgrade at cuetra.com/pricing";
|
|
393
556
|
return (
|
|
394
557
|
`${service} rejected the key ${mask}: every activation of this key is already in use` +
|
|
395
558
|
`${live.detail ? ` (${live.detail})` : ""}. ${seatAdvice}`
|
|
@@ -401,8 +564,9 @@ function rejectedDetail(rawKey, live, provider) {
|
|
|
401
564
|
);
|
|
402
565
|
}
|
|
403
566
|
|
|
404
|
-
// Polar keys spell the tier out; a Dodo key's tier lives in the
|
|
405
|
-
// result (or the cache), so anything unknown falls back to the
|
|
567
|
+
// Polar keys spell the tier out; a Dodo or Creem key's tier lives in the
|
|
568
|
+
// validation result (or the cache), so anything unknown falls back to the
|
|
569
|
+
// plain name.
|
|
406
570
|
function tierName(tier) {
|
|
407
571
|
return TIER_NAME[tier] || "Cuetra licence";
|
|
408
572
|
}
|
|
@@ -419,23 +583,23 @@ export async function validateLicence(rawKey) {
|
|
|
419
583
|
if (!parsed) {
|
|
420
584
|
return {
|
|
421
585
|
status: "shape-invalid",
|
|
422
|
-
detail: `the key ${maskKey(rawKey)} did not match the Cuetra key shapes (Polar's CUETRA
|
|
586
|
+
detail: `the key ${maskKey(rawKey)} did not match the Cuetra key shapes (Polar's CUETRA-..., Dodo Payments' five-group code, or Creem's key format), so it was not sent anywhere - copy the key again from your receipt or cuetra.com/redeem`,
|
|
423
587
|
};
|
|
424
588
|
}
|
|
425
589
|
|
|
426
|
-
const provider = parsed.provider; // "polar" | "dodo"
|
|
427
|
-
// Polar keys are sent upper-cased; Dodo UUIDs lower-cased, exactly
|
|
428
|
-
// parseKey normalised them, so the cache hash and the wire format agree.
|
|
590
|
+
const provider = parsed.provider; // "polar" | "dodo" | "creem"
|
|
591
|
+
// Polar and Creem keys are sent upper-cased; Dodo UUIDs lower-cased, exactly
|
|
592
|
+
// as parseKey normalised them, so the cache hash and the wire format agree.
|
|
429
593
|
const normalized = provider === "dodo" ? parsed.key : normalizeKey(rawKey);
|
|
430
|
-
const service = provider
|
|
431
|
-
const serviceHost = provider === "dodo" ? DODO_API_BASE : POLAR_API_BASE;
|
|
594
|
+
const service = SERVICE_BY_PROVIDER[provider] || "the licence service";
|
|
595
|
+
const serviceHost = provider === "dodo" ? DODO_API_BASE : provider === "creem" ? creemProxyUrl() : POLAR_API_BASE;
|
|
432
596
|
|
|
433
597
|
const cached = readCacheEntry(normalized);
|
|
434
598
|
const cacheAge = cached ? Date.now() - cached.validatedAt : null;
|
|
435
599
|
|
|
436
600
|
if (cached && cacheAge <= CACHE_TTL_MS) {
|
|
437
|
-
// A Dodo key spells no tier out, so the cached live validation
|
|
438
|
-
// a Polar key already knows its own.
|
|
601
|
+
// A Dodo or Creem key spells no tier out, so the cached live validation
|
|
602
|
+
// names it; a Polar key already knows its own.
|
|
439
603
|
const tier = parsed.tier || cached.tier;
|
|
440
604
|
return {
|
|
441
605
|
status: "cache-valid",
|
|
@@ -449,11 +613,13 @@ export async function validateLicence(rawKey) {
|
|
|
449
613
|
const live =
|
|
450
614
|
provider === "dodo"
|
|
451
615
|
? await liveDodo(normalized, cached ? cached.activationId : null)
|
|
452
|
-
:
|
|
616
|
+
: provider === "creem"
|
|
617
|
+
? await liveCreem(normalized, cached ? cached.activationId : null)
|
|
618
|
+
: await liveValidate(normalized, parsed, cached ? cached.activationId : null);
|
|
453
619
|
|
|
454
620
|
if (live.kind === "valid") {
|
|
455
|
-
// The tier of a Dodo key comes from the activation reply; on a
|
|
456
|
-
// that only re-validated, the earlier cached tier still names it.
|
|
621
|
+
// The tier of a Dodo or Creem key comes from the activation reply; on a
|
|
622
|
+
// refresh that only re-validated, the earlier cached tier still names it.
|
|
457
623
|
const tier = live.tier || parsed.tier || (cached ? cached.tier : null);
|
|
458
624
|
const wrote = writeCacheEntry(normalized, tier, live.activationId);
|
|
459
625
|
const cacheNote = wrote ? "" : " (the offline cache could not be written, so the next run needs the network again)";
|
package/mcp-server/lib/pack.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// served; paid access
|
|
4
4
|
// requires both CUETRA_LICENCE_KEY and CUETRA_PACK_DIR pointing at the unpacked full
|
|
5
5
|
// pack - mirroring the CLI's licence behavior - and the key must PASS online
|
|
6
|
-
// validation with the processor that issued it, Polar
|
|
6
|
+
// validation with the processor that issued it, Polar, Dodo Payments or Creem
|
|
7
7
|
// (lib/licence.js: a live check, or one cached within the
|
|
8
8
|
// 7-day window). A paid request without a validated key gets an honest error,
|
|
9
9
|
// never paid content.
|
|
@@ -20,8 +20,8 @@ export const BUNDLED_FREE_PACK_DIR = fileURLToPath(new URL("../../pack/", import
|
|
|
20
20
|
// Validation runs only on the paid path: a run without a full pack directory
|
|
21
21
|
// never contacts a licence server. The shape check itself (first step of
|
|
22
22
|
// validateLicence) is the tier-aware parseKey from src/licence.js - Polar,
|
|
23
|
-
// Dodo or legacy shape, legacy keys checksum-verified - so a malformed
|
|
24
|
-
// never sent anywhere.
|
|
23
|
+
// Dodo, Creem or legacy shape, legacy keys checksum-verified - so a malformed
|
|
24
|
+
// key is never sent anywhere.
|
|
25
25
|
// The MCP server runs from this repo, so the relative import resolves to src/.
|
|
26
26
|
|
|
27
27
|
export const FREE_SET_SIZE = 100;
|
|
@@ -209,7 +209,7 @@ export async function resolvePack() {
|
|
|
209
209
|
// the startup note says what is missing.
|
|
210
210
|
notes.push(
|
|
211
211
|
"CUETRA_LICENCE_KEY is set but no CUETRA_PACK_DIR is configured, so the key was not validated; " +
|
|
212
|
-
"serving the free sampler set. Paid icons need both a validated key (Polar
|
|
212
|
+
"serving the free sampler set. Paid icons need both a validated key (Polar, Dodo Payments or Creem) and the full pack directory."
|
|
213
213
|
);
|
|
214
214
|
}
|
|
215
215
|
const pack = loadPack(BUNDLED_FREE_PACK_DIR);
|
|
@@ -245,7 +245,7 @@ export async function resolvePack() {
|
|
|
245
245
|
if (!licenceKey) {
|
|
246
246
|
notes.push(
|
|
247
247
|
"CUETRA_PACK_DIR is set but no CUETRA_LICENCE_KEY is configured; serving the free sampler set. " +
|
|
248
|
-
"Paid icons need a licence key that passes online validation (Polar
|
|
248
|
+
"Paid icons need a licence key that passes online validation (Polar, Dodo Payments or Creem)."
|
|
249
249
|
);
|
|
250
250
|
const pack = loadPack(BUNDLED_FREE_PACK_DIR);
|
|
251
251
|
return { ...pack, licensed: false, notes };
|
package/mcp-server/lib/tools.js
CHANGED
|
@@ -7,13 +7,13 @@ const TREATMENTS = ["outline", "solid", "duotone", "glass"];
|
|
|
7
7
|
|
|
8
8
|
// Honest paid-set refusal: an unlicensed server serves the free 100, so a paid icon
|
|
9
9
|
// name is simply not in the served pack - and the error says how paid access unlocks:
|
|
10
|
-
// a key that passes online validation with the processor that issued it (Polar
|
|
11
|
-
//
|
|
10
|
+
// a key that passes online validation with the processor that issued it (Polar, Dodo
|
|
11
|
+
// Payments or Creem), plus the full pack directory.
|
|
12
12
|
function unknownIconError(pack, name) {
|
|
13
13
|
if (!pack.licensed) {
|
|
14
14
|
return new Error(
|
|
15
15
|
`"${name}" is not in the free sampler set (${FREE_SET_SIZE} icons) served by this server. ` +
|
|
16
|
-
"Paid icons need CUETRA_LICENCE_KEY (validated online with Polar
|
|
16
|
+
"Paid icons need CUETRA_LICENCE_KEY (validated online with Polar, Dodo Payments or Creem) and CUETRA_PACK_DIR pointing at the unpacked full pack."
|
|
17
17
|
);
|
|
18
18
|
}
|
|
19
19
|
return new Error(`unknown icon "${name}" - use search first`);
|
package/pack/motion/bus.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"family":"cuetra","name":"bus","viewBox":"0 0 24 24","cue":"pop","domain":"industry","archetype":"
|
|
1
|
+
{"family":"cuetra","name":"bus","viewBox":"0 0 24 24","cue":"pop","domain":"industry","archetype":"settle","duration":328,"easing":"spring-soft","amplitude":2.6,"direction":1,"axis":"y","parts":[{"role":"body","delay":0,"pivot":"50% 100%","amplitudeScale":1.047},{"role":"detail","delay":96,"pivot":"50% 100%","amplitudeScale":0.358},{"role":"detail","delay":116,"pivot":"50% 100%","amplitudeScale":0.368},{"role":"detail","delay":136,"pivot":"50% 100%","amplitudeScale":0.436},{"role":"detail","delay":152,"pivot":"50% 100%","amplitudeScale":0.441},{"role":"detail","delay":172,"pivot":"50% 100%","amplitudeScale":0.389}],"strikeAt":204,"amp":2.6,"dir":1,"treatments":["outline","solid","duotone","glass"],"signature":"5c6da0b40316","partCounts":{"outline":6,"solid":3,"duotone":9,"glass":3},"bytes":7656}
|
package/pack/motion/car.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"family":"cuetra","name":"car","viewBox":"0 0 24 24","cue":"pop","domain":"industry","archetype":"
|
|
1
|
+
{"family":"cuetra","name":"car","viewBox":"0 0 24 24","cue":"pop","domain":"industry","archetype":"slide-in","duration":284,"easing":"ease-out","amplitude":3.944,"direction":-1,"axis":"x","parts":[{"role":"body","delay":0,"pivot":"50% 50%","amplitudeScale":1},{"role":"detail","delay":20,"pivot":"50% 50%","amplitudeScale":1,"follows":0},{"role":"detail","delay":40,"pivot":"50% 50%","amplitudeScale":1,"follows":0},{"role":"detail","delay":60,"pivot":"50% 50%","amplitudeScale":1,"follows":0}],"strikeAt":204,"coupling":{"lead":0,"strikeAt":204,"followers":[{"part":1,"preset":"free","stiffness":0,"damping":0,"gain":1},{"part":2,"preset":"free","stiffness":0,"damping":0,"gain":1},{"part":3,"preset":"free","stiffness":0,"damping":0,"gain":1}]},"amp":3.944,"dir":-1,"treatments":["outline","solid","duotone","glass"],"signature":"ed693fb6142f","partCounts":{"outline":4,"solid":3,"duotone":7,"glass":3},"bytes":5902}
|
package/pack/motion/index.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
["bell","bell-ring","heart","star","rocket","zap","search","settings","user","users","mail","send","lock","lock-open","eye","calendar","clock","download","upload","copy","check","x","plus","minus","trash","pen","folder","file","image","camera","play","pause","volume","mic","phone","message-square","globe","link","bookmark","tag","gift","shopping-cart","credit-card","trending-up","activity","battery","sun","moon","cloud","umbrella","navigation","compass","anchor","flag","award","shield-check","key","terminal","database","layers","list","power","refresh-cw","arrow-right","arrow-up","chevron-down","external-link","menu","thumbs-up","flame","coffee","printer","bluetooth","monitor","smartphone","watch","headphones","airplay","aperture","badge-check","bike","blocks","book","book-open","box","brain","briefcase","bug","bus","calculator","car","circle-alert","circle-check","clipboard","code","command","cookie","cpu","crown","diamond"]
|
|
1
|
+
{"names":["bell","bell-ring","heart","star","rocket","zap","search","settings","user","users","mail","send","lock","lock-open","eye","calendar","clock","download","upload","copy","check","x","plus","minus","trash","pen","folder","file","image","camera","play","pause","volume","mic","phone","message-square","globe","link","bookmark","tag","gift","shopping-cart","credit-card","trending-up","activity","battery","sun","moon","cloud","umbrella","navigation","compass","anchor","flag","award","shield-check","key","terminal","database","layers","list","power","refresh-cw","arrow-right","arrow-up","chevron-down","external-link","menu","thumbs-up","flame","coffee","printer","bluetooth","monitor","smartphone","watch","headphones","airplay","aperture","badge-check","bike","blocks","book","book-open","box","brain","briefcase","bug","bus","calculator","car","circle-alert","circle-check","clipboard","code","command","cookie","cpu","crown","diamond"]}
|
package/pack/motion/key.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"family":"cuetra","name":"key","viewBox":"0 0 24 24","cue":"swing","domain":"security","archetype":"twirl","duration":280,"easing":"linear","amplitude":8.5,"direction":1,"axis":"r","parts":[{"role":"body","delay":0,"pivot":"188.89% -88.89%","amplitudeScale":1},{"role":"accent","delay":16,"pivot":"100% 0%","amplitudeScale":1,"follows":0},{"role":"detail","delay":32,"pivot":"140% -140%","amplitudeScale":1,"follows":0},{"role":"detail","delay":40,"pivot":"300% -300%","amplitudeScale":1,"follows":0}],"strikeAt":280,"
|
|
1
|
+
{"family":"cuetra","name":"key","viewBox":"0 0 24 24","cue":"swing","domain":"security","archetype":"twirl","duration":280,"easing":"linear","amplitude":8.5,"direction":1,"axis":"r","parts":[{"role":"body","delay":0,"pivot":"188.89% -88.89%","amplitudeScale":1},{"role":"accent","delay":16,"pivot":"100% 0%","amplitudeScale":1,"follows":0},{"role":"detail","delay":32,"pivot":"140% -140%","amplitudeScale":1,"follows":0},{"role":"detail","delay":40,"pivot":"300% -300%","amplitudeScale":1,"follows":0}],"strikeAt":280,"amp":8.5,"dir":1,"treatments":["outline","solid","duotone","glass"],"signature":"d63a8658be5a","partCounts":{"outline":4,"solid":4,"duotone":5,"glass":4},"bytes":4389}
|
package/pack/motion/power.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"family":"cuetra","name":"power","viewBox":"0 0 24 24","cue":"pop","domain":"device","archetype":"
|
|
1
|
+
{"family":"cuetra","name":"power","viewBox":"0 0 24 24","cue":"pop","domain":"device","archetype":"knock","duration":300,"easing":"snap","amplitude":2.8,"direction":1,"axis":"y","parts":[{"role":"body","delay":0,"pivot":"50% 50%","amplitudeScale":0.316},{"role":"detail","delay":36,"pivot":"50% 50%","amplitudeScale":0.993}],"strikeAt":68,"amp":2.8,"dir":1,"treatments":["outline","solid","duotone","glass"],"signature":"f2f742c626de","partCounts":{"outline":2,"solid":2,"duotone":4,"glass":2},"bytes":13276}
|
package/pack/motion/trash.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"family":"cuetra","name":"trash","viewBox":"0 0 24 24","cue":"pop","domain":"action","archetype":"
|
|
1
|
+
{"family":"cuetra","name":"trash","viewBox":"0 0 24 24","cue":"pop","domain":"action","archetype":"settle","duration":348,"easing":"spring-soft","amplitude":2.6,"direction":1,"axis":"y","parts":[{"role":"body","delay":0,"pivot":"50% 100%","amplitudeScale":0.989},{"role":"detail","delay":0,"pivot":"50% 100%","amplitudeScale":0.711,"follows":0},{"role":"detail","delay":0,"pivot":"50% 100%","amplitudeScale":0.629,"follows":0},{"role":"detail","delay":0,"pivot":"50% 100%","amplitudeScale":0.686,"follows":0},{"role":"detail","delay":0,"pivot":"50% 100%","amplitudeScale":0.62,"follows":0}],"strikeAt":216,"coupling":{"lead":0,"strikeAt":216,"followers":[{"part":1,"preset":"lag","stiffness":329,"damping":14.5,"gain":0.9},{"part":2,"preset":"lag","stiffness":328,"damping":15,"gain":0.9},{"part":3,"preset":"lag","stiffness":310,"damping":15,"gain":0.9},{"part":4,"preset":"lag","stiffness":317,"damping":14.5,"gain":0.9}]},"amp":2.6,"dir":1,"treatments":["outline","solid","duotone","glass"],"signature":"4b3f9d26cf3a","partCounts":{"outline":5,"solid":3,"duotone":6,"glass":3},"bytes":6741}
|
package/pack/motion/x.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"family":"cuetra","name":"x","viewBox":"0 0 24 24","cue":"
|
|
1
|
+
{"family":"cuetra","name":"x","viewBox":"0 0 24 24","cue":"pop","domain":"error","archetype":"stamp","duration":264,"easing":"snap","amplitude":0.21,"direction":1,"axis":"s","parts":[{"role":"body","delay":0,"pivot":"50% 100%","amplitudeScale":1.112},{"role":"accent","delay":0,"pivot":"50% 100%","amplitudeScale":0.766}],"strikeAt":192,"amp":0.21,"dir":1,"treatments":["outline","solid","duotone","glass"],"signature":"1b1a6089bb21","partCounts":{"outline":2,"solid":2,"duotone":4,"glass":2},"bytes":2430}
|
package/pack/tone/bus.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"sound":"pop","voice":{"instrument":"
|
|
1
|
+
{"sound":"pop","voice":{"instrument":"whoosh","pitchSemis":-14.37,"contour":[{"at":0,"ratio":1},{"at":1,"ratio":1}],"attackMs":2,"decayMs":116,"brightness":0.6,"noiseMix":0,"pan":0.2,"signature":"92d71a538b49"},"sonic":{"timbre":"air","semis":-14,"decay":0.792,"bright":1.12,"pan":0.2},"voiceSignature":"92d71a538b49"}
|
package/pack/tone/car.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"sound":"pop","voice":{"instrument":"
|
|
1
|
+
{"sound":"pop","voice":{"instrument":"whoosh","pitchSemis":-14.37,"contour":[{"at":0,"ratio":1},{"at":1,"ratio":1}],"attackMs":1.5,"decayMs":100,"brightness":0.57,"noiseMix":0.02,"pan":-0.3,"signature":"5dd659694d78"},"sonic":{"timbre":"air","semis":-14,"decay":0.78,"bright":1.099,"pan":-0.3},"voiceSignature":"5dd659694d78"}
|
package/pack/tone/key.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"sound":"swing","voice":{"instrument":"
|
|
1
|
+
{"sound":"swing","voice":{"instrument":"click","pitchSemis":-20.51,"contour":[{"at":0,"ratio":1},{"at":1,"ratio":1}],"attackMs":0.5,"decayMs":132,"brightness":0.73,"noiseMix":0.03,"pan":-0.16,"signature":"ce210dd2bba6"},"sonic":{"timbre":"tick","semis":-21,"decay":0.752,"bright":1.211,"pan":-0.16},"voiceSignature":"ce210dd2bba6"}
|
package/pack/tone/moon.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"sound":"rise","voice":{"instrument":"
|
|
1
|
+
{"sound":"rise","voice":{"instrument":"glass-chime","pitchSemis":-21.02,"contour":[{"at":0,"ratio":1},{"at":0.5,"ratio":1},{"at":1,"ratio":1}],"attackMs":5,"decayMs":722,"brightness":0.66,"noiseMix":0.05,"pan":0.22,"signature":"087a18aa4028"},"sonic":{"timbre":"glass","semis":-21,"decay":1.016,"bright":1.162,"pan":0.22},"voiceSignature":"087a18aa4028"}
|
package/pack/tone/power.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"sound":"pop","voice":{"instrument":"
|
|
1
|
+
{"sound":"pop","voice":{"instrument":"knock","pitchSemis":3,"contour":[{"at":0,"ratio":1},{"at":0.5,"ratio":1},{"at":1,"ratio":1}],"attackMs":2.5,"decayMs":536,"brightness":0.74,"noiseMix":0.01,"pan":-0.32,"signature":"3aafd3aa9997"},"sonic":{"timbre":"wood","semis":3,"decay":1.126,"bright":1.218,"pan":-0.32},"voiceSignature":"3aafd3aa9997"}
|
package/pack/tone/trash.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"sound":"pop","voice":{"instrument":"
|
|
1
|
+
{"sound":"pop","voice":{"instrument":"thud","pitchSemis":6.48,"contour":[{"at":0,"ratio":1},{"at":0.5,"ratio":1.1225},{"at":1,"ratio":1.3348}],"attackMs":2,"decayMs":130,"brightness":0.62,"noiseMix":0.06,"pan":0.5,"signature":"9aabeb7daaca"},"sonic":{"timbre":"thud","semis":6,"decay":0.803,"bright":1.134,"pan":0.5},"voiceSignature":"9aabeb7daaca"}
|
package/pack/tone/users.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"sound":"pop","voice":{"instrument":"
|
|
1
|
+
{"sound":"pop","voice":{"instrument":"chime-stack","pitchSemis":-18.99,"contour":[{"at":0,"ratio":1},{"at":1,"ratio":1}],"attackMs":2,"decayMs":76,"brightness":0.6,"noiseMix":0.02,"pan":0.1,"signature":"d407c27850aa"},"sonic":{"timbre":"glass","semis":-19,"decay":0.76,"bright":1.12,"pan":0.1},"voiceSignature":"d407c27850aa"}
|
package/pack/tone/x.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"sound":"
|
|
1
|
+
{"sound":"pop","voice":{"instrument":"thud","pitchSemis":6.48,"contour":[{"at":0,"ratio":1},{"at":0.5,"ratio":0.8409},{"at":1,"ratio":0.8409}],"attackMs":1.5,"decayMs":120,"brightness":0.56,"noiseMix":0.01,"pan":0.02,"signature":"c4d4007cb1c2"},"sonic":{"timbre":"thud","semis":6,"decay":0.795,"bright":1.092,"pan":0.02},"voiceSignature":"c4d4007cb1c2"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cuetra",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.2",
|
|
5
5
|
"description": "The free set of Cuetra: 100 icon designs on one 24px grid - outline, solid, duotone and glass statics plus the kinetic SVGs and their per-icon motion and tone records, all in one pack/ directory. The full pack is 6,646 icons - founding price $14.50 at cuetra.com.",
|
|
6
6
|
"license": "UNLICENSED",
|
|
7
7
|
"files": [
|
package/src/licence.js
CHANGED
|
@@ -10,12 +10,26 @@
|
|
|
10
10
|
* Polar: CUETRA-<tier>-XXXX-XXXX-XXXX e.g. CUETRA-P-7K2M-9QF3-B9ZX
|
|
11
11
|
* legacy: CUETRA-<tier + 7 random>-<4 checksum> e.g. CUETRA-P7K2M9QF-3B9Z
|
|
12
12
|
* Dodo: a UUID issued by Dodo Payments e.g. 2b1f8e2d-c41e-4e8f-b2d3-d9fd61c38f43
|
|
13
|
+
* Creem: 4 or 5 dash-separated uppercase alnum groups e.g. ABCDE-FGHIJ-KLMNO-PQRST-UVWXY
|
|
13
14
|
*
|
|
14
15
|
* Polar-issued keys spell the tier out and carry no local checksum; legacy keys
|
|
15
16
|
* (the old demo shape) still validate against their own checksum. Dodo Payments
|
|
16
17
|
* keys are plain UUIDs that spell nothing out — the tier is read from the
|
|
17
18
|
* product that issued the key during live validation, not from the key string.
|
|
18
19
|
* A UUID can never start with CUETRA-, so the classes stay disjoint.
|
|
20
|
+
*
|
|
21
|
+
* Creem keys (third processor, 2026-11-29) are four or five uppercase alnum
|
|
22
|
+
* groups separated by dashes (live keys: five groups of five). They spell no
|
|
23
|
+
* tier out either — the tier comes from the
|
|
24
|
+
* product named in the activation/validate response (see CREEM_PRODUCT_BY_TIER).
|
|
25
|
+
* The classes stay disjoint by construction and by match order: Polar/legacy
|
|
26
|
+
* keys carry the literal CUETRA- prefix and are matched first, and a Dodo
|
|
27
|
+
* UUID (8-4-4-4-12 hex) is matched before the Creem branch is reached.
|
|
28
|
+
* The one remaining ambiguity is a fabricated 4-group key whose FIRST group is
|
|
29
|
+
* the literal CUETRA — that would sit inside the Cuetra/Polar namespace, so the
|
|
30
|
+
* Creem matcher refuses any key starting with the CUETRA- prefix rather than
|
|
31
|
+
* risk stealing a shape from the existing providers (fail-closed: such a key
|
|
32
|
+
* parses as null and is never sent anywhere).
|
|
19
33
|
*/
|
|
20
34
|
|
|
21
35
|
export const ALPHABET = "ABCDEFGHJKLMNPQRSTUVWXYZ23456789";
|
|
@@ -45,6 +59,46 @@ function checksum(payload) {
|
|
|
45
59
|
return (h >>> 0).toString(32).toUpperCase().padStart(4, "0").slice(-4);
|
|
46
60
|
}
|
|
47
61
|
|
|
62
|
+
// Creem, the third processor (owner order 2026-11-29). Creem keys spell no
|
|
63
|
+
// tier out, so the tier is read from the product that issued the key — the
|
|
64
|
+
// activation/validate reply names it. Creem's licence API needs a server-side
|
|
65
|
+
// API key (docs.creem.io/features/addons/licenses), so the browser and the
|
|
66
|
+
// tools never call Creem directly: they POST to the Cuetra proxy
|
|
67
|
+
// (/api/creem-licence, functions/api/creem-licence.js) which holds the secret
|
|
68
|
+
// and answers with Creem's JSON verbatim. The product ids below are the
|
|
69
|
+
// owner's real ids from the Creem dashboard, verified 2026-11-29 — the same
|
|
70
|
+
// ids the Creem checkout links issue licences for.
|
|
71
|
+
export const CREEM_PRODUCT_BY_TIER = {
|
|
72
|
+
personal: "prod_5zPjwkeROZ3mpg8uKwGgNg",
|
|
73
|
+
team: "prod_1vctuq3ViQLb0n1SFX7qE2",
|
|
74
|
+
business: "prod_1mpKue6zCOeGPdOuOmPQd5",
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
// Creem's activate/validate replies carry the licence object; the issuing
|
|
78
|
+
// product is the top-level `product_id` field (required in the OpenAPI
|
|
79
|
+
// LicenseEntity, docs.creem.io, re-fetched 2026-11-29). `product.id` and
|
|
80
|
+
// `product.product_id` are accepted as fallbacks. Anything else reads as no
|
|
81
|
+
// product, and the caller fails closed.
|
|
82
|
+
export function creemProductId(body) {
|
|
83
|
+
if (!body || typeof body !== "object" || Array.isArray(body)) return null;
|
|
84
|
+
if (typeof body.product_id === "string") return body.product_id;
|
|
85
|
+
if (body.product && typeof body.product === "object") {
|
|
86
|
+
if (typeof body.product.id === "string") return body.product.id;
|
|
87
|
+
if (typeof body.product.product_id === "string") return body.product.product_id;
|
|
88
|
+
}
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// Reverse map: the product that issued a Creem key -> the Cuetra tier. An id
|
|
93
|
+
// that is not one of ours reads as null, and the caller fails closed.
|
|
94
|
+
export function creemTierForProduct(productId) {
|
|
95
|
+
if (typeof productId !== "string") return null;
|
|
96
|
+
for (const tier of Object.keys(CREEM_PRODUCT_BY_TIER)) {
|
|
97
|
+
if (CREEM_PRODUCT_BY_TIER[tier] === productId) return tier;
|
|
98
|
+
}
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
|
|
48
102
|
export function makeKey(tier) {
|
|
49
103
|
const code = TIER_CODE[tier] || "P";
|
|
50
104
|
const body = Array.from(crypto.getRandomValues(new Uint8Array(7)))
|
|
@@ -56,9 +110,9 @@ export function makeKey(tier) {
|
|
|
56
110
|
|
|
57
111
|
/** Returns { provider, tier, payload, key } or null. Accepts lower case and
|
|
58
112
|
* stray spaces. `key` is the exact normalised string to send to the issuing
|
|
59
|
-
* service: upper-cased for Polar shapes, lower-cased for Dodo UUIDs.
|
|
60
|
-
* key carries no tier, so tier is null until the live check
|
|
61
|
-
* that issued it. */
|
|
113
|
+
* service: upper-cased for Polar and Creem shapes, lower-cased for Dodo UUIDs.
|
|
114
|
+
* A Dodo or Creem key carries no tier, so tier is null until the live check
|
|
115
|
+
* names the product that issued it. */
|
|
62
116
|
export function parseKey(input) {
|
|
63
117
|
if (typeof input !== "string") return null;
|
|
64
118
|
const clean = input.trim().toUpperCase().replace(/\s+/g, "");
|
|
@@ -94,5 +148,29 @@ export function parseKey(input) {
|
|
|
94
148
|
return { provider: "dodo", tier: null, payload: clean.toLowerCase(), key: clean.toLowerCase() };
|
|
95
149
|
}
|
|
96
150
|
|
|
151
|
+
// Creem shape: four OR five dash-separated uppercase alnum groups. Creem's
|
|
152
|
+
// webhook docs (docs.creem.io/code/webhooks, license_keys table, re-fetched
|
|
153
|
+
// 2026-11-29) state live keys are "five groups of five uppercase
|
|
154
|
+
// alphanumeric characters" (ABCDE-FGHIJ-KLMNO-PQRST-UVWXY); the licence API
|
|
155
|
+
// examples show four groups (ABC123-XYZ456-XYZ456-XYZ456). Both are accepted.
|
|
156
|
+
// Ordering keeps the classes disjoint: Polar/legacy (CUETRA- prefix) and
|
|
157
|
+
// Dodo (8-4-4-4-12 hex UUID) are matched above, and the CUETRA- prefix is
|
|
158
|
+
// refused here. A key spells no tier: tier stays null until the live check
|
|
159
|
+
// names the product that issued it.
|
|
160
|
+
const creem = /^[A-Z0-9]{4,16}(?:-[A-Z0-9]{4,16}){3,4}$/.exec(clean);
|
|
161
|
+
if (creem && !clean.startsWith("CUETRA-")) {
|
|
162
|
+
return { provider: "creem", tier: null, payload: clean, key: clean };
|
|
163
|
+
}
|
|
164
|
+
|
|
97
165
|
return null;
|
|
98
166
|
}
|
|
167
|
+
|
|
168
|
+
// The instance id Creem returns on activate (needed for every later
|
|
169
|
+
// validate). The OpenAPI types `instance` as one object; the licence guide's
|
|
170
|
+
// example shows an array - both are read. `activation` is a NUMBER (the
|
|
171
|
+
// activation count), never an id.
|
|
172
|
+
export function creemInstanceId(body) {
|
|
173
|
+
if (!body || typeof body !== "object") return null;
|
|
174
|
+
const inst = Array.isArray(body.instance) ? body.instance[0] : body.instance;
|
|
175
|
+
return inst && typeof inst === "object" && typeof inst.id === "string" && inst.id ? inst.id : null;
|
|
176
|
+
}
|