@buoy-gg/license 7.0.36 → 7.0.38
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 +32 -3
- package/lib/typescript/commonjs/api.d.ts.map +1 -1
- package/lib/typescript/commonjs/config.d.ts +46 -13
- 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 +32 -3
- package/lib/typescript/module/api.d.ts.map +1 -1
- package/lib/typescript/module/config.d.ts +46 -13
- 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
package/lib/module/index.js
CHANGED
|
@@ -15,4 +15,4 @@
|
|
|
15
15
|
* Pro is $9/mo, and is free every weekend for anyone holding a key —
|
|
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
|
-
*/export{LicenseManager}from"./LicenseManager.js";export{DeviceRegistrationModal}from"./DeviceRegistrationModal.js";export{useLicense,useFeatureAccess,useIsPro,useProAccess,useTier}from"./hooks.js";export{
|
|
18
|
+
*/export{LicenseManager}from"./LicenseManager.js";export{DeviceRegistrationModal}from"./DeviceRegistrationModal.js";export{useLicense,useFeatureAccess,useIsPro,useProAccess,useTier}from"./hooks.js";export{useAccountAccess}from"./hooks.js";export{resolveAccountAccess}from"./accountAccess.js";export{LicenseTransportError,isTransientLicenseError}from"./api.js";export{isBuoyToken}from"./freeToken.js";export{isWeekendFreePro,useWeekendFreePro}from"./weekendPro.js";export async function setLicenseKey(e){const{LicenseManager:r}=await import("./LicenseManager");await r.initialize();return r.setLicenseKey(e)}function n(){const{isWeekendFreePro:e,weekendPassAppliesTo:r}=require("./weekendPro");const{LicenseManager:s}=require("./LicenseManager");return r(s.hasAccountAccess(),e())}export function isPro(){const{LicenseManager:e}=require("./LicenseManager");if(e.isPro())return true;return n()}export function hasEntitlement(e){const{LicenseManager:r}=require("./LicenseManager");if(r.hasEntitlement(e))return true;return n()}
|
package/lib/module/index.web.js
CHANGED
|
@@ -15,4 +15,4 @@
|
|
|
15
15
|
* Pro is $9/mo, and is free every weekend for anyone holding a key —
|
|
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
|
-
*/export{LicenseManager}from"./LicenseManager.js";export{useLicense,useFeatureAccess,useIsPro,useProAccess,useTier}from"./hooks.js";export{
|
|
18
|
+
*/import{LicenseManager as r}from"./LicenseManager.js";import{isWeekendFreePro as n,weekendPassAppliesTo as o}from"./weekendPro.js";export{LicenseManager}from"./LicenseManager.js";export{useLicense,useFeatureAccess,useIsPro,useProAccess,useTier}from"./hooks.js";export{useAccountAccess}from"./hooks.js";export{resolveAccountAccess}from"./accountAccess.js";export{LicenseTransportError,isTransientLicenseError}from"./api.js";export{isBuoyToken}from"./freeToken.js";export{isWeekendFreePro,useWeekendFreePro}from"./weekendPro.js";export async function setLicenseKey(e){const{LicenseManager:s}=await import("./LicenseManager");await s.initialize();return s.setLicenseKey(e)}function t(){return o(r.hasAccountAccess(),n())}export function isPro(){if(r.isPro())return true;return t()}export function hasEntitlement(e){if(r.hasEntitlement(e))return true;return t()}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const m="buoy-license";let c=null;let a=null;const l=new Map;function y(){if(c)return c;try{const e=require("expo-file-system/legacy");c=e?.default||e;if(c?.documentDirectory){return c}c=null}catch{}try{const e=require("expo-file-system");c=e?.default||e;if(c?.documentDirectory){return c}c=null}catch{}return null}function f(){const e=y();if(!e?.documentDirectory)return null;return`${e.documentDirectory}${m}/`}function u(e){const n=f();if(!n)return null;return`${n}${encodeURIComponent(e)}.json`}function g(){try{const e=require("@react-native-async-storage/async-storage");const n=e?.default||e;if(typeof n?.getItem==="function"&&typeof n.setItem==="function"&&typeof n.removeItem==="function"){return n}}catch{}return null}function I(){try{return typeof localStorage!=="undefined"&&!!localStorage}catch{return false}}export async function getLicenseStorage(){if(a)return a;const e=y();let n=null;if(e?.documentDirectory){a={async getItem(t){const r=u(t);if(!r)return null;try{const o=await e.getInfoAsync(r);if(!o.exists)return null;return await e.readAsStringAsync(r)}catch{return null}},async setItem(t,r){const o=f();const s=u(t);if(!o||!s)return;try{const i=await e.getInfoAsync(o);if(!i.exists){await e.makeDirectoryAsync(o,{intermediates:true})}await e.writeAsStringAsync(s,r)}catch(i){console.warn("[Buoy] License storage write failed:",i)}},async removeItem(t){const r=u(t);if(!r)return;try{await e.deleteAsync(r,{idempotent:true})}catch{}}}}else if(n=g()){const t=n;a={async getItem(r){try{return await t.getItem(r)}catch{return null}},async setItem(r,o){try{await t.setItem(r,o)}catch(s){console.warn("[Buoy] License storage write failed:",s)}},async removeItem(r){try{await t.removeItem(r)}catch{}}}}else if(I()){a={async getItem(t){try{return localStorage.getItem(t)}catch{return null}},async setItem(t,r){try{localStorage.setItem(t,r)}catch{}},async removeItem(t){try{localStorage.removeItem(t)}catch{}}}}else{a={async getItem(t){return l.get(t)??null},async setItem(t,r){l.set(t,r)},async removeItem(t){l.delete(t)}}}return a}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=new Map;const c={async getItem(t){try{return localStorage.getItem(t)??e.get(t)??null}catch{return e.get(t)??null}},async setItem(t,r){e.set(t,r);try{localStorage.setItem(t,r)}catch{}},async removeItem(t){e.delete(t);try{localStorage.removeItem(t)}catch{}}};export async function getLicenseStorage(){return c}
|
package/lib/module/tier.js
CHANGED
|
@@ -14,4 +14,4 @@
|
|
|
14
14
|
* Pro is $9/mo, and is free every weekend for anyone holding a key —
|
|
15
15
|
* including a free one (`npx buoy login`). Buy a key at
|
|
16
16
|
* https://buoy.gg or use it free on Saturday and Sunday.
|
|
17
|
-
*/import{KEYGEN_POLICIES as
|
|
17
|
+
*/import{KEYGEN_CONFIG as n,KEYGEN_POLICIES as e}from"./config.js";export function resolveTier(r){const t=r.relationships?.policy?.data?.id;if(t===e.free)return"free";if(t===e.solo||t===e.business){return"pro"}const o=r.attributes?.metadata?.plan;if(o==="free")return"free";return"pro"}export function tierAfterFatalError(r){return r==="EXPIRED"?"free":null}export function isRecognizedAccount(r){if(!r)return false;const t=r.relationships?.product?.data?.id;if(t)return t===n.productId;const o=r.relationships?.policy?.data?.id;return Object.values(e).some(i=>i===o)}
|
package/lib/module/weekendPro.js
CHANGED
|
@@ -15,4 +15,4 @@
|
|
|
15
15
|
* Pro is $9/mo, and is free every weekend for anyone holding a key —
|
|
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
|
-
*/import{
|
|
18
|
+
*/import{useEffect as s,useState as c}from"react";export function isWeekendFreePro(t=new Date){const e=t.getDay();return e===0||e===6}export function useWeekendFreePro(){const[t,e]=c(()=>isWeekendFreePro());s(()=>{const o=setInterval(()=>{const n=isWeekendFreePro();e(r=>r===n?r:n)},60*1e3);return()=>clearInterval(o)},[]);return t}export function weekendPassAppliesTo(t,e){return e&&t}
|
|
@@ -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;I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EG;IACH,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAIrC;;OAEG;IACH,QAAQ;;;;;;;;;;;;IAMR,gBAAgB;IAOhB,gBAAgB,IAAI,OAAO;IAE3B,OAAO,CAAC,aAAa;IAkBrB;;OAEG;IACH,SAAS,CAAC,QAAQ,EAAE,eAAe,GAAG,MAAM,IAAI;IAKhD;;;;;OAKG;IACH,0BAA0B,CAAC,QAAQ,EAAE,0BAA0B,GAAG,MAAM,IAAI;IAO5E;;;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,10 +57,17 @@ 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
|
* Activate a machine for a license (for visibility, not enforcement)
|
|
44
73
|
*/
|
|
@@ -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;AAqGD,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;;GAEG;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,CAsEhC;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,wBAAwB,GACjC,uBAAuB,CAUzB;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAQzD"}
|
|
@@ -33,6 +33,13 @@ export declare const KEYGEN_CONFIG: {
|
|
|
33
33
|
readonly productToken: "prod-4467c14b75b715e91884945cd3e69705846ccbce7dd5e380236a1ab3bc03139fv3";
|
|
34
34
|
readonly apiUrl: "https://api.keygen.sh/v1/accounts";
|
|
35
35
|
};
|
|
36
|
+
/**
|
|
37
|
+
* Ed25519 public key that free-tier tokens are verified against (see
|
|
38
|
+
* freeToken.ts). Not a secret: it can only check signatures, never make them.
|
|
39
|
+
* The private half lives in the website Worker as BUOY_FREE_TOKEN_PRIVATE_KEY.
|
|
40
|
+
* Rotating it means a new SDK release, since this ships in the bundle.
|
|
41
|
+
*/
|
|
42
|
+
export declare const FREE_TOKEN_PUBLIC_KEY = "3b546fc717a62683f3236c70167899a271bee3ffc04df6ec1eea60a394a2f1e9";
|
|
36
43
|
/**
|
|
37
44
|
* Keygen policy IDs, which are what decide a key's tier.
|
|
38
45
|
*
|
|
@@ -72,22 +79,48 @@ export declare const LICENSE_LAUNCH_VALIDATION_TTL: number;
|
|
|
72
79
|
*/
|
|
73
80
|
export declare const LICENSE_TRANSIENT_RETRY_DELAYS: readonly [number, number, number, number, number];
|
|
74
81
|
/**
|
|
75
|
-
*
|
|
82
|
+
* Server-driven backoff, the way Sentry and PostHog SDKs handle it.
|
|
76
83
|
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
84
|
+
* The retry schedule above exists for blips: a 5xx, a dropped connection, a
|
|
85
|
+
* proxy in the way. It is the WRONG response to the server saying "stop": a
|
|
86
|
+
* 429 carries a Retry-After, and a 402 means the account's daily quota is
|
|
87
|
+
* spent, so every retry is a request that cannot succeed and is billed anyway.
|
|
88
|
+
* During the August 2026 quota incident each fresh install spent six requests
|
|
89
|
+
* per launch on exactly that, which made the outage worse the longer it ran.
|
|
79
90
|
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
91
|
+
* The rule: a 429 waits exactly as long as the server said (default 60 s if it
|
|
92
|
+
* said nothing); a 402 waits LICENSE_QUOTA_COOLDOWN. Either way the wait is
|
|
93
|
+
* persisted, so a dev reload or a relaunch inside the window makes no request
|
|
94
|
+
* at all, and one attempt runs when the window ends.
|
|
95
|
+
*/
|
|
96
|
+
export declare const LICENSE_RATE_LIMIT_DEFAULT_WAIT: number;
|
|
97
|
+
export declare const LICENSE_QUOTA_COOLDOWN: number;
|
|
98
|
+
/**
|
|
99
|
+
* A verdict is an answer, and answers don't change by relaunching.
|
|
82
100
|
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
101
|
+
* NOT_FOUND, SUSPENDED and BANNED clear the cache, so without this the next
|
|
102
|
+
* launch asks the exact same question, and a key that is dead in a shipped app
|
|
103
|
+
* costs one request per launch per device forever. The verdict is remembered
|
|
104
|
+
* for this long; a key typed in by hand always asks again.
|
|
105
|
+
*/
|
|
106
|
+
export declare const LICENSE_VERDICT_CACHE_DURATION: number;
|
|
107
|
+
/**
|
|
108
|
+
* A key already attached to this many machines is running on a fleet, not a
|
|
109
|
+
* developer's desk. The device stops registering itself and stops
|
|
110
|
+
* revalidating: whatever the answer is, it will not change per phone. The
|
|
111
|
+
* count comes back in the validation response, so this costs nothing to know.
|
|
112
|
+
*/
|
|
113
|
+
export declare const LICENSE_FLEET_MACHINE_THRESHOLD = 50;
|
|
114
|
+
/**
|
|
115
|
+
* Launch-time revalidation TTL for caches that have nothing to learn.
|
|
87
116
|
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
*
|
|
117
|
+
* A free key cannot lose a tier it doesn't have, and outside a development
|
|
118
|
+
* bundle it cannot render anything either, so re-asking every hour (launch) or
|
|
119
|
+
* every day (timer) is pure quota spend. The same goes for a fleet member. The
|
|
120
|
+
* 30-day cache expiry is the only clock these caches keep. Pro keys and free
|
|
121
|
+
* keys on a developer's machine keep the short TTL: an upgrade or an expiry
|
|
122
|
+
* has to land.
|
|
91
123
|
*/
|
|
92
|
-
export declare const
|
|
124
|
+
export declare const LICENSE_QUIET_VALIDATION_TTL: number;
|
|
125
|
+
export declare const LICENSE_HOLD_STORAGE_KEY = "buoy-gg-license-hold";
|
|
93
126
|
//# 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;;;;CAMK,CAAC;AAEX;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe;IAC1B,iEAAiE;;IAEjE,qEAAqE;;IAErE,oDAAoD;;CAE5C,CAAC;AAGX,eAAO,MAAM,sBAAsB,QAA2B,CA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
|
|
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"}
|
|
@@ -4,5 +4,5 @@
|
|
|
4
4
|
* The fingerprint is a generated UUID that is stored alongside the license.
|
|
5
5
|
* It's created when the user registers their device and persists with the license data.
|
|
6
6
|
*/
|
|
7
|
-
export { generateUUID, isSimulator, getDeviceMetadata, getDefaultDeviceName, } from "./device-info";
|
|
7
|
+
export { generateUUID, isDevBundle, isSimulator, getDeviceMetadata, getDefaultDeviceName, } from "./device-info";
|
|
8
8
|
//# sourceMappingURL=fingerprint.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fingerprint.d.ts","sourceRoot":"","sources":["../../../src/fingerprint.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,YAAY,EACZ,WAAW,EACX,iBAAiB,EACjB,oBAAoB,GACrB,MAAM,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"fingerprint.d.ts","sourceRoot":"","sources":["../../../src/fingerprint.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,YAAY,EACZ,WAAW,EACX,WAAW,EACX,iBAAiB,EACjB,oBAAoB,GACrB,MAAM,eAAe,CAAC"}
|
|
@@ -4,5 +4,5 @@
|
|
|
4
4
|
* The fingerprint is a generated UUID that is stored alongside the license.
|
|
5
5
|
* It's created when the user registers their device and persists with the license data.
|
|
6
6
|
*/
|
|
7
|
-
export { generateUUID, isSimulator, getDeviceMetadata, getDefaultDeviceName, } from "./device-info.web";
|
|
7
|
+
export { generateUUID, isDevBundle, isSimulator, getDeviceMetadata, getDefaultDeviceName, } from "./device-info.web";
|
|
8
8
|
//# sourceMappingURL=fingerprint.web.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fingerprint.web.d.ts","sourceRoot":"","sources":["../../../src/fingerprint.web.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,YAAY,EACZ,WAAW,EACX,iBAAiB,EACjB,oBAAoB,GACrB,MAAM,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"fingerprint.web.d.ts","sourceRoot":"","sources":["../../../src/fingerprint.web.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,YAAY,EACZ,WAAW,EACX,WAAW,EACX,iBAAiB,EACjB,oBAAoB,GACrB,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"foreground.d.ts","sourceRoot":"","sources":["../../../src/foreground.ts"],"names":[],"mappings":"AACA,mFAAmF;AACnF,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAGnE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"foreground.web.d.ts","sourceRoot":"","sources":["../../../src/foreground.web.ts"],"names":[],"mappings":"AAAA,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAMnE"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* PROPRIETARY — Buoy Pro license enforcement. NOT open source.
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) Buoy. All rights reserved. Licensed under the Buoy EULA
|
|
5
|
+
* (https://buoy.gg/terms), not an OSS license.
|
|
6
|
+
*/
|
|
7
|
+
export declare const FREE_TOKEN_PREFIX = "BUOY1";
|
|
8
|
+
export interface FreeTokenClaims {
|
|
9
|
+
tier: "free";
|
|
10
|
+
/** When the token was issued, ms since epoch. */
|
|
11
|
+
issuedAt: number;
|
|
12
|
+
/** Hex of the 16-byte account hash. */
|
|
13
|
+
accountHash: string;
|
|
14
|
+
}
|
|
15
|
+
/** Whether a key is a Buoy token rather than a Keygen license key. */
|
|
16
|
+
export declare function isBuoyToken(key: string): boolean;
|
|
17
|
+
/** First 16 bytes of sha512(account id): what the token carries instead of an email. */
|
|
18
|
+
export declare function accountHashFor(accountId: string): Uint8Array;
|
|
19
|
+
/**
|
|
20
|
+
* Issue a token. Server-side only: needs the private key (the 32-byte seed,
|
|
21
|
+
* hex). Deterministic for a given (account, issuedAt), so an account always
|
|
22
|
+
* sees the same token.
|
|
23
|
+
*/
|
|
24
|
+
export declare function mintFreeToken(accountId: string, issuedAtMs: number, privateKeyHex: string): string;
|
|
25
|
+
/** The public key for a private seed, hex. Used by tests and the keypair script. */
|
|
26
|
+
export declare function publicKeyFor(privateKeyHex: string): string;
|
|
27
|
+
/** @internal test seam — only free-tier claims ride on this key. */
|
|
28
|
+
export declare function __setFreeTokenPublicKeyForTests(hex: string | null): void;
|
|
29
|
+
/**
|
|
30
|
+
* Verify a token offline. Null for anything that is not a token this public
|
|
31
|
+
* key signed: wrong format, wrong version, wrong tier code, bad signature.
|
|
32
|
+
*/
|
|
33
|
+
export declare function verifyFreeToken(key: string, publicKeyHex?: string): FreeTokenClaims | null;
|
|
34
|
+
//# sourceMappingURL=freeToken.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"freeToken.d.ts","sourceRoot":"","sources":["../../../src/freeToken.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAmCH,eAAO,MAAM,iBAAiB,UAAU,CAAC;AASzC,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,iDAAiD;IACjD,QAAQ,EAAE,MAAM,CAAC;IACjB,uCAAuC;IACvC,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,sEAAsE;AACtE,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAEhD;AAqED,wFAAwF;AACxF,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,UAAU,CAE5D;AAeD;;;;GAIG;AACH,wBAAgB,aAAa,CAC3B,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,MAAM,GACpB,MAAM,CAKR;AAED,oFAAoF;AACpF,wBAAgB,YAAY,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAE1D;AAKD,oEAAoE;AACpE,wBAAgB,+BAA+B,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAExE;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,YAAY,GAAE,MAAwB,GAAG,eAAe,GAAG,IAAI,CAe3G"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Platform-neutral licensing policy. Safe to import from plain Node. */
|
|
2
|
+
export { validateLicense, isAcceptedValidation, isTransientLicenseError, LicenseTransportError } from "./api";
|
|
3
|
+
export { resolveTier, isRecognizedAccount } from "./tier";
|
|
4
|
+
export { isBuoyToken, verifyFreeToken, mintFreeToken, accountHashFor, publicKeyFor, __setFreeTokenPublicKeyForTests } from "./freeToken";
|
|
5
|
+
export type { FreeTokenClaims } from "./freeToken";
|
|
6
|
+
export { resolveAccountAccess } from "./accountAccess";
|
|
7
|
+
export { signCache, verifyCacheSignature } from "./cacheSignature";
|
|
8
|
+
export { LICENSE_CACHE_DURATION, LICENSE_REVALIDATION_INTERVAL, LICENSE_LAUNCH_VALIDATION_TTL, LICENSE_TRANSIENT_RETRY_DELAYS, KEYGEN_CONFIG } from "./config";
|
|
9
|
+
export type { CachedLicense, BuoyTier, KeygenValidationResponse } from "./types";
|
|
10
|
+
//# sourceMappingURL=headless.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"headless.d.ts","sourceRoot":"","sources":["../../../src/headless.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,qBAAqB,EAAE,MAAM,OAAO,CAAC;AAC9G,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,QAAQ,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,aAAa,EAAE,cAAc,EAAE,YAAY,EAAE,+BAA+B,EAAE,MAAM,aAAa,CAAC;AACzI,YAAY,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACnE,OAAO,EAAE,sBAAsB,EAAE,6BAA6B,EAAE,6BAA6B,EAAE,8BAA8B,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC/J,YAAY,EAAE,aAAa,EAAE,QAAQ,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
* including a free one (`npx buoy login`). Buy a key at
|
|
16
16
|
* https://buoy.gg or use it free on Saturday and Sunday.
|
|
17
17
|
*/
|
|
18
|
+
import { LicenseManager } from "./LicenseManager";
|
|
18
19
|
import type { BuoyTier, LicenseState } from "./types";
|
|
19
20
|
/**
|
|
20
21
|
* Why the user currently has Pro access:
|
|
@@ -38,21 +39,24 @@ export type ProAccessReason = "licensed" | "weekend" | null;
|
|
|
38
39
|
* ```
|
|
39
40
|
*/
|
|
40
41
|
export declare function useLicense(): LicenseState & {
|
|
42
|
+
access: ReturnType<typeof LicenseManager.getAccountAccess>;
|
|
41
43
|
/** Validate and set a license key */
|
|
42
44
|
setLicenseKey: (key: string) => Promise<boolean>;
|
|
43
45
|
/** Clear the current license */
|
|
44
46
|
clearLicense: () => Promise<void>;
|
|
45
47
|
};
|
|
48
|
+
export declare function useAccountAccess(): import("./accountAccess").AccountAccess;
|
|
46
49
|
/**
|
|
47
|
-
* The current
|
|
50
|
+
* The current tier: "free" | "pro".
|
|
48
51
|
*
|
|
49
52
|
* This is the value tier-aware limits should read. It reports the tier the
|
|
50
53
|
* user's *credential* grants and deliberately ignores the Weekend Pass — a
|
|
51
54
|
* weekend unlock is temporary Pro *access*, not a change of tier, and callers
|
|
52
55
|
* that care about access should compose this with `useIsPro()`.
|
|
53
56
|
*
|
|
54
|
-
* Returns "
|
|
55
|
-
*
|
|
57
|
+
* Returns "free" until the manager has finished initializing, which matches
|
|
58
|
+
* how `useIsPro()` reports false over the same window. Whether the tools are
|
|
59
|
+
* usable at all is `useAccountAccess()`, not this.
|
|
56
60
|
*/
|
|
57
61
|
export declare function useTier(): BuoyTier;
|
|
58
62
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../src/hooks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../src/hooks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAUH,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAgB,MAAM,SAAS,CAAC;AAEpE;;;;;GAKG;AACH,MAAM,MAAM,eAAe,GAAG,UAAU,GAAG,SAAS,GAAG,IAAI,CAAC;AAE5D;;;;;;;;;;;;;GAaG;AACH,wBAAgB,UAAU,IAAI,YAAY,GAAG;IAC3C,MAAM,EAAE,UAAU,CAAC,OAAO,cAAc,CAAC,gBAAgB,CAAC,CAAC;IAC3D,qCAAqC;IACrC,aAAa,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACjD,gCAAgC;IAChC,YAAY,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACnC,CAmCA;AAED,wBAAgB,gBAAgB,4CAAkC;AAElE;;;;;;;;;;;GAWG;AACH,wBAAgB,OAAO,IAAI,QAAQ,CAGlC;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG;IACtD,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,OAAO,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;CACpB,CAWA;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,IAAI,OAAO,CAQlC;AAED;;;;GAIG;AACH,wBAAgB,YAAY,IAAI;IAC9B,sDAAsD;IACtD,KAAK,EAAE,OAAO,CAAC;IACf,+CAA+C;IAC/C,UAAU,EAAE,OAAO,CAAC;IACpB,2CAA2C;IAC3C,aAAa,EAAE,OAAO,CAAC;IACvB,MAAM,EAAE,eAAe,CAAC;CACzB,CAcA"}
|
|
@@ -30,8 +30,10 @@ export type { DeviceRegistrationInfo, DeviceRegistrationCallback, } from "./Lice
|
|
|
30
30
|
export { DeviceRegistrationModal } from "./DeviceRegistrationModal";
|
|
31
31
|
export { useLicense, useFeatureAccess, useIsPro, useProAccess, useTier } from "./hooks";
|
|
32
32
|
export type { ProAccessReason } from "./hooks";
|
|
33
|
-
export {
|
|
33
|
+
export { useAccountAccess } from "./hooks";
|
|
34
|
+
export { resolveAccountAccess, type AccountAccess } from "./accountAccess";
|
|
34
35
|
export { LicenseTransportError, isTransientLicenseError } from "./api";
|
|
36
|
+
export { isBuoyToken } from "./freeToken";
|
|
35
37
|
export { isWeekendFreePro, useWeekendFreePro } from "./weekendPro";
|
|
36
38
|
export type { BuoyTier, TierSource, LicenseState, LicenseEvent, LicenseListener, LicenseValidationResult, CachedLicense, } from "./types";
|
|
37
39
|
export declare function setLicenseKey(key: string): Promise<boolean>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH;;;;;;;;GAQG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,YAAY,EACV,sBAAsB,EACtB,0BAA0B,GAC3B,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAE,uBAAuB,EAAE,MAAM,2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@ -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>;
|