@react-pdf-kit/viewer 2.5.0-beta.4 → 2.5.0-rc.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.
- package/dist/utils/hooks/useLicense.js +11 -11
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@ import { useState as E, useCallback as y, useEffect as b } from "react";
|
|
|
2
2
|
import { LicenseType as L } from "../types.js";
|
|
3
3
|
import { appConsole as c } from "../appConsole.js";
|
|
4
4
|
import "../../de_DE-8145915f.js";
|
|
5
|
-
const A = /* @__PURE__ */ new Date("2026-05-06T12:
|
|
5
|
+
const A = /* @__PURE__ */ new Date("2026-05-06T12:44:45.520Z"), v = `-----BEGIN PUBLIC KEY-----
|
|
6
6
|
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvIokvErJ0Fctu0jduSAx
|
|
7
7
|
gr+5Har/VSuZLlOunS28hnlqqA+OF1apHL7RYkjBosS15yvviYdLrVWYHpHnoY4b
|
|
8
8
|
HLQ9I6YX6FMB9T/VbB4xLdVdKvfi8r49aTScl5EKuSpgpPgz2VSJTfvVGcRuth/Y
|
|
@@ -10,7 +10,7 @@ Bm7PPGYdL2l2gvKDxchmmsHFPukGki9L4JOUeIVX0GXAxabENckaEH/iC1NZhX+W
|
|
|
10
10
|
vXnpHeHuIIKlZ16LSivXNgo6BH2Z3GFdg4G3cAaXr6qNP8fsacYNqv2SpTW1viFD
|
|
11
11
|
vzcGRabN25gpJAp9/syeScefWH3OiJY1lmw88oTiJbjIoiq6AkPhfn3G9mF54nvR
|
|
12
12
|
kwIDAQAB
|
|
13
|
-
-----END PUBLIC KEY-----`, f = "Please visit https://
|
|
13
|
+
-----END PUBLIC KEY-----`, f = "Please visit https://app.react-pdf-kit.dev to generate a new license key.", o = {
|
|
14
14
|
invalidLicense: `You are currently using without a valid license. ${f}`,
|
|
15
15
|
mismatchedDomain: `Your license key is not valid for the current domain / IP. ${f}`,
|
|
16
16
|
expired: `Your license key has expired. ${f}`,
|
|
@@ -31,7 +31,7 @@ function I(a) {
|
|
|
31
31
|
}
|
|
32
32
|
async function T(a) {
|
|
33
33
|
try {
|
|
34
|
-
const i = await import("../../index-e04c91b1.js").then((u) => u.i), e = (i == null ? void 0 : i.default) ?? i, t = e.pki.publicKeyFromPem(
|
|
34
|
+
const i = await import("../../index-e04c91b1.js").then((u) => u.i), e = (i == null ? void 0 : i.default) ?? i, t = e.pki.publicKeyFromPem(v), r = atob(a.data), n = e.util.decode64(a.signature), s = e.md.sha256.create();
|
|
35
35
|
s.update(r, "utf8");
|
|
36
36
|
const d = e.pss.create({
|
|
37
37
|
md: e.md.sha256.create(),
|
|
@@ -50,7 +50,7 @@ async function B(a, i = "SHA-256") {
|
|
|
50
50
|
let r = !1;
|
|
51
51
|
try {
|
|
52
52
|
if ((e = window.crypto) != null && e.subtle) {
|
|
53
|
-
const n = S(
|
|
53
|
+
const n = S(v), s = await window.crypto.subtle.importKey(
|
|
54
54
|
"spki",
|
|
55
55
|
n,
|
|
56
56
|
{ name: "RSA-PSS", hash: i },
|
|
@@ -96,26 +96,26 @@ const N = (a, i) => {
|
|
|
96
96
|
throw c.warn(l.message), new Error(l.message);
|
|
97
97
|
}
|
|
98
98
|
c.debug(">>> validatedLicense", r);
|
|
99
|
-
const { avu: n, exp: s, dmt: d, dm: u, t:
|
|
99
|
+
const { avu: n, exp: s, dmt: d, dm: u, t: p } = r;
|
|
100
100
|
if (!s)
|
|
101
101
|
throw new Error("License is missing expiration timestamp");
|
|
102
102
|
if (s > Number.MAX_SAFE_INTEGER / 1e3)
|
|
103
103
|
throw new Error("Invalid expiration timestamp: value too large");
|
|
104
|
-
const
|
|
105
|
-
if (
|
|
104
|
+
const w = new Date(s * 1e3), h = (/* @__PURE__ */ new Date()).getTime();
|
|
105
|
+
if (w.getTime() < h)
|
|
106
106
|
throw new Error(o.expired);
|
|
107
107
|
if (!n)
|
|
108
108
|
throw new Error("License is missing available until version timestamp");
|
|
109
109
|
if (n > Number.MAX_SAFE_INTEGER / 1e3)
|
|
110
110
|
throw new Error("Invalid available until version timestamp: value too large");
|
|
111
|
-
const
|
|
112
|
-
if (c.debug("availableUntilTimestamp",
|
|
111
|
+
const g = new Date(n * 1e3);
|
|
112
|
+
if (c.debug("availableUntilTimestamp", g), g.getTime() < A.getTime())
|
|
113
113
|
throw new Error(o.exceededVersion);
|
|
114
|
-
if (
|
|
114
|
+
if (p !== L.Custom && !N(d, u))
|
|
115
115
|
throw new Error(o.mismatchedDomain);
|
|
116
116
|
return {
|
|
117
117
|
isValid: !0,
|
|
118
|
-
type:
|
|
118
|
+
type: p,
|
|
119
119
|
invalidatedMessage: void 0
|
|
120
120
|
};
|
|
121
121
|
}, [a]);
|