c2pa-react-cawg-component 0.1.10 → 0.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +41 -0
- package/dist/c2pa-react-cawg-component.css +1 -1
- package/dist/c2pa-react-cawg-component.js +354 -168
- package/dist/c2pa-react-cawg-component.umd.cjs +1 -1
- package/dist/components/Cawg/helper/TrustBadge.d.ts +9 -0
- package/dist/components/Cawg/helper/getBestUserName.d.ts +10 -0
- package/dist/components/Cawg/helper/trqp.d.ts +29 -0
- package/dist/index.d.ts +2 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -89,6 +89,45 @@ import { CAWGManifest } from "c2pa-react-cawg-component";
|
|
|
89
89
|
|
|
90
90
|
Clicking "More Info" advances from level 1 → 2 → 3. Clicking "Small View" at level 3 returns to level 1.
|
|
91
91
|
|
|
92
|
+
## Trust registry (TRQP)
|
|
93
|
+
|
|
94
|
+
Level 2 and level 3 render a `TrustBadge` next to verified identities, showing whether the manifest's issuer is recognized by a [TRQP](https://creator-assertions.github.io/) trust registry.
|
|
95
|
+
|
|
96
|
+
This package does **not** ship a mock or default trust registry. Out of the box, the badge will always report "Unable to reach trust registry" — you must configure a real query function that calls your TRQP endpoint (or any equivalent authorization check).
|
|
97
|
+
|
|
98
|
+
### `setTrustRegistryQueryFn`
|
|
99
|
+
|
|
100
|
+
Call once at app startup to configure the query function used by every `TrustBadge` in your app:
|
|
101
|
+
|
|
102
|
+
```ts
|
|
103
|
+
import { setTrustRegistryQueryFn } from "c2pa-react-cawg-component";
|
|
104
|
+
import type { TrqpAuthorizationResponse } from "c2pa-react-cawg-component";
|
|
105
|
+
|
|
106
|
+
setTrustRegistryQueryFn(async ({ entityId, action, resource }): Promise<TrqpAuthorizationResponse> => {
|
|
107
|
+
const res = await fetch(
|
|
108
|
+
`https://your-trqp-endpoint.example.com/registries/main/entities/${entityId}/authorization/${action}/${resource}`,
|
|
109
|
+
);
|
|
110
|
+
if (!res.ok) throw new Error(`TRQP query failed: ${res.status}`);
|
|
111
|
+
return res.json();
|
|
112
|
+
});
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
If no query function is configured, every `TrustBadge` throws and renders an error state instead of silently reporting a false result.
|
|
116
|
+
|
|
117
|
+
### Per-badge override
|
|
118
|
+
|
|
119
|
+
`TrustBadge` (used internally by `CAWGManifest` at levels 2–3) also accepts a `queryFn` prop directly, which takes precedence over the app-wide default set via `setTrustRegistryQueryFn`.
|
|
120
|
+
|
|
121
|
+
### `TrustRegistryQueryFn`
|
|
122
|
+
|
|
123
|
+
```ts
|
|
124
|
+
type TrustRegistryQueryFn = (params: {
|
|
125
|
+
entityId: string;
|
|
126
|
+
action?: string;
|
|
127
|
+
resource?: string;
|
|
128
|
+
}) => Promise<TrqpAuthorizationResponse>;
|
|
129
|
+
```
|
|
130
|
+
|
|
92
131
|
## Types
|
|
93
132
|
|
|
94
133
|
Types are provided by the shared `c2pa-react-component-types` package, which is installed automatically as a dependency.
|
|
@@ -102,6 +141,8 @@ import type {
|
|
|
102
141
|
} from "c2pa-react-component-types";
|
|
103
142
|
```
|
|
104
143
|
|
|
144
|
+
This package also exports its own TRQP-related types — see [Trust registry (TRQP)](#trust-registry-trqp) above.
|
|
145
|
+
|
|
105
146
|
## Local development
|
|
106
147
|
|
|
107
148
|
Use [yalc](https://github.com/wclr/yalc) to consume the library in another local project without publishing to npm.
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
.cawg-card{background:#fff;border-radius:12px;width:95%;padding:16px;display:inline-block;box-shadow:0 4px 20px #00000014}.cawg-container{align-items:center;gap:16px;display:flex}.cawg-square{background-color:gold;border-radius:4px;flex-shrink:0;justify-content:center;align-items:center;width:48px;height:48px;display:flex}.cawg-logo-text{color:#000;letter-spacing:-.5px;font-size:18px;font-weight:700}.cawg-media-title{color:#333;letter-spacing:-.3px;font-size:20px;font-weight:600}.cawg-claim-generator{color:#666;font-size:14px}.cawg-thumbnail{object-fit:cover;border-radius:4px;width:48px;height:48px}.cawg-button{color:#666;cursor:pointer;background:#fff;border:2px solid #666;border-radius:999px;width:100%;height:42px;font-size:16px;font-weight:700;transition:background-color .16s,border-color .16s,color .16s,box-shadow .16s}.cawg-button:hover{color:#fff;background:#111;border-color:#111;box-shadow:0 4px 12px #00000024}.cawg-button:focus-visible{outline-offset:3px;outline:3px solid #11111140}.cawg-section-title{color:#333;margin-bottom:6px;font-size:16px;font-weight:600}.cawg-key-value{margin-top:16px}.cawg-key-value-label{color:#64748b;text-transform:uppercase;letter-spacing:.025em;margin-bottom:4px;font-size:14px;font-weight:600}.cawg-key-value-value{color:#1e293b;word-break:break-word;overflow-wrap:break-word;font-size:16px;line-height:1.5}.cawg-divider{background:#e2e8f0;height:1px;margin:16px 0}.cawg-roles{flex-wrap:wrap;gap:6px;margin-top:12px;display:flex}.cawg-role-badge{color:#475569;letter-spacing:.02em;background:#f0f4f8;border:1px solid #cbd5e1;border-radius:999px;align-items:center;padding:2px 10px;font-size:12px;font-weight:600;display:inline-flex}.cawg-identity-list{flex-direction:column;gap:8px;margin-top:10px;display:flex}.cawg-identity-item{background:#f8fafc;border:1px solid #e2e8f0;border-radius:8px;align-items:flex-start;padding:10px 12px;display:flex}.cawg-identity-type-label{color:#64748b;text-transform:uppercase;letter-spacing:.06em;margin-bottom:2px;font-size:11px;font-weight:700}.cawg-identity-name{color:#1e293b;font-size:14px;font-weight:600}.cawg-identity-provider{color:#64748b;margin-top:1px;font-size:13px}.cawg-identity-link{color:#3b82f6;word-break:break-all;margin-top:2px;font-size:12px;text-decoration:none;display:block}.cawg-identity-link:hover{text-decoration:underline}.cawg-identity-meta{color:#94a3b8;margin-top:3px;font-size:11px}.cawg-training-list{flex-direction:column;gap:6px;margin-top:10px;display:flex}.cawg-training-item{background:#f8fafc;border:1px solid #e2e8f0;border-radius:8px;justify-content:space-between;align-items:flex-start;gap:8px;padding:8px 12px;display:flex}.cawg-training-label{color:#374151;font-size:13px;font-weight:500}.cawg-constraint-info{color:#92400e;margin-top:3px;font-size:12px;font-style:italic}.cawg-use-badge{letter-spacing:.04em;text-transform:uppercase;border-radius:999px;flex-shrink:0;padding:2px 8px;font-size:11px;font-weight:700}.cawg-use-allowed{color:#166534;background:#dcfce7}.cawg-use-not-allowed{color:#991b1b;background:#fee2e2}.cawg-use-constrained{color:#854d0e;background:#fef9c3}
|
|
1
|
+
.cawg-card{background:#fff;border-radius:12px;width:95%;padding:16px;display:inline-block;box-shadow:0 4px 20px #00000014}.cawg-container{align-items:center;gap:16px;display:flex}.cawg-square{background-color:gold;border-radius:4px;flex-shrink:0;justify-content:center;align-items:center;width:48px;height:48px;display:flex}.cawg-logo-text{color:#000;letter-spacing:-.5px;font-size:18px;font-weight:700}.cawg-media-title{color:#333;letter-spacing:-.3px;font-size:20px;font-weight:600}.cawg-claim-generator,.cawg-creators-name{color:#666;font-size:14px}.cawg-thumbnail{object-fit:cover;border-radius:4px;width:48px;height:48px}.cawg-button{color:#666;cursor:pointer;background:#fff;border:2px solid #666;border-radius:999px;width:100%;height:42px;font-size:16px;font-weight:700;transition:background-color .16s,border-color .16s,color .16s,box-shadow .16s}.cawg-button:hover{color:#fff;background:#111;border-color:#111;box-shadow:0 4px 12px #00000024}.cawg-button:focus-visible{outline-offset:3px;outline:3px solid #11111140}.cawg-section-title{color:#333;margin-bottom:6px;font-size:16px;font-weight:600}.cawg-key-value{margin-top:16px}.cawg-key-value-label{color:#64748b;text-transform:uppercase;letter-spacing:.025em;margin-bottom:4px;font-size:14px;font-weight:600}.cawg-key-value-value{color:#1e293b;word-break:break-word;overflow-wrap:break-word;font-size:16px;line-height:1.5}.cawg-divider{background:#e2e8f0;height:1px;margin:16px 0}.cawg-roles{flex-wrap:wrap;gap:6px;margin-top:12px;display:flex}.cawg-role-badge{color:#475569;letter-spacing:.02em;background:#f0f4f8;border:1px solid #cbd5e1;border-radius:999px;align-items:center;padding:2px 10px;font-size:12px;font-weight:600;display:inline-flex}.cawg-identity-list{flex-direction:column;gap:8px;margin-top:10px;display:flex}.cawg-identity-item{background:#f8fafc;border:1px solid #e2e8f0;border-radius:8px;align-items:flex-start;padding:10px 12px;display:flex}.cawg-identity-type-label{color:#64748b;text-transform:uppercase;letter-spacing:.06em;margin-bottom:2px;font-size:11px;font-weight:700}.cawg-identity-name{color:#1e293b;font-size:14px;font-weight:600}.cawg-identity-provider{color:#64748b;margin-top:1px;font-size:13px}.cawg-identity-link{color:#3b82f6;word-break:break-all;margin-top:2px;font-size:12px;text-decoration:none;display:block}.cawg-identity-link:hover{text-decoration:underline}.cawg-identity-meta{color:#94a3b8;margin-top:3px;font-size:11px}.cawg-training-list{flex-direction:column;gap:6px;margin-top:10px;display:flex}.cawg-training-item{background:#f8fafc;border:1px solid #e2e8f0;border-radius:8px;justify-content:space-between;align-items:flex-start;gap:8px;padding:8px 12px;display:flex}.cawg-training-label{color:#374151;font-size:13px;font-weight:500}.cawg-constraint-info{color:#92400e;margin-top:3px;font-size:12px;font-style:italic}.cawg-use-badge{letter-spacing:.04em;text-transform:uppercase;border-radius:999px;flex-shrink:0;padding:2px 8px;font-size:11px;font-weight:700}.cawg-use-allowed{color:#166534;background:#dcfce7}.cawg-use-not-allowed{color:#991b1b;background:#fee2e2}.cawg-use-constrained{color:#854d0e;background:#fef9c3}.cawg-trust-status{margin-top:4px}.cawg-trust-badge{letter-spacing:.04em;text-transform:uppercase;white-space:nowrap;border-radius:999px;align-items:center;padding:2px 10px;font-size:11px;font-weight:700;display:inline-flex}.cawg-trust-pending{color:#64748b;background:#f1f5f9}.cawg-trust-verified{color:#166534;background:#dcfce7}.cawg-trust-unverified{color:#991b1b;background:#fee2e2}.cawg-trust-meta{color:#94a3b8;margin-top:4px;font-size:12px}.cawg-trust-message{color:#991b1b;margin-top:4px;font-size:12px}
|
|
2
2
|
/*$vite$:1*/
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import e from "react";
|
|
2
|
-
import { Fragment as
|
|
1
|
+
import e, { useEffect as t, useState as n } from "react";
|
|
2
|
+
import { Fragment as r, jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
3
3
|
//#region src/components/Cawg/CAWG_Header.tsx
|
|
4
|
-
var
|
|
4
|
+
var o = "<svg width=\"34\" height=\"34\" viewBox=\"0 0 34 34\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<g clip-path=\"url(#clip0_17170_59571)\">\n<path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M12.8875 2.20138C12.9985 0.955258 14.0434 0 15.2937 0H18.7065C19.9567 0 21.0017 0.955258 21.1127 2.20138L21.3059 4.36814C21.85 4.55372 22.3784 4.77304 22.8882 5.02387L24.555 3.62851C25.5149 2.8265 26.9306 2.88955 27.8143 3.77319L30.227 6.18588L30.2287 6.18758C31.1092 7.07235 31.1751 8.48356 30.3723 9.44443L28.9769 11.1112C29.2286 11.6219 29.4473 12.1506 29.6323 12.6944L31.7987 12.8875C33.0448 12.9984 34.0002 14.0434 34.0002 15.2937V18.7065C34.0002 19.9568 33.0448 21.0018 31.7987 21.1127L29.632 21.3059C29.4464 21.85 29.2271 22.3784 28.9763 22.8882L30.3717 24.555C31.1737 25.5149 31.1106 26.9307 30.227 27.8143L27.8143 30.227L27.8126 30.2287C26.9278 31.1092 25.5166 31.1751 24.5557 30.3723L22.889 28.9769C22.3782 29.2286 21.8496 29.4473 21.3058 29.6323L21.1127 31.7987C21.0017 33.0448 19.9567 34.0002 18.7065 34.0002H15.2937C14.0434 34.0002 12.9985 33.0449 12.8875 31.7988L12.6943 29.632C12.1502 29.4465 11.6218 29.2271 11.1119 28.9763L9.44515 30.3717C8.48529 31.1737 7.06951 31.1106 6.18588 30.227L3.77319 27.8143L3.77149 27.8126C2.89097 26.9278 2.82504 25.5166 3.6279 24.5557L5.02323 22.889C4.77158 22.3783 4.55287 21.8496 4.36784 21.3058L2.20148 21.1127C0.95531 21.0018 0 19.9568 0 18.7065V15.2937C0 14.0434 0.95531 12.9984 2.20148 12.8875L4.36814 12.6943C4.55372 12.1502 4.77304 11.6218 5.02387 11.112L3.62851 9.44515C2.8265 8.48529 2.88955 7.06952 3.77319 6.18588L6.18588 3.77319L6.18758 3.77149C7.07235 2.89097 8.48356 2.82504 9.44443 3.6279L11.1112 5.02323C11.6219 4.77158 12.1506 4.55288 12.6943 4.36784L12.8875 2.20138ZM15.2937 2.00016C15.0789 2.00016 14.8988 2.16494 14.8797 2.37888L14.6272 5.2117L14.5661 5.89685L13.9044 6.08489C13.0453 6.32903 12.2307 6.66675 11.4733 7.09234L10.8711 7.43075L10.3414 6.98733L8.16195 5.16279C7.99794 5.02598 7.75432 5.03471 7.59907 5.18865L5.18751 7.6002C5.03615 7.75156 5.02474 7.99645 5.16256 8.16168L6.98732 10.3414L7.42966 10.8698L7.09346 11.4713C6.66869 12.2313 6.32859 13.0469 6.08489 13.9045L5.89685 14.5661L5.2117 14.6272L2.37898 14.8797C2.16503 14.8988 2.00016 15.0789 2.00016 15.2937V18.7065C2.00016 18.9213 2.16493 19.1014 2.37888 19.1205L5.2117 19.373L5.89685 19.4341L6.08489 20.0957C6.32903 20.9548 6.66674 21.7695 7.09234 22.5269L7.43074 23.1291L6.98732 23.6588L5.16279 25.8382C5.02613 26.0022 5.03474 26.2457 5.18849 26.401L5.18921 26.4017L7.6002 28.8127C7.75162 28.9641 7.99664 28.9754 8.16187 28.8375L10.3414 27.0129L10.8698 26.5705L11.4713 26.9067C12.2313 27.3315 13.0469 27.6716 13.9044 27.9153L14.5661 28.1033L14.6272 28.7885L14.8797 31.6212C14.8988 31.8351 15.0789 32 15.2937 32H18.7065C18.9213 32 19.1014 31.8352 19.1204 31.6213L19.373 28.7885L19.434 28.1033L20.0957 27.9153C20.9548 27.6711 21.7695 27.3334 22.5269 26.9078L23.1291 26.5694L23.6588 27.0129L25.8382 28.8374C26.0022 28.9744 26.2458 28.9656 26.4011 28.8115L28.8126 26.4C28.964 26.2486 28.9754 26.0037 28.8376 25.8385L27.0128 23.6588L26.5705 23.1304L26.9067 22.5289C27.3315 21.7689 27.6716 20.9533 27.9153 20.0957L28.1033 19.4341L28.7885 19.373L31.6212 19.1205C31.8351 19.1014 32 18.9213 32 18.7065V15.2937C32 15.0789 31.8352 14.8988 31.6213 14.8797L28.7885 14.6272L28.1033 14.5661L27.9153 13.9045C27.6711 13.0454 27.3334 12.2307 26.9078 11.4733L26.5694 10.8711L27.0128 10.3414L28.8374 8.16195C28.9745 7.99789 28.9655 7.75428 28.8114 7.59895L26.4 5.18751C26.2485 5.03607 26.0034 5.02473 25.8382 5.16279L23.6588 6.98733L23.1304 7.42966L22.5289 7.09347C21.7689 6.66869 20.9533 6.3286 20.0957 6.08489L19.434 5.89685L19.373 5.2117L19.1204 2.37898C19.1014 2.16504 18.9213 2.00016 18.7065 2.00016H15.2937ZM12.1524 16.874C11.9997 17.8144 12.6384 18.7006 13.5788 18.8532C14.5193 19.0059 15.4054 18.3672 15.5581 17.4268C15.7108 16.4863 15.0721 15.6002 14.1317 15.4475C13.1912 15.2949 12.3051 15.9335 12.1524 16.874ZM13.2584 20.8275C11.2275 20.4979 9.84843 18.5843 10.1781 16.5535C10.5077 14.5226 12.4213 13.1436 14.4521 13.4732C16.483 13.8029 17.8621 15.7164 17.5324 17.7473C17.2028 19.7781 15.2892 21.1572 13.2584 20.8275ZM23.61 17.1489C23.61 18.104 22.8349 18.8791 21.8799 18.8791C20.9248 18.8791 20.1497 18.104 20.1497 17.1489C20.1497 16.1939 20.9248 15.4188 21.8799 15.4188C22.8349 15.4188 23.61 16.1939 23.61 17.1489Z\" fill=\"black\"/>\n</g>\n<defs>\n<clipPath id=\"clip0_17170_59571\">\n<rect width=\"34\" height=\"34\" fill=\"black\"/>\n</clipPath>\n</defs>\n</svg>", s = () => /* @__PURE__ */ a("div", {
|
|
5
5
|
style: {
|
|
6
6
|
display: "flex",
|
|
7
7
|
alignItems: "center",
|
|
8
8
|
gap: "8px",
|
|
9
9
|
marginBottom: "16px"
|
|
10
10
|
},
|
|
11
|
-
children: [/* @__PURE__ */
|
|
12
|
-
dangerouslySetInnerHTML: { __html:
|
|
11
|
+
children: [/* @__PURE__ */ i("div", {
|
|
12
|
+
dangerouslySetInnerHTML: { __html: o },
|
|
13
13
|
style: {
|
|
14
14
|
width: "24px",
|
|
15
15
|
height: "24px",
|
|
16
16
|
display: "flex",
|
|
17
17
|
alignItems: "center"
|
|
18
18
|
}
|
|
19
|
-
}), /* @__PURE__ */
|
|
19
|
+
}), /* @__PURE__ */ i("span", {
|
|
20
20
|
style: {
|
|
21
21
|
fontSize: "14px",
|
|
22
22
|
fontWeight: 600,
|
|
@@ -26,7 +26,19 @@ var i = "<svg width=\"34\" height=\"34\" viewBox=\"0 0 34 34\" fill=\"none\" xml
|
|
|
26
26
|
},
|
|
27
27
|
children: "Creator Assertions Working Group"
|
|
28
28
|
})]
|
|
29
|
-
}),
|
|
29
|
+
}), c = (e) => {
|
|
30
|
+
switch (e) {
|
|
31
|
+
case "cawg.document_verification": return 0;
|
|
32
|
+
case "cawg.social_media": return 10;
|
|
33
|
+
case "cawg.web_site": return 20;
|
|
34
|
+
case "cawg.affiliation": return 1e6;
|
|
35
|
+
default: return 1e5;
|
|
36
|
+
}
|
|
37
|
+
}, l = ["cawg.affiliation"], u = (e) => {
|
|
38
|
+
if (typeof e == "object" && !Array.isArray(e) && (e = [e]), !e || e.length === 0) return "Unknown";
|
|
39
|
+
let t = e.sort((e, t) => c(e.type) - c(t.type))[0];
|
|
40
|
+
return !t || l.includes(t.type) ? "Unknown" : t.name;
|
|
41
|
+
}, d = {
|
|
30
42
|
"cawg.creator": "Creator",
|
|
31
43
|
"cawg.contributor": "Contributor",
|
|
32
44
|
"cawg.editor": "Editor",
|
|
@@ -35,49 +47,49 @@ var i = "<svg width=\"34\" height=\"34\" viewBox=\"0 0 34 34\" fill=\"none\" xml
|
|
|
35
47
|
"cawg.sponsor": "Sponsor",
|
|
36
48
|
"cawg.translator": "Translator"
|
|
37
49
|
};
|
|
38
|
-
function
|
|
39
|
-
let
|
|
40
|
-
return /* @__PURE__ */
|
|
50
|
+
function f({ className: e, manifest: t, moreInfo: n }) {
|
|
51
|
+
let r = t.title, o = t.claimGenerator ?? t.claimGeneratorInfo?.[0]?.name ?? "Unknown", c = u(t.assertions?.["cawg.identity"]?.verifiedIdentities), l = o.split(" ").filter(Boolean).map((e) => e[0].toUpperCase()).join("") || "?", f = (t.assertions?.["cawg.identity"])?.signer_payload?.role ?? [];
|
|
52
|
+
return /* @__PURE__ */ a("div", {
|
|
41
53
|
className: `cawg-card ${e ?? ""}`,
|
|
42
54
|
children: [
|
|
43
|
-
/* @__PURE__ */
|
|
44
|
-
/* @__PURE__ */
|
|
55
|
+
/* @__PURE__ */ i(s, {}),
|
|
56
|
+
/* @__PURE__ */ a("div", {
|
|
45
57
|
className: "cawg-container",
|
|
46
|
-
children: [t.thumbnail ? /* @__PURE__ */
|
|
58
|
+
children: [t.thumbnail ? /* @__PURE__ */ i("img", {
|
|
47
59
|
src: t.thumbnail,
|
|
48
60
|
alt: "Thumbnail",
|
|
49
61
|
className: "cawg-thumbnail"
|
|
50
|
-
}) : /* @__PURE__ */
|
|
62
|
+
}) : /* @__PURE__ */ i("div", {
|
|
51
63
|
className: "cawg-square",
|
|
52
|
-
children: /* @__PURE__ */
|
|
64
|
+
children: /* @__PURE__ */ i("span", {
|
|
53
65
|
className: "cawg-logo-text",
|
|
54
66
|
children: l
|
|
55
67
|
})
|
|
56
|
-
}), /* @__PURE__ */
|
|
68
|
+
}), /* @__PURE__ */ a("div", {
|
|
57
69
|
style: {
|
|
58
70
|
display: "flex",
|
|
59
71
|
flexDirection: "column"
|
|
60
72
|
},
|
|
61
|
-
children: [/* @__PURE__ */
|
|
73
|
+
children: [/* @__PURE__ */ i("span", {
|
|
62
74
|
className: "cawg-media-title",
|
|
63
|
-
children:
|
|
64
|
-
}), /* @__PURE__ */
|
|
65
|
-
className: "cawg-
|
|
75
|
+
children: r
|
|
76
|
+
}), /* @__PURE__ */ i("span", {
|
|
77
|
+
className: "cawg-creators-name",
|
|
66
78
|
children: c
|
|
67
79
|
})]
|
|
68
80
|
})]
|
|
69
81
|
}),
|
|
70
|
-
|
|
82
|
+
f.length > 0 && /* @__PURE__ */ i("div", {
|
|
71
83
|
className: "cawg-roles",
|
|
72
|
-
children:
|
|
84
|
+
children: f.map((e) => /* @__PURE__ */ i("span", {
|
|
73
85
|
className: "cawg-role-badge",
|
|
74
|
-
children:
|
|
86
|
+
children: d[e] ?? e
|
|
75
87
|
}, e))
|
|
76
88
|
}),
|
|
77
|
-
|
|
89
|
+
n && /* @__PURE__ */ i("div", {
|
|
78
90
|
style: { marginTop: 16 },
|
|
79
|
-
children: /* @__PURE__ */
|
|
80
|
-
onClick:
|
|
91
|
+
children: /* @__PURE__ */ i("button", {
|
|
92
|
+
onClick: n,
|
|
81
93
|
className: "cawg-button",
|
|
82
94
|
children: "More Info"
|
|
83
95
|
})
|
|
@@ -86,8 +98,96 @@ function s({ className: e, manifest: t, moreInfo: i }) {
|
|
|
86
98
|
});
|
|
87
99
|
}
|
|
88
100
|
//#endregion
|
|
101
|
+
//#region src/components/Cawg/helper/trqp.ts
|
|
102
|
+
async function p() {
|
|
103
|
+
throw Error("No trust registry query function configured. Call `setTrustRegistryQueryFn` (or pass a `queryFn` prop to TrustBadge) with a function that queries a real TRQP endpoint.");
|
|
104
|
+
}
|
|
105
|
+
var m = p;
|
|
106
|
+
function h(e) {
|
|
107
|
+
m = e;
|
|
108
|
+
}
|
|
109
|
+
function g() {
|
|
110
|
+
return m;
|
|
111
|
+
}
|
|
112
|
+
function _(e, r, i, a = g()) {
|
|
113
|
+
let [o, s] = n("idle"), [c, l] = n(null), [u, d] = n(null);
|
|
114
|
+
return t(() => {
|
|
115
|
+
if (!e) {
|
|
116
|
+
s("idle"), l(null), d(null);
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
let t = !1;
|
|
120
|
+
return s("loading"), d(null), a({
|
|
121
|
+
entityId: e,
|
|
122
|
+
action: r,
|
|
123
|
+
resource: i
|
|
124
|
+
}).then((e) => {
|
|
125
|
+
t || (l(e), s("done"));
|
|
126
|
+
}, (e) => {
|
|
127
|
+
t || (l(null), d(e instanceof Error ? e : Error(String(e))), s("error"));
|
|
128
|
+
}), () => {
|
|
129
|
+
t = !0;
|
|
130
|
+
};
|
|
131
|
+
}, [
|
|
132
|
+
e,
|
|
133
|
+
r,
|
|
134
|
+
i,
|
|
135
|
+
a
|
|
136
|
+
]), {
|
|
137
|
+
status: o,
|
|
138
|
+
result: c,
|
|
139
|
+
error: u
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
//#endregion
|
|
143
|
+
//#region src/components/Cawg/helper/TrustBadge.tsx
|
|
144
|
+
function v(e) {
|
|
145
|
+
try {
|
|
146
|
+
return new Date(e).toLocaleDateString(void 0, {
|
|
147
|
+
year: "numeric",
|
|
148
|
+
month: "long",
|
|
149
|
+
day: "numeric"
|
|
150
|
+
});
|
|
151
|
+
} catch {
|
|
152
|
+
return e;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
var y = "Identity Verified by Trust Registry", b = "Identity Unable to be Verified by Trust Registry";
|
|
156
|
+
function x({ entityId: e, action: t, resource: n, variant: r = "full", queryFn: o }) {
|
|
157
|
+
let { status: s, result: c, error: l } = _(e, t, n, o);
|
|
158
|
+
if (!e) return null;
|
|
159
|
+
if (s === "error") return /* @__PURE__ */ i("span", {
|
|
160
|
+
className: "cawg-trust-badge cawg-trust-unverified",
|
|
161
|
+
title: l?.message,
|
|
162
|
+
children: "Unable to reach trust registry"
|
|
163
|
+
});
|
|
164
|
+
if (s !== "done" || !c) return /* @__PURE__ */ i("span", {
|
|
165
|
+
className: "cawg-trust-badge cawg-trust-pending",
|
|
166
|
+
children: "Checking trust registry…"
|
|
167
|
+
});
|
|
168
|
+
let u = /* @__PURE__ */ i("span", {
|
|
169
|
+
className: c.authorized ? "cawg-trust-badge cawg-trust-verified" : "cawg-trust-badge cawg-trust-unverified",
|
|
170
|
+
title: c.authorized ? `Recognized by ${c.authority_id} · checked ${v(c.time_evaluated)}` : c.message,
|
|
171
|
+
children: c.authorized ? y : b
|
|
172
|
+
});
|
|
173
|
+
return r === "compact" ? u : /* @__PURE__ */ a("div", {
|
|
174
|
+
className: "cawg-trust-status",
|
|
175
|
+
children: [u, c.authorized ? /* @__PURE__ */ a("div", {
|
|
176
|
+
className: "cawg-trust-meta",
|
|
177
|
+
children: [
|
|
178
|
+
c.authority_id,
|
|
179
|
+
" · checked ",
|
|
180
|
+
v(c.time_evaluated)
|
|
181
|
+
]
|
|
182
|
+
}) : c.message && /* @__PURE__ */ i("div", {
|
|
183
|
+
className: "cawg-trust-message",
|
|
184
|
+
children: c.message
|
|
185
|
+
})]
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
//#endregion
|
|
89
189
|
//#region src/components/Cawg/levels/L2/CAWGL2.tsx
|
|
90
|
-
var
|
|
190
|
+
var S = {
|
|
91
191
|
"cawg.creator": "Creator",
|
|
92
192
|
"cawg.contributor": "Contributor",
|
|
93
193
|
"cawg.editor": "Editor",
|
|
@@ -95,89 +195,114 @@ var c = {
|
|
|
95
195
|
"cawg.publisher": "Publisher",
|
|
96
196
|
"cawg.sponsor": "Sponsor",
|
|
97
197
|
"cawg.translator": "Translator"
|
|
98
|
-
},
|
|
198
|
+
}, C = {
|
|
99
199
|
"cawg.document_verification": "ID Verified",
|
|
100
200
|
"cawg.web_site": "Website",
|
|
101
201
|
"cawg.affiliation": "Affiliation",
|
|
102
202
|
"cawg.social_media": "Social Media",
|
|
103
203
|
"cawg.crypto_wallet": "Crypto Wallet"
|
|
104
|
-
},
|
|
204
|
+
}, w = {
|
|
105
205
|
"cawg.data_mining": "Data Mining",
|
|
106
206
|
"cawg.ai_inference": "AI Inference",
|
|
107
207
|
"cawg.ai_training": "AI Training",
|
|
108
208
|
"cawg.ai_generative_training": "AI Generative Training"
|
|
109
|
-
},
|
|
209
|
+
}, T = {
|
|
110
210
|
allowed: "cawg-use-badge cawg-use-allowed",
|
|
111
211
|
notAllowed: "cawg-use-badge cawg-use-not-allowed",
|
|
112
212
|
constrained: "cawg-use-badge cawg-use-constrained"
|
|
113
|
-
},
|
|
213
|
+
}, E = {
|
|
114
214
|
allowed: "Allowed",
|
|
115
215
|
notAllowed: "Not Allowed",
|
|
116
216
|
constrained: "Constrained"
|
|
117
217
|
};
|
|
118
|
-
function
|
|
119
|
-
|
|
120
|
-
|
|
218
|
+
function D(e) {
|
|
219
|
+
try {
|
|
220
|
+
return new Date(e).toLocaleDateString(void 0, {
|
|
221
|
+
year: "numeric",
|
|
222
|
+
month: "long",
|
|
223
|
+
day: "numeric"
|
|
224
|
+
});
|
|
225
|
+
} catch {
|
|
226
|
+
return e;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
function O(e) {
|
|
230
|
+
return Array.isArray(e) ? e.filter((e) => typeof e == "string").join(", ") : typeof e == "string" ? e : "";
|
|
231
|
+
}
|
|
232
|
+
function k({ className: e, manifest: t, moreInfo: n }) {
|
|
233
|
+
let o = t.title, c = (t.claimGenerator ?? t.claimGeneratorInfo?.[0]?.name ?? "Unknown").split(" ").filter(Boolean).map((e) => e[0].toUpperCase()).join("") || "?", l = u(t.assertions?.["cawg.identity"]?.verifiedIdentities), d = t.assertions?.["cawg.identity"], f = d?.signer_payload?.role ?? [], p = d?.verifiedIdentities ?? [], m = d?.issuer, h = t.assertions?.["cawg.training-mining"]?.entries ?? {}, g = t.assertions?.["cawg.metadata"], _ = O(g?.["dc:creator"]), v = g?.["xmp:CreateDate"];
|
|
234
|
+
return /* @__PURE__ */ a("div", {
|
|
121
235
|
className: `cawg-card ${e ?? ""}`,
|
|
122
236
|
children: [
|
|
123
|
-
/* @__PURE__ */
|
|
124
|
-
/* @__PURE__ */
|
|
237
|
+
/* @__PURE__ */ i(s, {}),
|
|
238
|
+
/* @__PURE__ */ a("div", {
|
|
125
239
|
className: "cawg-container",
|
|
126
|
-
children: [
|
|
127
|
-
src:
|
|
240
|
+
children: [t.thumbnail ? /* @__PURE__ */ i("img", {
|
|
241
|
+
src: t.thumbnail,
|
|
128
242
|
alt: "Thumbnail",
|
|
129
243
|
className: "cawg-thumbnail"
|
|
130
|
-
}) : /* @__PURE__ */
|
|
244
|
+
}) : /* @__PURE__ */ i("div", {
|
|
131
245
|
className: "cawg-square",
|
|
132
|
-
children: /* @__PURE__ */
|
|
246
|
+
children: /* @__PURE__ */ i("span", {
|
|
133
247
|
className: "cawg-logo-text",
|
|
134
|
-
children:
|
|
248
|
+
children: c
|
|
135
249
|
})
|
|
136
|
-
}), /* @__PURE__ */
|
|
250
|
+
}), /* @__PURE__ */ a("div", {
|
|
137
251
|
style: {
|
|
138
252
|
display: "flex",
|
|
139
253
|
flexDirection: "column"
|
|
140
254
|
},
|
|
141
|
-
children: [/* @__PURE__ */
|
|
255
|
+
children: [/* @__PURE__ */ i("span", {
|
|
142
256
|
className: "cawg-media-title",
|
|
143
|
-
children:
|
|
144
|
-
}), /* @__PURE__ */
|
|
145
|
-
className: "cawg-
|
|
146
|
-
children:
|
|
257
|
+
children: o
|
|
258
|
+
}), /* @__PURE__ */ i("span", {
|
|
259
|
+
className: "cawg-creators-name",
|
|
260
|
+
children: l
|
|
147
261
|
})]
|
|
148
262
|
})]
|
|
149
263
|
}),
|
|
150
|
-
|
|
264
|
+
f.length > 0 && /* @__PURE__ */ i("div", {
|
|
151
265
|
className: "cawg-roles",
|
|
152
|
-
children:
|
|
266
|
+
children: f.map((e) => /* @__PURE__ */ i("span", {
|
|
153
267
|
className: "cawg-role-badge",
|
|
154
|
-
children:
|
|
268
|
+
children: S[e] ?? e
|
|
155
269
|
}, e))
|
|
156
270
|
}),
|
|
157
|
-
|
|
158
|
-
/* @__PURE__ */
|
|
159
|
-
/* @__PURE__ */
|
|
271
|
+
p.length > 0 && /* @__PURE__ */ a(r, { children: [
|
|
272
|
+
/* @__PURE__ */ i("div", { className: "cawg-divider" }),
|
|
273
|
+
/* @__PURE__ */ a("div", {
|
|
160
274
|
className: "cawg-section-title",
|
|
161
|
-
|
|
275
|
+
style: {
|
|
276
|
+
display: "flex",
|
|
277
|
+
alignItems: "center",
|
|
278
|
+
justifyContent: "space-between",
|
|
279
|
+
gap: 8
|
|
280
|
+
},
|
|
281
|
+
children: [/* @__PURE__ */ i("span", { children: "Identity" }), /* @__PURE__ */ i(x, {
|
|
282
|
+
entityId: m,
|
|
283
|
+
action: "issue",
|
|
284
|
+
resource: "cawg.identity",
|
|
285
|
+
variant: "compact"
|
|
286
|
+
})]
|
|
162
287
|
}),
|
|
163
|
-
/* @__PURE__ */
|
|
288
|
+
/* @__PURE__ */ i("div", {
|
|
164
289
|
className: "cawg-identity-list",
|
|
165
|
-
children:
|
|
166
|
-
let
|
|
167
|
-
return /* @__PURE__ */
|
|
290
|
+
children: p.map((e, t) => {
|
|
291
|
+
let n = e.type, r = e.name ?? e.username, o = e.provider;
|
|
292
|
+
return /* @__PURE__ */ i("div", {
|
|
168
293
|
className: "cawg-identity-item",
|
|
169
|
-
children: /* @__PURE__ */
|
|
294
|
+
children: /* @__PURE__ */ a("div", {
|
|
170
295
|
style: { flex: 1 },
|
|
171
296
|
children: [
|
|
172
|
-
/* @__PURE__ */
|
|
297
|
+
/* @__PURE__ */ i("div", {
|
|
173
298
|
className: "cawg-identity-type-label",
|
|
174
|
-
children:
|
|
299
|
+
children: C[n] ?? n
|
|
175
300
|
}),
|
|
176
|
-
|
|
301
|
+
r && /* @__PURE__ */ i("div", {
|
|
177
302
|
className: "cawg-identity-name",
|
|
178
|
-
children:
|
|
303
|
+
children: r
|
|
179
304
|
}),
|
|
180
|
-
o?.name && /* @__PURE__ */
|
|
305
|
+
o?.name && /* @__PURE__ */ i("div", {
|
|
181
306
|
className: "cawg-identity-provider",
|
|
182
307
|
children: o.name
|
|
183
308
|
})
|
|
@@ -187,30 +312,57 @@ function p({ className: e, manifest: i, moreInfo: o }) {
|
|
|
187
312
|
})
|
|
188
313
|
})
|
|
189
314
|
] }),
|
|
190
|
-
Object.keys(
|
|
191
|
-
/* @__PURE__ */
|
|
192
|
-
/* @__PURE__ */
|
|
315
|
+
Object.keys(h).length > 0 && /* @__PURE__ */ a(r, { children: [
|
|
316
|
+
/* @__PURE__ */ i("div", { className: "cawg-divider" }),
|
|
317
|
+
/* @__PURE__ */ i("div", {
|
|
193
318
|
className: "cawg-section-title",
|
|
194
319
|
children: "Training & Data Mining"
|
|
195
320
|
}),
|
|
196
|
-
/* @__PURE__ */
|
|
321
|
+
/* @__PURE__ */ i("div", {
|
|
197
322
|
className: "cawg-training-list",
|
|
198
|
-
children: Object.entries(
|
|
323
|
+
children: Object.entries(h).map(([e, t]) => /* @__PURE__ */ a("div", {
|
|
199
324
|
className: "cawg-training-item",
|
|
200
|
-
children: [/* @__PURE__ */
|
|
325
|
+
children: [/* @__PURE__ */ i("span", {
|
|
201
326
|
className: "cawg-training-label",
|
|
202
|
-
children:
|
|
203
|
-
}), /* @__PURE__ */
|
|
204
|
-
className:
|
|
205
|
-
children:
|
|
327
|
+
children: w[e] ?? e
|
|
328
|
+
}), /* @__PURE__ */ i("span", {
|
|
329
|
+
className: T[t.use] ?? "cawg-use-badge",
|
|
330
|
+
children: E[t.use] ?? t.use
|
|
206
331
|
})]
|
|
207
332
|
}, e))
|
|
208
333
|
})
|
|
209
334
|
] }),
|
|
210
|
-
|
|
335
|
+
(_ || v) && /* @__PURE__ */ a(r, { children: [
|
|
336
|
+
/* @__PURE__ */ i("div", { className: "cawg-divider" }),
|
|
337
|
+
/* @__PURE__ */ i("div", {
|
|
338
|
+
className: "cawg-section-title",
|
|
339
|
+
children: "Creator"
|
|
340
|
+
}),
|
|
341
|
+
_ && /* @__PURE__ */ a("div", {
|
|
342
|
+
className: "cawg-key-value",
|
|
343
|
+
children: [/* @__PURE__ */ i("div", {
|
|
344
|
+
className: "cawg-key-value-label",
|
|
345
|
+
children: "Name"
|
|
346
|
+
}), /* @__PURE__ */ i("div", {
|
|
347
|
+
className: "cawg-key-value-value",
|
|
348
|
+
children: _
|
|
349
|
+
})]
|
|
350
|
+
}),
|
|
351
|
+
v && /* @__PURE__ */ a("div", {
|
|
352
|
+
className: "cawg-key-value",
|
|
353
|
+
children: [/* @__PURE__ */ i("div", {
|
|
354
|
+
className: "cawg-key-value-label",
|
|
355
|
+
children: "Date Created"
|
|
356
|
+
}), /* @__PURE__ */ i("div", {
|
|
357
|
+
className: "cawg-key-value-value",
|
|
358
|
+
children: D(v)
|
|
359
|
+
})]
|
|
360
|
+
})
|
|
361
|
+
] }),
|
|
362
|
+
n && /* @__PURE__ */ i("div", {
|
|
211
363
|
style: { marginTop: 16 },
|
|
212
|
-
children: /* @__PURE__ */
|
|
213
|
-
onClick:
|
|
364
|
+
children: /* @__PURE__ */ i("button", {
|
|
365
|
+
onClick: n,
|
|
214
366
|
className: "cawg-button",
|
|
215
367
|
children: "More Info"
|
|
216
368
|
})
|
|
@@ -220,7 +372,7 @@ function p({ className: e, manifest: i, moreInfo: o }) {
|
|
|
220
372
|
}
|
|
221
373
|
//#endregion
|
|
222
374
|
//#region src/components/Cawg/levels/L3/CAWGL3.tsx
|
|
223
|
-
var
|
|
375
|
+
var A = {
|
|
224
376
|
"cawg.creator": "Creator",
|
|
225
377
|
"cawg.contributor": "Contributor",
|
|
226
378
|
"cawg.editor": "Editor",
|
|
@@ -228,31 +380,31 @@ var m = {
|
|
|
228
380
|
"cawg.publisher": "Publisher",
|
|
229
381
|
"cawg.sponsor": "Sponsor",
|
|
230
382
|
"cawg.translator": "Translator"
|
|
231
|
-
},
|
|
383
|
+
}, j = {
|
|
232
384
|
"cawg.document_verification": "ID Verified",
|
|
233
385
|
"cawg.web_site": "Website",
|
|
234
386
|
"cawg.affiliation": "Affiliation",
|
|
235
387
|
"cawg.social_media": "Social Media",
|
|
236
388
|
"cawg.crypto_wallet": "Crypto Wallet"
|
|
237
|
-
},
|
|
389
|
+
}, M = {
|
|
238
390
|
"cawg.data_mining": "Data Mining",
|
|
239
391
|
"cawg.ai_inference": "AI Inference",
|
|
240
392
|
"cawg.ai_training": "AI Training",
|
|
241
393
|
"cawg.ai_generative_training": "AI Generative Training"
|
|
242
|
-
},
|
|
394
|
+
}, N = {
|
|
243
395
|
allowed: "cawg-use-badge cawg-use-allowed",
|
|
244
396
|
notAllowed: "cawg-use-badge cawg-use-not-allowed",
|
|
245
397
|
constrained: "cawg-use-badge cawg-use-constrained"
|
|
246
|
-
},
|
|
398
|
+
}, P = {
|
|
247
399
|
allowed: "Allowed",
|
|
248
400
|
notAllowed: "Not Allowed",
|
|
249
401
|
constrained: "Constrained"
|
|
250
|
-
},
|
|
402
|
+
}, F = {
|
|
251
403
|
"cawg.identity_claims_aggregation": "Identity Claims Aggregation",
|
|
252
404
|
"cawg.x509.cose": "X.509 Certificate",
|
|
253
405
|
"cawg.verifiable_credential_binding": "Verifiable Credential"
|
|
254
406
|
};
|
|
255
|
-
function
|
|
407
|
+
function I(e) {
|
|
256
408
|
try {
|
|
257
409
|
return new Date(e).toLocaleDateString(void 0, {
|
|
258
410
|
year: "numeric",
|
|
@@ -263,106 +415,118 @@ function b(e) {
|
|
|
263
415
|
return e;
|
|
264
416
|
}
|
|
265
417
|
}
|
|
266
|
-
function
|
|
267
|
-
return e == null ? "" : typeof e == "string" || typeof e == "number" || typeof e == "boolean" ? String(e) : Array.isArray(e) ? e.map((e) =>
|
|
418
|
+
function L(e) {
|
|
419
|
+
return e == null ? "" : typeof e == "string" || typeof e == "number" || typeof e == "boolean" ? String(e) : Array.isArray(e) ? e.map((e) => L(e)).filter(Boolean).join(", ") : typeof e == "object" ? Object.entries(e).filter(([e]) => !e.startsWith("@")).map(([e, t]) => `${e}: ${L(t)}`).join("; ") : String(e);
|
|
268
420
|
}
|
|
269
|
-
function
|
|
270
|
-
let
|
|
271
|
-
return /* @__PURE__ */
|
|
421
|
+
function R({ className: e, manifest: t, moreInfo: n }) {
|
|
422
|
+
let o = t.title, c = t.claimGenerator ?? t.claimGeneratorInfo?.[0]?.name ?? "Unknown", l = u(t.assertions?.["cawg.identity"]?.verifiedIdentities), d = c.split(" ").filter(Boolean).map((e) => e[0].toUpperCase()).join("") || "?", f = t.assertions?.["cawg.identity"], p = f?.signer_payload?.role ?? [], m = f?.verifiedIdentities ?? [], h = f?.signer_payload?.sig_type, g = f?.issuer, _ = t.assertions?.["cawg.training-mining"]?.entries ?? {}, v = t.assertions?.["cawg.metadata"], y = v ? Object.entries(v).filter(([e]) => !e.startsWith("@")) : [];
|
|
423
|
+
return /* @__PURE__ */ a("div", {
|
|
272
424
|
className: `cawg-card ${e ?? ""}`,
|
|
273
425
|
children: [
|
|
274
|
-
/* @__PURE__ */
|
|
275
|
-
/* @__PURE__ */
|
|
426
|
+
/* @__PURE__ */ i(s, {}),
|
|
427
|
+
/* @__PURE__ */ a("div", {
|
|
276
428
|
className: "cawg-container",
|
|
277
|
-
children: [
|
|
278
|
-
src:
|
|
429
|
+
children: [t.thumbnail ? /* @__PURE__ */ i("img", {
|
|
430
|
+
src: t.thumbnail,
|
|
279
431
|
alt: "Thumbnail",
|
|
280
432
|
className: "cawg-thumbnail"
|
|
281
|
-
}) : /* @__PURE__ */
|
|
433
|
+
}) : /* @__PURE__ */ i("div", {
|
|
282
434
|
className: "cawg-square",
|
|
283
|
-
children: /* @__PURE__ */
|
|
435
|
+
children: /* @__PURE__ */ i("span", {
|
|
284
436
|
className: "cawg-logo-text",
|
|
285
|
-
children:
|
|
437
|
+
children: d
|
|
286
438
|
})
|
|
287
|
-
}), /* @__PURE__ */
|
|
439
|
+
}), /* @__PURE__ */ a("div", {
|
|
288
440
|
style: {
|
|
289
441
|
display: "flex",
|
|
290
442
|
flexDirection: "column"
|
|
291
443
|
},
|
|
292
|
-
children: [/* @__PURE__ */
|
|
444
|
+
children: [/* @__PURE__ */ i("span", {
|
|
293
445
|
className: "cawg-media-title",
|
|
294
|
-
children:
|
|
295
|
-
}), /* @__PURE__ */
|
|
296
|
-
className: "cawg-
|
|
297
|
-
children:
|
|
446
|
+
children: o
|
|
447
|
+
}), /* @__PURE__ */ i("span", {
|
|
448
|
+
className: "cawg-creators-name",
|
|
449
|
+
children: l
|
|
298
450
|
})]
|
|
299
451
|
})]
|
|
300
452
|
}),
|
|
301
|
-
|
|
453
|
+
p.length > 0 && /* @__PURE__ */ i("div", {
|
|
302
454
|
className: "cawg-roles",
|
|
303
|
-
children:
|
|
455
|
+
children: p.map((e) => /* @__PURE__ */ i("span", {
|
|
304
456
|
className: "cawg-role-badge",
|
|
305
|
-
children:
|
|
457
|
+
children: A[e] ?? e
|
|
306
458
|
}, e))
|
|
307
459
|
}),
|
|
308
|
-
|
|
309
|
-
/* @__PURE__ */
|
|
310
|
-
/* @__PURE__ */
|
|
460
|
+
f && /* @__PURE__ */ a(r, { children: [
|
|
461
|
+
/* @__PURE__ */ i("div", { className: "cawg-divider" }),
|
|
462
|
+
/* @__PURE__ */ i("div", {
|
|
311
463
|
className: "cawg-section-title",
|
|
312
464
|
children: "Identity Assertion"
|
|
313
465
|
}),
|
|
314
|
-
|
|
466
|
+
h && /* @__PURE__ */ a("div", {
|
|
315
467
|
className: "cawg-key-value",
|
|
316
|
-
children: [/* @__PURE__ */
|
|
468
|
+
children: [/* @__PURE__ */ i("div", {
|
|
317
469
|
className: "cawg-key-value-label",
|
|
318
470
|
children: "Credential Type"
|
|
319
|
-
}), /* @__PURE__ */
|
|
471
|
+
}), /* @__PURE__ */ i("div", {
|
|
320
472
|
className: "cawg-key-value-value",
|
|
321
|
-
children:
|
|
473
|
+
children: F[h] ?? h
|
|
322
474
|
})]
|
|
323
475
|
}),
|
|
324
|
-
|
|
476
|
+
g && /* @__PURE__ */ a("div", {
|
|
325
477
|
className: "cawg-key-value",
|
|
326
|
-
children: [/* @__PURE__ */
|
|
478
|
+
children: [/* @__PURE__ */ i("div", {
|
|
327
479
|
className: "cawg-key-value-label",
|
|
328
480
|
children: "Issuer"
|
|
329
|
-
}), /* @__PURE__ */
|
|
481
|
+
}), /* @__PURE__ */ i("div", {
|
|
330
482
|
className: "cawg-key-value-value",
|
|
331
|
-
children:
|
|
483
|
+
children: g
|
|
484
|
+
})]
|
|
485
|
+
}),
|
|
486
|
+
/* @__PURE__ */ a("div", {
|
|
487
|
+
className: "cawg-key-value",
|
|
488
|
+
children: [/* @__PURE__ */ i("div", {
|
|
489
|
+
className: "cawg-key-value-label",
|
|
490
|
+
children: "Trust Registry"
|
|
491
|
+
}), /* @__PURE__ */ i(x, {
|
|
492
|
+
entityId: g,
|
|
493
|
+
action: "issue",
|
|
494
|
+
resource: "cawg.identity",
|
|
495
|
+
variant: "full"
|
|
332
496
|
})]
|
|
333
497
|
}),
|
|
334
|
-
|
|
498
|
+
m.length > 0 && /* @__PURE__ */ i("div", {
|
|
335
499
|
className: "cawg-identity-list",
|
|
336
500
|
style: { marginTop: 12 },
|
|
337
|
-
children:
|
|
338
|
-
let
|
|
339
|
-
return /* @__PURE__ */
|
|
501
|
+
children: m.map((e, t) => {
|
|
502
|
+
let n = e.type, r = e.name ?? e.username ?? e.address, o = e.provider, s = e.uri, c = e.verifiedAt;
|
|
503
|
+
return /* @__PURE__ */ i("div", {
|
|
340
504
|
className: "cawg-identity-item",
|
|
341
|
-
children: /* @__PURE__ */
|
|
505
|
+
children: /* @__PURE__ */ a("div", {
|
|
342
506
|
style: { flex: 1 },
|
|
343
507
|
children: [
|
|
344
|
-
/* @__PURE__ */
|
|
508
|
+
/* @__PURE__ */ i("div", {
|
|
345
509
|
className: "cawg-identity-type-label",
|
|
346
|
-
children:
|
|
510
|
+
children: j[n] ?? n
|
|
347
511
|
}),
|
|
348
|
-
|
|
512
|
+
r && /* @__PURE__ */ i("div", {
|
|
349
513
|
className: "cawg-identity-name",
|
|
350
|
-
children:
|
|
514
|
+
children: r
|
|
351
515
|
}),
|
|
352
|
-
o?.name && /* @__PURE__ */
|
|
516
|
+
o?.name && /* @__PURE__ */ a("div", {
|
|
353
517
|
className: "cawg-identity-provider",
|
|
354
518
|
children: ["via ", o.name]
|
|
355
519
|
}),
|
|
356
|
-
s && /* @__PURE__ */
|
|
520
|
+
s && /* @__PURE__ */ i("a", {
|
|
357
521
|
href: s,
|
|
358
522
|
target: "_blank",
|
|
359
523
|
rel: "noopener noreferrer",
|
|
360
524
|
className: "cawg-identity-link",
|
|
361
525
|
children: s
|
|
362
526
|
}),
|
|
363
|
-
c && /* @__PURE__ */
|
|
527
|
+
c && /* @__PURE__ */ a("div", {
|
|
364
528
|
className: "cawg-identity-meta",
|
|
365
|
-
children: ["Verified ",
|
|
529
|
+
children: ["Verified ", I(c)]
|
|
366
530
|
})
|
|
367
531
|
]
|
|
368
532
|
})
|
|
@@ -370,64 +534,64 @@ function S({ className: e, manifest: i, moreInfo: o }) {
|
|
|
370
534
|
})
|
|
371
535
|
})
|
|
372
536
|
] }),
|
|
373
|
-
Object.keys(
|
|
374
|
-
/* @__PURE__ */
|
|
375
|
-
/* @__PURE__ */
|
|
537
|
+
Object.keys(_).length > 0 && /* @__PURE__ */ a(r, { children: [
|
|
538
|
+
/* @__PURE__ */ i("div", { className: "cawg-divider" }),
|
|
539
|
+
/* @__PURE__ */ i("div", {
|
|
376
540
|
className: "cawg-section-title",
|
|
377
541
|
children: "Training & Data Mining"
|
|
378
542
|
}),
|
|
379
|
-
/* @__PURE__ */
|
|
543
|
+
/* @__PURE__ */ i("div", {
|
|
380
544
|
className: "cawg-training-list",
|
|
381
|
-
children: Object.entries(
|
|
545
|
+
children: Object.entries(_).map(([e, t]) => /* @__PURE__ */ a("div", {
|
|
382
546
|
className: "cawg-training-item",
|
|
383
547
|
style: {
|
|
384
548
|
flexDirection: "column",
|
|
385
549
|
alignItems: "flex-start"
|
|
386
550
|
},
|
|
387
|
-
children: [/* @__PURE__ */
|
|
551
|
+
children: [/* @__PURE__ */ a("div", {
|
|
388
552
|
style: {
|
|
389
553
|
display: "flex",
|
|
390
554
|
justifyContent: "space-between",
|
|
391
555
|
width: "100%"
|
|
392
556
|
},
|
|
393
|
-
children: [/* @__PURE__ */
|
|
557
|
+
children: [/* @__PURE__ */ i("span", {
|
|
394
558
|
className: "cawg-training-label",
|
|
395
|
-
children:
|
|
396
|
-
}), /* @__PURE__ */
|
|
397
|
-
className:
|
|
398
|
-
children:
|
|
559
|
+
children: M[e] ?? e
|
|
560
|
+
}), /* @__PURE__ */ i("span", {
|
|
561
|
+
className: N[t.use] ?? "cawg-use-badge",
|
|
562
|
+
children: P[t.use] ?? t.use
|
|
399
563
|
})]
|
|
400
|
-
}), t.constraint_info && /* @__PURE__ */
|
|
564
|
+
}), t.constraint_info && /* @__PURE__ */ i("div", {
|
|
401
565
|
className: "cawg-constraint-info",
|
|
402
566
|
children: t.constraint_info
|
|
403
567
|
})]
|
|
404
568
|
}, e))
|
|
405
569
|
})
|
|
406
570
|
] }),
|
|
407
|
-
|
|
408
|
-
/* @__PURE__ */
|
|
409
|
-
/* @__PURE__ */
|
|
571
|
+
y.length > 0 && /* @__PURE__ */ a(r, { children: [
|
|
572
|
+
/* @__PURE__ */ i("div", { className: "cawg-divider" }),
|
|
573
|
+
/* @__PURE__ */ i("div", {
|
|
410
574
|
className: "cawg-section-title",
|
|
411
575
|
children: "Metadata"
|
|
412
576
|
}),
|
|
413
|
-
|
|
414
|
-
let
|
|
415
|
-
return
|
|
577
|
+
y.map(([e, t]) => {
|
|
578
|
+
let n = L(t);
|
|
579
|
+
return n ? /* @__PURE__ */ a("div", {
|
|
416
580
|
className: "cawg-key-value",
|
|
417
|
-
children: [/* @__PURE__ */
|
|
581
|
+
children: [/* @__PURE__ */ i("div", {
|
|
418
582
|
className: "cawg-key-value-label",
|
|
419
583
|
children: e
|
|
420
|
-
}), /* @__PURE__ */
|
|
584
|
+
}), /* @__PURE__ */ i("div", {
|
|
421
585
|
className: "cawg-key-value-value",
|
|
422
|
-
children:
|
|
586
|
+
children: n
|
|
423
587
|
})]
|
|
424
588
|
}, e) : null;
|
|
425
589
|
})
|
|
426
590
|
] }),
|
|
427
|
-
|
|
591
|
+
n && /* @__PURE__ */ i("div", {
|
|
428
592
|
style: { marginTop: 16 },
|
|
429
|
-
children: /* @__PURE__ */
|
|
430
|
-
onClick:
|
|
593
|
+
children: /* @__PURE__ */ i("button", {
|
|
594
|
+
onClick: n,
|
|
431
595
|
className: "cawg-button",
|
|
432
596
|
children: "Small View"
|
|
433
597
|
})
|
|
@@ -437,36 +601,58 @@ function S({ className: e, manifest: i, moreInfo: o }) {
|
|
|
437
601
|
}
|
|
438
602
|
//#endregion
|
|
439
603
|
//#region src/components/Cawg/Cawg.tsx
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
604
|
+
function z(e) {
|
|
605
|
+
return {
|
|
606
|
+
id: e.id ?? "",
|
|
607
|
+
title: e.title ?? "",
|
|
608
|
+
claimGenerator: e.claimGenerator ?? null,
|
|
609
|
+
claimGeneratorInfo: (e.claimGeneratorInfo ?? []).map((e) => ({
|
|
610
|
+
name: e.name,
|
|
611
|
+
"org.contentauth.c2pa_rs": e["org.contentauth.c2pa_rs"] ?? ""
|
|
612
|
+
})),
|
|
613
|
+
instanceId: e.instanceId ?? "",
|
|
614
|
+
signatureInfo: {
|
|
615
|
+
alg: e.signatureInfo?.alg ?? "",
|
|
616
|
+
issuer: e.signatureInfo?.issuer ?? "",
|
|
617
|
+
common_name: e.signatureInfo?.common_name ?? "",
|
|
618
|
+
cert_serial_number: e.signatureInfo?.cert_serial_number ?? ""
|
|
619
|
+
},
|
|
620
|
+
assertions: e.assertions ?? {},
|
|
621
|
+
credentials: e.credentials ?? [],
|
|
622
|
+
thumbnail: typeof e.thumbnail == "string" ? e.thumbnail : null,
|
|
623
|
+
ingredients: e.ingredients ?? []
|
|
624
|
+
};
|
|
625
|
+
}
|
|
626
|
+
var B = ({ manifest: t, entry: n, level: r, className: a }) => {
|
|
627
|
+
let o = t.manifestStore?.activeManifest, s = n == null ? t.manifests.find((e) => e.id === o || e.instanceId === o) ?? (o ? t.manifestStore.manifests[o] : void 0) ?? t.manifests[0] : z(n);
|
|
628
|
+
if (!s || !(s.assertions?.["cawg.identity"] != null || s.assertions?.["cawg.training-mining"] != null || s.assertions?.["cawg.metadata"] != null)) return null;
|
|
443
629
|
let [c, l] = e.useState(r || 1);
|
|
444
630
|
switch (c) {
|
|
445
|
-
case 1: return /* @__PURE__ */
|
|
446
|
-
className:
|
|
447
|
-
manifest:
|
|
631
|
+
case 1: return /* @__PURE__ */ i(f, {
|
|
632
|
+
className: a,
|
|
633
|
+
manifest: s,
|
|
448
634
|
moreInfo: () => {
|
|
449
635
|
l(2);
|
|
450
636
|
}
|
|
451
637
|
});
|
|
452
|
-
case 2: return /* @__PURE__ */
|
|
453
|
-
className:
|
|
454
|
-
manifest:
|
|
638
|
+
case 2: return /* @__PURE__ */ i(k, {
|
|
639
|
+
className: a,
|
|
640
|
+
manifest: s,
|
|
455
641
|
moreInfo: () => {
|
|
456
642
|
l(3);
|
|
457
643
|
}
|
|
458
644
|
});
|
|
459
|
-
case 3: return /* @__PURE__ */
|
|
460
|
-
className:
|
|
461
|
-
manifest:
|
|
645
|
+
case 3: return /* @__PURE__ */ i(R, {
|
|
646
|
+
className: a,
|
|
647
|
+
manifest: s,
|
|
462
648
|
moreInfo: () => {
|
|
463
649
|
l(1);
|
|
464
650
|
}
|
|
465
651
|
});
|
|
466
652
|
}
|
|
467
|
-
return /* @__PURE__ */
|
|
653
|
+
return /* @__PURE__ */ i("div", { children: "Level Of Detail Not Selected" });
|
|
468
654
|
};
|
|
469
|
-
|
|
655
|
+
B.knownAssertions = [
|
|
470
656
|
"cawg.identity",
|
|
471
657
|
"cawg.training-mining",
|
|
472
658
|
"cawg.metadata",
|
|
@@ -484,4 +670,4 @@ C.knownAssertions = [
|
|
|
484
670
|
"cawg.crypto_wallet"
|
|
485
671
|
];
|
|
486
672
|
//#endregion
|
|
487
|
-
export {
|
|
673
|
+
export { B as CAWGManifest, x as TrustBadge, g as getTrustRegistryQueryFn, p as queryTrustRegistry, h as setTrustRegistryQueryFn, _ as useTrustRegistryQuery };
|
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
<rect width="34" height="34" fill="black"/>
|
|
8
8
|
</clipPath>
|
|
9
9
|
</defs>
|
|
10
|
-
</svg>`,d=()=>(0,n.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`8px`,marginBottom:`16px`},children:[(0,n.jsx)(`div`,{dangerouslySetInnerHTML:{__html:u},style:{width:`24px`,height:`24px`,display:`flex`,alignItems:`center`}}),(0,n.jsx)(`span`,{style:{fontSize:`14px`,fontWeight:600,color:`#333`,display:`flex`,alignItems:`center`},children:`Creator Assertions Working Group`})]}),f={"cawg.creator":`Creator`,"cawg.contributor":`Contributor`,"cawg.editor":`Editor`,"cawg.producer":`Producer`,"cawg.publisher":`Publisher`,"cawg.sponsor":`Sponsor`,"cawg.translator":`Translator`};function p({className:e,manifest:t,moreInfo:r}){let i=t.title,a=t.claimGenerator??t.claimGeneratorInfo?.[0]?.name??`Unknown`,o=a.split(` `).filter(Boolean).map(e=>e[0].toUpperCase()).join(``)||`?`,s=(t.assertions?.[`cawg.identity`])?.signer_payload?.role??[];return(0,n.jsxs)(`div`,{className:`cawg-card ${e??``}`,children:[(0,n.jsx)(d,{}),(0,n.jsxs)(`div`,{className:`cawg-container`,children:[t.thumbnail?(0,n.jsx)(`img`,{src:t.thumbnail,alt:`Thumbnail`,className:`cawg-thumbnail`}):(0,n.jsx)(`div`,{className:`cawg-square`,children:(0,n.jsx)(`span`,{className:`cawg-logo-text`,children:o})}),(0,n.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`},children:[(0,n.jsx)(`span`,{className:`cawg-media-title`,children:i}),(0,n.jsx)(`span`,{className:`cawg-claim-generator`,children:a})]})]}),s.length>0&&(0,n.jsx)(`div`,{className:`cawg-roles`,children:s.map(e=>(0,n.jsx)(`span`,{className:`cawg-role-badge`,children:f[e]??e},e))}),r&&(0,n.jsx)(`div`,{style:{marginTop:16},children:(0,n.jsx)(`button`,{onClick:r,className:`cawg-button`,children:`More Info`})})]})}var m={"cawg.creator":`Creator`,"cawg.contributor":`Contributor`,"cawg.editor":`Editor`,"cawg.producer":`Producer`,"cawg.publisher":`Publisher`,"cawg.sponsor":`Sponsor`,"cawg.translator":`Translator`},h={"cawg.document_verification":`ID Verified`,"cawg.web_site":`Website`,"cawg.affiliation":`Affiliation`,"cawg.social_media":`Social Media`,"cawg.crypto_wallet":`Crypto Wallet`},g={"cawg.data_mining":`Data Mining`,"cawg.ai_inference":`AI Inference`,"cawg.ai_training":`AI Training`,"cawg.ai_generative_training":`AI Generative Training`},_={allowed:`cawg-use-badge cawg-use-allowed`,notAllowed:`cawg-use-badge cawg-use-not-allowed`,constrained:`cawg-use-badge cawg-use-constrained`},v={allowed:`Allowed`,notAllowed:`Not Allowed`,constrained:`Constrained`};function y({className:e,manifest:t,moreInfo:r}){let i=t.title,a=t.claimGenerator??t.claimGeneratorInfo?.[0]?.name??`Unknown`,o=a.split(` `).filter(Boolean).map(e=>e[0].toUpperCase()).join(``)||`?`,s=t.assertions?.[`cawg.identity`],c=s?.signer_payload?.role??[],l=s?.verifiedIdentities??[],u=t.assertions?.[`cawg.training-mining`]?.entries??{};return(0,n.jsxs)(`div`,{className:`cawg-card ${e??``}`,children:[(0,n.jsx)(d,{}),(0,n.jsxs)(`div`,{className:`cawg-container`,children:[t.thumbnail?(0,n.jsx)(`img`,{src:t.thumbnail,alt:`Thumbnail`,className:`cawg-thumbnail`}):(0,n.jsx)(`div`,{className:`cawg-square`,children:(0,n.jsx)(`span`,{className:`cawg-logo-text`,children:o})}),(0,n.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`},children:[(0,n.jsx)(`span`,{className:`cawg-media-title`,children:i}),(0,n.jsx)(`span`,{className:`cawg-claim-generator`,children:a})]})]}),c.length>0&&(0,n.jsx)(`div`,{className:`cawg-roles`,children:c.map(e=>(0,n.jsx)(`span`,{className:`cawg-role-badge`,children:m[e]??e},e))}),l.length>0&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`div`,{className:`cawg-divider`}),(0,n.jsx)(`div`,{className:`cawg-section-title`,children:`Identity`}),(0,n.jsx)(`div`,{className:`cawg-identity-list`,children:l.map((e,t)=>{let r=e.type,i=e.name??e.username,a=e.provider;return(0,n.jsx)(`div`,{className:`cawg-identity-item`,children:(0,n.jsxs)(`div`,{style:{flex:1},children:[(0,n.jsx)(`div`,{className:`cawg-identity-type-label`,children:h[r]??r}),i&&(0,n.jsx)(`div`,{className:`cawg-identity-name`,children:i}),a?.name&&(0,n.jsx)(`div`,{className:`cawg-identity-provider`,children:a.name})]})},t)})})]}),Object.keys(u).length>0&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`div`,{className:`cawg-divider`}),(0,n.jsx)(`div`,{className:`cawg-section-title`,children:`Training & Data Mining`}),(0,n.jsx)(`div`,{className:`cawg-training-list`,children:Object.entries(u).map(([e,t])=>(0,n.jsxs)(`div`,{className:`cawg-training-item`,children:[(0,n.jsx)(`span`,{className:`cawg-training-label`,children:g[e]??e}),(0,n.jsx)(`span`,{className:_[t.use]??`cawg-use-badge`,children:v[t.use]??t.use})]},e))})]}),r&&(0,n.jsx)(`div`,{style:{marginTop:16},children:(0,n.jsx)(`button`,{onClick:r,className:`cawg-button`,children:`More Info`})})]})}var b={"cawg.creator":`Creator`,"cawg.contributor":`Contributor`,"cawg.editor":`Editor`,"cawg.producer":`Producer`,"cawg.publisher":`Publisher`,"cawg.sponsor":`Sponsor`,"cawg.translator":`Translator`},x={"cawg.document_verification":`ID Verified`,"cawg.web_site":`Website`,"cawg.affiliation":`Affiliation`,"cawg.social_media":`Social Media`,"cawg.crypto_wallet":`Crypto Wallet`},S={"cawg.data_mining":`Data Mining`,"cawg.ai_inference":`AI Inference`,"cawg.ai_training":`AI Training`,"cawg.ai_generative_training":`AI Generative Training`},C={allowed:`cawg-use-badge cawg-use-allowed`,notAllowed:`cawg-use-badge cawg-use-not-allowed`,constrained:`cawg-use-badge cawg-use-constrained`},w={allowed:`Allowed`,notAllowed:`Not Allowed`,constrained:`Constrained`},T={"cawg.identity_claims_aggregation":`Identity Claims Aggregation`,"cawg.x509.cose":`X.509 Certificate`,"cawg.verifiable_credential_binding":`Verifiable Credential`};function E(e){try{return new Date(e).toLocaleDateString(void 0,{year:`numeric`,month:`long`,day:`numeric`})}catch{return e}}function D(e){return e==null?``:typeof e==`string`||typeof e==`number`||typeof e==`boolean`?String(e):Array.isArray(e)?e.map(e=>D(e)).filter(Boolean).join(`, `):typeof e==`object`?Object.entries(e).filter(([e])=>!e.startsWith(`@`)).map(([e,t])=>`${e}: ${D(t)}`).join(`; `):String(e)}function O({className:e,manifest:t,moreInfo:r}){let i=t.title,a=t.claimGenerator??t.claimGeneratorInfo?.[0]?.name??`Unknown`,o=a.split(` `).filter(Boolean).map(e=>e[0].toUpperCase()).join(``)||`?`,s=t.assertions?.[`cawg.identity`],c=s?.signer_payload?.role??[],l=s?.verifiedIdentities??[],u=s?.signer_payload?.sig_type,f=s?.issuer,p=t.assertions?.[`cawg.training-mining`]?.entries??{},m=t.assertions?.[`cawg.metadata`],h=m?Object.entries(m).filter(([e])=>!e.startsWith(`@`)):[];return(0,n.jsxs)(`div`,{className:`cawg-card ${e??``}`,children:[(0,n.jsx)(d,{}),(0,n.jsxs)(`div`,{className:`cawg-container`,children:[t.thumbnail?(0,n.jsx)(`img`,{src:t.thumbnail,alt:`Thumbnail`,className:`cawg-thumbnail`}):(0,n.jsx)(`div`,{className:`cawg-square`,children:(0,n.jsx)(`span`,{className:`cawg-logo-text`,children:o})}),(0,n.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`},children:[(0,n.jsx)(`span`,{className:`cawg-media-title`,children:i}),(0,n.jsx)(`span`,{className:`cawg-claim-generator`,children:a})]})]}),c.length>0&&(0,n.jsx)(`div`,{className:`cawg-roles`,children:c.map(e=>(0,n.jsx)(`span`,{className:`cawg-role-badge`,children:b[e]??e},e))}),s&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`div`,{className:`cawg-divider`}),(0,n.jsx)(`div`,{className:`cawg-section-title`,children:`Identity Assertion`}),u&&(0,n.jsxs)(`div`,{className:`cawg-key-value`,children:[(0,n.jsx)(`div`,{className:`cawg-key-value-label`,children:`Credential Type`}),(0,n.jsx)(`div`,{className:`cawg-key-value-value`,children:T[u]??u})]}),f&&(0,n.jsxs)(`div`,{className:`cawg-key-value`,children:[(0,n.jsx)(`div`,{className:`cawg-key-value-label`,children:`Issuer`}),(0,n.jsx)(`div`,{className:`cawg-key-value-value`,children:f})]}),l.length>0&&(0,n.jsx)(`div`,{className:`cawg-identity-list`,style:{marginTop:12},children:l.map((e,t)=>{let r=e.type,i=e.name??e.username??e.address,a=e.provider,o=e.uri,s=e.verifiedAt;return(0,n.jsx)(`div`,{className:`cawg-identity-item`,children:(0,n.jsxs)(`div`,{style:{flex:1},children:[(0,n.jsx)(`div`,{className:`cawg-identity-type-label`,children:x[r]??r}),i&&(0,n.jsx)(`div`,{className:`cawg-identity-name`,children:i}),a?.name&&(0,n.jsxs)(`div`,{className:`cawg-identity-provider`,children:[`via `,a.name]}),o&&(0,n.jsx)(`a`,{href:o,target:`_blank`,rel:`noopener noreferrer`,className:`cawg-identity-link`,children:o}),s&&(0,n.jsxs)(`div`,{className:`cawg-identity-meta`,children:[`Verified `,E(s)]})]})},t)})})]}),Object.keys(p).length>0&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`div`,{className:`cawg-divider`}),(0,n.jsx)(`div`,{className:`cawg-section-title`,children:`Training & Data Mining`}),(0,n.jsx)(`div`,{className:`cawg-training-list`,children:Object.entries(p).map(([e,t])=>(0,n.jsxs)(`div`,{className:`cawg-training-item`,style:{flexDirection:`column`,alignItems:`flex-start`},children:[(0,n.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,width:`100%`},children:[(0,n.jsx)(`span`,{className:`cawg-training-label`,children:S[e]??e}),(0,n.jsx)(`span`,{className:C[t.use]??`cawg-use-badge`,children:w[t.use]??t.use})]}),t.constraint_info&&(0,n.jsx)(`div`,{className:`cawg-constraint-info`,children:t.constraint_info})]},e))})]}),h.length>0&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`div`,{className:`cawg-divider`}),(0,n.jsx)(`div`,{className:`cawg-section-title`,children:`Metadata`}),h.map(([e,t])=>{let r=D(t);return r?(0,n.jsxs)(`div`,{className:`cawg-key-value`,children:[(0,n.jsx)(`div`,{className:`cawg-key-value-label`,children:e}),(0,n.jsx)(`div`,{className:`cawg-key-value-value`,children:r})]},e):null})]}),r&&(0,n.jsx)(`div`,{style:{marginTop:16},children:(0,n.jsx)(`button`,{onClick:r,className:`cawg-button`,children:`Small View`})})]})}var k=({manifest:e,level:r,className:i})=>{let a=e.manifestStore?.activeManifest,o=e.manifests.find(e=>e.id===a||e.instanceId===a)??(a?e.manifestStore.manifests[a]:void 0)??e.manifests[0];if(!o||!(o.assertions?.[`cawg.identity`]!=null||o.assertions?.[`cawg.training-mining`]!=null||o.assertions?.[`cawg.metadata`]!=null))return null;let[s,c]=t.default.useState(r||1);switch(s){case 1:return(0,n.jsx)(p,{className:i,manifest:o,moreInfo:()=>{c(2)}});case 2:return(0,n.jsx)(y,{className:i,manifest:o,moreInfo:()=>{c(3)}});case 3:return(0,n.jsx)(O,{className:i,manifest:o,moreInfo:()=>{c(1)}})}return(0,n.jsx)(`div`,{children:`Level Of Detail Not Selected`})};k.knownAssertions=[`cawg.identity`,`cawg.training-mining`,`cawg.metadata`,`cawg.creator`,`cawg.contributor`,`cawg.editor`,`cawg.producer`,`cawg.publisher`,`cawg.sponsor`,`cawg.translator`,`cawg.document_verification`,`cawg.web_site`,`cawg.affiliation`,`cawg.social_media`,`cawg.crypto_wallet`],e.CAWGManifest=k});
|
|
10
|
+
</svg>`,d=()=>(0,n.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`8px`,marginBottom:`16px`},children:[(0,n.jsx)(`div`,{dangerouslySetInnerHTML:{__html:u},style:{width:`24px`,height:`24px`,display:`flex`,alignItems:`center`}}),(0,n.jsx)(`span`,{style:{fontSize:`14px`,fontWeight:600,color:`#333`,display:`flex`,alignItems:`center`},children:`Creator Assertions Working Group`})]}),f=e=>{switch(e){case`cawg.document_verification`:return 0;case`cawg.social_media`:return 10;case`cawg.web_site`:return 20;case`cawg.affiliation`:return 1e6;default:return 1e5}},p=[`cawg.affiliation`],m=e=>{if(typeof e==`object`&&!Array.isArray(e)&&(e=[e]),!e||e.length===0)return`Unknown`;let t=e.sort((e,t)=>f(e.type)-f(t.type))[0];return!t||p.includes(t.type)?`Unknown`:t.name},h={"cawg.creator":`Creator`,"cawg.contributor":`Contributor`,"cawg.editor":`Editor`,"cawg.producer":`Producer`,"cawg.publisher":`Publisher`,"cawg.sponsor":`Sponsor`,"cawg.translator":`Translator`};function g({className:e,manifest:t,moreInfo:r}){let i=t.title,a=t.claimGenerator??t.claimGeneratorInfo?.[0]?.name??`Unknown`,o=m(t.assertions?.[`cawg.identity`]?.verifiedIdentities),s=a.split(` `).filter(Boolean).map(e=>e[0].toUpperCase()).join(``)||`?`,c=(t.assertions?.[`cawg.identity`])?.signer_payload?.role??[];return(0,n.jsxs)(`div`,{className:`cawg-card ${e??``}`,children:[(0,n.jsx)(d,{}),(0,n.jsxs)(`div`,{className:`cawg-container`,children:[t.thumbnail?(0,n.jsx)(`img`,{src:t.thumbnail,alt:`Thumbnail`,className:`cawg-thumbnail`}):(0,n.jsx)(`div`,{className:`cawg-square`,children:(0,n.jsx)(`span`,{className:`cawg-logo-text`,children:s})}),(0,n.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`},children:[(0,n.jsx)(`span`,{className:`cawg-media-title`,children:i}),(0,n.jsx)(`span`,{className:`cawg-creators-name`,children:o})]})]}),c.length>0&&(0,n.jsx)(`div`,{className:`cawg-roles`,children:c.map(e=>(0,n.jsx)(`span`,{className:`cawg-role-badge`,children:h[e]??e},e))}),r&&(0,n.jsx)(`div`,{style:{marginTop:16},children:(0,n.jsx)(`button`,{onClick:r,className:`cawg-button`,children:`More Info`})})]})}async function _(){throw Error("No trust registry query function configured. Call `setTrustRegistryQueryFn` (or pass a `queryFn` prop to TrustBadge) with a function that queries a real TRQP endpoint.")}var v=_;function y(e){v=e}function b(){return v}function x(e,n,r,i=b()){let[a,o]=(0,t.useState)(`idle`),[s,c]=(0,t.useState)(null),[l,u]=(0,t.useState)(null);return(0,t.useEffect)(()=>{if(!e){o(`idle`),c(null),u(null);return}let t=!1;return o(`loading`),u(null),i({entityId:e,action:n,resource:r}).then(e=>{t||(c(e),o(`done`))},e=>{t||(c(null),u(e instanceof Error?e:Error(String(e))),o(`error`))}),()=>{t=!0}},[e,n,r,i]),{status:a,result:s,error:l}}function S(e){try{return new Date(e).toLocaleDateString(void 0,{year:`numeric`,month:`long`,day:`numeric`})}catch{return e}}var C=`Identity Verified by Trust Registry`,w=`Identity Unable to be Verified by Trust Registry`;function T({entityId:e,action:t,resource:r,variant:i=`full`,queryFn:a}){let{status:o,result:s,error:c}=x(e,t,r,a);if(!e)return null;if(o===`error`)return(0,n.jsx)(`span`,{className:`cawg-trust-badge cawg-trust-unverified`,title:c?.message,children:`Unable to reach trust registry`});if(o!==`done`||!s)return(0,n.jsx)(`span`,{className:`cawg-trust-badge cawg-trust-pending`,children:`Checking trust registry…`});let l=(0,n.jsx)(`span`,{className:s.authorized?`cawg-trust-badge cawg-trust-verified`:`cawg-trust-badge cawg-trust-unverified`,title:s.authorized?`Recognized by ${s.authority_id} · checked ${S(s.time_evaluated)}`:s.message,children:s.authorized?C:w});return i===`compact`?l:(0,n.jsxs)(`div`,{className:`cawg-trust-status`,children:[l,s.authorized?(0,n.jsxs)(`div`,{className:`cawg-trust-meta`,children:[s.authority_id,` · checked `,S(s.time_evaluated)]}):s.message&&(0,n.jsx)(`div`,{className:`cawg-trust-message`,children:s.message})]})}var E={"cawg.creator":`Creator`,"cawg.contributor":`Contributor`,"cawg.editor":`Editor`,"cawg.producer":`Producer`,"cawg.publisher":`Publisher`,"cawg.sponsor":`Sponsor`,"cawg.translator":`Translator`},D={"cawg.document_verification":`ID Verified`,"cawg.web_site":`Website`,"cawg.affiliation":`Affiliation`,"cawg.social_media":`Social Media`,"cawg.crypto_wallet":`Crypto Wallet`},O={"cawg.data_mining":`Data Mining`,"cawg.ai_inference":`AI Inference`,"cawg.ai_training":`AI Training`,"cawg.ai_generative_training":`AI Generative Training`},k={allowed:`cawg-use-badge cawg-use-allowed`,notAllowed:`cawg-use-badge cawg-use-not-allowed`,constrained:`cawg-use-badge cawg-use-constrained`},A={allowed:`Allowed`,notAllowed:`Not Allowed`,constrained:`Constrained`};function j(e){try{return new Date(e).toLocaleDateString(void 0,{year:`numeric`,month:`long`,day:`numeric`})}catch{return e}}function M(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`).join(`, `):typeof e==`string`?e:``}function N({className:e,manifest:t,moreInfo:r}){let i=t.title,a=(t.claimGenerator??t.claimGeneratorInfo?.[0]?.name??`Unknown`).split(` `).filter(Boolean).map(e=>e[0].toUpperCase()).join(``)||`?`,o=m(t.assertions?.[`cawg.identity`]?.verifiedIdentities),s=t.assertions?.[`cawg.identity`],c=s?.signer_payload?.role??[],l=s?.verifiedIdentities??[],u=s?.issuer,f=t.assertions?.[`cawg.training-mining`]?.entries??{},p=t.assertions?.[`cawg.metadata`],h=M(p?.[`dc:creator`]),g=p?.[`xmp:CreateDate`];return(0,n.jsxs)(`div`,{className:`cawg-card ${e??``}`,children:[(0,n.jsx)(d,{}),(0,n.jsxs)(`div`,{className:`cawg-container`,children:[t.thumbnail?(0,n.jsx)(`img`,{src:t.thumbnail,alt:`Thumbnail`,className:`cawg-thumbnail`}):(0,n.jsx)(`div`,{className:`cawg-square`,children:(0,n.jsx)(`span`,{className:`cawg-logo-text`,children:a})}),(0,n.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`},children:[(0,n.jsx)(`span`,{className:`cawg-media-title`,children:i}),(0,n.jsx)(`span`,{className:`cawg-creators-name`,children:o})]})]}),c.length>0&&(0,n.jsx)(`div`,{className:`cawg-roles`,children:c.map(e=>(0,n.jsx)(`span`,{className:`cawg-role-badge`,children:E[e]??e},e))}),l.length>0&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`div`,{className:`cawg-divider`}),(0,n.jsxs)(`div`,{className:`cawg-section-title`,style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:8},children:[(0,n.jsx)(`span`,{children:`Identity`}),(0,n.jsx)(T,{entityId:u,action:`issue`,resource:`cawg.identity`,variant:`compact`})]}),(0,n.jsx)(`div`,{className:`cawg-identity-list`,children:l.map((e,t)=>{let r=e.type,i=e.name??e.username,a=e.provider;return(0,n.jsx)(`div`,{className:`cawg-identity-item`,children:(0,n.jsxs)(`div`,{style:{flex:1},children:[(0,n.jsx)(`div`,{className:`cawg-identity-type-label`,children:D[r]??r}),i&&(0,n.jsx)(`div`,{className:`cawg-identity-name`,children:i}),a?.name&&(0,n.jsx)(`div`,{className:`cawg-identity-provider`,children:a.name})]})},t)})})]}),Object.keys(f).length>0&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`div`,{className:`cawg-divider`}),(0,n.jsx)(`div`,{className:`cawg-section-title`,children:`Training & Data Mining`}),(0,n.jsx)(`div`,{className:`cawg-training-list`,children:Object.entries(f).map(([e,t])=>(0,n.jsxs)(`div`,{className:`cawg-training-item`,children:[(0,n.jsx)(`span`,{className:`cawg-training-label`,children:O[e]??e}),(0,n.jsx)(`span`,{className:k[t.use]??`cawg-use-badge`,children:A[t.use]??t.use})]},e))})]}),(h||g)&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`div`,{className:`cawg-divider`}),(0,n.jsx)(`div`,{className:`cawg-section-title`,children:`Creator`}),h&&(0,n.jsxs)(`div`,{className:`cawg-key-value`,children:[(0,n.jsx)(`div`,{className:`cawg-key-value-label`,children:`Name`}),(0,n.jsx)(`div`,{className:`cawg-key-value-value`,children:h})]}),g&&(0,n.jsxs)(`div`,{className:`cawg-key-value`,children:[(0,n.jsx)(`div`,{className:`cawg-key-value-label`,children:`Date Created`}),(0,n.jsx)(`div`,{className:`cawg-key-value-value`,children:j(g)})]})]}),r&&(0,n.jsx)(`div`,{style:{marginTop:16},children:(0,n.jsx)(`button`,{onClick:r,className:`cawg-button`,children:`More Info`})})]})}var P={"cawg.creator":`Creator`,"cawg.contributor":`Contributor`,"cawg.editor":`Editor`,"cawg.producer":`Producer`,"cawg.publisher":`Publisher`,"cawg.sponsor":`Sponsor`,"cawg.translator":`Translator`},F={"cawg.document_verification":`ID Verified`,"cawg.web_site":`Website`,"cawg.affiliation":`Affiliation`,"cawg.social_media":`Social Media`,"cawg.crypto_wallet":`Crypto Wallet`},I={"cawg.data_mining":`Data Mining`,"cawg.ai_inference":`AI Inference`,"cawg.ai_training":`AI Training`,"cawg.ai_generative_training":`AI Generative Training`},L={allowed:`cawg-use-badge cawg-use-allowed`,notAllowed:`cawg-use-badge cawg-use-not-allowed`,constrained:`cawg-use-badge cawg-use-constrained`},R={allowed:`Allowed`,notAllowed:`Not Allowed`,constrained:`Constrained`},z={"cawg.identity_claims_aggregation":`Identity Claims Aggregation`,"cawg.x509.cose":`X.509 Certificate`,"cawg.verifiable_credential_binding":`Verifiable Credential`};function B(e){try{return new Date(e).toLocaleDateString(void 0,{year:`numeric`,month:`long`,day:`numeric`})}catch{return e}}function V(e){return e==null?``:typeof e==`string`||typeof e==`number`||typeof e==`boolean`?String(e):Array.isArray(e)?e.map(e=>V(e)).filter(Boolean).join(`, `):typeof e==`object`?Object.entries(e).filter(([e])=>!e.startsWith(`@`)).map(([e,t])=>`${e}: ${V(t)}`).join(`; `):String(e)}function H({className:e,manifest:t,moreInfo:r}){let i=t.title,a=t.claimGenerator??t.claimGeneratorInfo?.[0]?.name??`Unknown`,o=m(t.assertions?.[`cawg.identity`]?.verifiedIdentities),s=a.split(` `).filter(Boolean).map(e=>e[0].toUpperCase()).join(``)||`?`,c=t.assertions?.[`cawg.identity`],l=c?.signer_payload?.role??[],u=c?.verifiedIdentities??[],f=c?.signer_payload?.sig_type,p=c?.issuer,h=t.assertions?.[`cawg.training-mining`]?.entries??{},g=t.assertions?.[`cawg.metadata`],_=g?Object.entries(g).filter(([e])=>!e.startsWith(`@`)):[];return(0,n.jsxs)(`div`,{className:`cawg-card ${e??``}`,children:[(0,n.jsx)(d,{}),(0,n.jsxs)(`div`,{className:`cawg-container`,children:[t.thumbnail?(0,n.jsx)(`img`,{src:t.thumbnail,alt:`Thumbnail`,className:`cawg-thumbnail`}):(0,n.jsx)(`div`,{className:`cawg-square`,children:(0,n.jsx)(`span`,{className:`cawg-logo-text`,children:s})}),(0,n.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`},children:[(0,n.jsx)(`span`,{className:`cawg-media-title`,children:i}),(0,n.jsx)(`span`,{className:`cawg-creators-name`,children:o})]})]}),l.length>0&&(0,n.jsx)(`div`,{className:`cawg-roles`,children:l.map(e=>(0,n.jsx)(`span`,{className:`cawg-role-badge`,children:P[e]??e},e))}),c&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`div`,{className:`cawg-divider`}),(0,n.jsx)(`div`,{className:`cawg-section-title`,children:`Identity Assertion`}),f&&(0,n.jsxs)(`div`,{className:`cawg-key-value`,children:[(0,n.jsx)(`div`,{className:`cawg-key-value-label`,children:`Credential Type`}),(0,n.jsx)(`div`,{className:`cawg-key-value-value`,children:z[f]??f})]}),p&&(0,n.jsxs)(`div`,{className:`cawg-key-value`,children:[(0,n.jsx)(`div`,{className:`cawg-key-value-label`,children:`Issuer`}),(0,n.jsx)(`div`,{className:`cawg-key-value-value`,children:p})]}),(0,n.jsxs)(`div`,{className:`cawg-key-value`,children:[(0,n.jsx)(`div`,{className:`cawg-key-value-label`,children:`Trust Registry`}),(0,n.jsx)(T,{entityId:p,action:`issue`,resource:`cawg.identity`,variant:`full`})]}),u.length>0&&(0,n.jsx)(`div`,{className:`cawg-identity-list`,style:{marginTop:12},children:u.map((e,t)=>{let r=e.type,i=e.name??e.username??e.address,a=e.provider,o=e.uri,s=e.verifiedAt;return(0,n.jsx)(`div`,{className:`cawg-identity-item`,children:(0,n.jsxs)(`div`,{style:{flex:1},children:[(0,n.jsx)(`div`,{className:`cawg-identity-type-label`,children:F[r]??r}),i&&(0,n.jsx)(`div`,{className:`cawg-identity-name`,children:i}),a?.name&&(0,n.jsxs)(`div`,{className:`cawg-identity-provider`,children:[`via `,a.name]}),o&&(0,n.jsx)(`a`,{href:o,target:`_blank`,rel:`noopener noreferrer`,className:`cawg-identity-link`,children:o}),s&&(0,n.jsxs)(`div`,{className:`cawg-identity-meta`,children:[`Verified `,B(s)]})]})},t)})})]}),Object.keys(h).length>0&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`div`,{className:`cawg-divider`}),(0,n.jsx)(`div`,{className:`cawg-section-title`,children:`Training & Data Mining`}),(0,n.jsx)(`div`,{className:`cawg-training-list`,children:Object.entries(h).map(([e,t])=>(0,n.jsxs)(`div`,{className:`cawg-training-item`,style:{flexDirection:`column`,alignItems:`flex-start`},children:[(0,n.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,width:`100%`},children:[(0,n.jsx)(`span`,{className:`cawg-training-label`,children:I[e]??e}),(0,n.jsx)(`span`,{className:L[t.use]??`cawg-use-badge`,children:R[t.use]??t.use})]}),t.constraint_info&&(0,n.jsx)(`div`,{className:`cawg-constraint-info`,children:t.constraint_info})]},e))})]}),_.length>0&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`div`,{className:`cawg-divider`}),(0,n.jsx)(`div`,{className:`cawg-section-title`,children:`Metadata`}),_.map(([e,t])=>{let r=V(t);return r?(0,n.jsxs)(`div`,{className:`cawg-key-value`,children:[(0,n.jsx)(`div`,{className:`cawg-key-value-label`,children:e}),(0,n.jsx)(`div`,{className:`cawg-key-value-value`,children:r})]},e):null})]}),r&&(0,n.jsx)(`div`,{style:{marginTop:16},children:(0,n.jsx)(`button`,{onClick:r,className:`cawg-button`,children:`Small View`})})]})}function U(e){return{id:e.id??``,title:e.title??``,claimGenerator:e.claimGenerator??null,claimGeneratorInfo:(e.claimGeneratorInfo??[]).map(e=>({name:e.name,"org.contentauth.c2pa_rs":e[`org.contentauth.c2pa_rs`]??``})),instanceId:e.instanceId??``,signatureInfo:{alg:e.signatureInfo?.alg??``,issuer:e.signatureInfo?.issuer??``,common_name:e.signatureInfo?.common_name??``,cert_serial_number:e.signatureInfo?.cert_serial_number??``},assertions:e.assertions??{},credentials:e.credentials??[],thumbnail:typeof e.thumbnail==`string`?e.thumbnail:null,ingredients:e.ingredients??[]}}var W=({manifest:e,entry:r,level:i,className:a})=>{let o=e.manifestStore?.activeManifest,s=r==null?e.manifests.find(e=>e.id===o||e.instanceId===o)??(o?e.manifestStore.manifests[o]:void 0)??e.manifests[0]:U(r);if(!s||!(s.assertions?.[`cawg.identity`]!=null||s.assertions?.[`cawg.training-mining`]!=null||s.assertions?.[`cawg.metadata`]!=null))return null;let[c,l]=t.default.useState(i||1);switch(c){case 1:return(0,n.jsx)(g,{className:a,manifest:s,moreInfo:()=>{l(2)}});case 2:return(0,n.jsx)(N,{className:a,manifest:s,moreInfo:()=>{l(3)}});case 3:return(0,n.jsx)(H,{className:a,manifest:s,moreInfo:()=>{l(1)}})}return(0,n.jsx)(`div`,{children:`Level Of Detail Not Selected`})};W.knownAssertions=[`cawg.identity`,`cawg.training-mining`,`cawg.metadata`,`cawg.creator`,`cawg.contributor`,`cawg.editor`,`cawg.producer`,`cawg.publisher`,`cawg.sponsor`,`cawg.translator`,`cawg.document_verification`,`cawg.web_site`,`cawg.affiliation`,`cawg.social_media`,`cawg.crypto_wallet`],e.CAWGManifest=W,e.TrustBadge=T,e.getTrustRegistryQueryFn=b,e.queryTrustRegistry=_,e.setTrustRegistryQueryFn=y,e.useTrustRegistryQuery=x});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { TrustRegistryQueryFn } from './trqp';
|
|
2
|
+
export interface TrustBadgeProps {
|
|
3
|
+
entityId?: string;
|
|
4
|
+
action?: string;
|
|
5
|
+
resource?: string;
|
|
6
|
+
variant?: 'compact' | 'full';
|
|
7
|
+
queryFn?: TrustRegistryQueryFn;
|
|
8
|
+
}
|
|
9
|
+
export declare function TrustBadge({ entityId, action, resource, variant, queryFn }: TrustBadgeProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type VerifiedIdentitiesObject = {
|
|
2
|
+
"type": string;
|
|
3
|
+
"name": string;
|
|
4
|
+
"provider": {
|
|
5
|
+
"id": string;
|
|
6
|
+
"name": string;
|
|
7
|
+
};
|
|
8
|
+
"verifiedAt": string;
|
|
9
|
+
};
|
|
10
|
+
export declare const getBestUserName: (identityObjectArray: VerifiedIdentitiesObject[] | VerifiedIdentitiesObject) => string;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export interface TrqpAuthorizationResponse {
|
|
2
|
+
entity_id: string;
|
|
3
|
+
authority_id: string;
|
|
4
|
+
action: string;
|
|
5
|
+
resource: string;
|
|
6
|
+
authorized: boolean;
|
|
7
|
+
time_requested: string;
|
|
8
|
+
time_evaluated: string;
|
|
9
|
+
message?: string;
|
|
10
|
+
}
|
|
11
|
+
export type TrustRegistryQueryFn = (params: {
|
|
12
|
+
entityId: string;
|
|
13
|
+
action?: string;
|
|
14
|
+
resource?: string;
|
|
15
|
+
}) => Promise<TrqpAuthorizationResponse>;
|
|
16
|
+
export declare function queryTrustRegistry(): Promise<TrqpAuthorizationResponse>;
|
|
17
|
+
/**
|
|
18
|
+
* Overrides the default TRQP query function used by every TrustBadge / useTrustRegistryQuery
|
|
19
|
+
* call that doesn't receive an explicit `queryFn`. Call once at app startup.
|
|
20
|
+
*/
|
|
21
|
+
export declare function setTrustRegistryQueryFn(fn: TrustRegistryQueryFn): void;
|
|
22
|
+
export declare function getTrustRegistryQueryFn(): TrustRegistryQueryFn;
|
|
23
|
+
type QueryStatus = 'idle' | 'loading' | 'done' | 'error';
|
|
24
|
+
export declare function useTrustRegistryQuery(entityId: string | undefined, action?: string, resource?: string, queryFn?: TrustRegistryQueryFn): {
|
|
25
|
+
status: QueryStatus;
|
|
26
|
+
result: TrqpAuthorizationResponse | null;
|
|
27
|
+
error: Error | null;
|
|
28
|
+
};
|
|
29
|
+
export {};
|
package/dist/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "c2pa-react-cawg-component",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.12",
|
|
4
4
|
"description": "A React plugin for c2pa-react-component that renders Creator Assertions Working Group (CAWG) data — identity credentials, metadata, and training permissions.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/c2pa-react-cawg-component.umd.cjs",
|
|
@@ -79,6 +79,6 @@
|
|
|
79
79
|
"vitest": "^4.1.5"
|
|
80
80
|
},
|
|
81
81
|
"dependencies": {
|
|
82
|
-
"c2pa-react-component-types": "
|
|
82
|
+
"c2pa-react-component-types": "0.1.5"
|
|
83
83
|
}
|
|
84
84
|
}
|