next-flipbook 0.9.0 → 1.0.0

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.
Files changed (70) hide show
  1. package/LICENSE +221 -21
  2. package/README.md +23 -2
  3. package/dist/index.d.ts +2 -0
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/index.js +1 -0
  6. package/dist/index.js.map +1 -1
  7. package/dist/license/check.d.ts +19 -0
  8. package/dist/license/check.d.ts.map +1 -0
  9. package/dist/license/check.js +42 -0
  10. package/dist/license/check.js.map +1 -0
  11. package/dist/license/format.d.ts +47 -0
  12. package/dist/license/format.d.ts.map +1 -0
  13. package/dist/license/format.js +114 -0
  14. package/dist/license/format.js.map +1 -0
  15. package/dist/license/index.d.ts +10 -0
  16. package/dist/license/index.d.ts.map +1 -0
  17. package/dist/license/index.js +7 -0
  18. package/dist/license/index.js.map +1 -0
  19. package/dist/license/publicKey.d.ts +10 -0
  20. package/dist/license/publicKey.d.ts.map +1 -0
  21. package/dist/license/publicKey.js +14 -0
  22. package/dist/license/publicKey.js.map +1 -0
  23. package/dist/license/revoked.d.ts +8 -0
  24. package/dist/license/revoked.d.ts.map +1 -0
  25. package/dist/license/revoked.js +8 -0
  26. package/dist/license/revoked.js.map +1 -0
  27. package/dist/license/types.d.ts +76 -0
  28. package/dist/license/types.d.ts.map +1 -0
  29. package/dist/license/types.js +2 -0
  30. package/dist/license/types.js.map +1 -0
  31. package/dist/license/verify.d.ts +25 -0
  32. package/dist/license/verify.d.ts.map +1 -0
  33. package/dist/license/verify.js +48 -0
  34. package/dist/license/verify.js.map +1 -0
  35. package/dist/license/warn.d.ts +14 -0
  36. package/dist/license/warn.d.ts.map +1 -0
  37. package/dist/license/warn.js +47 -0
  38. package/dist/license/warn.js.map +1 -0
  39. package/dist/react/components/FlipBookLicenseMark.d.ts +11 -0
  40. package/dist/react/components/FlipBookLicenseMark.d.ts.map +1 -0
  41. package/dist/react/components/FlipBookLicenseMark.js +46 -0
  42. package/dist/react/components/FlipBookLicenseMark.js.map +1 -0
  43. package/dist/react/components/FlipBookLicenseProvider.d.ts +18 -0
  44. package/dist/react/components/FlipBookLicenseProvider.d.ts.map +1 -0
  45. package/dist/react/components/FlipBookLicenseProvider.js +17 -0
  46. package/dist/react/components/FlipBookLicenseProvider.js.map +1 -0
  47. package/dist/react/components/FlipBookProvider.d.ts.map +1 -1
  48. package/dist/react/components/FlipBookProvider.js +5 -1
  49. package/dist/react/components/FlipBookProvider.js.map +1 -1
  50. package/dist/react/components/FlipBookStage.d.ts.map +1 -1
  51. package/dist/react/components/FlipBookStage.js +4 -3
  52. package/dist/react/components/FlipBookStage.js.map +1 -1
  53. package/dist/react/context.d.ts +3 -0
  54. package/dist/react/context.d.ts.map +1 -1
  55. package/dist/react/context.js.map +1 -1
  56. package/dist/react/hooks/useLicense.d.ts +9 -0
  57. package/dist/react/hooks/useLicense.d.ts.map +1 -0
  58. package/dist/react/hooks/useLicense.js +32 -0
  59. package/dist/react/hooks/useLicense.js.map +1 -0
  60. package/dist/react/index.d.ts +3 -0
  61. package/dist/react/index.d.ts.map +1 -1
  62. package/dist/react/index.js +2 -0
  63. package/dist/react/index.js.map +1 -1
  64. package/dist/react/licenseContext.d.ts +3 -0
  65. package/dist/react/licenseContext.d.ts.map +1 -0
  66. package/dist/react/licenseContext.js +5 -0
  67. package/dist/react/licenseContext.js.map +1 -0
  68. package/dist/types/index.d.ts +7 -0
  69. package/dist/types/index.d.ts.map +1 -1
  70. package/package.json +3 -3
package/LICENSE CHANGED
@@ -1,21 +1,221 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 Samith Mendis
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ # next-flipbook Commercial License
2
+
3
+ This document describes a commercial, one-time-payment license for next-flipbook. It is intended to provide perpetual use of the licensed Software for one website, without recurring subscription or renewal fees.
4
+
5
+ The Licensor should obtain legal advice on enforceability, governing law, liability limitations, third-party licenses, contributor rights, and applicable consumer protection requirements before publishing this agreement.
6
+
7
+ Complete all [bracketed] sections before release.
8
+
9
+ # next-flipbook Commercial License
10
+
11
+ Copyright (c) 2026 Samith Mendis ("the Licensor"). All rights reserved.
12
+
13
+ This license applies to next-flipbook version [0.10.0] and later ("the Software"). Earlier versions published under the MIT License remain under the MIT License for recipients who obtained them under that license.
14
+
15
+ ## 1. Definitions
16
+
17
+ **"Software"** means the next-flipbook npm package, including its source code, compiled files, documentation, and associated components distributed by the Licensor.
18
+
19
+ **"License Key"** means the unique license identifier issued by the Licensor after successful payment.
20
+
21
+ **"Licensed Website"** means the website domain registered to a License Key, including its subdomains.
22
+
23
+ **"Project"** means the website or web application operated from the Licensed Website.
24
+
25
+ **"Licensee"** means the individual or legal entity that purchases and holds the License Key.
26
+
27
+ **"Development Address"** means a local or private-network address, including localhost, an address in a private range (10.x.x.x, 172.16-31.x.x, 192.168.x.x, 127.x.x.x), or a hostname ending in .local, .localhost, .test, or .internal.
28
+
29
+ ## 2. License Grant
30
+
31
+ Subject to payment of the applicable one-time license fee and compliance with this agreement, the Licensor grants the Licensee a non-exclusive, non-transferable, non-sublicensable, worldwide, perpetual commercial license to:
32
+
33
+ a. Evaluate and test the Software on any Development Address without a License Key and without charge.
34
+
35
+ b. Install, configure, integrate, and use the Software in the Project associated with the Licensed Website.
36
+
37
+ c. Use the Software in production and testing environments associated with the Project.
38
+
39
+ d. Include the Software in the Project's production build and distribute the resulting compiled or bundled files to visitors of the Licensed Website as part of the Project.
40
+
41
+ e. Access and read the Software's source code for the purposes of understanding, configuring, debugging, and maintaining their own use of the Software.
42
+
43
+ The rights granted under this section remain valid for the lifetime of the purchased license and do not require periodic renewal.
44
+
45
+ ## 3. One License Key, One Website
46
+
47
+ Each License Key grants production usage rights for exactly one Licensed Website and its associated Project.
48
+
49
+ The following conditions apply:
50
+
51
+ a. A License Key may not be used for multiple independent websites or projects.
52
+
53
+ b. A separate License Key must be purchased for each additional website.
54
+
55
+ c. A License Key may not be shared, sold, transferred, published, or distributed to another party for independent use.
56
+
57
+ d. Agencies, development companies, and freelancers developing websites for multiple clients must purchase a separate License Key for each client's website.
58
+
59
+ e. Multiple developers working on the same Project may use the same License Key, provided they are working on behalf of the same Licensee and for the same Licensed Website.
60
+
61
+ f. Subdomains belonging to the Licensed Website are included under the same License Key.
62
+
63
+ g. Staging, testing, and preview environments associated with the same Project are permitted, including staging subdomains. Separate independent websites and projects require separate licenses.
64
+
65
+ A License Key does not grant production usage rights for any other website owned or operated by the Licensee.
66
+
67
+ ## 4. Domain Changes and License Migration
68
+
69
+ A Licensee may migrate the License Key to a replacement domain when changing the domain of the same Project.
70
+
71
+ The following conditions apply:
72
+
73
+ a. The Licensee must deactivate the previous domain before activating the replacement domain.
74
+
75
+ b. A License Key cannot be active on multiple independent production websites simultaneously.
76
+
77
+ c. Domain migration must be performed through the license management system or by contacting the Licensor if manual assistance is required.
78
+
79
+ d. Domain migration does not require purchasing another License Key when it relates to the same Project.
80
+
81
+ e. A domain migration cannot be used to transfer a License Key to another customer's independent Project.
82
+
83
+ The Licensor may request reasonable verification to prevent misuse of domain migration.
84
+
85
+ ## 5. Restrictions
86
+
87
+ The Licensee may not:
88
+
89
+ a. Remove, hide, disable, modify, or circumvent the Software's license validation mechanism, watermark, or console warning.
90
+
91
+ b. Modify the Software to make an unlicensed website appear as though it has a valid License Key.
92
+
93
+ c. Sell, rent, sublicense, redistribute, publish, or otherwise make the Software available to third parties as a standalone product or competing package.
94
+
95
+ d. Redistribute the Software's source code, compiled package, or substantial portions of it as part of another npm package, template, library, or commercial product, except for the permitted distribution described in Section 2.
96
+
97
+ e. Use the Software to develop, distribute, or operate a competing flipbook library or substantially similar competing software product.
98
+
99
+ f. Use the Software in production on a website without a valid License Key.
100
+
101
+ g. Share or expose a License Key publicly or intentionally allow unauthorized third parties to use it.
102
+
103
+ These restrictions do not prohibit the normal integration and distribution of the Software as part of the licensed Project.
104
+
105
+ ## 6. Lifetime License and Payment
106
+
107
+ The Software is licensed under a one-time-payment model.
108
+
109
+ a. The Licensee pays a fixed license fee determined by the Licensor at the time of purchase.
110
+
111
+ b. The payment is made once for each Licensed Website.
112
+
113
+ c. No monthly, annual, subscription, or recurring renewal fees are required.
114
+
115
+ d. After successful payment and issuance of a License Key, the license is perpetual and does not have an automatic expiration date.
116
+
117
+ e. The Licensee may continue using the licensed version of the Software indefinitely, subject to this agreement.
118
+
119
+ f. Updates and bug fixes made generally available for the licensed product are included without additional recurring fees. Any separately priced major-version upgrade must be clearly identified and disclosed before purchase.
120
+
121
+ g. The Licensee is not required to pay additional fees merely to maintain an existing valid lifetime license.
122
+
123
+ The lifetime license grants continuing usage rights. It does not guarantee that the Licensor will maintain the Software, provide technical support, host external services, or release updates indefinitely.
124
+
125
+ ## 7. License Termination and Revocation
126
+
127
+ A properly purchased lifetime License Key does not expire due to the passage of time.
128
+
129
+ However, the Licensor reserves the right to suspend or revoke a License Key if:
130
+
131
+ a. The Licensee materially breaches the terms of this agreement.
132
+
133
+ b. The License Key is obtained through fraud, unauthorized payment methods, or other unlawful means.
134
+
135
+ c. A payment is reversed, charged back, or otherwise invalidated after the License Key has been issued, subject to applicable payment dispute procedures.
136
+
137
+ d. The Licensee redistributes or sublicenses the Software in violation of this agreement.
138
+
139
+ Where reasonably possible, the Licensor will provide written notice describing the violation and a reasonable opportunity to correct it before revocation.
140
+
141
+ Upon valid termination or revocation:
142
+
143
+ a. The Licensee must stop production use of the Software on the affected Licensed Website.
144
+
145
+ b. The Software may display its watermark and license warning on the affected website.
146
+
147
+ c. The Licensee must remove or replace the Software if continued licensed use is no longer authorized.
148
+
149
+ d. The Licensee may contact the Licensor to resolve a disputed suspension or revocation.
150
+
151
+ A revocation becomes technically effective when the affected website receives or installs a Software version that recognizes the revoked License Key.
152
+
153
+ Nothing in this section removes any rights that cannot legally be excluded under applicable law.
154
+
155
+ ## 8. Ownership and Intellectual Property
156
+
157
+ The Software is licensed, not sold.
158
+
159
+ The Licensor retains ownership of all intellectual property rights in the Software, including its source code, architecture, design, documentation, branding, and associated materials, except for third-party components.
160
+
161
+ This agreement does not transfer ownership of the Software to the Licensee.
162
+
163
+ The Licensee receives only the rights expressly granted under this agreement.
164
+
165
+ Nothing in this agreement grants the Licensee ownership of or rights to the next-flipbook name, trademarks, logos, or branding.
166
+
167
+ ## 9. Third-Party Software
168
+
169
+ The Software may include or depend on third-party libraries, frameworks, and components, including React and PDF.js.
170
+
171
+ Such third-party components remain subject to their respective licenses and copyright notices.
172
+
173
+ This commercial license does not replace, override, or modify the licensing terms of third-party software.
174
+
175
+ The Licensor will identify applicable third-party licenses where required.
176
+
177
+ ## 10. No Warranty
178
+
179
+ TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE SOFTWARE IS PROVIDED "AS IS" AND "AS AVAILABLE", WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
180
+
181
+ The Licensor does not guarantee that the Software will be uninterrupted, error-free, compatible with every environment, or suitable for every particular use.
182
+
183
+ Nothing in this section excludes warranties or rights that cannot legally be excluded.
184
+
185
+ ## 11. Limitation of Liability
186
+
187
+ TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW:
188
+
189
+ a. The Licensor shall not be liable for indirect, incidental, special, exemplary, or consequential damages.
190
+
191
+ b. The Licensor shall not be liable for loss of profits, revenue, business opportunities, data, or business interruption arising from the use of or inability to use the Software.
192
+
193
+ c. The Licensor's total aggregate liability arising from or relating to this agreement shall not exceed the license fee actually paid by the Licensee for the relevant License Key.
194
+
195
+ These limitations do not apply to liability that cannot legally be excluded or limited under applicable law.
196
+
197
+ ## 12. Governing Law and Jurisdiction
198
+
199
+ This agreement shall be governed by the laws of [SRI LANKA / OTHER JURISDICTION], without regard to conflict-of-law principles.
200
+
201
+ Any disputes arising from or relating to this agreement shall be subject to the jurisdiction of the competent courts of [COLOMBO, SRI LANKA / OTHER AGREED JURISDICTION], subject to mandatory legal protections and jurisdictional requirements.
202
+
203
+ ## 13. Changes to This Agreement
204
+
205
+ The Licensor may publish updated versions of this agreement.
206
+
207
+ Changes to the agreement will not automatically remove or reduce the perpetual usage rights already granted under a previously purchased License Key.
208
+
209
+ Any material changes affecting existing Licensees must be communicated appropriately and will be subject to applicable law.
210
+
211
+ ## 14. Contact Information
212
+
213
+ For licensing questions, technical inquiries, domain migrations, and license-related support:
214
+
215
+ **Licensor:** Samith Mendis
216
+ **Email:** samithmendis.01@gmail.com
217
+ **GitHub:** https://github.com/dsamithmendis
218
+
219
+ ---
220
+
221
+ Copyright (c) 2026 Samith Mendis. All rights reserved.
package/README.md CHANGED
@@ -4,7 +4,7 @@ A realistic, responsive flipbook engine for React and Next.js.
4
4
 
5
5
  Give it a PDF, images or React components and it gives you a book: a physical page-turn animation you can grab and drag, pinch and double-tap zoom, thumbnails, bookmarks, text search and a table of contents, single or two-page layout that follows the container size, keyboard navigation, accessible controls and right-to-left support. The engine has no React or Next.js dependency, and the React layer is a thin, SSR-safe shell around it.
6
6
 
7
- > **Status: Phase 7 (0.9.0).** PDFs (PDF.js), images and custom React pages; drag, swipe and zoom; a toolbar with thumbnails (their size can be set), bookmarks, a changeable background, fullscreen, download, print and share; text search, the PDF's table of contents, clickable PDF links, hotspots, overlays, deep links and a saved reading place; bounded memory on very long PDFs, with benchmarks; linted, with end-to-end, accessibility and visual tests and CI. Not built yet: autoplay, hard pages, page curl, sound, plugins. The API only exposes what is implemented.
7
+ > **Status: Phase 7 (0.10.0).** PDFs (PDF.js), images and custom React pages; drag, swipe and zoom; a toolbar with thumbnails (their size can be set), bookmarks, a changeable background, fullscreen, download, print and share; text search, the PDF's table of contents, clickable PDF links, hotspots, overlays, deep links and a saved reading place; bounded memory on very long PDFs, with benchmarks; linted, with end-to-end, accessibility and visual tests and CI. A license key per website. Not built yet: autoplay, hard pages, page curl, sound, plugins. The API only exposes what is implemented.
8
8
 
9
9
  ## Install
10
10
 
@@ -14,6 +14,24 @@ npm install next-flipbook
14
14
 
15
15
  Requires React 18 or newer. The package is ESM-only. `pdfjs-dist` is installed with it and is loaded only when a PDF is shown, in its own chunk, so image-only books never download it.
16
16
 
17
+ ### License key
18
+
19
+ next-flipbook is not free: a website that uses it in production needs a **license key**, and one key works on one website. Anyone can install it and try it. Without a valid key the viewer shows an "Unlicensed copy" watermark and writes one warning to the console, and it keeps working. `localhost` and private-network addresses never need a key.
20
+
21
+ ```tsx
22
+ <FlipBook source="/magazine.pdf" licenseKey="FB1.eyJ2Ijox…" />
23
+ ```
24
+
25
+ Or once for the whole app, in the root layout:
26
+
27
+ ```tsx
28
+ import { FlipBookLicenseProvider } from "next-flipbook";
29
+
30
+ <FlipBookLicenseProvider licenseKey={process.env.NEXT_PUBLIC_FLIPBOOK_LICENSE_KEY}>{children}</FlipBookLicenseProvider>
31
+ ```
32
+
33
+ How keys work, what a visitor and a developer see, and how to make keys: [docs/licensing.md](docs/licensing.md).
34
+
17
35
  ## Quick start: a PDF
18
36
 
19
37
  ```tsx
@@ -134,6 +152,7 @@ ref.current?.getCacheStats(); // what the viewer holds: cached pages, thumbnails
134
152
 
135
153
  | Prop | Default | Notes |
136
154
  | --- | --- | --- |
155
+ | `licenseKey` | none | The key you were given for this website. Without a valid one the viewer shows a watermark and one console warning, and keeps working. `localhost` and private addresses need none. `<FlipBookLicenseProvider>` sets it for every viewer below it. See [docs/licensing.md](docs/licensing.md). |
137
156
  | `source` | none | A PDF: URL, `File`, `Blob`, `ArrayBuffer` or `Uint8Array`. Pass `source` or `pages`, not both. Keep it referentially stable: a new value loads a new document. |
138
157
  | `pages` | none | Strings (image URLs), `{ type: "image", src, alt?, width?, height? }`, `{ type: "custom", component? \| render? }` or `{ type: "pdf", source, page }`. |
139
158
  | `pdf` | none | `workerSrc`, `renderScale`, `maxCanvasPixels`, `maxCacheBytes`, `maxTextCacheBytes`, `cleanupAfterPages`, `password`, `withCredentials`, `httpHeaders`, `maxConcurrentRenders`, `documentParams`, `loadPdfjs`. See [docs/pdf.md](docs/pdf.md). |
@@ -276,6 +295,8 @@ node benchmarks/browser.mjs # a real Chromium on the demo's /l
276
295
 
277
296
  What was measured, on what, and what it does not show: [docs/performance.md](docs/performance.md).
278
297
 
298
+ License keys are made with `npm run license -- …` (see [docs/licensing.md](docs/licensing.md)), and `npm run verify:release` checks that a package is ready to be published.
299
+
279
300
  Layout: `packages/flipbook` is the library, `demo/next-app` is the App Router demo, `benchmarks` holds the benchmarks, `docs` holds design notes. See [docs/architecture.md](docs/architecture.md).
280
301
 
281
302
  ## Author
@@ -284,4 +305,4 @@ Samith Mendis ([@dsamithmendis](https://github.com/dsamithmendis)) · samithmend
284
305
 
285
306
  ## License
286
307
 
287
- MIT. See [LICENSE](LICENSE).
308
+ Commercial: one license key per website. See [LICENSE](LICENSE) and [docs/licensing.md](docs/licensing.md).
package/dist/index.d.ts CHANGED
@@ -1,4 +1,6 @@
1
1
  export * from "./react/index.js";
2
2
  export type { AppearanceSnapshot, AspectRatioProp, BackgroundChoice, BookmarkOptions, BookmarkStorage, CustomPage, DownloadOptions, EngineState, FlipBookAppearanceControls, FlipBookBookProps, FlipBookController, FlipBookDirection, FlipBookError, FlipBookErrorCode, FlipBookFeatures, FlipBookHotspot, FlipBookLink, FlipBookLocale, FlipBookMode, FlipBookPage, FlipBookPageInput, FlipBookProps, FlipBookStageProps, FlipBookTheme, FlipBookTurnEvent, FlipBookView, ImagePage, ImageTextBox, PasswordReason, PersistStateOptions, PdfOptions, PdfPage, PdfSource, PrintOptions, SearchOptions, ShareOptions, ThumbnailSize, ThumbnailSizeName, PanelId, UiSnapshot, UrlStateOptions, WhileTurning, ZoomSnapshot, } from "./types/index.js";
3
3
  export type { FlipBookCacheControls, FlipBookCacheStats, FlipBookOutlineControls, FlipBookOutlineItem, FlipBookSearchControls, SearchResult, SearchSnapshot, StorageLike, } from "./core/index.js";
4
+ export { LICENSE_INFO_URL, hostMatchesDomain, isDevelopmentHost, parseLicenseKey, verifyLicense } from "./license/index.js";
5
+ export type { LicenseProblem, LicensePayload, LicensePublicKey, LicenseStatus, VerifyLicenseOptions } from "./license/index.js";
4
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AAEjC,YAAY,EACV,kBAAkB,EAClB,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,UAAU,EACV,eAAe,EACf,WAAW,EACX,0BAA0B,EAC1B,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,aAAa,EACb,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,EACf,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACb,kBAAkB,EAClB,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,SAAS,EACT,YAAY,EACZ,cAAc,EACd,mBAAmB,EACnB,UAAU,EACV,OAAO,EACP,SAAS,EACT,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,aAAa,EACb,iBAAiB,EACjB,OAAO,EACP,UAAU,EACV,eAAe,EACf,YAAY,EACZ,YAAY,GACb,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EACV,qBAAqB,EACrB,kBAAkB,EAClB,uBAAuB,EACvB,mBAAmB,EACnB,sBAAsB,EACtB,YAAY,EACZ,cAAc,EACd,WAAW,GACZ,MAAM,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AAEjC,YAAY,EACV,kBAAkB,EAClB,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,UAAU,EACV,eAAe,EACf,WAAW,EACX,0BAA0B,EAC1B,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,aAAa,EACb,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,EACf,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACb,kBAAkB,EAClB,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,SAAS,EACT,YAAY,EACZ,cAAc,EACd,mBAAmB,EACnB,UAAU,EACV,OAAO,EACP,SAAS,EACT,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,aAAa,EACb,iBAAiB,EACjB,OAAO,EACP,UAAU,EACV,eAAe,EACf,YAAY,EACZ,YAAY,GACb,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EACV,qBAAqB,EACrB,kBAAkB,EAClB,uBAAuB,EACvB,mBAAmB,EACnB,sBAAsB,EACtB,YAAY,EACZ,cAAc,EACd,WAAW,GACZ,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAC5H,YAAY,EAAE,cAAc,EAAE,cAAc,EAAE,gBAAgB,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC"}
package/dist/index.js CHANGED
@@ -1,2 +1,3 @@
1
1
  export * from "./react/index.js";
2
+ export { LICENSE_INFO_URL, hostMatchesDomain, isDevelopmentHost, parseLicenseKey, verifyLicense } from "./license/index.js";
2
3
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AAyDjC,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC"}
@@ -0,0 +1,19 @@
1
+ import type { LicensePublicKey, LicenseStatus } from "./types.js";
2
+ /** The website the page is on, or null where there is no page (server rendering). */
3
+ export declare function currentHostname(): string | null;
4
+ /**
5
+ * The license status of `key` for the website this page is on. Every viewer on a page asks the
6
+ * same question, so the check runs once per key and the answer is shared. On the server it answers
7
+ * `pending`: the check belongs to the browser, and the server's HTML has to match the browser's
8
+ * first render.
9
+ */
10
+ export declare function checkLicense(key: string | undefined): Promise<LicenseStatus>;
11
+ /** Forgets the answers. For tests: a page never needs it. */
12
+ export declare function resetLicenseChecks(): void;
13
+ /**
14
+ * Checks keys against another public key, or against the package's own again with `undefined`. For
15
+ * tests, which sign keys with a key of their own. It is not exported from the package (nothing in
16
+ * `exports` reaches this file), so an app cannot swap the key.
17
+ */
18
+ export declare function overrideLicensePublicKey(key: LicensePublicKey | null | undefined): void;
19
+ //# sourceMappingURL=check.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"check.d.ts","sourceRoot":"","sources":["../../src/license/check.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAOlE,qFAAqF;AACrF,wBAAgB,eAAe,IAAI,MAAM,GAAG,IAAI,CAE/C;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC,CAU5E;AAED,6DAA6D;AAC7D,wBAAgB,kBAAkB,IAAI,IAAI,CAEzC;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,gBAAgB,GAAG,IAAI,GAAG,SAAS,GAAG,IAAI,CAGvF"}
@@ -0,0 +1,42 @@
1
+ import { LICENSE_PUBLIC_KEY } from "./publicKey.js";
2
+ import { REVOKED_LICENSE_IDS } from "./revoked.js";
3
+ import { verifyLicense } from "./verify.js";
4
+ const PENDING = { state: "pending" };
5
+ const answers = new Map();
6
+ let publicKey = LICENSE_PUBLIC_KEY;
7
+ /** The website the page is on, or null where there is no page (server rendering). */
8
+ export function currentHostname() {
9
+ return typeof location === "undefined" ? null : location.hostname;
10
+ }
11
+ /**
12
+ * The license status of `key` for the website this page is on. Every viewer on a page asks the
13
+ * same question, so the check runs once per key and the answer is shared. On the server it answers
14
+ * `pending`: the check belongs to the browser, and the server's HTML has to match the browser's
15
+ * first render.
16
+ */
17
+ export function checkLicense(key) {
18
+ const hostname = currentHostname();
19
+ if (hostname === null)
20
+ return Promise.resolve(PENDING);
21
+ const id = `${hostname}\n${key ?? ""}`;
22
+ let answer = answers.get(id);
23
+ if (!answer) {
24
+ answer = verifyLicense({ key, hostname, publicKey, revoked: REVOKED_LICENSE_IDS });
25
+ answers.set(id, answer);
26
+ }
27
+ return answer;
28
+ }
29
+ /** Forgets the answers. For tests: a page never needs it. */
30
+ export function resetLicenseChecks() {
31
+ answers.clear();
32
+ }
33
+ /**
34
+ * Checks keys against another public key, or against the package's own again with `undefined`. For
35
+ * tests, which sign keys with a key of their own. It is not exported from the package (nothing in
36
+ * `exports` reaches this file), so an app cannot swap the key.
37
+ */
38
+ export function overrideLicensePublicKey(key) {
39
+ publicKey = key === undefined ? LICENSE_PUBLIC_KEY : key;
40
+ answers.clear();
41
+ }
42
+ //# sourceMappingURL=check.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"check.js","sourceRoot":"","sources":["../../src/license/check.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAEnD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,MAAM,OAAO,GAAkB,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;AACpD,MAAM,OAAO,GAAG,IAAI,GAAG,EAAkC,CAAC;AAC1D,IAAI,SAAS,GAA4B,kBAAkB,CAAC;AAE5D,qFAAqF;AACrF,MAAM,UAAU,eAAe;IAC7B,OAAO,OAAO,QAAQ,KAAK,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC;AACpE,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAC,GAAuB;IAClD,MAAM,QAAQ,GAAG,eAAe,EAAE,CAAC;IACnC,IAAI,QAAQ,KAAK,IAAI;QAAE,OAAO,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACvD,MAAM,EAAE,GAAG,GAAG,QAAQ,KAAK,GAAG,IAAI,EAAE,EAAE,CAAC;IACvC,IAAI,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAC7B,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,GAAG,aAAa,CAAC,EAAE,GAAG,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,mBAAmB,EAAE,CAAC,CAAC;QACnF,OAAO,CAAC,GAAG,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;IAC1B,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,6DAA6D;AAC7D,MAAM,UAAU,kBAAkB;IAChC,OAAO,CAAC,KAAK,EAAE,CAAC;AAClB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,wBAAwB,CAAC,GAAwC;IAC/E,SAAS,GAAG,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,GAAG,CAAC;IACzD,OAAO,CAAC,KAAK,EAAE,CAAC;AAClB,CAAC"}
@@ -0,0 +1,47 @@
1
+ import type { LicensePayload } from "./types.js";
2
+ /**
3
+ * A license key is three parts joined by dots:
4
+ *
5
+ * FB1.<payload>.<signature>
6
+ *
7
+ * The payload is JSON (see `LicensePayload`) and the signature covers the text `FB1.<payload>`
8
+ * exactly as written, so there is nothing to canonicalize. Both parts are base64url. The
9
+ * signature is ECDSA with P-256 and SHA-256, in the 64-byte `r || s` form that `crypto.subtle`
10
+ * uses. That algorithm is the one every browser's `crypto.subtle` has had for years; Ed25519 is
11
+ * not available in the older ones.
12
+ *
13
+ * This file is plain functions with no browser or Node APIs beyond `atob` and `TextDecoder`, so
14
+ * the same code runs in the browser, on the server and in tests.
15
+ */
16
+ export declare const LICENSE_KEY_PREFIX = "FB1";
17
+ export interface ParsedLicenseKey {
18
+ payload: LicensePayload;
19
+ /** The text the signature covers. */
20
+ signedText: string;
21
+ /** The 64 signature bytes. */
22
+ signature: Uint8Array<ArrayBuffer>;
23
+ }
24
+ /** Bytes from base64url text, or null if it is not that. */
25
+ export declare function fromBase64Url(text: string): Uint8Array<ArrayBuffer> | null;
26
+ /**
27
+ * Splits a key into its payload and signature. Spaces and line breaks are ignored, because keys
28
+ * get pasted from emails and wrapped. Returns null for anything that is not shaped like a key.
29
+ * Nothing in the result can be trusted until the signature has been checked.
30
+ */
31
+ export declare function parseLicenseKey(input: string): ParsedLicenseKey | null;
32
+ /** A host name or domain in the form that is compared: lower case, with no brackets or trailing dot. */
33
+ export declare function normalizeHost(value: string): string;
34
+ /**
35
+ * Whether `host` is `domain` or one of its subdomains. A key for `example.com` covers
36
+ * `www.example.com` and `app.example.com`, and not `notexample.com`. A domain with a single label
37
+ * (`com`, `intranet`) matches only itself, so a key can never cover a whole top-level domain.
38
+ */
39
+ export declare function hostMatchesDomain(host: string, domain: string): boolean;
40
+ /**
41
+ * Whether the viewer runs on a developer's own machine or network: there is no website to check a
42
+ * key against, and a warning on every `npm run dev` would only train people to ignore it. This
43
+ * covers `localhost`, loopback and private-network addresses, `*.local`, `*.test`, `*.internal`,
44
+ * and pages that are not on a host at all (`file:`).
45
+ */
46
+ export declare function isDevelopmentHost(host: string): boolean;
47
+ //# sourceMappingURL=format.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../src/license/format.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,kBAAkB,QAAQ,CAAC;AAExC,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,cAAc,CAAC;IACxB,qCAAqC;IACrC,UAAU,EAAE,MAAM,CAAC;IACnB,8BAA8B;IAC9B,SAAS,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC;CACpC;AAED,4DAA4D;AAC5D,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,CAAC,WAAW,CAAC,GAAG,IAAI,CAY1E;AAmBD;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,gBAAgB,GAAG,IAAI,CAkBtE;AAED,wGAAwG;AACxG,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAMvE;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAevD"}
@@ -0,0 +1,114 @@
1
+ /**
2
+ * A license key is three parts joined by dots:
3
+ *
4
+ * FB1.<payload>.<signature>
5
+ *
6
+ * The payload is JSON (see `LicensePayload`) and the signature covers the text `FB1.<payload>`
7
+ * exactly as written, so there is nothing to canonicalize. Both parts are base64url. The
8
+ * signature is ECDSA with P-256 and SHA-256, in the 64-byte `r || s` form that `crypto.subtle`
9
+ * uses. That algorithm is the one every browser's `crypto.subtle` has had for years; Ed25519 is
10
+ * not available in the older ones.
11
+ *
12
+ * This file is plain functions with no browser or Node APIs beyond `atob` and `TextDecoder`, so
13
+ * the same code runs in the browser, on the server and in tests.
14
+ */
15
+ export const LICENSE_KEY_PREFIX = "FB1";
16
+ /** Bytes from base64url text, or null if it is not that. */
17
+ export function fromBase64Url(text) {
18
+ if (!/^[A-Za-z0-9_-]*$/.test(text))
19
+ return null;
20
+ const padded = text.replace(/-/g, "+").replace(/_/g, "/") + "=".repeat((4 - (text.length % 4)) % 4);
21
+ let binary;
22
+ try {
23
+ binary = atob(padded);
24
+ }
25
+ catch {
26
+ return null;
27
+ }
28
+ const bytes = new Uint8Array(new ArrayBuffer(binary.length));
29
+ for (let index = 0; index < binary.length; index += 1)
30
+ bytes[index] = binary.charCodeAt(index);
31
+ return bytes;
32
+ }
33
+ function isPayload(value) {
34
+ if (typeof value !== "object" || value === null)
35
+ return false;
36
+ const payload = value;
37
+ const whole = (n) => typeof n === "number" && Number.isSafeInteger(n) && n >= 0;
38
+ return (payload.v === 1 &&
39
+ typeof payload.id === "string" &&
40
+ payload.id.length > 0 &&
41
+ payload.id.length <= 32 &&
42
+ typeof payload.d === "string" &&
43
+ payload.d.length > 0 &&
44
+ payload.d.length <= 253 &&
45
+ whole(payload.iat) &&
46
+ (payload.exp === undefined || whole(payload.exp)));
47
+ }
48
+ /**
49
+ * Splits a key into its payload and signature. Spaces and line breaks are ignored, because keys
50
+ * get pasted from emails and wrapped. Returns null for anything that is not shaped like a key.
51
+ * Nothing in the result can be trusted until the signature has been checked.
52
+ */
53
+ export function parseLicenseKey(input) {
54
+ const text = input.replace(/\s+/g, "");
55
+ const parts = text.split(".");
56
+ if (parts.length !== 3 || parts[0] !== LICENSE_KEY_PREFIX)
57
+ return null;
58
+ const [prefix, encodedPayload, encodedSignature] = parts;
59
+ const payloadBytes = fromBase64Url(encodedPayload);
60
+ const signature = fromBase64Url(encodedSignature);
61
+ if (!payloadBytes || !signature || signature.length !== 64)
62
+ return null;
63
+ let payload;
64
+ try {
65
+ payload = JSON.parse(new TextDecoder().decode(payloadBytes));
66
+ }
67
+ catch {
68
+ return null;
69
+ }
70
+ if (!isPayload(payload))
71
+ return null;
72
+ return { payload, signedText: `${prefix}.${encodedPayload}`, signature };
73
+ }
74
+ /** A host name or domain in the form that is compared: lower case, with no brackets or trailing dot. */
75
+ export function normalizeHost(value) {
76
+ return value.trim().toLowerCase().replace(/^\[|\]$/g, "").replace(/\.+$/, "");
77
+ }
78
+ /**
79
+ * Whether `host` is `domain` or one of its subdomains. A key for `example.com` covers
80
+ * `www.example.com` and `app.example.com`, and not `notexample.com`. A domain with a single label
81
+ * (`com`, `intranet`) matches only itself, so a key can never cover a whole top-level domain.
82
+ */
83
+ export function hostMatchesDomain(host, domain) {
84
+ const h = normalizeHost(host);
85
+ const d = normalizeHost(domain);
86
+ if (h === "" || d === "")
87
+ return false;
88
+ if (h === d)
89
+ return true;
90
+ return d.includes(".") && h.endsWith(`.${d}`);
91
+ }
92
+ /**
93
+ * Whether the viewer runs on a developer's own machine or network: there is no website to check a
94
+ * key against, and a warning on every `npm run dev` would only train people to ignore it. This
95
+ * covers `localhost`, loopback and private-network addresses, `*.local`, `*.test`, `*.internal`,
96
+ * and pages that are not on a host at all (`file:`).
97
+ */
98
+ export function isDevelopmentHost(host) {
99
+ const h = normalizeHost(host);
100
+ if (h === "")
101
+ return true;
102
+ if (h === "localhost" || /\.(localhost|local|test|internal)$/.test(h))
103
+ return true;
104
+ const v4 = /^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/.exec(h);
105
+ if (v4) {
106
+ const a = Number(v4[1]);
107
+ const b = Number(v4[2]);
108
+ return (a === 0 || a === 10 || a === 127 || (a === 169 && b === 254) || (a === 172 && b >= 16 && b <= 31) || (a === 192 && b === 168));
109
+ }
110
+ if (h.includes(":"))
111
+ return h === "::" || h === "::1" || /^f[cd][0-9a-f]{2}:/.test(h) || /^fe[89ab][0-9a-f]:/.test(h);
112
+ return false;
113
+ }
114
+ //# sourceMappingURL=format.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format.js","sourceRoot":"","sources":["../../src/license/format.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,CAAC;AAUxC,4DAA4D;AAC5D,MAAM,UAAU,aAAa,CAAC,IAAY;IACxC,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IAChD,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IACpG,IAAI,MAAc,CAAC;IACnB,IAAI,CAAC;QACH,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC;IACxB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,IAAI,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;IAC7D,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,KAA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Host, normalizeHost, parseLicenseKey, } from "./format.js";
3
+ export type { ParsedLicenseKey } from "./format.js";
4
+ export { LICENSE_PUBLIC_KEY } from "./publicKey.js";
5
+ export { REVOKED_LICENSE_IDS } from "./revoked.js";
6
+ export type { LicensePayload, LicenseProblem, LicensePublicKey, LicenseStatus } from "./types.js";
7
+ export { verifyLicense } from "./verify.js";
8
+ export type { VerifyLicenseOptions } from "./verify.js";
9
+ export { LICENSE_INFO_URL, describeLicense, resetLicenseWarnings, warnAboutLicense } from "./warn.js";
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/license/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAC/E,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,aAAa,EACb,eAAe,GAChB,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,YAAY,EAAE,cAAc,EAAE,cAAc,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAClG,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,YAAY,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC"}
@@ -0,0 +1,7 @@
1
+ export { checkLicense, currentHostname, resetLicenseChecks } from "./check.js";
2
+ export { LICENSE_KEY_PREFIX, hostMatchesDomain, isDevelopmentHost, normalizeHost, parseLicenseKey, } from "./format.js";
3
+ export { LICENSE_PUBLIC_KEY } from "./publicKey.js";
4
+ export { REVOKED_LICENSE_IDS } from "./revoked.js";
5
+ export { verifyLicense } from "./verify.js";
6
+ export { LICENSE_INFO_URL, describeLicense, resetLicenseWarnings, warnAboutLicense } from "./warn.js";
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/license/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAC/E,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,aAAa,EACb,eAAe,GAChB,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAEnD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC"}
@@ -0,0 +1,10 @@
1
+ import type { LicensePublicKey } from "./types.js";
2
+ /**
3
+ * The half of the signing key that checks license keys. It is not a secret: it goes out in every
4
+ * copy of the package, and it can only check keys, never make them.
5
+ *
6
+ * Written by `npm run license -- init`. A build with no key here (`null`) accepts no license key at
7
+ * all, and `npm run verify:release` refuses to publish it.
8
+ */
9
+ export declare const LICENSE_PUBLIC_KEY: LicensePublicKey | null;
10
+ //# sourceMappingURL=publicKey.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"publicKey.d.ts","sourceRoot":"","sources":["../../src/license/publicKey.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEnD;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,EAAE,gBAAgB,GAAG,IAKnD,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * The half of the signing key that checks license keys. It is not a secret: it goes out in every
3
+ * copy of the package, and it can only check keys, never make them.
4
+ *
5
+ * Written by `npm run license -- init`. A build with no key here (`null`) accepts no license key at
6
+ * all, and `npm run verify:release` refuses to publish it.
7
+ */
8
+ export const LICENSE_PUBLIC_KEY = {
9
+ kty: "EC",
10
+ crv: "P-256",
11
+ x: "Jq6blXQje0K12yUu6S6fOWFJSDvju2JIjAYmbzTIB2E",
12
+ y: "M5acONLudl9xHsvDa2J5XYVTfgWYTlZnRwgD6dRb7Wk",
13
+ };
14
+ //# sourceMappingURL=publicKey.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"publicKey.js","sourceRoot":"","sources":["../../src/license/publicKey.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAA4B;IACzD,GAAG,EAAE,IAAI;IACT,GAAG,EAAE,OAAO;IACZ,CAAC,EAAE,6CAA6C;IAChD,CAAC,EAAE,6CAA6C;CACjD,CAAC"}