@buoy-gg/license 7.0.24 → 7.0.26
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/LICENSE +6 -4
- package/lib/commonjs/LicenseManager.js +3 -2
- package/lib/commonjs/cacheSignature.js +2 -1
- package/lib/commonjs/config.js +3 -2
- package/lib/commonjs/hooks.js +2 -1
- package/lib/commonjs/index.js +2 -1
- package/lib/commonjs/index.web.js +2 -1
- package/lib/commonjs/tier.js +2 -1
- package/lib/commonjs/weekendPro.js +2 -1
- package/lib/module/LicenseManager.js +3 -2
- package/lib/module/cacheSignature.js +2 -1
- package/lib/module/config.js +3 -2
- package/lib/module/hooks.js +2 -1
- package/lib/module/index.js +2 -1
- package/lib/module/index.web.js +2 -1
- package/lib/module/tier.js +2 -1
- package/lib/module/weekendPro.js +2 -1
- package/lib/typescript/commonjs/LicenseManager.d.ts +15 -1
- package/lib/typescript/commonjs/LicenseManager.d.ts.map +1 -1
- package/lib/typescript/commonjs/cacheSignature.d.ts +2 -1
- package/lib/typescript/commonjs/cacheSignature.d.ts.map +1 -1
- package/lib/typescript/commonjs/config.d.ts +3 -2
- package/lib/typescript/commonjs/config.d.ts.map +1 -1
- package/lib/typescript/commonjs/hooks.d.ts +4 -2
- package/lib/typescript/commonjs/hooks.d.ts.map +1 -1
- package/lib/typescript/commonjs/index.d.ts +2 -1
- package/lib/typescript/commonjs/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/index.web.d.ts +2 -1
- package/lib/typescript/commonjs/index.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/tier.d.ts +2 -1
- package/lib/typescript/commonjs/tier.d.ts.map +1 -1
- package/lib/typescript/commonjs/weekendPro.d.ts +2 -1
- package/lib/typescript/commonjs/weekendPro.d.ts.map +1 -1
- package/lib/typescript/module/LicenseManager.d.ts +15 -1
- package/lib/typescript/module/LicenseManager.d.ts.map +1 -1
- package/lib/typescript/module/cacheSignature.d.ts +2 -1
- package/lib/typescript/module/cacheSignature.d.ts.map +1 -1
- package/lib/typescript/module/config.d.ts +3 -2
- package/lib/typescript/module/config.d.ts.map +1 -1
- package/lib/typescript/module/hooks.d.ts +4 -2
- package/lib/typescript/module/hooks.d.ts.map +1 -1
- package/lib/typescript/module/index.d.ts +2 -1
- package/lib/typescript/module/index.d.ts.map +1 -1
- package/lib/typescript/module/index.web.d.ts +2 -1
- package/lib/typescript/module/index.web.d.ts.map +1 -1
- package/lib/typescript/module/tier.d.ts +2 -1
- package/lib/typescript/module/tier.d.ts.map +1 -1
- package/lib/typescript/module/weekendPro.d.ts +2 -1
- package/lib/typescript/module/weekendPro.d.ts.map +1 -1
- package/package.json +1 -1
package/LICENSE
CHANGED
|
@@ -37,10 +37,12 @@ not any code is copied or redistributed.
|
|
|
37
37
|
You do not need to do any of this
|
|
38
38
|
---------------------------------
|
|
39
39
|
|
|
40
|
-
Buoy Pro is $9/month, and it is free
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
Buoy Pro is $9/month, and it is free every weekend — all of Saturday and
|
|
41
|
+
Sunday — for anyone holding a key, including a FREE one. A free key costs
|
|
42
|
+
nothing, needs no card, and takes about thirty seconds: run `npx buoy login`.
|
|
43
|
+
If you want Pro during the week, buy a key at https://buoy.gg. If you are
|
|
44
|
+
evaluating Buoy, or working on a side project, the Weekend Pass is meant for
|
|
45
|
+
exactly that.
|
|
44
46
|
|
|
45
47
|
If cost is the obstacle, regional pricing is available, and you can email
|
|
46
48
|
support at https://buoy.gg rather than patching anything.
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
* and, in the United States, circumvention of an access control under
|
|
11
11
|
* 17 U.S.C. § 1201 — which applies whether or not any code is copied.
|
|
12
12
|
*
|
|
13
|
-
* Pro is $9/mo, and is free
|
|
13
|
+
* Pro is $9/mo, and is free every weekend for anyone holding a key —
|
|
14
|
+
* including a free one (`npx buoy login`). Buy a key at
|
|
14
15
|
* https://buoy.gg or use it free on Saturday and Sunday.
|
|
15
|
-
*/const LICENSE_STORAGE_DIR="buoy-license";let _FileSystem=null;let _licenseStorage=null;const _memoryStore=new Map;function loadFileSystem(){if(_FileSystem)return _FileSystem;try{const a=require("expo-file-system/legacy");_FileSystem=a?.default||a;if(_FileSystem?.documentDirectory){return _FileSystem}_FileSystem=null}catch{}try{const a=require("expo-file-system");_FileSystem=a?.default||a;if(_FileSystem?.documentDirectory){return _FileSystem}_FileSystem=null}catch{}return null}function getLicenseStorageDir(){const a=loadFileSystem();if(!a?.documentDirectory)return null;return`${a.documentDirectory}${LICENSE_STORAGE_DIR}/`}function getLicenseFilePath(a){const e=getLicenseStorageDir();if(!e)return null;return`${e}${encodeURIComponent(a)}.json`}async function getLicenseStorage(){if(_licenseStorage)return _licenseStorage;const a=loadFileSystem();if(a?.documentDirectory){_licenseStorage={async getItem(e){const t=getLicenseFilePath(e);if(!t)return null;try{const i=await a.getInfoAsync(t);if(!i.exists)return null;return await a.readAsStringAsync(t)}catch{return null}},async setItem(e,t){const i=getLicenseStorageDir();const s=getLicenseFilePath(e);if(!i||!s)return;try{const r=await a.getInfoAsync(i);if(!r.exists){await a.makeDirectoryAsync(i,{intermediates:true})}await a.writeAsStringAsync(s,t)}catch(r){console.warn("[Buoy] License storage write failed:",r)}},async removeItem(e){const t=getLicenseFilePath(e);if(!t)return;try{await a.deleteAsync(t,{idempotent:true})}catch{}}}}else{_licenseStorage={async getItem(e){return _memoryStore.get(e)??null},async setItem(e,t){_memoryStore.set(e,t)},async removeItem(e){_memoryStore.delete(e)}}}return _licenseStorage}function tierOfCache(a){if(a.tier)return a.tier;return a.isPro?"pro":"anonymous"}class LicenseManagerImpl{state={isInitialized:false,isValidating:false,isPro:false,tier:"anonymous",tierSource:"none",licenseKey:null,error:null,expiresAt:null};listeners=new Set;revalidationTimer=null;cachedLicense=null;initPromise=null;deviceRegistrationCallback=null;pendingRegistration=null;async initialize(){if(this.initPromise)return this.initPromise;if(this.state.isInitialized)return;this.initPromise=this._doInitialize();return this.initPromise}async _doInitialize(){if(this.state.isInitialized)return;try{const e=await this.loadCachedLicense();if(e){const t=(0,_cacheSignature.verifyCacheSignature)(e);this.cachedLicense=e;this.state.licenseKey=e.licenseKey;this.applyTier(t&&this.isCacheValid(e)?tierOfCache(e):"anonymous");this.state.expiresAt=e.expiresAt?new Date(e.expiresAt):null;if(e.licenseKey){this.validateInBackground(e.licenseKey)}}this.state.isInitialized=true;this.emit({type:"initialized",isPro:this.state.isPro});this.startRevalidationTimer()}catch(e){console.warn("[React Buoy] License initialization failed:",e);this.state.isInitialized=true;this.emit({type:"initialized",isPro:false})}}async setLicenseKey(e){if(!e||e.trim().length===0){this.state.error="License key is required";return false}const t=e.trim().toUpperCase();this.state.licenseKey=t;this.state.isValidating=true;this.state.error=null;this.emit({type:"validating",isPro:this.state.isPro});try{const
|
|
16
|
+
*/const LICENSE_STORAGE_DIR="buoy-license";let _FileSystem=null;let _licenseStorage=null;const _memoryStore=new Map;function loadFileSystem(){if(_FileSystem)return _FileSystem;try{const a=require("expo-file-system/legacy");_FileSystem=a?.default||a;if(_FileSystem?.documentDirectory){return _FileSystem}_FileSystem=null}catch{}try{const a=require("expo-file-system");_FileSystem=a?.default||a;if(_FileSystem?.documentDirectory){return _FileSystem}_FileSystem=null}catch{}return null}function getLicenseStorageDir(){const a=loadFileSystem();if(!a?.documentDirectory)return null;return`${a.documentDirectory}${LICENSE_STORAGE_DIR}/`}function getLicenseFilePath(a){const e=getLicenseStorageDir();if(!e)return null;return`${e}${encodeURIComponent(a)}.json`}async function getLicenseStorage(){if(_licenseStorage)return _licenseStorage;const a=loadFileSystem();if(a?.documentDirectory){_licenseStorage={async getItem(e){const t=getLicenseFilePath(e);if(!t)return null;try{const i=await a.getInfoAsync(t);if(!i.exists)return null;return await a.readAsStringAsync(t)}catch{return null}},async setItem(e,t){const i=getLicenseStorageDir();const s=getLicenseFilePath(e);if(!i||!s)return;try{const r=await a.getInfoAsync(i);if(!r.exists){await a.makeDirectoryAsync(i,{intermediates:true})}await a.writeAsStringAsync(s,t)}catch(r){console.warn("[Buoy] License storage write failed:",r)}},async removeItem(e){const t=getLicenseFilePath(e);if(!t)return;try{await a.deleteAsync(t,{idempotent:true})}catch{}}}}else{_licenseStorage={async getItem(e){return _memoryStore.get(e)??null},async setItem(e,t){_memoryStore.set(e,t)},async removeItem(e){_memoryStore.delete(e)}}}return _licenseStorage}function tierOfCache(a){if(a.tier)return a.tier;return a.isPro?"pro":"anonymous"}class LicenseManagerImpl{state={isInitialized:false,isValidating:false,isPro:false,tier:"anonymous",tierSource:"none",licenseKey:null,error:null,expiresAt:null};listeners=new Set;revalidationTimer=null;cachedLicense=null;initPromise=null;generation=0;deviceRegistrationCallback=null;pendingRegistration=null;async initialize(){if(this.initPromise)return this.initPromise;if(this.state.isInitialized)return;this.initPromise=this._doInitialize();return this.initPromise}async _doInitialize(){if(this.state.isInitialized)return;try{const e=await this.loadCachedLicense();if(e){const t=(0,_cacheSignature.verifyCacheSignature)(e);this.cachedLicense=e;this.state.licenseKey=e.licenseKey;this.applyTier(t&&this.isCacheValid(e)?tierOfCache(e):"anonymous");this.state.expiresAt=e.expiresAt?new Date(e.expiresAt):null;if(e.licenseKey){this.validateInBackground(e.licenseKey)}}this.state.isInitialized=true;this.emit({type:"initialized",isPro:this.state.isPro});this.startRevalidationTimer()}catch(e){console.warn("[React Buoy] License initialization failed:",e);this.state.isInitialized=true;this.emit({type:"initialized",isPro:false})}}async setLicenseKey(e){if(!e||e.trim().length===0){this.state.error="License key is required";return false}const t=e.trim().toUpperCase();this.generation+=1;const i=this.generation;this.state.licenseKey=t;this.state.isValidating=true;this.state.error=null;this.emit({type:"validating",isPro:this.state.isPro});try{const s=await(0,_api.validateLicense)(t);if(i!==this.generation)return false;const r=(0,_api.parseValidationResult)(s);if((0,_api.isFatalLicenseError)(r.code)){this.applyTier((0,_tier.tierAfterFatalError)(r.code));this.state.isValidating=false;this.state.error=r.detail;await this.clearCachedLicense();this.emit({type:"error",isPro:false,error:r.detail});return false}if(!s.data){this.state.isValidating=false;this.state.error=r.detail||"License not found";await this.clearCachedLicense();this.emit({type:"error",isPro:false,error:this.state.error});return false}const n=(0,_tier.resolveTier)(s.data);this.applyTier(n);this.state.isValidating=false;this.state.expiresAt=s.data.attributes.expiry?new Date(s.data.attributes.expiry):null;const c=s.data.id;const o=Date.now();let l=this.cachedLicense?.fingerprint;let d=this.cachedLicense?.deviceName;let u=false;if(!l){l=(0,_fingerprint.generateUUID)();d=(0,_fingerprint.getDefaultDeviceName)();u=true}let h=false;if(u){if(this.deviceRegistrationCallback){this.pendingRegistration={licenseId:c,licenseKey:t,fingerprint:l};this.deviceRegistrationCallback({fingerprint:l,defaultName:d});h=true}else{this.registerDeviceAsync(c,t,l,d)}}const f={licenseKey:t,licenseId:c,valid:true,isPro:n==="pro",tier:n,expiresAt:s.data.attributes.expiry??null,cachedAt:o,lastValidatedAt:o,fingerprint:h?void 0:l,deviceName:h?void 0:d};this.cachedLicense=await this.persistCache(f);this.emit({type:"validated",isPro:this.state.isPro});return true}catch(s){const r=s instanceof Error?s.message:"Validation failed";if(i!==this.generation)return false;if(this.isNetworkError(s)&&this.cachedLicense&&this.isCacheValid(this.cachedLicense)){this.applyTier(tierOfCache(this.cachedLicense));this.state.isValidating=false;this.emit({type:"validated",isPro:this.state.isPro});return true}this.state.isValidating=false;this.state.error=r;this.emit({type:"error",isPro:false,error:r});return false}}isNetworkError(e){if(e instanceof TypeError){return true}if(e instanceof Error){const t=e.message.toLowerCase();return t.includes("network")||t.includes("fetch")||t.includes("timeout")||t.includes("connection")||t.includes("offline")||t.includes("failed to fetch")}return false}async clearLicense(){this.generation+=1;this.state.licenseKey=null;this.applyTier("anonymous");this.state.expiresAt=null;this.state.error=null;this.cachedLicense=null;await this.clearCachedLicense();this.emit({type:"deactivated",isPro:false})}applyTier(e){this.state.tier=e;this.state.tierSource=e==="anonymous"?"none":"key";this.state.isPro=e==="pro"}getTier(){return this.state.tier}isPro(){return this.state.tier==="pro"}hasEntitlement(e){if(e==="PRO"){return this.state.isPro}return this.state.isPro}getState(){return{...this.state}}subscribe(e){this.listeners.add(e);return()=>this.listeners.delete(e)}onDeviceRegistrationNeeded(e){this.deviceRegistrationCallback=e;return()=>{this.deviceRegistrationCallback=null}}async completeDeviceRegistration(e){if(!this.pendingRegistration){console.warn("[Buoy] No pending device registration");return}const{licenseId:t,licenseKey:i,fingerprint:s}=this.pendingRegistration;const r=e.trim()||(0,_fingerprint.getDefaultDeviceName)();const n=(0,_fingerprint.getDeviceMetadata)();try{await(0,_api.activateMachine)(t,i,s,r,n)}catch(c){const o=c instanceof Error?c.message:String(c);if(o==="FINGERPRINT_TAKEN"||o==="MACHINE_LIMIT_EXCEEDED"){}else{console.warn("[Buoy] Device registration failed:",o);throw c}}if(this.cachedLicense){this.cachedLicense.fingerprint=s;this.cachedLicense.deviceName=r;this.cachedLicense=await this.persistCache(this.cachedLicense)}this.pendingRegistration=null}emit(e){const t=[...this.listeners];t.forEach(i=>{try{i(e)}catch(s){console.warn("[React Buoy] License listener error:",s)}})}isCacheValid(e){const t=Date.now();const i=t-e.cachedAt;if(i>_config.LICENSE_CACHE_DURATION){return false}if(e.expiresAt){const s=new Date(e.expiresAt).getTime();if(t>s){return false}}return true}async persistCache(e){const t=(0,_cacheSignature.signCache)(e);const i=await getLicenseStorage();await i.setItem(_config.LICENSE_STORAGE_KEY,JSON.stringify(t));return t}async loadCachedLicense(){try{const e=await getLicenseStorage();const t=await e.getItem(_config.LICENSE_STORAGE_KEY);if(!t)return null;const i=JSON.parse(t);return i}catch(e){console.warn("[Buoy] Error loading cached license:",e);return null}}async clearCachedLicense(){this.cachedLicense=null;try{const e=await getLicenseStorage();await e.removeItem(_config.LICENSE_STORAGE_KEY)}catch{}}registerDeviceAsync(e,t,i,s){const r=(0,_fingerprint.getDeviceMetadata)();(0,_api.activateMachine)(e,t,i,s,r).catch(n=>{if(n.message!=="FINGERPRINT_TAKEN"&&n.message!=="MACHINE_LIMIT_EXCEEDED"){console.warn("[Buoy] Device registration failed (non-blocking):",n.message)}})}validateInBackground(e){const t=this.generation;(0,_api.validateLicense)(e).then(async i=>{if(t!==this.generation)return;const s=(0,_api.parseValidationResult)(i);if(s.valid&&i.data){const r=(0,_tier.resolveTier)(i.data);this.applyTier(r);const n=Date.now();this.cachedLicense=await this.persistCache({...this.cachedLicense??{},licenseKey:e,licenseId:i.data.id,valid:true,isPro:r==="pro",tier:r,expiresAt:i.data.attributes.expiry??null,cachedAt:n,lastValidatedAt:n});this.state.expiresAt=i.data.attributes.expiry?new Date(i.data.attributes.expiry):null;this.emit({type:"validated",isPro:this.state.isPro})}else if((0,_api.isFatalLicenseError)(s.code)){console.warn("[React Buoy] Background validation: license is invalid -",s.code);this.applyTier((0,_tier.tierAfterFatalError)(s.code));await this.clearCachedLicense();this.emit({type:"deactivated",isPro:false})}}).catch(i=>{console.warn("[React Buoy] Background validation failed:",i)})}startRevalidationTimer(){if(this.revalidationTimer){clearInterval(this.revalidationTimer)}this.revalidationTimer=setInterval(()=>{if(this.state.licenseKey&&!this.state.isValidating){this.validateInBackground(this.state.licenseKey)}},_config.LICENSE_REVALIDATION_INTERVAL);if(__DEV__){global.__LICENSE_MANAGER_TIMER__=this.revalidationTimer}}stopRevalidationTimer(){if(this.revalidationTimer){clearInterval(this.revalidationTimer);this.revalidationTimer=null}}async forceReregister(){if(this.cachedLicense){this.cachedLicense.fingerprint=void 0;this.cachedLicense.deviceName=void 0}await this.clearCachedLicense()}}const LicenseManager=exports.LicenseManager=new LicenseManagerImpl;if(__DEV__){if(global.__LICENSE_MANAGER_TIMER__){clearInterval(global.__LICENSE_MANAGER_TIMER__)}}
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
* of the EULA and, in the United States, circumvention of an access control
|
|
11
11
|
* under 17 U.S.C. § 1201 — which applies whether or not any code is copied.
|
|
12
12
|
*
|
|
13
|
-
* Pro is $9/mo, and is free
|
|
13
|
+
* Pro is $9/mo, and is free every weekend for anyone holding a key —
|
|
14
|
+
* including a free one (`npx buoy login`). Buy a key at
|
|
14
15
|
* https://buoy.gg or use it free on Saturday and Sunday.
|
|
15
16
|
*/const SIGNATURE_VERSION="v2";const LEGACY_VERSIONS=["v1"];const SIGNING_SALT="buoy.gg/pro:9f3c1d7a4b2e:license-cache";const FIELD_SEPARATOR="\0";function fnv1a(t,e){let n=e>>>0;for(let r=0;r<t.length;r++){n^=t.charCodeAt(r);n=Math.imul(n,16777619)>>>0}return n>>>0}function canonicalize(t,e){const n=[e,t.licenseKey,t.licenseId,t.isPro?"1":"0",t.expiresAt??"",String(t.cachedAt)];if(e!=="v1"){n.push(t.tier??"")}n.push(SIGNING_SALT);return n.join(FIELD_SEPARATOR)}function signatureFor(t,e){const n=canonicalize(t,e);const r=fnv1a(n,2166136261);const i=fnv1a(n,2135587861);return`${e}.${r.toString(16)}${i.toString(16)}`}function cacheSignature(t){return signatureFor(t,SIGNATURE_VERSION)}function signCache(t){return{...t,sig:cacheSignature(t)}}function verifyCacheSignature(t){if(!t||typeof t.sig!=="string"||t.sig.length===0){return false}if(t.sig===cacheSignature(t))return true;return LEGACY_VERSIONS.some(e=>t.sig.startsWith(`${e}.`)&&t.sig===signatureFor(t,e))}
|
package/lib/commonjs/config.js
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
* in the United States, circumvention of an access control under 17 U.S.C.
|
|
12
12
|
* § 1201, which applies whether or not any code is copied.
|
|
13
13
|
*
|
|
14
|
-
* Pro is $9/mo, and is free
|
|
14
|
+
* Pro is $9/mo, and is free every weekend for anyone holding a key —
|
|
15
|
+
* including a free one (`npx buoy login`). Buy a key at
|
|
15
16
|
* https://buoy.gg or use it free on Saturday and Sunday.
|
|
16
|
-
*/const KEYGEN_CONFIG=exports.KEYGEN_CONFIG={accountId:"b0eba0e8-e904-4906-b644-38f9aab57bed",productId:"bf67cb43-eeef-40ca-b308-e6e1b22c0eaa",productToken:"prod-4467c14b75b715e91884945cd3e69705846ccbce7dd5e380236a1ab3bc03139fv3",apiUrl:"https://api.keygen.sh/v1/accounts"};const KEYGEN_POLICIES=exports.KEYGEN_POLICIES={free:"394e3351-1249-4f73-807a-703408604c0e",solo:"fa5d3c8f-5379-40f1-b63e-ab8a974b2f28",business:"690c2212-8e54-426f-b4b4-002ee1c0ae2b"};const LICENSE_CACHE_DURATION=exports.LICENSE_CACHE_DURATION=30*24*60*60*1e3;const LICENSE_REVALIDATION_INTERVAL=exports.LICENSE_REVALIDATION_INTERVAL=24*60*60*1e3;const LICENSE_STORAGE_KEY=exports.LICENSE_STORAGE_KEY="buoy-gg-license";const ANONYMOUS_TIER_ENABLED=exports.ANONYMOUS_TIER_ENABLED=
|
|
17
|
+
*/const KEYGEN_CONFIG=exports.KEYGEN_CONFIG={accountId:"b0eba0e8-e904-4906-b644-38f9aab57bed",productId:"bf67cb43-eeef-40ca-b308-e6e1b22c0eaa",productToken:"prod-4467c14b75b715e91884945cd3e69705846ccbce7dd5e380236a1ab3bc03139fv3",apiUrl:"https://api.keygen.sh/v1/accounts"};const KEYGEN_POLICIES=exports.KEYGEN_POLICIES={free:"394e3351-1249-4f73-807a-703408604c0e",solo:"fa5d3c8f-5379-40f1-b63e-ab8a974b2f28",business:"690c2212-8e54-426f-b4b4-002ee1c0ae2b"};const LICENSE_CACHE_DURATION=exports.LICENSE_CACHE_DURATION=30*24*60*60*1e3;const LICENSE_REVALIDATION_INTERVAL=exports.LICENSE_REVALIDATION_INTERVAL=24*60*60*1e3;const LICENSE_STORAGE_KEY=exports.LICENSE_STORAGE_KEY="buoy-gg-license";const ANONYMOUS_TIER_ENABLED=exports.ANONYMOUS_TIER_ENABLED=true;
|
package/lib/commonjs/hooks.js
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
* United States, circumvention of an access control under 17 U.S.C. § 1201 —
|
|
12
12
|
* which applies whether or not any code is copied.
|
|
13
13
|
*
|
|
14
|
-
* Pro is $9/mo, and is free
|
|
14
|
+
* Pro is $9/mo, and is free every weekend for anyone holding a key —
|
|
15
|
+
* including a free one (`npx buoy login`). Buy a key at
|
|
15
16
|
* https://buoy.gg or use it free on Saturday and Sunday.
|
|
16
17
|
*/function useLicense(){const[t,e]=(0,_react.useState)(_LicenseManager.LicenseManager.getState());(0,_react.useEffect)(()=>{const n=_LicenseManager.LicenseManager.subscribe(i=>{e(_LicenseManager.LicenseManager.getState())});_LicenseManager.LicenseManager.initialize().then(()=>{e(_LicenseManager.LicenseManager.getState())});return n},[]);const r=(0,_react.useCallback)(async n=>{const i=await _LicenseManager.LicenseManager.setLicenseKey(n);e(_LicenseManager.LicenseManager.getState());return i},[]);const s=(0,_react.useCallback)(async()=>{await _LicenseManager.LicenseManager.clearLicense();e(_LicenseManager.LicenseManager.getState())},[]);return{...t,setLicenseKey:r,clearLicense:s}}function useTier(){const{tier:t,isInitialized:e}=useLicense();return e?t:"anonymous"}function useFeatureAccess(t){const{isPro:e,isInitialized:r,isValidating:s}=useLicense();const n=e;const i=!r||s;return{hasAccess:n,isPro:e,isLoading:i}}function useIsPro(){const{isPro:t,isInitialized:e,tier:r}=useLicense();const s=(0,_weekendPro.weekendPassAppliesTo)(r,(0,_weekendPro.useWeekendFreePro)());return e&&t||s}function useProAccess(){const{isPro:t,isInitialized:e,tier:r}=useLicense();const s=e&&t;const n=(0,_weekendPro.weekendPassAppliesTo)(r,(0,_weekendPro.useWeekendFreePro)())&&!s;const i=s?"licensed":n?"weekend":null;return{isPro:s||n,isLicensed:s,isWeekendFree:n,reason:i}}
|
package/lib/commonjs/index.js
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
* control under 17 U.S.C. § 1201, which applies whether or not any code is
|
|
13
13
|
* copied.
|
|
14
14
|
*
|
|
15
|
-
* Pro is $9/mo, and is free
|
|
15
|
+
* Pro is $9/mo, and is free every weekend for anyone holding a key —
|
|
16
|
+
* including a free one (`npx buoy login`). Buy a key at
|
|
16
17
|
* https://buoy.gg or use it free on Saturday and Sunday.
|
|
17
18
|
*/async function setLicenseKey(r){const{LicenseManager:t}=await Promise.resolve().then(()=>_interopRequireWildcard(require("./LicenseManager")));await t.initialize();return t.setLicenseKey(r)}function weekendPassActive(){const{isWeekendFreePro:r,weekendPassAppliesTo:t}=require("./weekendPro");const{LicenseManager:u}=require("./LicenseManager");return t(u.getTier(),r())}function isPro(){const{LicenseManager:r}=require("./LicenseManager");if(r.isPro())return true;return weekendPassActive()}function hasEntitlement(r){const{LicenseManager:t}=require("./LicenseManager");if(t.hasEntitlement(r))return true;return weekendPassActive()}
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
* control under 17 U.S.C. § 1201, which applies whether or not any code is
|
|
13
13
|
* copied.
|
|
14
14
|
*
|
|
15
|
-
* Pro is $9/mo, and is free
|
|
15
|
+
* Pro is $9/mo, and is free every weekend for anyone holding a key —
|
|
16
|
+
* including a free one (`npx buoy login`). Buy a key at
|
|
16
17
|
* https://buoy.gg or use it free on Saturday and Sunday.
|
|
17
18
|
*/async function setLicenseKey(r){const{LicenseManager:n}=await Promise.resolve().then(()=>_interopRequireWildcard(require("./LicenseManager")));await n.initialize();return n.setLicenseKey(r)}function weekendPassActive(){const{isWeekendFreePro:r,weekendPassAppliesTo:n}=require("./weekendPro");const{LicenseManager:o}=require("./LicenseManager");return n(o.getTier(),r())}function isPro(){const{LicenseManager:r}=require("./LicenseManager");if(r.isPro())return true;return weekendPassActive()}function hasEntitlement(r){const{LicenseManager:n}=require("./LicenseManager");if(n.hasEntitlement(r))return true;return weekendPassActive()}
|
package/lib/commonjs/tier.js
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
* States, circumvention of an access control under 17 U.S.C. § 1201 — which
|
|
12
12
|
* applies whether or not any code is copied.
|
|
13
13
|
*
|
|
14
|
-
* Pro is $9/mo, and is free
|
|
14
|
+
* Pro is $9/mo, and is free every weekend for anyone holding a key —
|
|
15
|
+
* including a free one (`npx buoy login`). Buy a key at
|
|
15
16
|
* https://buoy.gg or use it free on Saturday and Sunday.
|
|
16
17
|
*/function resolveTier(r){const e=r.relationships?.policy?.data?.id;if(e===_config.KEYGEN_POLICIES.free)return"free";if(e===_config.KEYGEN_POLICIES.solo||e===_config.KEYGEN_POLICIES.business){return"pro"}const t=r.attributes?.metadata?.plan;if(t==="free")return"free";return"pro"}function tierAfterFatalError(r){return r==="EXPIRED"?"free":"anonymous"}
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
* circumvention of an access control under 17 U.S.C. § 1201 — which applies
|
|
13
13
|
* whether or not any code is copied.
|
|
14
14
|
*
|
|
15
|
-
* Pro is $9/mo, and is free
|
|
15
|
+
* Pro is $9/mo, and is free every weekend for anyone holding a key —
|
|
16
|
+
* including a free one (`npx buoy login`). Buy a key at
|
|
16
17
|
* https://buoy.gg or use it free on Saturday and Sunday.
|
|
17
18
|
*/function isWeekendFreePro(r=new Date){const e=r.getDay();return e===0||e===6}function useWeekendFreePro(){const[r,e]=(0,_react.useState)(()=>isWeekendFreePro());(0,_react.useEffect)(()=>{const s=setInterval(()=>{const t=isWeekendFreePro();e(n=>n===t?n:t)},60*1e3);return()=>clearInterval(s)},[]);return r}function weekendPassAppliesTo(r,e){if(!e)return false;if(!_config.ANONYMOUS_TIER_ENABLED)return true;return r!=="anonymous"}
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
* and, in the United States, circumvention of an access control under
|
|
11
11
|
* 17 U.S.C. § 1201 — which applies whether or not any code is copied.
|
|
12
12
|
*
|
|
13
|
-
* Pro is $9/mo, and is free
|
|
13
|
+
* Pro is $9/mo, and is free every weekend for anyone holding a key —
|
|
14
|
+
* including a free one (`npx buoy login`). Buy a key at
|
|
14
15
|
* https://buoy.gg or use it free on Saturday and Sunday.
|
|
15
|
-
*/const
|
|
16
|
+
*/const S="buoy-license";let c=null;let h=null;const y=new Map;function v(){if(c)return c;try{const a=require("expo-file-system/legacy");c=a?.default||a;if(c?.documentDirectory){return c}c=null}catch{}try{const a=require("expo-file-system");c=a?.default||a;if(c?.documentDirectory){return c}c=null}catch{}return null}function L(){const a=v();if(!a?.documentDirectory)return null;return`${a.documentDirectory}${S}/`}function g(a){const e=L();if(!e)return null;return`${e}${encodeURIComponent(a)}.json`}async function m(){if(h)return h;const a=v();if(a?.documentDirectory){h={async getItem(e){const t=g(e);if(!t)return null;try{const i=await a.getInfoAsync(t);if(!i.exists)return null;return await a.readAsStringAsync(t)}catch{return null}},async setItem(e,t){const i=L();const s=g(e);if(!i||!s)return;try{const r=await a.getInfoAsync(i);if(!r.exists){await a.makeDirectoryAsync(i,{intermediates:true})}await a.writeAsStringAsync(s,t)}catch(r){console.warn("[Buoy] License storage write failed:",r)}},async removeItem(e){const t=g(e);if(!t)return;try{await a.deleteAsync(t,{idempotent:true})}catch{}}}}else{h={async getItem(e){return y.get(e)??null},async setItem(e,t){y.set(e,t)},async removeItem(e){y.delete(e)}}}return h}import{LICENSE_STORAGE_KEY as p,LICENSE_CACHE_DURATION as x,LICENSE_REVALIDATION_INTERVAL as V}from"./config.js";import{validateLicense as E,activateMachine as w,parseValidationResult as A,isFatalLicenseError as _}from"./api.js";import{generateUUID as b,getDeviceMetadata as C,getDefaultDeviceName as R}from"./fingerprint";import{signCache as k,verifyCacheSignature as M}from"./cacheSignature.js";import{resolveTier as T,tierAfterFatalError as P}from"./tier.js";function D(a){if(a.tier)return a.tier;return a.isPro?"pro":"anonymous"}class B{state={isInitialized:false,isValidating:false,isPro:false,tier:"anonymous",tierSource:"none",licenseKey:null,error:null,expiresAt:null};listeners=new Set;revalidationTimer=null;cachedLicense=null;initPromise=null;generation=0;deviceRegistrationCallback=null;pendingRegistration=null;async initialize(){if(this.initPromise)return this.initPromise;if(this.state.isInitialized)return;this.initPromise=this._doInitialize();return this.initPromise}async _doInitialize(){if(this.state.isInitialized)return;try{const e=await this.loadCachedLicense();if(e){const t=M(e);this.cachedLicense=e;this.state.licenseKey=e.licenseKey;this.applyTier(t&&this.isCacheValid(e)?D(e):"anonymous");this.state.expiresAt=e.expiresAt?new Date(e.expiresAt):null;if(e.licenseKey){this.validateInBackground(e.licenseKey)}}this.state.isInitialized=true;this.emit({type:"initialized",isPro:this.state.isPro});this.startRevalidationTimer()}catch(e){console.warn("[React Buoy] License initialization failed:",e);this.state.isInitialized=true;this.emit({type:"initialized",isPro:false})}}async setLicenseKey(e){if(!e||e.trim().length===0){this.state.error="License key is required";return false}const t=e.trim().toUpperCase();this.generation+=1;const i=this.generation;this.state.licenseKey=t;this.state.isValidating=true;this.state.error=null;this.emit({type:"validating",isPro:this.state.isPro});try{const s=await E(t);if(i!==this.generation)return false;const r=A(s);if(_(r.code)){this.applyTier(P(r.code));this.state.isValidating=false;this.state.error=r.detail;await this.clearCachedLicense();this.emit({type:"error",isPro:false,error:r.detail});return false}if(!s.data){this.state.isValidating=false;this.state.error=r.detail||"License not found";await this.clearCachedLicense();this.emit({type:"error",isPro:false,error:this.state.error});return false}const n=T(s.data);this.applyTier(n);this.state.isValidating=false;this.state.expiresAt=s.data.attributes.expiry?new Date(s.data.attributes.expiry):null;const o=s.data.id;const l=Date.now();let d=this.cachedLicense?.fingerprint;let u=this.cachedLicense?.deviceName;let I=false;if(!d){d=b();u=R();I=true}let f=false;if(I){if(this.deviceRegistrationCallback){this.pendingRegistration={licenseId:o,licenseKey:t,fingerprint:d};this.deviceRegistrationCallback({fingerprint:d,defaultName:u});f=true}else{this.registerDeviceAsync(o,t,d,u)}}const N={licenseKey:t,licenseId:o,valid:true,isPro:n==="pro",tier:n,expiresAt:s.data.attributes.expiry??null,cachedAt:l,lastValidatedAt:l,fingerprint:f?void 0:d,deviceName:f?void 0:u};this.cachedLicense=await this.persistCache(N);this.emit({type:"validated",isPro:this.state.isPro});return true}catch(s){const r=s instanceof Error?s.message:"Validation failed";if(i!==this.generation)return false;if(this.isNetworkError(s)&&this.cachedLicense&&this.isCacheValid(this.cachedLicense)){this.applyTier(D(this.cachedLicense));this.state.isValidating=false;this.emit({type:"validated",isPro:this.state.isPro});return true}this.state.isValidating=false;this.state.error=r;this.emit({type:"error",isPro:false,error:r});return false}}isNetworkError(e){if(e instanceof TypeError){return true}if(e instanceof Error){const t=e.message.toLowerCase();return t.includes("network")||t.includes("fetch")||t.includes("timeout")||t.includes("connection")||t.includes("offline")||t.includes("failed to fetch")}return false}async clearLicense(){this.generation+=1;this.state.licenseKey=null;this.applyTier("anonymous");this.state.expiresAt=null;this.state.error=null;this.cachedLicense=null;await this.clearCachedLicense();this.emit({type:"deactivated",isPro:false})}applyTier(e){this.state.tier=e;this.state.tierSource=e==="anonymous"?"none":"key";this.state.isPro=e==="pro"}getTier(){return this.state.tier}isPro(){return this.state.tier==="pro"}hasEntitlement(e){if(e==="PRO"){return this.state.isPro}return this.state.isPro}getState(){return{...this.state}}subscribe(e){this.listeners.add(e);return()=>this.listeners.delete(e)}onDeviceRegistrationNeeded(e){this.deviceRegistrationCallback=e;return()=>{this.deviceRegistrationCallback=null}}async completeDeviceRegistration(e){if(!this.pendingRegistration){console.warn("[Buoy] No pending device registration");return}const{licenseId:t,licenseKey:i,fingerprint:s}=this.pendingRegistration;const r=e.trim()||R();const n=C();try{await w(t,i,s,r,n)}catch(o){const l=o instanceof Error?o.message:String(o);if(l==="FINGERPRINT_TAKEN"||l==="MACHINE_LIMIT_EXCEEDED"){}else{console.warn("[Buoy] Device registration failed:",l);throw o}}if(this.cachedLicense){this.cachedLicense.fingerprint=s;this.cachedLicense.deviceName=r;this.cachedLicense=await this.persistCache(this.cachedLicense)}this.pendingRegistration=null}emit(e){const t=[...this.listeners];t.forEach(i=>{try{i(e)}catch(s){console.warn("[React Buoy] License listener error:",s)}})}isCacheValid(e){const t=Date.now();const i=t-e.cachedAt;if(i>x){return false}if(e.expiresAt){const s=new Date(e.expiresAt).getTime();if(t>s){return false}}return true}async persistCache(e){const t=k(e);const i=await m();await i.setItem(p,JSON.stringify(t));return t}async loadCachedLicense(){try{const e=await m();const t=await e.getItem(p);if(!t)return null;const i=JSON.parse(t);return i}catch(e){console.warn("[Buoy] Error loading cached license:",e);return null}}async clearCachedLicense(){this.cachedLicense=null;try{const e=await m();await e.removeItem(p)}catch{}}registerDeviceAsync(e,t,i,s){const r=C();w(e,t,i,s,r).catch(n=>{if(n.message!=="FINGERPRINT_TAKEN"&&n.message!=="MACHINE_LIMIT_EXCEEDED"){console.warn("[Buoy] Device registration failed (non-blocking):",n.message)}})}validateInBackground(e){const t=this.generation;E(e).then(async i=>{if(t!==this.generation)return;const s=A(i);if(s.valid&&i.data){const r=T(i.data);this.applyTier(r);const n=Date.now();this.cachedLicense=await this.persistCache({...this.cachedLicense??{},licenseKey:e,licenseId:i.data.id,valid:true,isPro:r==="pro",tier:r,expiresAt:i.data.attributes.expiry??null,cachedAt:n,lastValidatedAt:n});this.state.expiresAt=i.data.attributes.expiry?new Date(i.data.attributes.expiry):null;this.emit({type:"validated",isPro:this.state.isPro})}else if(_(s.code)){console.warn("[React Buoy] Background validation: license is invalid -",s.code);this.applyTier(P(s.code));await this.clearCachedLicense();this.emit({type:"deactivated",isPro:false})}}).catch(i=>{console.warn("[React Buoy] Background validation failed:",i)})}startRevalidationTimer(){if(this.revalidationTimer){clearInterval(this.revalidationTimer)}this.revalidationTimer=setInterval(()=>{if(this.state.licenseKey&&!this.state.isValidating){this.validateInBackground(this.state.licenseKey)}},V);if(__DEV__){global.__LICENSE_MANAGER_TIMER__=this.revalidationTimer}}stopRevalidationTimer(){if(this.revalidationTimer){clearInterval(this.revalidationTimer);this.revalidationTimer=null}}async forceReregister(){if(this.cachedLicense){this.cachedLicense.fingerprint=void 0;this.cachedLicense.deviceName=void 0}await this.clearCachedLicense()}}export const LicenseManager=new B;if(__DEV__){if(global.__LICENSE_MANAGER_TIMER__){clearInterval(global.__LICENSE_MANAGER_TIMER__)}}
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
* of the EULA and, in the United States, circumvention of an access control
|
|
11
11
|
* under 17 U.S.C. § 1201 — which applies whether or not any code is copied.
|
|
12
12
|
*
|
|
13
|
-
* Pro is $9/mo, and is free
|
|
13
|
+
* Pro is $9/mo, and is free every weekend for anyone holding a key —
|
|
14
|
+
* including a free one (`npx buoy login`). Buy a key at
|
|
14
15
|
* https://buoy.gg or use it free on Saturday and Sunday.
|
|
15
16
|
*/const u="v2";const g=["v1"];const f="buoy.gg/pro:9f3c1d7a4b2e:license-cache";const S="\0";function s(t,i){let n=i>>>0;for(let r=0;r<t.length;r++){n^=t.charCodeAt(r);n=Math.imul(n,16777619)>>>0}return n>>>0}function l(t,i){const n=[i,t.licenseKey,t.licenseId,t.isPro?"1":"0",t.expiresAt??"",String(t.cachedAt)];if(i!=="v1"){n.push(t.tier??"")}n.push(f);return n.join(S)}function e(t,i){const n=l(t,i);const r=s(n,2166136261);const o=s(n,2135587861);return`${i}.${r.toString(16)}${o.toString(16)}`}export function cacheSignature(t){return e(t,u)}export function signCache(t){return{...t,sig:cacheSignature(t)}}export function verifyCacheSignature(t){if(!t||typeof t.sig!=="string"||t.sig.length===0){return false}if(t.sig===cacheSignature(t))return true;return g.some(i=>t.sig.startsWith(`${i}.`)&&t.sig===e(t,i))}
|
package/lib/module/config.js
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
* in the United States, circumvention of an access control under 17 U.S.C.
|
|
12
12
|
* § 1201, which applies whether or not any code is copied.
|
|
13
13
|
*
|
|
14
|
-
* Pro is $9/mo, and is free
|
|
14
|
+
* Pro is $9/mo, and is free every weekend for anyone holding a key —
|
|
15
|
+
* including a free one (`npx buoy login`). Buy a key at
|
|
15
16
|
* https://buoy.gg or use it free on Saturday and Sunday.
|
|
16
|
-
*/export const KEYGEN_CONFIG={accountId:"b0eba0e8-e904-4906-b644-38f9aab57bed",productId:"bf67cb43-eeef-40ca-b308-e6e1b22c0eaa",productToken:"prod-4467c14b75b715e91884945cd3e69705846ccbce7dd5e380236a1ab3bc03139fv3",apiUrl:"https://api.keygen.sh/v1/accounts"};export const KEYGEN_POLICIES={free:"394e3351-1249-4f73-807a-703408604c0e",solo:"fa5d3c8f-5379-40f1-b63e-ab8a974b2f28",business:"690c2212-8e54-426f-b4b4-002ee1c0ae2b"};export const LICENSE_CACHE_DURATION=30*24*60*60*1e3;export const LICENSE_REVALIDATION_INTERVAL=24*60*60*1e3;export const LICENSE_STORAGE_KEY="buoy-gg-license";export const ANONYMOUS_TIER_ENABLED=
|
|
17
|
+
*/export const KEYGEN_CONFIG={accountId:"b0eba0e8-e904-4906-b644-38f9aab57bed",productId:"bf67cb43-eeef-40ca-b308-e6e1b22c0eaa",productToken:"prod-4467c14b75b715e91884945cd3e69705846ccbce7dd5e380236a1ab3bc03139fv3",apiUrl:"https://api.keygen.sh/v1/accounts"};export const KEYGEN_POLICIES={free:"394e3351-1249-4f73-807a-703408604c0e",solo:"fa5d3c8f-5379-40f1-b63e-ab8a974b2f28",business:"690c2212-8e54-426f-b4b4-002ee1c0ae2b"};export const LICENSE_CACHE_DURATION=30*24*60*60*1e3;export const LICENSE_REVALIDATION_INTERVAL=24*60*60*1e3;export const LICENSE_STORAGE_KEY="buoy-gg-license";export const ANONYMOUS_TIER_ENABLED=true;
|
package/lib/module/hooks.js
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
* United States, circumvention of an access control under 17 U.S.C. § 1201 —
|
|
12
12
|
* which applies whether or not any code is copied.
|
|
13
13
|
*
|
|
14
|
-
* Pro is $9/mo, and is free
|
|
14
|
+
* Pro is $9/mo, and is free every weekend for anyone holding a key —
|
|
15
|
+
* including a free one (`npx buoy login`). Buy a key at
|
|
15
16
|
* https://buoy.gg or use it free on Saturday and Sunday.
|
|
16
17
|
*/import{useState as l,useEffect as d,useCallback as c}from"react";import{LicenseManager as n}from"./LicenseManager.js";import{useWeekendFreePro as a,weekendPassAppliesTo as u}from"./weekendPro.js";export function useLicense(){const[i,e]=l(n.getState());d(()=>{const s=n.subscribe(o=>{e(n.getState())});n.initialize().then(()=>{e(n.getState())});return s},[]);const r=c(async s=>{const o=await n.setLicenseKey(s);e(n.getState());return o},[]);const t=c(async()=>{await n.clearLicense();e(n.getState())},[]);return{...i,setLicenseKey:r,clearLicense:t}}export function useTier(){const{tier:i,isInitialized:e}=useLicense();return e?i:"anonymous"}export function useFeatureAccess(i){const{isPro:e,isInitialized:r,isValidating:t}=useLicense();const s=e;const o=!r||t;return{hasAccess:s,isPro:e,isLoading:o}}export function useIsPro(){const{isPro:i,isInitialized:e,tier:r}=useLicense();const t=u(r,a());return e&&i||t}export function useProAccess(){const{isPro:i,isInitialized:e,tier:r}=useLicense();const t=e&&i;const s=u(r,a())&&!t;const o=t?"licensed":s?"weekend":null;return{isPro:t||s,isLicensed:t,isWeekendFree:s,reason:o}}
|
package/lib/module/index.js
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
* control under 17 U.S.C. § 1201, which applies whether or not any code is
|
|
13
13
|
* copied.
|
|
14
14
|
*
|
|
15
|
-
* Pro is $9/mo, and is free
|
|
15
|
+
* Pro is $9/mo, and is free every weekend for anyone holding a key —
|
|
16
|
+
* including a free one (`npx buoy login`). Buy a key at
|
|
16
17
|
* https://buoy.gg or use it free on Saturday and Sunday.
|
|
17
18
|
*/export{LicenseManager}from"./LicenseManager.js";export{DeviceRegistrationModal}from"./DeviceRegistrationModal.js";export{useLicense,useFeatureAccess,useIsPro,useProAccess,useTier}from"./hooks.js";export{ANONYMOUS_TIER_ENABLED}from"./config.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.getTier(),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
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
* control under 17 U.S.C. § 1201, which applies whether or not any code is
|
|
13
13
|
* copied.
|
|
14
14
|
*
|
|
15
|
-
* Pro is $9/mo, and is free
|
|
15
|
+
* Pro is $9/mo, and is free every weekend for anyone holding a key —
|
|
16
|
+
* including a free one (`npx buoy login`). Buy a key at
|
|
16
17
|
* https://buoy.gg or use it free on Saturday and Sunday.
|
|
17
18
|
*/export{LicenseManager}from"./LicenseManager.js";export{useLicense,useFeatureAccess,useIsPro,useProAccess,useTier}from"./hooks.js";export{ANONYMOUS_TIER_ENABLED}from"./config.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.getTier(),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/tier.js
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
* States, circumvention of an access control under 17 U.S.C. § 1201 — which
|
|
12
12
|
* applies whether or not any code is copied.
|
|
13
13
|
*
|
|
14
|
-
* Pro is $9/mo, and is free
|
|
14
|
+
* Pro is $9/mo, and is free every weekend for anyone holding a key —
|
|
15
|
+
* including a free one (`npx buoy login`). Buy a key at
|
|
15
16
|
* https://buoy.gg or use it free on Saturday and Sunday.
|
|
16
17
|
*/import{KEYGEN_POLICIES as t}from"./config.js";export function resolveTier(r){const e=r.relationships?.policy?.data?.id;if(e===t.free)return"free";if(e===t.solo||e===t.business){return"pro"}const o=r.attributes?.metadata?.plan;if(o==="free")return"free";return"pro"}export function tierAfterFatalError(r){return r==="EXPIRED"?"free":"anonymous"}
|
package/lib/module/weekendPro.js
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
* circumvention of an access control under 17 U.S.C. § 1201 — which applies
|
|
13
13
|
* whether or not any code is copied.
|
|
14
14
|
*
|
|
15
|
-
* Pro is $9/mo, and is free
|
|
15
|
+
* Pro is $9/mo, and is free every weekend for anyone holding a key —
|
|
16
|
+
* including a free one (`npx buoy login`). Buy a key at
|
|
16
17
|
* https://buoy.gg or use it free on Saturday and Sunday.
|
|
17
18
|
*/import{ANONYMOUS_TIER_ENABLED as s}from"./config.js";import{useEffect as u,useState as i}from"react";export function isWeekendFreePro(t=new Date){const e=t.getDay();return e===0||e===6}export function useWeekendFreePro(){const[t,e]=i(()=>isWeekendFreePro());u(()=>{const o=setInterval(()=>{const r=isWeekendFreePro();e(n=>n===r?n:r)},60*1e3);return()=>clearInterval(o)},[]);return t}export function weekendPassAppliesTo(t,e){if(!e)return false;if(!s)return true;return t!=="anonymous"}
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
* and, in the United States, circumvention of an access control under
|
|
11
11
|
* 17 U.S.C. § 1201 — which applies whether or not any code is copied.
|
|
12
12
|
*
|
|
13
|
-
* Pro is $9/mo, and is free
|
|
13
|
+
* Pro is $9/mo, and is free every weekend for anyone holding a key —
|
|
14
|
+
* including a free one (`npx buoy login`). Buy a key at
|
|
14
15
|
* https://buoy.gg or use it free on Saturday and Sunday.
|
|
15
16
|
*/
|
|
16
17
|
import type { BuoyTier, LicenseState, LicenseListener } from "./types";
|
|
@@ -27,6 +28,19 @@ declare class LicenseManagerImpl {
|
|
|
27
28
|
private revalidationTimer;
|
|
28
29
|
private cachedLicense;
|
|
29
30
|
private initPromise;
|
|
31
|
+
/**
|
|
32
|
+
* Bumped whenever the license is deliberately changed or cleared.
|
|
33
|
+
*
|
|
34
|
+
* `initialize()` kicks off a background revalidation of the cached key and
|
|
35
|
+
* does NOT await it, so a `clearLicense()` that lands in between would be
|
|
36
|
+
* silently undone: the in-flight response re-applies the old tier and
|
|
37
|
+
* re-persists the cache blob that was just deleted. Removing a key would
|
|
38
|
+
* then appear to do nothing — Pro comes straight back a moment later.
|
|
39
|
+
*
|
|
40
|
+
* Background work captures this value when it starts and drops its result if
|
|
41
|
+
* it no longer matches.
|
|
42
|
+
*/
|
|
43
|
+
private generation;
|
|
30
44
|
private deviceRegistrationCallback;
|
|
31
45
|
private pendingRegistration;
|
|
32
46
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LicenseManager.d.ts","sourceRoot":"","sources":["../../../src/LicenseManager.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"LicenseManager.d.ts","sourceRoot":"","sources":["../../../src/LicenseManager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AA8KH,OAAO,KAAK,EACV,QAAQ,EAER,YAAY,EAEZ,eAAe,EAChB,MAAM,SAAS,CAAC;AAEjB,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;AAsBhF,cAAM,kBAAkB;IACtB,OAAO,CAAC,KAAK,CASX;IAEF,OAAO,CAAC,SAAS,CAAmC;IACpD,OAAO,CAAC,iBAAiB,CAA+C;IACxE,OAAO,CAAC,aAAa,CAA8B;IAGnD,OAAO,CAAC,WAAW,CAA8B;IAEjD;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,UAAU,CAAK;IAGvB,OAAO,CAAC,0BAA0B,CAA2C;IAC7E,OAAO,CAAC,mBAAmB,CAAoC;IAE/D;;OAEG;IACG,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAUjC;;OAEG;YACW,aAAa;IA4C3B;;;;;;OAMG;IACG,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IA6IzD;;OAEG;IACH,OAAO,CAAC,cAAc;IAkBtB;;OAEG;IACG,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAanC;;;;;OAKG;IACH,OAAO,CAAC,SAAS;IAQjB;;OAEG;IACH,OAAO,IAAI,QAAQ;IAInB;;OAEG;IACH,KAAK,IAAI,OAAO;IAIhB;;OAEG;IACH,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAOrC;;OAEG;IACH,QAAQ,IAAI,QAAQ,CAAC,YAAY,CAAC;IAIlC;;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;IAoCnE,OAAO,CAAC,IAAI;IAYZ,OAAO,CAAC,YAAY;IAkBpB;;;;OAIG;YACW,YAAY;YAOZ,iBAAiB;YAcjB,kBAAkB;IAWhC;;;OAGG;IACH,OAAO,CAAC,mBAAmB;IAiB3B,OAAO,CAAC,oBAAoB;IAmD5B,OAAO,CAAC,sBAAsB;IAmB9B;;OAEG;IACH,qBAAqB,IAAI,IAAI;IAO7B;;;OAGG;IACG,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC;CAOvC;AAGD,eAAO,MAAM,cAAc,oBAA2B,CAAC"}
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
* of the EULA and, in the United States, circumvention of an access control
|
|
11
11
|
* under 17 U.S.C. § 1201 — which applies whether or not any code is copied.
|
|
12
12
|
*
|
|
13
|
-
* Pro is $9/mo, and is free
|
|
13
|
+
* Pro is $9/mo, and is free every weekend for anyone holding a key —
|
|
14
|
+
* including a free one (`npx buoy login`). Buy a key at
|
|
14
15
|
* https://buoy.gg or use it free on Saturday and Sunday.
|
|
15
16
|
*/
|
|
16
17
|
/** The subset of the cache that the checksum covers. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cacheSignature.d.ts","sourceRoot":"","sources":["../../../src/cacheSignature.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"cacheSignature.d.ts","sourceRoot":"","sources":["../../../src/cacheSignature.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAmDH,wDAAwD;AACxD,MAAM,WAAW,aAAa;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,OAAO,CAAC;IACf,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,kEAAkE;IAClE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,yDAAyD;IACzD,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAiDD,6DAA6D;AAC7D,wBAAgB,cAAc,CAAC,KAAK,EAAE,aAAa,GAAG,MAAM,CAE3D;AAED,mEAAmE;AACnE,wBAAgB,SAAS,CAAC,CAAC,SAAS,aAAa,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAE9D;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,aAAa,GAAG,IAAI,GAAG,OAAO,CAgBzE"}
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
* in the United States, circumvention of an access control under 17 U.S.C.
|
|
12
12
|
* § 1201, which applies whether or not any code is copied.
|
|
13
13
|
*
|
|
14
|
-
* Pro is $9/mo, and is free
|
|
14
|
+
* Pro is $9/mo, and is free every weekend for anyone holding a key —
|
|
15
|
+
* including a free one (`npx buoy login`). Buy a key at
|
|
15
16
|
* https://buoy.gg or use it free on Saturday and Sunday.
|
|
16
17
|
*/
|
|
17
18
|
/**
|
|
@@ -70,5 +71,5 @@ export declare const LICENSE_STORAGE_KEY = "buoy-gg-license";
|
|
|
70
71
|
* grace period, so a user who wakes up with less needs a twenty-second way out
|
|
71
72
|
* — and the CLI only exists for them once @buoy-gg/core ships with its bin.
|
|
72
73
|
*/
|
|
73
|
-
export declare const ANONYMOUS_TIER_ENABLED =
|
|
74
|
+
export declare const ANONYMOUS_TIER_ENABLED = true;
|
|
74
75
|
//# sourceMappingURL=config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/config.ts"],"names":[],"mappings":"AAAA
|
|
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,CAAC;AAI/D,eAAO,MAAM,6BAA6B,QAAsB,CAAC;AAIjE,eAAO,MAAM,mBAAmB,oBAAoB,CAAC;AAErD;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,sBAAsB,OAAO,CAAC"}
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
* United States, circumvention of an access control under 17 U.S.C. § 1201 —
|
|
12
12
|
* which applies whether or not any code is copied.
|
|
13
13
|
*
|
|
14
|
-
* Pro is $9/mo, and is free
|
|
14
|
+
* Pro is $9/mo, and is free every weekend for anyone holding a key —
|
|
15
|
+
* including a free one (`npx buoy login`). Buy a key at
|
|
15
16
|
* https://buoy.gg or use it free on Saturday and Sunday.
|
|
16
17
|
*/
|
|
17
18
|
import type { BuoyTier, LicenseState } from "./types";
|
|
@@ -64,7 +65,8 @@ export declare function useFeatureAccess(featureCode?: string): {
|
|
|
64
65
|
};
|
|
65
66
|
/**
|
|
66
67
|
* Hook that returns true when the user has Pro access — either a validated
|
|
67
|
-
* license OR the free Weekend Pass (Pro is free
|
|
68
|
+
* license OR the free Weekend Pass (Pro is free on weekends for anyone
|
|
69
|
+
* holding a key, including a free one).
|
|
68
70
|
*/
|
|
69
71
|
export declare function useIsPro(): boolean;
|
|
70
72
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../src/hooks.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../src/hooks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAYH,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,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,CAiCA;AAED;;;;;;;;;;GAUG;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,CAKlC;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,CAaA"}
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
* control under 17 U.S.C. § 1201, which applies whether or not any code is
|
|
13
13
|
* copied.
|
|
14
14
|
*
|
|
15
|
-
* Pro is $9/mo, and is free
|
|
15
|
+
* Pro is $9/mo, and is free every weekend for anyone holding a key —
|
|
16
|
+
* including a free one (`npx buoy login`). Buy a key at
|
|
16
17
|
* https://buoy.gg or use it free on Saturday and Sunday.
|
|
17
18
|
*/
|
|
18
19
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA
|
|
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,2BAA2B,CAAC;AAGpE,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AACxF,YAAY,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAG/C,OAAO,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAGlD,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;AAaD,wBAAgB,KAAK,IAAI,OAAO,CAI/B;AAGD,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAIpD"}
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
* control under 17 U.S.C. § 1201, which applies whether or not any code is
|
|
13
13
|
* copied.
|
|
14
14
|
*
|
|
15
|
-
* Pro is $9/mo, and is free
|
|
15
|
+
* Pro is $9/mo, and is free every weekend for anyone holding a key —
|
|
16
|
+
* including a free one (`npx buoy login`). Buy a key at
|
|
16
17
|
* https://buoy.gg or use it free on Saturday and Sunday.
|
|
17
18
|
*/
|
|
18
19
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.web.d.ts","sourceRoot":"","sources":["../../../src/index.web.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.web.d.ts","sourceRoot":"","sources":["../../../src/index.web.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH;;;;;;;;GAQG;AAGH,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;AAG/C,OAAO,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAGlD,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;AAaD,wBAAgB,KAAK,IAAI,OAAO,CAI/B;AAGD,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAIpD"}
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
* States, circumvention of an access control under 17 U.S.C. § 1201 — which
|
|
12
12
|
* applies whether or not any code is copied.
|
|
13
13
|
*
|
|
14
|
-
* Pro is $9/mo, and is free
|
|
14
|
+
* Pro is $9/mo, and is free every weekend for anyone holding a key —
|
|
15
|
+
* including a free one (`npx buoy login`). Buy a key at
|
|
15
16
|
* https://buoy.gg or use it free on Saturday and Sunday.
|
|
16
17
|
*/
|
|
17
18
|
import type { BuoyTier, KeygenLicense } from "./types";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tier.d.ts","sourceRoot":"","sources":["../../../src/tier.ts"],"names":[],"mappings":"AAAA
|
|
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,CAE1D"}
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
* circumvention of an access control under 17 U.S.C. § 1201 — which applies
|
|
13
13
|
* whether or not any code is copied.
|
|
14
14
|
*
|
|
15
|
-
* Pro is $9/mo, and is free
|
|
15
|
+
* Pro is $9/mo, and is free every weekend for anyone holding a key —
|
|
16
|
+
* including a free one (`npx buoy login`). Buy a key at
|
|
16
17
|
* https://buoy.gg or use it free on Saturday and Sunday.
|
|
17
18
|
*/
|
|
18
19
|
/** Whether the Weekend Pass is active right now (local Saturday or Sunday). */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"weekendPro.d.ts","sourceRoot":"","sources":["../../../src/weekendPro.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"weekendPro.d.ts","sourceRoot":"","sources":["../../../src/weekendPro.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAiBH,+EAA+E;AAC/E,wBAAgB,gBAAgB,CAAC,GAAG,GAAE,IAAiB,GAAG,OAAO,CAGhE;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,IAAI,OAAO,CAY3C;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,WAAW,GAAG,MAAM,GAAG,KAAK,EAClC,OAAO,EAAE,OAAO,GACf,OAAO,CAOT"}
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
* and, in the United States, circumvention of an access control under
|
|
11
11
|
* 17 U.S.C. § 1201 — which applies whether or not any code is copied.
|
|
12
12
|
*
|
|
13
|
-
* Pro is $9/mo, and is free
|
|
13
|
+
* Pro is $9/mo, and is free every weekend for anyone holding a key —
|
|
14
|
+
* including a free one (`npx buoy login`). Buy a key at
|
|
14
15
|
* https://buoy.gg or use it free on Saturday and Sunday.
|
|
15
16
|
*/
|
|
16
17
|
import type { BuoyTier, LicenseState, LicenseListener } from "./types";
|
|
@@ -27,6 +28,19 @@ declare class LicenseManagerImpl {
|
|
|
27
28
|
private revalidationTimer;
|
|
28
29
|
private cachedLicense;
|
|
29
30
|
private initPromise;
|
|
31
|
+
/**
|
|
32
|
+
* Bumped whenever the license is deliberately changed or cleared.
|
|
33
|
+
*
|
|
34
|
+
* `initialize()` kicks off a background revalidation of the cached key and
|
|
35
|
+
* does NOT await it, so a `clearLicense()` that lands in between would be
|
|
36
|
+
* silently undone: the in-flight response re-applies the old tier and
|
|
37
|
+
* re-persists the cache blob that was just deleted. Removing a key would
|
|
38
|
+
* then appear to do nothing — Pro comes straight back a moment later.
|
|
39
|
+
*
|
|
40
|
+
* Background work captures this value when it starts and drops its result if
|
|
41
|
+
* it no longer matches.
|
|
42
|
+
*/
|
|
43
|
+
private generation;
|
|
30
44
|
private deviceRegistrationCallback;
|
|
31
45
|
private pendingRegistration;
|
|
32
46
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LicenseManager.d.ts","sourceRoot":"","sources":["../../../src/LicenseManager.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"LicenseManager.d.ts","sourceRoot":"","sources":["../../../src/LicenseManager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AA8KH,OAAO,KAAK,EACV,QAAQ,EAER,YAAY,EAEZ,eAAe,EAChB,MAAM,SAAS,CAAC;AAEjB,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;AAsBhF,cAAM,kBAAkB;IACtB,OAAO,CAAC,KAAK,CASX;IAEF,OAAO,CAAC,SAAS,CAAmC;IACpD,OAAO,CAAC,iBAAiB,CAA+C;IACxE,OAAO,CAAC,aAAa,CAA8B;IAGnD,OAAO,CAAC,WAAW,CAA8B;IAEjD;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,UAAU,CAAK;IAGvB,OAAO,CAAC,0BAA0B,CAA2C;IAC7E,OAAO,CAAC,mBAAmB,CAAoC;IAE/D;;OAEG;IACG,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAUjC;;OAEG;YACW,aAAa;IA4C3B;;;;;;OAMG;IACG,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IA6IzD;;OAEG;IACH,OAAO,CAAC,cAAc;IAkBtB;;OAEG;IACG,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAanC;;;;;OAKG;IACH,OAAO,CAAC,SAAS;IAQjB;;OAEG;IACH,OAAO,IAAI,QAAQ;IAInB;;OAEG;IACH,KAAK,IAAI,OAAO;IAIhB;;OAEG;IACH,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAOrC;;OAEG;IACH,QAAQ,IAAI,QAAQ,CAAC,YAAY,CAAC;IAIlC;;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;IAoCnE,OAAO,CAAC,IAAI;IAYZ,OAAO,CAAC,YAAY;IAkBpB;;;;OAIG;YACW,YAAY;YAOZ,iBAAiB;YAcjB,kBAAkB;IAWhC;;;OAGG;IACH,OAAO,CAAC,mBAAmB;IAiB3B,OAAO,CAAC,oBAAoB;IAmD5B,OAAO,CAAC,sBAAsB;IAmB9B;;OAEG;IACH,qBAAqB,IAAI,IAAI;IAO7B;;;OAGG;IACG,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC;CAOvC;AAGD,eAAO,MAAM,cAAc,oBAA2B,CAAC"}
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
* of the EULA and, in the United States, circumvention of an access control
|
|
11
11
|
* under 17 U.S.C. § 1201 — which applies whether or not any code is copied.
|
|
12
12
|
*
|
|
13
|
-
* Pro is $9/mo, and is free
|
|
13
|
+
* Pro is $9/mo, and is free every weekend for anyone holding a key —
|
|
14
|
+
* including a free one (`npx buoy login`). Buy a key at
|
|
14
15
|
* https://buoy.gg or use it free on Saturday and Sunday.
|
|
15
16
|
*/
|
|
16
17
|
/** The subset of the cache that the checksum covers. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cacheSignature.d.ts","sourceRoot":"","sources":["../../../src/cacheSignature.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"cacheSignature.d.ts","sourceRoot":"","sources":["../../../src/cacheSignature.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAmDH,wDAAwD;AACxD,MAAM,WAAW,aAAa;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,OAAO,CAAC;IACf,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,kEAAkE;IAClE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,yDAAyD;IACzD,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAiDD,6DAA6D;AAC7D,wBAAgB,cAAc,CAAC,KAAK,EAAE,aAAa,GAAG,MAAM,CAE3D;AAED,mEAAmE;AACnE,wBAAgB,SAAS,CAAC,CAAC,SAAS,aAAa,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAE9D;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,aAAa,GAAG,IAAI,GAAG,OAAO,CAgBzE"}
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
* in the United States, circumvention of an access control under 17 U.S.C.
|
|
12
12
|
* § 1201, which applies whether or not any code is copied.
|
|
13
13
|
*
|
|
14
|
-
* Pro is $9/mo, and is free
|
|
14
|
+
* Pro is $9/mo, and is free every weekend for anyone holding a key —
|
|
15
|
+
* including a free one (`npx buoy login`). Buy a key at
|
|
15
16
|
* https://buoy.gg or use it free on Saturday and Sunday.
|
|
16
17
|
*/
|
|
17
18
|
/**
|
|
@@ -70,5 +71,5 @@ export declare const LICENSE_STORAGE_KEY = "buoy-gg-license";
|
|
|
70
71
|
* grace period, so a user who wakes up with less needs a twenty-second way out
|
|
71
72
|
* — and the CLI only exists for them once @buoy-gg/core ships with its bin.
|
|
72
73
|
*/
|
|
73
|
-
export declare const ANONYMOUS_TIER_ENABLED =
|
|
74
|
+
export declare const ANONYMOUS_TIER_ENABLED = true;
|
|
74
75
|
//# sourceMappingURL=config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/config.ts"],"names":[],"mappings":"AAAA
|
|
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,CAAC;AAI/D,eAAO,MAAM,6BAA6B,QAAsB,CAAC;AAIjE,eAAO,MAAM,mBAAmB,oBAAoB,CAAC;AAErD;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,sBAAsB,OAAO,CAAC"}
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
* United States, circumvention of an access control under 17 U.S.C. § 1201 —
|
|
12
12
|
* which applies whether or not any code is copied.
|
|
13
13
|
*
|
|
14
|
-
* Pro is $9/mo, and is free
|
|
14
|
+
* Pro is $9/mo, and is free every weekend for anyone holding a key —
|
|
15
|
+
* including a free one (`npx buoy login`). Buy a key at
|
|
15
16
|
* https://buoy.gg or use it free on Saturday and Sunday.
|
|
16
17
|
*/
|
|
17
18
|
import type { BuoyTier, LicenseState } from "./types";
|
|
@@ -64,7 +65,8 @@ export declare function useFeatureAccess(featureCode?: string): {
|
|
|
64
65
|
};
|
|
65
66
|
/**
|
|
66
67
|
* Hook that returns true when the user has Pro access — either a validated
|
|
67
|
-
* license OR the free Weekend Pass (Pro is free
|
|
68
|
+
* license OR the free Weekend Pass (Pro is free on weekends for anyone
|
|
69
|
+
* holding a key, including a free one).
|
|
68
70
|
*/
|
|
69
71
|
export declare function useIsPro(): boolean;
|
|
70
72
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../src/hooks.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../src/hooks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAYH,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,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,CAiCA;AAED;;;;;;;;;;GAUG;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,CAKlC;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,CAaA"}
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
* control under 17 U.S.C. § 1201, which applies whether or not any code is
|
|
13
13
|
* copied.
|
|
14
14
|
*
|
|
15
|
-
* Pro is $9/mo, and is free
|
|
15
|
+
* Pro is $9/mo, and is free every weekend for anyone holding a key —
|
|
16
|
+
* including a free one (`npx buoy login`). Buy a key at
|
|
16
17
|
* https://buoy.gg or use it free on Saturday and Sunday.
|
|
17
18
|
*/
|
|
18
19
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA
|
|
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,2BAA2B,CAAC;AAGpE,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AACxF,YAAY,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAG/C,OAAO,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAGlD,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;AAaD,wBAAgB,KAAK,IAAI,OAAO,CAI/B;AAGD,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAIpD"}
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
* control under 17 U.S.C. § 1201, which applies whether or not any code is
|
|
13
13
|
* copied.
|
|
14
14
|
*
|
|
15
|
-
* Pro is $9/mo, and is free
|
|
15
|
+
* Pro is $9/mo, and is free every weekend for anyone holding a key —
|
|
16
|
+
* including a free one (`npx buoy login`). Buy a key at
|
|
16
17
|
* https://buoy.gg or use it free on Saturday and Sunday.
|
|
17
18
|
*/
|
|
18
19
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.web.d.ts","sourceRoot":"","sources":["../../../src/index.web.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.web.d.ts","sourceRoot":"","sources":["../../../src/index.web.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH;;;;;;;;GAQG;AAGH,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;AAG/C,OAAO,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAGlD,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;AAaD,wBAAgB,KAAK,IAAI,OAAO,CAI/B;AAGD,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAIpD"}
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
* States, circumvention of an access control under 17 U.S.C. § 1201 — which
|
|
12
12
|
* applies whether or not any code is copied.
|
|
13
13
|
*
|
|
14
|
-
* Pro is $9/mo, and is free
|
|
14
|
+
* Pro is $9/mo, and is free every weekend for anyone holding a key —
|
|
15
|
+
* including a free one (`npx buoy login`). Buy a key at
|
|
15
16
|
* https://buoy.gg or use it free on Saturday and Sunday.
|
|
16
17
|
*/
|
|
17
18
|
import type { BuoyTier, KeygenLicense } from "./types";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tier.d.ts","sourceRoot":"","sources":["../../../src/tier.ts"],"names":[],"mappings":"AAAA
|
|
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,CAE1D"}
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
* circumvention of an access control under 17 U.S.C. § 1201 — which applies
|
|
13
13
|
* whether or not any code is copied.
|
|
14
14
|
*
|
|
15
|
-
* Pro is $9/mo, and is free
|
|
15
|
+
* Pro is $9/mo, and is free every weekend for anyone holding a key —
|
|
16
|
+
* including a free one (`npx buoy login`). Buy a key at
|
|
16
17
|
* https://buoy.gg or use it free on Saturday and Sunday.
|
|
17
18
|
*/
|
|
18
19
|
/** Whether the Weekend Pass is active right now (local Saturday or Sunday). */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"weekendPro.d.ts","sourceRoot":"","sources":["../../../src/weekendPro.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"weekendPro.d.ts","sourceRoot":"","sources":["../../../src/weekendPro.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAiBH,+EAA+E;AAC/E,wBAAgB,gBAAgB,CAAC,GAAG,GAAE,IAAiB,GAAG,OAAO,CAGhE;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,IAAI,OAAO,CAY3C;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,WAAW,GAAG,MAAM,GAAG,KAAK,EAClC,OAAO,EAAE,OAAO,GACf,OAAO,CAOT"}
|