@buoy-gg/license 7.0.36 → 7.0.39
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/README.md +28 -0
- package/lib/commonjs/LicenseManager.js +2 -2
- package/lib/commonjs/accountAccess.js +1 -0
- package/lib/commonjs/api.js +1 -1
- package/lib/commonjs/config.js +2 -2
- package/lib/commonjs/device-info.js +1 -1
- package/lib/commonjs/device-info.web.js +1 -1
- package/lib/commonjs/fingerprint.js +1 -1
- package/lib/commonjs/fingerprint.web.js +1 -1
- package/lib/commonjs/foreground.js +1 -0
- package/lib/commonjs/foreground.web.js +1 -0
- package/lib/commonjs/freeToken.js +6 -0
- package/lib/commonjs/headless.js +1 -0
- package/lib/commonjs/hooks.js +2 -2
- package/lib/commonjs/index.js +2 -2
- package/lib/commonjs/index.web.js +2 -2
- package/lib/commonjs/storage.js +1 -0
- package/lib/commonjs/storage.web.js +1 -0
- package/lib/commonjs/tier.js +2 -2
- package/lib/commonjs/weekendPro.js +2 -2
- package/lib/module/LicenseManager.js +1 -1
- package/lib/module/accountAccess.js +1 -0
- package/lib/module/api.js +1 -1
- package/lib/module/config.js +1 -1
- package/lib/module/device-info.js +1 -1
- package/lib/module/device-info.web.js +1 -1
- package/lib/module/fingerprint.js +1 -1
- package/lib/module/fingerprint.web.js +1 -1
- package/lib/module/foreground.js +1 -0
- package/lib/module/foreground.web.js +1 -0
- package/lib/module/freeToken.js +6 -0
- package/lib/module/headless.js +1 -0
- package/lib/module/hooks.js +1 -1
- package/lib/module/index.js +1 -1
- package/lib/module/index.web.js +1 -1
- package/lib/module/storage.js +1 -0
- package/lib/module/storage.web.js +1 -0
- package/lib/module/tier.js +1 -1
- package/lib/module/weekendPro.js +1 -1
- package/lib/typescript/commonjs/LicenseManager.d.ts +59 -4
- package/lib/typescript/commonjs/LicenseManager.d.ts.map +1 -1
- package/lib/typescript/commonjs/accountAccess.d.ts +16 -0
- package/lib/typescript/commonjs/accountAccess.d.ts.map +1 -0
- package/lib/typescript/commonjs/api.d.ts +36 -4
- package/lib/typescript/commonjs/api.d.ts.map +1 -1
- package/lib/typescript/commonjs/config.d.ts +58 -18
- package/lib/typescript/commonjs/config.d.ts.map +1 -1
- package/lib/typescript/commonjs/device-info.d.ts +16 -0
- package/lib/typescript/commonjs/device-info.d.ts.map +1 -1
- package/lib/typescript/commonjs/device-info.web.d.ts +7 -0
- package/lib/typescript/commonjs/device-info.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/fingerprint.d.ts +1 -1
- package/lib/typescript/commonjs/fingerprint.d.ts.map +1 -1
- package/lib/typescript/commonjs/fingerprint.web.d.ts +1 -1
- package/lib/typescript/commonjs/fingerprint.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/foreground.d.ts +3 -0
- package/lib/typescript/commonjs/foreground.d.ts.map +1 -0
- package/lib/typescript/commonjs/foreground.web.d.ts +2 -0
- package/lib/typescript/commonjs/foreground.web.d.ts.map +1 -0
- package/lib/typescript/commonjs/freeToken.d.ts +34 -0
- package/lib/typescript/commonjs/freeToken.d.ts.map +1 -0
- package/lib/typescript/commonjs/headless.d.ts +10 -0
- package/lib/typescript/commonjs/headless.d.ts.map +1 -0
- package/lib/typescript/commonjs/hooks.d.ts +7 -3
- package/lib/typescript/commonjs/hooks.d.ts.map +1 -1
- package/lib/typescript/commonjs/index.d.ts +3 -1
- package/lib/typescript/commonjs/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/index.web.d.ts +3 -10
- package/lib/typescript/commonjs/index.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/storage.d.ts +12 -0
- package/lib/typescript/commonjs/storage.d.ts.map +1 -0
- package/lib/typescript/commonjs/storage.web.d.ts +6 -0
- package/lib/typescript/commonjs/storage.web.d.ts.map +1 -0
- package/lib/typescript/commonjs/tier.d.ts +10 -8
- package/lib/typescript/commonjs/tier.d.ts.map +1 -1
- package/lib/typescript/commonjs/types.d.ts +18 -9
- package/lib/typescript/commonjs/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/weekendPro.d.ts +8 -12
- package/lib/typescript/commonjs/weekendPro.d.ts.map +1 -1
- package/lib/typescript/module/LicenseManager.d.ts +59 -4
- package/lib/typescript/module/LicenseManager.d.ts.map +1 -1
- package/lib/typescript/module/accountAccess.d.ts +16 -0
- package/lib/typescript/module/accountAccess.d.ts.map +1 -0
- package/lib/typescript/module/api.d.ts +36 -4
- package/lib/typescript/module/api.d.ts.map +1 -1
- package/lib/typescript/module/config.d.ts +58 -18
- package/lib/typescript/module/config.d.ts.map +1 -1
- package/lib/typescript/module/device-info.d.ts +16 -0
- package/lib/typescript/module/device-info.d.ts.map +1 -1
- package/lib/typescript/module/device-info.web.d.ts +7 -0
- package/lib/typescript/module/device-info.web.d.ts.map +1 -1
- package/lib/typescript/module/fingerprint.d.ts +1 -1
- package/lib/typescript/module/fingerprint.d.ts.map +1 -1
- package/lib/typescript/module/fingerprint.web.d.ts +1 -1
- package/lib/typescript/module/fingerprint.web.d.ts.map +1 -1
- package/lib/typescript/module/foreground.d.ts +3 -0
- package/lib/typescript/module/foreground.d.ts.map +1 -0
- package/lib/typescript/module/foreground.web.d.ts +2 -0
- package/lib/typescript/module/foreground.web.d.ts.map +1 -0
- package/lib/typescript/module/freeToken.d.ts +34 -0
- package/lib/typescript/module/freeToken.d.ts.map +1 -0
- package/lib/typescript/module/headless.d.ts +10 -0
- package/lib/typescript/module/headless.d.ts.map +1 -0
- package/lib/typescript/module/hooks.d.ts +7 -3
- package/lib/typescript/module/hooks.d.ts.map +1 -1
- package/lib/typescript/module/index.d.ts +3 -1
- package/lib/typescript/module/index.d.ts.map +1 -1
- package/lib/typescript/module/index.web.d.ts +3 -10
- package/lib/typescript/module/index.web.d.ts.map +1 -1
- package/lib/typescript/module/storage.d.ts +12 -0
- package/lib/typescript/module/storage.d.ts.map +1 -0
- package/lib/typescript/module/storage.web.d.ts +6 -0
- package/lib/typescript/module/storage.web.d.ts.map +1 -0
- package/lib/typescript/module/tier.d.ts +10 -8
- package/lib/typescript/module/tier.d.ts.map +1 -1
- package/lib/typescript/module/types.d.ts +18 -9
- package/lib/typescript/module/types.d.ts.map +1 -1
- package/lib/typescript/module/weekendPro.d.ts +8 -12
- package/lib/typescript/module/weekendPro.d.ts.map +1 -1
- package/package.json +33 -9
|
@@ -16,20 +16,13 @@
|
|
|
16
16
|
* including a free one (`npx buoy login`). Buy a key at
|
|
17
17
|
* https://buoy.gg or use it free on Saturday and Sunday.
|
|
18
18
|
*/
|
|
19
|
-
/**
|
|
20
|
-
* @buoy-gg/license (Web/Electron)
|
|
21
|
-
*
|
|
22
|
-
* License validation for React Buoy Pro features
|
|
23
|
-
*
|
|
24
|
-
* Simplified model: Validate license key, cache locally.
|
|
25
|
-
* No device registration or limits - we trust our customers.
|
|
26
|
-
* Keygen tracks validation calls for usage analytics.
|
|
27
|
-
*/
|
|
28
19
|
export { LicenseManager } from "./LicenseManager";
|
|
29
20
|
export { useLicense, useFeatureAccess, useIsPro, useProAccess, useTier } from "./hooks";
|
|
30
21
|
export type { ProAccessReason } from "./hooks";
|
|
31
|
-
export {
|
|
22
|
+
export { useAccountAccess } from "./hooks";
|
|
23
|
+
export { resolveAccountAccess, type AccountAccess } from "./accountAccess";
|
|
32
24
|
export { LicenseTransportError, isTransientLicenseError } from "./api";
|
|
25
|
+
export { isBuoyToken } from "./freeToken";
|
|
33
26
|
export { isWeekendFreePro, useWeekendFreePro } from "./weekendPro";
|
|
34
27
|
export type { BuoyTier, TierSource, LicenseState, LicenseEvent, LicenseListener, LicenseValidationResult, CachedLicense, } from "./types";
|
|
35
28
|
export declare function setLicenseKey(key: string): Promise<boolean>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.web.d.ts","sourceRoot":"","sources":["../../../src/index.web.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;
|
|
1
|
+
{"version":3,"file":"index.web.d.ts","sourceRoot":"","sources":["../../../src/index.web.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAgBH,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGlD,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AACxF,YAAY,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,oBAAoB,EAAE,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAI3E,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,OAAO,CAAC;AAGvE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG1C,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAGnE,YAAY,EACV,QAAQ,EACR,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,uBAAuB,EACvB,aAAa,GACd,MAAM,SAAS,CAAC;AAGjB,wBAAsB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAIjE;AAWD,wBAAgB,KAAK,IAAI,OAAO,CAG/B;AAGD,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAGpD"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
interface LicenseStorage {
|
|
2
|
+
getItem(key: string): Promise<string | null>;
|
|
3
|
+
setItem(key: string, value: string): Promise<void>;
|
|
4
|
+
removeItem(key: string): Promise<void>;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Get protected license storage (file system based, separate from devtools)
|
|
8
|
+
* This storage survives app cache clears AND devtools "Clear Settings"
|
|
9
|
+
*/
|
|
10
|
+
export declare function getLicenseStorage(): Promise<LicenseStorage>;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=storage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../../src/storage.ts"],"names":[],"mappings":"AAUA,UAAU,cAAc;IACtB,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAC7C,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACnD,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACxC;AAgGD;;;GAGG;AACH,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,cAAc,CAAC,CAwHjE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage.web.d.ts","sourceRoot":"","sources":["../../../src/storage.web.ts"],"names":[],"mappings":"AAgBA,wBAAsB,iBAAiB;iBAblB,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;iBAI/B,MAAM,SAAS,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;oBAIlC,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;GAKe"}
|
|
@@ -20,7 +20,7 @@ import type { BuoyTier, KeygenLicense } from "./types";
|
|
|
20
20
|
* Which tier a *validated* license grants.
|
|
21
21
|
*
|
|
22
22
|
* Only ever called with a license the server already accepted — an invalid or
|
|
23
|
-
* absent key never reaches here
|
|
23
|
+
* absent key never reaches here; upstream it leaves the account locked.
|
|
24
24
|
*
|
|
25
25
|
* The policy is the primary signal because Keygen sets it on every
|
|
26
26
|
* create/upgrade/downgrade, and free↔paid is implemented as a policy swap that
|
|
@@ -37,20 +37,22 @@ import type { BuoyTier, KeygenLicense } from "./types";
|
|
|
37
37
|
*/
|
|
38
38
|
export declare function resolveTier(license: KeygenLicense): BuoyTier;
|
|
39
39
|
/**
|
|
40
|
-
*
|
|
40
|
+
* Whether a FATAL validation error still leaves the account admitted.
|
|
41
41
|
*
|
|
42
|
-
* `EXPIRED`
|
|
43
|
-
*
|
|
42
|
+
* `EXPIRED` keeps the account on **free**. An expired key still proves an
|
|
43
|
+
* account exists, and it is not even a stable state: the website's
|
|
44
44
|
* `subscription_expired` webhook calls `downgradeLicenseToFree()`, which swaps
|
|
45
45
|
* that very key onto the Free policy with a null expiry. So free is the steady
|
|
46
|
-
* state, and
|
|
47
|
-
* `/api/licenses` self-heal runs).
|
|
46
|
+
* state, and the lock would only cover the gap before the webhook lands (or
|
|
47
|
+
* before the `/api/licenses` self-heal runs). Locking someone out in that
|
|
48
48
|
* window would hit them at the exact moment they are deciding whether to
|
|
49
49
|
* re-subscribe.
|
|
50
50
|
*
|
|
51
51
|
* Every other fatal code means either "not our key" (`NOT_FOUND`,
|
|
52
52
|
* `PRODUCT_SCOPE_MISMATCH`) or a deliberate revocation (`SUSPENDED`, `BANNED`).
|
|
53
|
-
* Nothing about those proves an account, so they
|
|
53
|
+
* Nothing about those proves an account, so they lock (`null`).
|
|
54
54
|
*/
|
|
55
|
-
export declare function tierAfterFatalError(code: string): BuoyTier;
|
|
55
|
+
export declare function tierAfterFatalError(code: string): BuoyTier | null;
|
|
56
|
+
/** Product/policy identity is required before an expired key can prove an account. */
|
|
57
|
+
export declare function isRecognizedAccount(license: KeygenLicense | null | undefined): boolean;
|
|
56
58
|
//# sourceMappingURL=tier.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tier.d.ts","sourceRoot":"","sources":["../../../src/tier.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAOH,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAEvD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,aAAa,GAAG,QAAQ,CAgB5D;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,
|
|
1
|
+
{"version":3,"file":"tier.d.ts","sourceRoot":"","sources":["../../../src/tier.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAOH,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAEvD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,aAAa,GAAG,QAAQ,CAgB5D;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,GAAG,IAAI,CAEjE;AAED,sFAAsF;AACtF,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAMtF"}
|
|
@@ -4,17 +4,17 @@
|
|
|
4
4
|
* Simplified: No device/machine management - we trust our customers.
|
|
5
5
|
*/
|
|
6
6
|
/**
|
|
7
|
-
* The
|
|
7
|
+
* The two tiers.
|
|
8
8
|
*
|
|
9
|
-
* - "
|
|
10
|
-
*
|
|
11
|
-
* - "free" — a validated key on the Free policy. Today's free tier.
|
|
12
|
-
* - "pro" — a validated key on the Solo or Business policy.
|
|
9
|
+
* - "free" — a validated key on the Free policy.
|
|
10
|
+
* - "pro" — a validated key on the Solo or Business policy.
|
|
13
11
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
12
|
+
* There is no tier for "no credential". Whether the tools are usable at all is
|
|
13
|
+
* account admission (see `accountAccess.ts`), which is a separate question from
|
|
14
|
+
* which tier an admitted account is on. A manager with nothing validated
|
|
15
|
+
* reports "free" with `tierSource: "none"` and a locked `access`.
|
|
16
16
|
*/
|
|
17
|
-
export type BuoyTier = "
|
|
17
|
+
export type BuoyTier = "free" | "pro";
|
|
18
18
|
/**
|
|
19
19
|
* What granted the current tier.
|
|
20
20
|
*
|
|
@@ -23,7 +23,7 @@ export type BuoyTier = "anonymous" | "free" | "pro";
|
|
|
23
23
|
* NOT IMPLEMENTED YET; the type exists so every downstream layer
|
|
24
24
|
* reads `tier` instead of "does a key exist", which is what makes
|
|
25
25
|
* adding on-device login additive rather than a rewrite.
|
|
26
|
-
* - "none" —
|
|
26
|
+
* - "none" — nothing validated yet, or the last credential was rejected.
|
|
27
27
|
*/
|
|
28
28
|
export type TierSource = "key" | "session" | "none";
|
|
29
29
|
export interface LicenseValidationResult {
|
|
@@ -171,6 +171,15 @@ export interface CachedLicense {
|
|
|
171
171
|
fingerprint?: string;
|
|
172
172
|
/** Device name */
|
|
173
173
|
deviceName?: string;
|
|
174
|
+
/**
|
|
175
|
+
* This cache has nothing to learn from the server until it expires: a free
|
|
176
|
+
* key outside a development bundle, or a free key that is already on a
|
|
177
|
+
* fleet (see LICENSE_FLEET_MACHINE_THRESHOLD). Launch-time and daily
|
|
178
|
+
* revalidation both stand down; the 30-day expiry is the only clock. Never
|
|
179
|
+
* set for a paid key, whose expiry can move. Not covered by the checksum —
|
|
180
|
+
* it can only ever make the SDK ask LESS.
|
|
181
|
+
*/
|
|
182
|
+
quiet?: boolean;
|
|
174
183
|
/**
|
|
175
184
|
* Tamper-evident checksum over the licensing fields (see cacheSignature.ts).
|
|
176
185
|
* A blob whose checksum is missing or doesn't match is not trusted for Pro.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;GAUG;AACH,MAAM,MAAM,QAAQ,GAAG,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;GAUG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,KAAK,CAAC;AAEtC;;;;;;;;;GASG;AACH,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,SAAS,GAAG,MAAM,CAAC;AAEpD,MA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Date): boolean;
|
|
|
25
25
|
*/
|
|
26
26
|
export declare function useWeekendFreePro(): boolean;
|
|
27
27
|
/**
|
|
28
|
-
* Whether the Weekend Pass applies
|
|
28
|
+
* Whether the Weekend Pass applies right now.
|
|
29
29
|
*
|
|
30
|
-
* The pass is free Pro every Saturday and Sunday
|
|
31
|
-
*
|
|
32
|
-
*
|
|
30
|
+
* The pass is free Pro every Saturday and Sunday for an admitted account, free
|
|
31
|
+
* or paid. It never applies to a locked manager: with nothing validated there
|
|
32
|
+
* is no account to give the weekend to, and Pro access on a locked manager
|
|
33
|
+
* would be the one thing that could turn a missing key into a working tool.
|
|
33
34
|
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* withdraws it from anonymous, which makes claiming a key worth something and
|
|
37
|
-
* leaves every paying customer exactly where they were.
|
|
38
|
-
*
|
|
39
|
-
* Takes the tier as an argument rather than reading it, so this module stays a
|
|
40
|
-
* pure calendar utility and `hooks.ts` can keep importing it without a cycle.
|
|
35
|
+
* Takes admission as an argument rather than reading it, so this module stays
|
|
36
|
+
* a pure calendar utility and `hooks.ts` can keep importing it without a cycle.
|
|
41
37
|
*/
|
|
42
|
-
export declare function weekendPassAppliesTo(
|
|
38
|
+
export declare function weekendPassAppliesTo(admitted: boolean, weekend: boolean): boolean;
|
|
43
39
|
//# sourceMappingURL=weekendPro.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"weekendPro.d.ts","sourceRoot":"","sources":["../../../src/weekendPro.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;
|
|
1
|
+
{"version":3,"file":"weekendPro.d.ts","sourceRoot":"","sources":["../../../src/weekendPro.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAeH,+EAA+E;AAC/E,wBAAgB,gBAAgB,CAAC,GAAG,GAAE,IAAiB,GAAG,OAAO,CAGhE;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,IAAI,OAAO,CAY3C;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,OAAO,EACjB,OAAO,EAAE,OAAO,GACf,OAAO,CAET"}
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* including a free one (`npx buoy login`). Buy a key at
|
|
15
15
|
* https://buoy.gg or use it free on Saturday and Sunday.
|
|
16
16
|
*/
|
|
17
|
-
import type { BuoyTier,
|
|
17
|
+
import type { BuoyTier, LicenseListener } from "./types";
|
|
18
18
|
/** Info passed to device registration callback */
|
|
19
19
|
export interface DeviceRegistrationInfo {
|
|
20
20
|
fingerprint: string;
|
|
@@ -42,6 +42,11 @@ declare class LicenseManagerImpl {
|
|
|
42
42
|
* it no longer matches.
|
|
43
43
|
*/
|
|
44
44
|
private generation;
|
|
45
|
+
private configuredKey;
|
|
46
|
+
private persistence;
|
|
47
|
+
private verifiedAt;
|
|
48
|
+
private expiryTimer;
|
|
49
|
+
private removeForegroundListener;
|
|
45
50
|
/**
|
|
46
51
|
* Pending backoff retry after a transient failure (see
|
|
47
52
|
* LICENSE_TRANSIENT_RETRY_DELAYS). At most one is ever outstanding, and it
|
|
@@ -49,6 +54,8 @@ declare class LicenseManagerImpl {
|
|
|
49
54
|
*/
|
|
50
55
|
private retryTimer;
|
|
51
56
|
private retryAttempt;
|
|
57
|
+
/** The hold record, once read. `undefined` until the first read. */
|
|
58
|
+
private hold;
|
|
52
59
|
private deviceRegistrationCallback;
|
|
53
60
|
private pendingRegistration;
|
|
54
61
|
/**
|
|
@@ -59,6 +66,8 @@ declare class LicenseManagerImpl {
|
|
|
59
66
|
* Internal initialization logic
|
|
60
67
|
*/
|
|
61
68
|
private _doInitialize;
|
|
69
|
+
/** Omitted configuration preserves activation; an explicit blank signs out. */
|
|
70
|
+
configure(key?: string): Promise<boolean>;
|
|
62
71
|
/**
|
|
63
72
|
* Set and validate a license key.
|
|
64
73
|
*
|
|
@@ -86,6 +95,21 @@ declare class LicenseManagerImpl {
|
|
|
86
95
|
* prop, so without this the next attempt is the daily revalidation timer.
|
|
87
96
|
*/
|
|
88
97
|
private scheduleRetry;
|
|
98
|
+
/**
|
|
99
|
+
* Admit (or reject) a free-tier token. Verification is a signature check
|
|
100
|
+
* against the public key in config.ts; the cache is written so the next
|
|
101
|
+
* launch and the account-admission clock see a validated key, and marked
|
|
102
|
+
* quiet so nothing ever revalidates it against a server.
|
|
103
|
+
*/
|
|
104
|
+
private admitToken;
|
|
105
|
+
/**
|
|
106
|
+
* "Don't ask right now": serve the trusted cache if it vouches for this
|
|
107
|
+
* key, otherwise record why the tier can't move, then try exactly once when
|
|
108
|
+
* the wait is over. Used for server-set backoffs, both fresh and remembered.
|
|
109
|
+
*/
|
|
110
|
+
private standDown;
|
|
111
|
+
/** One retry at a server-chosen time. Replaces any ladder step pending. */
|
|
112
|
+
private scheduleRetryIn;
|
|
89
113
|
/** Drop any pending retry — a newer decision has replaced it. */
|
|
90
114
|
private cancelRetry;
|
|
91
115
|
/**
|
|
@@ -93,14 +117,21 @@ declare class LicenseManagerImpl {
|
|
|
93
117
|
*/
|
|
94
118
|
clearLicense(): Promise<void>;
|
|
95
119
|
/**
|
|
96
|
-
* Set the tier and keep the derived fields in step.
|
|
120
|
+
* Set the tier a validated key granted and keep the derived fields in step.
|
|
97
121
|
*
|
|
98
122
|
* `isPro` is a mirror of `tier === "pro"` and must never be assigned
|
|
99
123
|
* directly — that is exactly how a free key would end up granting Pro.
|
|
100
124
|
*/
|
|
101
125
|
private applyTier;
|
|
102
126
|
/**
|
|
103
|
-
*
|
|
127
|
+
* Forget whatever the current key had proven. There is no tier for "nothing
|
|
128
|
+
* validated": the tier falls back to free and `tierSource: "none"` is what
|
|
129
|
+
* makes `getAccountAccess()` report the manager locked.
|
|
130
|
+
*/
|
|
131
|
+
private lock;
|
|
132
|
+
/**
|
|
133
|
+
* The current tier. This is what caps should read; whether the tools are
|
|
134
|
+
* usable at all is `getAccountAccess()`.
|
|
104
135
|
*/
|
|
105
136
|
getTier(): BuoyTier;
|
|
106
137
|
/**
|
|
@@ -114,7 +145,21 @@ declare class LicenseManagerImpl {
|
|
|
114
145
|
/**
|
|
115
146
|
* Get current license state
|
|
116
147
|
*/
|
|
117
|
-
getState():
|
|
148
|
+
getState(): {
|
|
149
|
+
tier: BuoyTier;
|
|
150
|
+
isPro: boolean;
|
|
151
|
+
access: import("./accountAccess").AccountAccess;
|
|
152
|
+
isInitialized: boolean;
|
|
153
|
+
isValidating: boolean;
|
|
154
|
+
tierSource: import("./types").TierSource;
|
|
155
|
+
licenseKey: string | null;
|
|
156
|
+
error: string | null;
|
|
157
|
+
errorKind: "transport" | "verdict" | null;
|
|
158
|
+
expiresAt: Date | null;
|
|
159
|
+
};
|
|
160
|
+
getAccountAccess(): import("./accountAccess").AccountAccess;
|
|
161
|
+
hasAccountAccess(): boolean;
|
|
162
|
+
private setVerifiedAt;
|
|
118
163
|
/**
|
|
119
164
|
* Subscribe to license events
|
|
120
165
|
*/
|
|
@@ -138,12 +183,21 @@ declare class LicenseManagerImpl {
|
|
|
138
183
|
* launch-time revalidation would add nothing (see LICENSE_LAUNCH_VALIDATION_TTL).
|
|
139
184
|
*/
|
|
140
185
|
private isCacheFresh;
|
|
186
|
+
/**
|
|
187
|
+
* Whether a cache has anything to learn before it expires. Blobs written
|
|
188
|
+
* before the flag existed are judged the same way they would be today.
|
|
189
|
+
*/
|
|
190
|
+
private isQuiet;
|
|
191
|
+
private loadHold;
|
|
192
|
+
/** Replace the hold record (null clears it). Never throws: a failed write only costs a request. */
|
|
193
|
+
private saveHold;
|
|
141
194
|
/**
|
|
142
195
|
* Write the cache with a fresh checksum. Every write goes through here so a
|
|
143
196
|
* blob can never land on disk unsigned — an unsigned blob is treated as
|
|
144
197
|
* untrusted on the next read, which would silently drop a paying customer.
|
|
145
198
|
*/
|
|
146
199
|
private persistCache;
|
|
200
|
+
private saveCache;
|
|
147
201
|
private loadCachedLicense;
|
|
148
202
|
/**
|
|
149
203
|
* The install's stable device fingerprint, created once and persisted under
|
|
@@ -160,6 +214,7 @@ declare class LicenseManagerImpl {
|
|
|
160
214
|
*/
|
|
161
215
|
private registerDeviceAsync;
|
|
162
216
|
private validateInBackground;
|
|
217
|
+
refreshAccess(): void;
|
|
163
218
|
private startRevalidationTimer;
|
|
164
219
|
/**
|
|
165
220
|
* Stop the revalidation timer
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LicenseManager.d.ts","sourceRoot":"","sources":["../../../src/LicenseManager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;
|
|
1
|
+
{"version":3,"file":"LicenseManager.d.ts","sourceRoot":"","sources":["../../../src/LicenseManager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAiDH,OAAO,KAAK,EACV,QAAQ,EAKR,eAAe,EAChB,MAAM,SAAS,CAAC;AAUjB,kDAAkD;AAClD,MAAM,WAAW,sBAAsB;IACrC,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,mDAAmD;AACnD,MAAM,MAAM,0BAA0B,GAAG,CAAC,IAAI,EAAE,sBAAsB,KAAK,IAAI,CAAC;AA0ChF,cAAM,kBAAkB;IACtB,OAAO,CAAC,KAAK,CAUX;IAEF,OAAO,CAAC,SAAS,CAAmC;IACpD,OAAO,CAAC,iBAAiB,CAA+C;IACxE,OAAO,CAAC,aAAa,CAA8B;IACnD,OAAO,CAAC,kBAAkB,CAAgC;IAG1D,OAAO,CAAC,WAAW,CAA8B;IAEjD;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,UAAU,CAAK;IACvB,OAAO,CAAC,aAAa,CAA4B;IACjD,OAAO,CAAC,WAAW,CAAuC;IAC1D,OAAO,CAAC,UAAU,CAAuB;IACzC,OAAO,CAAC,WAAW,CAA8C;IACjE,OAAO,CAAC,wBAAwB,CAA6B;IAE7D;;;;OAIG;IACH,OAAO,CAAC,UAAU,CAA8C;IAChE,OAAO,CAAC,YAA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OAGG;IACG,0BAA0B,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAsCnE,OAAO,CAAC,IAAI;IAYZ,OAAO,CAAC,YAAY;IAWpB;;;OAGG;IACH,OAAO,CAAC,YAAY;IAKpB;;;OAGG;IACH,OAAO,CAAC,OAAO;YAKD,QAAQ;IAatB,mGAAmG;YACrF,QAAQ;IAWtB;;;;OAIG;YACW,YAAY;IAO1B,OAAO,CAAC,SAAS;YAUH,iBAAiB;IAiB/B;;;;;;OAMG;IACH,OAAO,CAAC,4BAA4B;YAetB,kBAAkB;IAUhC;;;OAGG;IACH,OAAO,CAAC,mBAAmB;IAiB3B,OAAO,CAAC,oBAAoB;IAK5B,aAAa,IAAI,IAAI;IAErB,OAAO,CAAC,sBAAsB;IA0B9B;;OAEG;IACH,qBAAqB,IAAI,IAAI;IAc7B;;;OAGG;IACG,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC;CAevC;AAGD,eAAO,MAAM,cAAc,oBAA2B,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { TierSource } from "./types";
|
|
2
|
+
export type AccountAccess = {
|
|
3
|
+
status: "initializing" | "locked" | "admitted";
|
|
4
|
+
reason: "checking" | "account_required" | "verification_expired" | null;
|
|
5
|
+
validUntil: number | null;
|
|
6
|
+
};
|
|
7
|
+
/** Account admission is independent of paid features and the Weekend Pass. */
|
|
8
|
+
export declare function resolveAccountAccess(input: {
|
|
9
|
+
initialized: boolean;
|
|
10
|
+
validating: boolean;
|
|
11
|
+
key: string | null;
|
|
12
|
+
/** "none" means nothing has been validated for the current key. */
|
|
13
|
+
tierSource: TierSource;
|
|
14
|
+
verifiedAt: number | null;
|
|
15
|
+
}, now?: number): AccountAccess;
|
|
16
|
+
//# sourceMappingURL=accountAccess.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accountAccess.d.ts","sourceRoot":"","sources":["../../../src/accountAccess.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,EAAE,cAAc,GAAG,QAAQ,GAAG,UAAU,CAAC;IAC/C,MAAM,EAAE,UAAU,GAAG,kBAAkB,GAAG,sBAAsB,GAAG,IAAI,CAAC;IACxE,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B,CAAC;AAEF,8EAA8E;AAC9E,wBAAgB,oBAAoB,CAAC,KAAK,EAAE;IAC1C,WAAW,EAAE,OAAO,CAAC;IACrB,UAAU,EAAE,OAAO,CAAC;IACpB,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,mEAAmE;IACnE,UAAU,EAAE,UAAU,CAAC;IACvB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B,EAAE,GAAG,SAAa,GAAG,aAAa,CAkBlC"}
|
|
@@ -25,8 +25,30 @@ export declare class LicenseTransportError extends Error {
|
|
|
25
25
|
readonly isTransient: true;
|
|
26
26
|
/** HTTP status, or null when the request never got an answer at all. */
|
|
27
27
|
readonly status: number | null;
|
|
28
|
-
|
|
28
|
+
/**
|
|
29
|
+
* How long the server asked us to wait, in ms, or null when it didn't say.
|
|
30
|
+
* Read from `Retry-After` (seconds or an HTTP date), falling back to
|
|
31
|
+
* `X-RateLimit-Reset` (epoch seconds). Only ever set on a 429.
|
|
32
|
+
*/
|
|
33
|
+
readonly retryAfterMs: number | null;
|
|
34
|
+
constructor(message: string, status: number | null, retryAfterMs?: number | null);
|
|
29
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* The server told us to stop asking for a while.
|
|
38
|
+
*
|
|
39
|
+
* 429 is Keygen's per-IP throttle; 402 is the account's daily quota, spent —
|
|
40
|
+
* and on the Dev tier that is a hard stop until it resets. Neither is a
|
|
41
|
+
* verdict about the key, and neither is a blip a retry ladder can outwait.
|
|
42
|
+
*/
|
|
43
|
+
export declare function isRateLimited(error: unknown): error is LicenseTransportError;
|
|
44
|
+
/**
|
|
45
|
+
* How long to stay quiet after a rate limit, in ms.
|
|
46
|
+
*
|
|
47
|
+
* A 429 says how long (default 60 s when it doesn't). A 402 says nothing, and
|
|
48
|
+
* Keygen's quota is daily, so there is no right number; LICENSE_QUOTA_COOLDOWN
|
|
49
|
+
* bounds how often a running app checks whether the day has turned.
|
|
50
|
+
*/
|
|
51
|
+
export declare function backoffAfter(error: LicenseTransportError, quotaCooldown: number, defaultWait: number): number;
|
|
30
52
|
/**
|
|
31
53
|
* True for anything that means "we could not ask", from any realm.
|
|
32
54
|
*
|
|
@@ -35,12 +57,22 @@ export declare class LicenseTransportError extends Error {
|
|
|
35
57
|
* and then the class identity differs from the one the thrower used.
|
|
36
58
|
*/
|
|
37
59
|
export declare function isTransientLicenseError(error: unknown): boolean;
|
|
60
|
+
/** Bounds the request AND body read, including fetch implementations that ignore abort. */
|
|
61
|
+
export declare function validateLicense(key: string): Promise<KeygenValidationResponse>;
|
|
62
|
+
/** Machine registration is advisory; unknown or scope/policy errors cannot grant access. */
|
|
63
|
+
export declare function isAcceptedValidation(response: KeygenValidationResponse): boolean;
|
|
38
64
|
/**
|
|
39
|
-
*
|
|
65
|
+
* How many machines the validated license already has, per the response.
|
|
66
|
+
*
|
|
67
|
+
* Keygen includes `relationships.machines.meta.count` on the license object,
|
|
68
|
+
* so this is free to read. Zero when the response doesn't carry it.
|
|
40
69
|
*/
|
|
41
|
-
export declare function
|
|
70
|
+
export declare function machineCount(response: KeygenValidationResponse): number;
|
|
42
71
|
/**
|
|
43
|
-
*
|
|
72
|
+
* Register this device for a license (for visibility, not enforcement).
|
|
73
|
+
*
|
|
74
|
+
* Goes through Buoy's endpoint, which holds the product token and forwards
|
|
75
|
+
* Keygen's answer unchanged, so the same error codes come back.
|
|
44
76
|
*/
|
|
45
77
|
export declare function activateMachine(licenseId: string, licenseKey: string, fingerprint: string, name: string, metadata?: Record<string, string>): Promise<KeygenMachineResponse>;
|
|
46
78
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/api.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EACV,wBAAwB,EACxB,qBAAqB,EAErB,uBAAuB,EACxB,MAAM,SAAS,CAAC;AAIjB;;;;;;;;;;;;;;GAcG;AACH,qBAAa,qBAAsB,SAAQ,KAAK;IAC9C,8EAA8E;IAC9E,QAAQ,CAAC,WAAW,EAAG,IAAI,CAAU;IACrC,wEAAwE;IACxE,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/api.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EACV,wBAAwB,EACxB,qBAAqB,EAErB,uBAAuB,EACxB,MAAM,SAAS,CAAC;AAIjB;;;;;;;;;;;;;;GAcG;AACH,qBAAa,qBAAsB,SAAQ,KAAK;IAC9C,8EAA8E;IAC9E,QAAQ,CAAC,WAAW,EAAG,IAAI,CAAU;IACrC,wEAAwE;IACxE,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B;;;;OAIG;IACH,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;gBAEzB,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,EAAE,YAAY,GAAE,MAAM,GAAG,IAAW;CAMvF;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,qBAAqB,CAG5E;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,qBAAqB,EAAE,aAAa,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAG7G;AAoBD;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAS/D;AAiFD,2FAA2F;AAC3F,wBAAsB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAcpF;AAED,4FAA4F;AAC5F,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,wBAAwB,GAAG,OAAO,CAQhF;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,wBAAwB,GAAG,MAAM,CAGvE;AAED;;;;;GAKG;AACH,wBAAsB,eAAe,CACnC,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,MAAM,EACZ,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAChC,OAAO,CAAC,qBAAqB,CAAC,CA0BhC;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,wBAAwB,GACjC,uBAAuB,CAUzB;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAQzD"}
|
|
@@ -21,18 +21,32 @@
|
|
|
21
21
|
export declare const KEYGEN_CONFIG: {
|
|
22
22
|
readonly accountId: "b0eba0e8-e904-4906-b644-38f9aab57bed";
|
|
23
23
|
/**
|
|
24
|
-
* The Keygen PRODUCT id
|
|
25
|
-
*
|
|
24
|
+
* The Keygen PRODUCT id, used to check that a validated license belongs to
|
|
25
|
+
* Buoy (see `isAcceptedValidation`).
|
|
26
26
|
*
|
|
27
27
|
* Careful: this field previously held `1037431d-b2fe-48db-aca9-10c5e9c4d944`,
|
|
28
|
-
* which is not a product at all — it
|
|
28
|
+
* which is not a product at all — it was the ID of a product token.
|
|
29
29
|
* Verified against the Keygen dashboard (Aug 2026): the account has exactly
|
|
30
30
|
* one product, "Buoy", and this is its id.
|
|
31
31
|
*/
|
|
32
32
|
readonly productId: "bf67cb43-eeef-40ca-b308-e6e1b22c0eaa";
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
/**
|
|
34
|
+
* Buoy's license endpoint. It sits in front of Keygen and answers from a
|
|
35
|
+
* cache, so the license server hears about a key about once an hour no
|
|
36
|
+
* matter how many devices hold it; Keygen's response body comes back
|
|
37
|
+
* unchanged. Device registration goes through it too, which is why no
|
|
38
|
+
* product token ships in this package any more: the token used to be
|
|
39
|
+
* embedded here, and anything embedded in an app is public.
|
|
40
|
+
*/
|
|
41
|
+
readonly apiUrl: "https://buoy.gg/api/license";
|
|
35
42
|
};
|
|
43
|
+
/**
|
|
44
|
+
* Ed25519 public key that free-tier tokens are verified against (see
|
|
45
|
+
* freeToken.ts). Not a secret: it can only check signatures, never make them.
|
|
46
|
+
* The private half lives in the website Worker as BUOY_FREE_TOKEN_PRIVATE_KEY.
|
|
47
|
+
* Rotating it means a new SDK release, since this ships in the bundle.
|
|
48
|
+
*/
|
|
49
|
+
export declare const FREE_TOKEN_PUBLIC_KEY = "3b546fc717a62683f3236c70167899a271bee3ffc04df6ec1eea60a394a2f1e9";
|
|
36
50
|
/**
|
|
37
51
|
* Keygen policy IDs, which are what decide a key's tier.
|
|
38
52
|
*
|
|
@@ -72,22 +86,48 @@ export declare const LICENSE_LAUNCH_VALIDATION_TTL: number;
|
|
|
72
86
|
*/
|
|
73
87
|
export declare const LICENSE_TRANSIENT_RETRY_DELAYS: readonly [number, number, number, number, number];
|
|
74
88
|
/**
|
|
75
|
-
*
|
|
89
|
+
* Server-driven backoff, the way Sentry and PostHog SDKs handle it.
|
|
76
90
|
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
91
|
+
* The retry schedule above exists for blips: a 5xx, a dropped connection, a
|
|
92
|
+
* proxy in the way. It is the WRONG response to the server saying "stop": a
|
|
93
|
+
* 429 carries a Retry-After, and a 402 means the account's daily quota is
|
|
94
|
+
* spent, so every retry is a request that cannot succeed and is billed anyway.
|
|
95
|
+
* During the August 2026 quota incident each fresh install spent six requests
|
|
96
|
+
* per launch on exactly that, which made the outage worse the longer it ran.
|
|
79
97
|
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
98
|
+
* The rule: a 429 waits exactly as long as the server said (default 60 s if it
|
|
99
|
+
* said nothing); a 402 waits LICENSE_QUOTA_COOLDOWN. Either way the wait is
|
|
100
|
+
* persisted, so a dev reload or a relaunch inside the window makes no request
|
|
101
|
+
* at all, and one attempt runs when the window ends.
|
|
102
|
+
*/
|
|
103
|
+
export declare const LICENSE_RATE_LIMIT_DEFAULT_WAIT: number;
|
|
104
|
+
export declare const LICENSE_QUOTA_COOLDOWN: number;
|
|
105
|
+
/**
|
|
106
|
+
* A verdict is an answer, and answers don't change by relaunching.
|
|
82
107
|
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
108
|
+
* NOT_FOUND, SUSPENDED and BANNED clear the cache, so without this the next
|
|
109
|
+
* launch asks the exact same question, and a key that is dead in a shipped app
|
|
110
|
+
* costs one request per launch per device forever. The verdict is remembered
|
|
111
|
+
* for this long; a key typed in by hand always asks again.
|
|
112
|
+
*/
|
|
113
|
+
export declare const LICENSE_VERDICT_CACHE_DURATION: number;
|
|
114
|
+
/**
|
|
115
|
+
* A key already attached to this many machines is running on a fleet, not a
|
|
116
|
+
* developer's desk. The device stops registering itself and stops
|
|
117
|
+
* revalidating: whatever the answer is, it will not change per phone. The
|
|
118
|
+
* count comes back in the validation response, so this costs nothing to know.
|
|
119
|
+
*/
|
|
120
|
+
export declare const LICENSE_FLEET_MACHINE_THRESHOLD = 50;
|
|
121
|
+
/**
|
|
122
|
+
* Launch-time revalidation TTL for caches that have nothing to learn.
|
|
87
123
|
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
*
|
|
124
|
+
* A free key cannot lose a tier it doesn't have, and outside a development
|
|
125
|
+
* bundle it cannot render anything either, so re-asking every hour (launch) or
|
|
126
|
+
* every day (timer) is pure quota spend. The same goes for a fleet member. The
|
|
127
|
+
* 30-day cache expiry is the only clock these caches keep. Pro keys and free
|
|
128
|
+
* keys on a developer's machine keep the short TTL: an upgrade or an expiry
|
|
129
|
+
* has to land.
|
|
91
130
|
*/
|
|
92
|
-
export declare const
|
|
131
|
+
export declare const LICENSE_QUIET_VALIDATION_TTL: number;
|
|
132
|
+
export declare const LICENSE_HOLD_STORAGE_KEY = "buoy-gg-license-hold";
|
|
93
133
|
//# sourceMappingURL=config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH;;GAEG;AAEH,eAAO,MAAM,aAAa;;IAExB;;;;;;;;OAQG
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH;;GAEG;AAEH,eAAO,MAAM,aAAa;;IAExB;;;;;;;;OAQG;;IAEH;;;;;;;OAOG;;CAEK,CAAC;AAEX;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,qEAAqE,CAAC;AAExG;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe;IAC1B,iEAAiE;;IAEjE,qEAAqE;;IAErE,oDAAoD;;CAE5C,CAAC;AAGX,eAAO,MAAM,sBAAsB,QAA2B,CAAC;AAI/D,eAAO,MAAM,6BAA6B,QAAsB,CAAC;AAIjE,eAAO,MAAM,mBAAmB,oBAAoB,CAAC;AAMrD,eAAO,MAAM,8BAA8B,+BAA+B,CAAC;AAM3E,eAAO,MAAM,6BAA6B,QAAiB,CAAC;AAE5D;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,8BAA8B,mDAMjC,CAAC;AAEX;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,+BAA+B,QAAY,CAAC;AACzD,eAAO,MAAM,sBAAsB,QAAiB,CAAC;AAErD;;;;;;;GAOG;AACH,eAAO,MAAM,8BAA8B,QAAsB,CAAC;AAElE;;;;;GAKG;AACH,eAAO,MAAM,+BAA+B,KAAK,CAAC;AAElD;;;;;;;;;GASG;AACH,eAAO,MAAM,4BAA4B,QAAyB,CAAC;AAKnE,eAAO,MAAM,wBAAwB,yBAAyB,CAAC"}
|
|
@@ -8,6 +8,22 @@
|
|
|
8
8
|
* Generate a UUID v4
|
|
9
9
|
*/
|
|
10
10
|
export declare function generateUUID(): string;
|
|
11
|
+
/**
|
|
12
|
+
* Whether this bundle was served by Metro — i.e. we are on a developer's
|
|
13
|
+
* machine, or on a device/simulator tethered to one.
|
|
14
|
+
*
|
|
15
|
+
* This is the question the license package actually needs answered, and it
|
|
16
|
+
* is a better one than `__DEV__`. A store build, a TestFlight build and a CI
|
|
17
|
+
* artifact all load their JS from a file inside the app; only a dev server
|
|
18
|
+
* hands out `http://…/index.bundle`. Machine registration exists so a
|
|
19
|
+
* developer can see their devices on the dashboard, and revalidating a free
|
|
20
|
+
* key only matters where it can render — both are "on a developer's machine"
|
|
21
|
+
* questions, and both used to run on every phone an app shipped to.
|
|
22
|
+
*
|
|
23
|
+
* When the script URL is unavailable (tests, unusual hosts) fall back to
|
|
24
|
+
* `__DEV__`, which is right far more often than it is wrong.
|
|
25
|
+
*/
|
|
26
|
+
export declare function isDevBundle(): boolean;
|
|
11
27
|
/**
|
|
12
28
|
* Check if running on a simulator/emulator using Platform constants
|
|
13
29
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"device-info.d.ts","sourceRoot":"","sources":["../../../src/device-info.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH;;GAEG;AACH,wBAAgB,YAAY,IAAI,MAAM,CAMrC;AAED;;GAEG;AACH,wBAAgB,WAAW,IAAI,OAAO,CAoCrC;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAuB1D;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAI7C"}
|
|
1
|
+
{"version":3,"file":"device-info.d.ts","sourceRoot":"","sources":["../../../src/device-info.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH;;GAEG;AACH,wBAAgB,YAAY,IAAI,MAAM,CAMrC;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,WAAW,IAAI,OAAO,CAarC;AAED;;GAEG;AACH,wBAAgB,WAAW,IAAI,OAAO,CAoCrC;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAuB1D;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAI7C"}
|
|
@@ -8,6 +8,13 @@
|
|
|
8
8
|
* Generate a UUID v4
|
|
9
9
|
*/
|
|
10
10
|
export declare function generateUUID(): string;
|
|
11
|
+
/**
|
|
12
|
+
* Whether this is a development bundle. There is no Metro on the web side,
|
|
13
|
+
* so the build flag is the only signal. Electron hosts are always "dev" from
|
|
14
|
+
* the license package's point of view: the desktop app is the developer's
|
|
15
|
+
* own tool, never something shipped to end users.
|
|
16
|
+
*/
|
|
17
|
+
export declare function isDevBundle(): boolean;
|
|
11
18
|
/**
|
|
12
19
|
* Check if running on a simulator/emulator
|
|
13
20
|
* Always returns false for web/Electron
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"device-info.web.d.ts","sourceRoot":"","sources":["../../../src/device-info.web.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,wBAAgB,YAAY,IAAI,MAAM,CAYrC;AAED;;;GAGG;AACH,wBAAgB,WAAW,IAAI,OAAO,CAErC;AA8HD;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CA6B1D;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAc7C"}
|
|
1
|
+
{"version":3,"file":"device-info.web.d.ts","sourceRoot":"","sources":["../../../src/device-info.web.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,wBAAgB,YAAY,IAAI,MAAM,CAYrC;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,IAAI,OAAO,CAQrC;AAED;;;GAGG;AACH,wBAAgB,WAAW,IAAI,OAAO,CAErC;AA8HD;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CA6B1D;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAc7C"}
|