c2pa-react-cawg-component 0.1.12 → 0.1.14
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/c2pa-react-cawg-component.css +1 -1
- package/dist/c2pa-react-cawg-component.js +298 -141
- package/dist/c2pa-react-cawg-component.umd.cjs +1 -1
- package/dist/components/Cawg/helper/TrustBadge.d.ts +27 -1
- package/dist/components/Cawg/helper/getSignerPayload.d.ts +26 -0
- package/dist/components/Cawg/helper/trqp.d.ts +18 -3
- package/package.json +1 -1
|
@@ -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,.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}
|
|
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}.cawg-trust-icon{object-fit:cover;border-radius:4px;flex-shrink:0;width:20px;height:20px;margin-right:8px}
|
|
2
2
|
/*$vite$:1*/
|
|
@@ -38,7 +38,85 @@ var o = "<svg width=\"34\" height=\"34\" viewBox=\"0 0 34 34\" fill=\"none\" xml
|
|
|
38
38
|
if (typeof e == "object" && !Array.isArray(e) && (e = [e]), !e || e.length === 0) return "Unknown";
|
|
39
39
|
let t = e.sort((e, t) => c(e.type) - c(t.type))[0];
|
|
40
40
|
return !t || l.includes(t.type) ? "Unknown" : t.name;
|
|
41
|
-
}, d = {
|
|
41
|
+
}, d = (e) => {
|
|
42
|
+
if (e) return e.signer_payload ?? e.c2paAsset;
|
|
43
|
+
};
|
|
44
|
+
//#endregion
|
|
45
|
+
//#region src/components/Cawg/helper/trqp.ts
|
|
46
|
+
async function f() {
|
|
47
|
+
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.");
|
|
48
|
+
}
|
|
49
|
+
var p = f;
|
|
50
|
+
function m(e) {
|
|
51
|
+
p = e;
|
|
52
|
+
}
|
|
53
|
+
function h() {
|
|
54
|
+
return p;
|
|
55
|
+
}
|
|
56
|
+
function g(e, r, i, a, o, s = h()) {
|
|
57
|
+
let [c, l] = n("idle"), [u, d] = n(null), [f, p] = n(null);
|
|
58
|
+
return t(() => {
|
|
59
|
+
if (!e) {
|
|
60
|
+
l("idle"), d(null), p(null);
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
let t = !1;
|
|
64
|
+
return l("loading"), p(null), s({
|
|
65
|
+
entityId: e,
|
|
66
|
+
action: r,
|
|
67
|
+
resource: i,
|
|
68
|
+
authorityId: a,
|
|
69
|
+
trqpAuthorizationUri: o
|
|
70
|
+
}).then((e) => {
|
|
71
|
+
t || (d(e), l("done"));
|
|
72
|
+
}, (e) => {
|
|
73
|
+
t || (d(null), p(e instanceof Error ? e : Error(String(e))), l("error"));
|
|
74
|
+
}), () => {
|
|
75
|
+
t = !0;
|
|
76
|
+
};
|
|
77
|
+
}, [
|
|
78
|
+
e,
|
|
79
|
+
r,
|
|
80
|
+
i,
|
|
81
|
+
a,
|
|
82
|
+
o,
|
|
83
|
+
s
|
|
84
|
+
]), {
|
|
85
|
+
status: c,
|
|
86
|
+
result: u,
|
|
87
|
+
error: f
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
function _(e, r = h()) {
|
|
91
|
+
let [i, a] = n("idle"), [o, s] = n([]), [c, l] = n(null), u = e.filter((e) => !!e.entity_id);
|
|
92
|
+
return t(() => {
|
|
93
|
+
if (u.length === 0) {
|
|
94
|
+
a("idle"), s([]), l(null);
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
let e = !1;
|
|
98
|
+
return a("loading"), l(null), Promise.all(u.map((e) => r({
|
|
99
|
+
entityId: e.entity_id,
|
|
100
|
+
action: e.action,
|
|
101
|
+
resource: e.resource,
|
|
102
|
+
authorityId: e.authority_id,
|
|
103
|
+
trqpAuthorizationUri: e.trqp_authorization_uri
|
|
104
|
+
}))).then((t) => {
|
|
105
|
+
e || (s(t), a("done"));
|
|
106
|
+
}, (t) => {
|
|
107
|
+
e || (s([]), l(t instanceof Error ? t : Error(String(t))), a("error"));
|
|
108
|
+
}), () => {
|
|
109
|
+
e = !0;
|
|
110
|
+
};
|
|
111
|
+
}, [u.map((e) => `${e.entity_id}|${e.action ?? ""}|${e.resource ?? ""}|${e.authority_id ?? ""}|${e.trqp_authorization_uri ?? ""}`).join(","), r]), {
|
|
112
|
+
status: i,
|
|
113
|
+
results: o,
|
|
114
|
+
error: c
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
//#endregion
|
|
118
|
+
//#region src/components/Cawg/levels/L1/CAWGL1.tsx
|
|
119
|
+
var v = "Identity Unable to be Verified by Trust Registry", y = {
|
|
42
120
|
"cawg.creator": "Creator",
|
|
43
121
|
"cawg.contributor": "Contributor",
|
|
44
122
|
"cawg.editor": "Editor",
|
|
@@ -47,8 +125,8 @@ var o = "<svg width=\"34\" height=\"34\" viewBox=\"0 0 34 34\" fill=\"none\" xml
|
|
|
47
125
|
"cawg.sponsor": "Sponsor",
|
|
48
126
|
"cawg.translator": "Translator"
|
|
49
127
|
};
|
|
50
|
-
function
|
|
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 =
|
|
128
|
+
function b({ className: e, manifest: t, moreInfo: n }) {
|
|
129
|
+
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"], p = d(f), m = p?.role ?? [], { status: h, results: g } = _(p?.trust_registry ?? []), b = g.filter((e) => !e.hide), x = h === "done" && b.some((e) => !e.authorized);
|
|
52
130
|
return /* @__PURE__ */ a("div", {
|
|
53
131
|
className: `cawg-card ${e ?? ""}`,
|
|
54
132
|
children: [
|
|
@@ -79,11 +157,18 @@ function f({ className: e, manifest: t, moreInfo: n }) {
|
|
|
79
157
|
})]
|
|
80
158
|
})]
|
|
81
159
|
}),
|
|
82
|
-
|
|
160
|
+
x && /* @__PURE__ */ i("div", {
|
|
161
|
+
style: { marginTop: 12 },
|
|
162
|
+
children: /* @__PURE__ */ i("span", {
|
|
163
|
+
className: "cawg-trust-badge cawg-trust-unverified",
|
|
164
|
+
children: v
|
|
165
|
+
})
|
|
166
|
+
}),
|
|
167
|
+
m.length > 0 && /* @__PURE__ */ i("div", {
|
|
83
168
|
className: "cawg-roles",
|
|
84
|
-
children:
|
|
169
|
+
children: m.map((e) => /* @__PURE__ */ i("span", {
|
|
85
170
|
className: "cawg-role-badge",
|
|
86
|
-
children:
|
|
171
|
+
children: y[e] ?? e
|
|
87
172
|
}, e))
|
|
88
173
|
}),
|
|
89
174
|
n && /* @__PURE__ */ i("div", {
|
|
@@ -98,50 +183,8 @@ function f({ className: e, manifest: t, moreInfo: n }) {
|
|
|
98
183
|
});
|
|
99
184
|
}
|
|
100
185
|
//#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
186
|
//#region src/components/Cawg/helper/TrustBadge.tsx
|
|
144
|
-
function
|
|
187
|
+
function x(e) {
|
|
145
188
|
try {
|
|
146
189
|
return new Date(e).toLocaleDateString(void 0, {
|
|
147
190
|
year: "numeric",
|
|
@@ -152,42 +195,134 @@ function v(e) {
|
|
|
152
195
|
return e;
|
|
153
196
|
}
|
|
154
197
|
}
|
|
155
|
-
var
|
|
156
|
-
function
|
|
157
|
-
|
|
158
|
-
if (!e) return null;
|
|
159
|
-
if (s === "error") return /* @__PURE__ */ i("span", {
|
|
198
|
+
var S = "Identity Verified by Trust Registry", C = "Identity Unable to be Verified by Trust Registry";
|
|
199
|
+
function w(e, t, n, r) {
|
|
200
|
+
if (e === "error") return /* @__PURE__ */ i("span", {
|
|
160
201
|
className: "cawg-trust-badge cawg-trust-unverified",
|
|
161
|
-
title:
|
|
202
|
+
title: n?.message,
|
|
162
203
|
children: "Unable to reach trust registry"
|
|
163
204
|
});
|
|
164
|
-
if (
|
|
205
|
+
if (e !== "done" || !t) return /* @__PURE__ */ i("span", {
|
|
165
206
|
className: "cawg-trust-badge cawg-trust-pending",
|
|
166
207
|
children: "Checking trust registry…"
|
|
167
208
|
});
|
|
168
|
-
let
|
|
169
|
-
className:
|
|
170
|
-
title:
|
|
171
|
-
children:
|
|
209
|
+
let o = /* @__PURE__ */ i("span", {
|
|
210
|
+
className: t.authorized ? "cawg-trust-badge cawg-trust-verified" : "cawg-trust-badge cawg-trust-unverified",
|
|
211
|
+
title: t.authorized ? `Recognized by ${t.authority_id} · checked ${x(t.time_evaluated)}` : t.message,
|
|
212
|
+
children: t.authorized ? S : C
|
|
172
213
|
});
|
|
173
|
-
return r === "compact" ?
|
|
214
|
+
return r === "compact" ? o : /* @__PURE__ */ a("div", {
|
|
174
215
|
className: "cawg-trust-status",
|
|
175
|
-
children: [
|
|
216
|
+
children: [o, t.authorized ? /* @__PURE__ */ a("div", {
|
|
176
217
|
className: "cawg-trust-meta",
|
|
177
218
|
children: [
|
|
178
|
-
|
|
219
|
+
t.authority_id,
|
|
179
220
|
" · checked ",
|
|
180
|
-
|
|
221
|
+
x(t.time_evaluated)
|
|
181
222
|
]
|
|
182
|
-
}) :
|
|
223
|
+
}) : t.message && /* @__PURE__ */ i("div", {
|
|
183
224
|
className: "cawg-trust-message",
|
|
184
|
-
children:
|
|
225
|
+
children: t.message
|
|
226
|
+
})]
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
function T({ entityId: e, action: t, resource: n, authorityId: o, trqpAuthorizationUri: s, variant: c = "full", queryFn: l }) {
|
|
230
|
+
let { status: u, result: d, error: f } = g(e, t, n, o, s, l);
|
|
231
|
+
return !e || u === "done" && d?.hide ? null : /* @__PURE__ */ a(r, { children: [u === "done" && d?.icon && /* @__PURE__ */ i("img", {
|
|
232
|
+
src: d.icon,
|
|
233
|
+
alt: "",
|
|
234
|
+
className: "cawg-trust-icon"
|
|
235
|
+
}), w(u, d, f, c)] });
|
|
236
|
+
}
|
|
237
|
+
function E({ entry: e, variant: t = "full", showEntity: n = !1, queryFn: r }) {
|
|
238
|
+
let { status: o, result: s, error: c } = g(e.entity_id, e.action, e.resource, e.authority_id, e.trqp_authorization_uri, r);
|
|
239
|
+
return o === "done" && s?.hide ? null : /* @__PURE__ */ a("div", {
|
|
240
|
+
className: "cawg-identity-item",
|
|
241
|
+
children: [o === "done" && s?.icon && /* @__PURE__ */ i("img", {
|
|
242
|
+
src: s.icon,
|
|
243
|
+
alt: "",
|
|
244
|
+
className: "cawg-trust-icon"
|
|
245
|
+
}), /* @__PURE__ */ a("div", {
|
|
246
|
+
style: { flex: 1 },
|
|
247
|
+
children: [
|
|
248
|
+
e.authority_id && /* @__PURE__ */ a("div", {
|
|
249
|
+
className: "cawg-identity-name",
|
|
250
|
+
children: ["Authority: ", e.authority_id]
|
|
251
|
+
}),
|
|
252
|
+
n && e.entity_id && /* @__PURE__ */ a("div", {
|
|
253
|
+
className: "cawg-identity-provider",
|
|
254
|
+
children: ["Entity: ", e.entity_id]
|
|
255
|
+
}),
|
|
256
|
+
e.action && /* @__PURE__ */ a("div", {
|
|
257
|
+
className: "cawg-identity-meta",
|
|
258
|
+
children: ["Action: ", e.action]
|
|
259
|
+
}),
|
|
260
|
+
e.resource && /* @__PURE__ */ a("div", {
|
|
261
|
+
className: "cawg-identity-meta",
|
|
262
|
+
children: ["Resource: ", e.resource]
|
|
263
|
+
}),
|
|
264
|
+
e.trqp_authorization_uri && /* @__PURE__ */ i("a", {
|
|
265
|
+
href: e.trqp_authorization_uri,
|
|
266
|
+
target: "_blank",
|
|
267
|
+
rel: "noopener noreferrer",
|
|
268
|
+
className: "cawg-identity-link",
|
|
269
|
+
children: e.trqp_authorization_uri
|
|
270
|
+
}),
|
|
271
|
+
w(o, s, c, t)
|
|
272
|
+
]
|
|
185
273
|
})]
|
|
186
274
|
});
|
|
187
275
|
}
|
|
276
|
+
function D({ entries: e, variant: t = "compact", queryFn: n }) {
|
|
277
|
+
let { status: o, results: s, error: c } = _(e, n);
|
|
278
|
+
if (e.filter((e) => e.entity_id).length === 0) return null;
|
|
279
|
+
if (o === "error") return /* @__PURE__ */ i("span", {
|
|
280
|
+
className: "cawg-trust-badge cawg-trust-unverified",
|
|
281
|
+
title: c?.message,
|
|
282
|
+
children: "Unable to reach trust registry"
|
|
283
|
+
});
|
|
284
|
+
if (o !== "done") return /* @__PURE__ */ i("span", {
|
|
285
|
+
className: "cawg-trust-badge cawg-trust-pending",
|
|
286
|
+
children: "Checking trust registry…"
|
|
287
|
+
});
|
|
288
|
+
let l = s.filter((e) => !e.hide);
|
|
289
|
+
if (l.length === 0) return null;
|
|
290
|
+
let u = l.every((e) => e.authorized), d = l.filter((e) => !e.authorized), f = l.find((e) => e.icon)?.icon, p = u ? `Recognized by ${Array.from(new Set(l.map((e) => e.authority_id))).join(", ")}` : d.map((e) => e.message).filter(Boolean).join(" · ") || void 0, m = /* @__PURE__ */ i("span", {
|
|
291
|
+
className: u ? "cawg-trust-badge cawg-trust-verified" : "cawg-trust-badge cawg-trust-unverified",
|
|
292
|
+
title: p,
|
|
293
|
+
children: u ? S : C
|
|
294
|
+
});
|
|
295
|
+
return t === "compact" ? /* @__PURE__ */ a(r, { children: [f && /* @__PURE__ */ i("img", {
|
|
296
|
+
src: f,
|
|
297
|
+
alt: "",
|
|
298
|
+
className: "cawg-trust-icon"
|
|
299
|
+
}), m] }) : /* @__PURE__ */ a("div", {
|
|
300
|
+
className: "cawg-trust-status",
|
|
301
|
+
children: [
|
|
302
|
+
f && /* @__PURE__ */ i("img", {
|
|
303
|
+
src: f,
|
|
304
|
+
alt: "",
|
|
305
|
+
className: "cawg-trust-icon"
|
|
306
|
+
}),
|
|
307
|
+
m,
|
|
308
|
+
u ? /* @__PURE__ */ a("div", {
|
|
309
|
+
className: "cawg-trust-meta",
|
|
310
|
+
children: [
|
|
311
|
+
Array.from(new Set(l.map((e) => e.authority_id))).join(", "),
|
|
312
|
+
" · checked",
|
|
313
|
+
" ",
|
|
314
|
+
x(l[0].time_evaluated)
|
|
315
|
+
]
|
|
316
|
+
}) : p && /* @__PURE__ */ i("div", {
|
|
317
|
+
className: "cawg-trust-message",
|
|
318
|
+
children: p
|
|
319
|
+
})
|
|
320
|
+
]
|
|
321
|
+
});
|
|
322
|
+
}
|
|
188
323
|
//#endregion
|
|
189
324
|
//#region src/components/Cawg/levels/L2/CAWGL2.tsx
|
|
190
|
-
var
|
|
325
|
+
var O = {
|
|
191
326
|
"cawg.creator": "Creator",
|
|
192
327
|
"cawg.contributor": "Contributor",
|
|
193
328
|
"cawg.editor": "Editor",
|
|
@@ -195,27 +330,27 @@ var S = {
|
|
|
195
330
|
"cawg.publisher": "Publisher",
|
|
196
331
|
"cawg.sponsor": "Sponsor",
|
|
197
332
|
"cawg.translator": "Translator"
|
|
198
|
-
},
|
|
333
|
+
}, k = {
|
|
199
334
|
"cawg.document_verification": "ID Verified",
|
|
200
335
|
"cawg.web_site": "Website",
|
|
201
336
|
"cawg.affiliation": "Affiliation",
|
|
202
337
|
"cawg.social_media": "Social Media",
|
|
203
338
|
"cawg.crypto_wallet": "Crypto Wallet"
|
|
204
|
-
},
|
|
339
|
+
}, A = {
|
|
205
340
|
"cawg.data_mining": "Data Mining",
|
|
206
341
|
"cawg.ai_inference": "AI Inference",
|
|
207
342
|
"cawg.ai_training": "AI Training",
|
|
208
343
|
"cawg.ai_generative_training": "AI Generative Training"
|
|
209
|
-
},
|
|
344
|
+
}, j = {
|
|
210
345
|
allowed: "cawg-use-badge cawg-use-allowed",
|
|
211
346
|
notAllowed: "cawg-use-badge cawg-use-not-allowed",
|
|
212
347
|
constrained: "cawg-use-badge cawg-use-constrained"
|
|
213
|
-
},
|
|
348
|
+
}, M = {
|
|
214
349
|
allowed: "Allowed",
|
|
215
350
|
notAllowed: "Not Allowed",
|
|
216
351
|
constrained: "Constrained"
|
|
217
352
|
};
|
|
218
|
-
function
|
|
353
|
+
function N(e) {
|
|
219
354
|
try {
|
|
220
355
|
return new Date(e).toLocaleDateString(void 0, {
|
|
221
356
|
year: "numeric",
|
|
@@ -226,11 +361,11 @@ function D(e) {
|
|
|
226
361
|
return e;
|
|
227
362
|
}
|
|
228
363
|
}
|
|
229
|
-
function
|
|
364
|
+
function P(e) {
|
|
230
365
|
return Array.isArray(e) ? e.filter((e) => typeof e == "string").join(", ") : typeof e == "string" ? e : "";
|
|
231
366
|
}
|
|
232
|
-
function
|
|
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),
|
|
367
|
+
function F({ className: e, manifest: t, moreInfo: n }) {
|
|
368
|
+
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), f = t.assertions?.["cawg.identity"], p = d(f), m = p?.role ?? [], h = f?.verifiedIdentities ?? [], g = p?.trust_registry ?? [], _ = t.assertions?.["cawg.training-mining"]?.entries ?? {}, v = t.assertions?.["cawg.metadata"], y = P(v?.["dc:creator"]), b = v?.["xmp:CreateDate"];
|
|
234
369
|
return /* @__PURE__ */ a("div", {
|
|
235
370
|
className: `cawg-card ${e ?? ""}`,
|
|
236
371
|
children: [
|
|
@@ -261,14 +396,14 @@ function k({ className: e, manifest: t, moreInfo: n }) {
|
|
|
261
396
|
})]
|
|
262
397
|
})]
|
|
263
398
|
}),
|
|
264
|
-
|
|
399
|
+
m.length > 0 && /* @__PURE__ */ i("div", {
|
|
265
400
|
className: "cawg-roles",
|
|
266
|
-
children:
|
|
401
|
+
children: m.map((e) => /* @__PURE__ */ i("span", {
|
|
267
402
|
className: "cawg-role-badge",
|
|
268
|
-
children:
|
|
403
|
+
children: O[e] ?? e
|
|
269
404
|
}, e))
|
|
270
405
|
}),
|
|
271
|
-
|
|
406
|
+
h.length > 0 && /* @__PURE__ */ a(r, { children: [
|
|
272
407
|
/* @__PURE__ */ i("div", { className: "cawg-divider" }),
|
|
273
408
|
/* @__PURE__ */ a("div", {
|
|
274
409
|
className: "cawg-section-title",
|
|
@@ -278,16 +413,14 @@ function k({ className: e, manifest: t, moreInfo: n }) {
|
|
|
278
413
|
justifyContent: "space-between",
|
|
279
414
|
gap: 8
|
|
280
415
|
},
|
|
281
|
-
children: [/* @__PURE__ */ i("span", { children: "Identity" }), /* @__PURE__ */ i(
|
|
282
|
-
|
|
283
|
-
action: "issue",
|
|
284
|
-
resource: "cawg.identity",
|
|
416
|
+
children: [/* @__PURE__ */ i("span", { children: "Identity" }), g.length > 0 && /* @__PURE__ */ i(D, {
|
|
417
|
+
entries: g,
|
|
285
418
|
variant: "compact"
|
|
286
419
|
})]
|
|
287
420
|
}),
|
|
288
421
|
/* @__PURE__ */ i("div", {
|
|
289
422
|
className: "cawg-identity-list",
|
|
290
|
-
children:
|
|
423
|
+
children: h.map((e, t) => {
|
|
291
424
|
let n = e.type, r = e.name ?? e.username, o = e.provider;
|
|
292
425
|
return /* @__PURE__ */ i("div", {
|
|
293
426
|
className: "cawg-identity-item",
|
|
@@ -296,7 +429,7 @@ function k({ className: e, manifest: t, moreInfo: n }) {
|
|
|
296
429
|
children: [
|
|
297
430
|
/* @__PURE__ */ i("div", {
|
|
298
431
|
className: "cawg-identity-type-label",
|
|
299
|
-
children:
|
|
432
|
+
children: k[n] ?? n
|
|
300
433
|
}),
|
|
301
434
|
r && /* @__PURE__ */ i("div", {
|
|
302
435
|
className: "cawg-identity-name",
|
|
@@ -312,7 +445,21 @@ function k({ className: e, manifest: t, moreInfo: n }) {
|
|
|
312
445
|
})
|
|
313
446
|
})
|
|
314
447
|
] }),
|
|
315
|
-
|
|
448
|
+
g.length > 0 && /* @__PURE__ */ a(r, { children: [
|
|
449
|
+
/* @__PURE__ */ i("div", { className: "cawg-divider" }),
|
|
450
|
+
/* @__PURE__ */ i("div", {
|
|
451
|
+
className: "cawg-section-title",
|
|
452
|
+
children: "Trust Registries"
|
|
453
|
+
}),
|
|
454
|
+
/* @__PURE__ */ i("div", {
|
|
455
|
+
className: "cawg-identity-list",
|
|
456
|
+
children: g.map((e, t) => /* @__PURE__ */ i(E, {
|
|
457
|
+
entry: e,
|
|
458
|
+
variant: "compact"
|
|
459
|
+
}, t))
|
|
460
|
+
})
|
|
461
|
+
] }),
|
|
462
|
+
Object.keys(_).length > 0 && /* @__PURE__ */ a(r, { children: [
|
|
316
463
|
/* @__PURE__ */ i("div", { className: "cawg-divider" }),
|
|
317
464
|
/* @__PURE__ */ i("div", {
|
|
318
465
|
className: "cawg-section-title",
|
|
@@ -320,42 +467,42 @@ function k({ className: e, manifest: t, moreInfo: n }) {
|
|
|
320
467
|
}),
|
|
321
468
|
/* @__PURE__ */ i("div", {
|
|
322
469
|
className: "cawg-training-list",
|
|
323
|
-
children: Object.entries(
|
|
470
|
+
children: Object.entries(_).map(([e, t]) => /* @__PURE__ */ a("div", {
|
|
324
471
|
className: "cawg-training-item",
|
|
325
472
|
children: [/* @__PURE__ */ i("span", {
|
|
326
473
|
className: "cawg-training-label",
|
|
327
|
-
children:
|
|
474
|
+
children: A[e] ?? e
|
|
328
475
|
}), /* @__PURE__ */ i("span", {
|
|
329
|
-
className:
|
|
330
|
-
children:
|
|
476
|
+
className: j[t.use] ?? "cawg-use-badge",
|
|
477
|
+
children: M[t.use] ?? t.use
|
|
331
478
|
})]
|
|
332
479
|
}, e))
|
|
333
480
|
})
|
|
334
481
|
] }),
|
|
335
|
-
(
|
|
482
|
+
(y || b) && /* @__PURE__ */ a(r, { children: [
|
|
336
483
|
/* @__PURE__ */ i("div", { className: "cawg-divider" }),
|
|
337
484
|
/* @__PURE__ */ i("div", {
|
|
338
485
|
className: "cawg-section-title",
|
|
339
486
|
children: "Creator"
|
|
340
487
|
}),
|
|
341
|
-
|
|
488
|
+
y && /* @__PURE__ */ a("div", {
|
|
342
489
|
className: "cawg-key-value",
|
|
343
490
|
children: [/* @__PURE__ */ i("div", {
|
|
344
491
|
className: "cawg-key-value-label",
|
|
345
492
|
children: "Name"
|
|
346
493
|
}), /* @__PURE__ */ i("div", {
|
|
347
494
|
className: "cawg-key-value-value",
|
|
348
|
-
children:
|
|
495
|
+
children: y
|
|
349
496
|
})]
|
|
350
497
|
}),
|
|
351
|
-
|
|
498
|
+
b && /* @__PURE__ */ a("div", {
|
|
352
499
|
className: "cawg-key-value",
|
|
353
500
|
children: [/* @__PURE__ */ i("div", {
|
|
354
501
|
className: "cawg-key-value-label",
|
|
355
502
|
children: "Date Created"
|
|
356
503
|
}), /* @__PURE__ */ i("div", {
|
|
357
504
|
className: "cawg-key-value-value",
|
|
358
|
-
children:
|
|
505
|
+
children: N(b)
|
|
359
506
|
})]
|
|
360
507
|
})
|
|
361
508
|
] }),
|
|
@@ -372,7 +519,7 @@ function k({ className: e, manifest: t, moreInfo: n }) {
|
|
|
372
519
|
}
|
|
373
520
|
//#endregion
|
|
374
521
|
//#region src/components/Cawg/levels/L3/CAWGL3.tsx
|
|
375
|
-
var
|
|
522
|
+
var I = {
|
|
376
523
|
"cawg.creator": "Creator",
|
|
377
524
|
"cawg.contributor": "Contributor",
|
|
378
525
|
"cawg.editor": "Editor",
|
|
@@ -380,31 +527,31 @@ var A = {
|
|
|
380
527
|
"cawg.publisher": "Publisher",
|
|
381
528
|
"cawg.sponsor": "Sponsor",
|
|
382
529
|
"cawg.translator": "Translator"
|
|
383
|
-
},
|
|
530
|
+
}, L = {
|
|
384
531
|
"cawg.document_verification": "ID Verified",
|
|
385
532
|
"cawg.web_site": "Website",
|
|
386
533
|
"cawg.affiliation": "Affiliation",
|
|
387
534
|
"cawg.social_media": "Social Media",
|
|
388
535
|
"cawg.crypto_wallet": "Crypto Wallet"
|
|
389
|
-
},
|
|
536
|
+
}, R = {
|
|
390
537
|
"cawg.data_mining": "Data Mining",
|
|
391
538
|
"cawg.ai_inference": "AI Inference",
|
|
392
539
|
"cawg.ai_training": "AI Training",
|
|
393
540
|
"cawg.ai_generative_training": "AI Generative Training"
|
|
394
|
-
},
|
|
541
|
+
}, z = {
|
|
395
542
|
allowed: "cawg-use-badge cawg-use-allowed",
|
|
396
543
|
notAllowed: "cawg-use-badge cawg-use-not-allowed",
|
|
397
544
|
constrained: "cawg-use-badge cawg-use-constrained"
|
|
398
|
-
},
|
|
545
|
+
}, B = {
|
|
399
546
|
allowed: "Allowed",
|
|
400
547
|
notAllowed: "Not Allowed",
|
|
401
548
|
constrained: "Constrained"
|
|
402
|
-
},
|
|
549
|
+
}, V = {
|
|
403
550
|
"cawg.identity_claims_aggregation": "Identity Claims Aggregation",
|
|
404
551
|
"cawg.x509.cose": "X.509 Certificate",
|
|
405
552
|
"cawg.verifiable_credential_binding": "Verifiable Credential"
|
|
406
553
|
};
|
|
407
|
-
function
|
|
554
|
+
function H(e) {
|
|
408
555
|
try {
|
|
409
556
|
return new Date(e).toLocaleDateString(void 0, {
|
|
410
557
|
year: "numeric",
|
|
@@ -415,11 +562,11 @@ function I(e) {
|
|
|
415
562
|
return e;
|
|
416
563
|
}
|
|
417
564
|
}
|
|
418
|
-
function
|
|
419
|
-
return e == null ? "" : typeof e == "string" || typeof e == "number" || typeof e == "boolean" ? String(e) : Array.isArray(e) ? e.map((e) =>
|
|
565
|
+
function U(e) {
|
|
566
|
+
return e == null ? "" : typeof e == "string" || typeof e == "number" || typeof e == "boolean" ? String(e) : Array.isArray(e) ? e.map((e) => U(e)).filter(Boolean).join(", ") : typeof e == "object" ? Object.entries(e).filter(([e]) => !e.startsWith("@")).map(([e, t]) => `${e}: ${U(t)}`).join("; ") : String(e);
|
|
420
567
|
}
|
|
421
|
-
function
|
|
422
|
-
let o = t.title, c = t.claimGenerator ?? t.claimGeneratorInfo?.[0]?.name ?? "Unknown", l = u(t.assertions?.["cawg.identity"]?.verifiedIdentities),
|
|
568
|
+
function W({ className: e, manifest: t, moreInfo: n }) {
|
|
569
|
+
let o = t.title, c = t.claimGenerator ?? t.claimGeneratorInfo?.[0]?.name ?? "Unknown", l = u(t.assertions?.["cawg.identity"]?.verifiedIdentities), f = c.split(" ").filter(Boolean).map((e) => e[0].toUpperCase()).join("") || "?", p = t.assertions?.["cawg.identity"], m = d(p), h = m?.role ?? [], g = p?.verifiedIdentities ?? [], _ = m?.sig_type, v = p?.issuer, y = m?.trust_registry ?? [], b = t.assertions?.["cawg.training-mining"]?.entries ?? {}, x = t.assertions?.["cawg.metadata"], S = x ? Object.entries(x).filter(([e]) => !e.startsWith("@")) : [];
|
|
423
570
|
return /* @__PURE__ */ a("div", {
|
|
424
571
|
className: `cawg-card ${e ?? ""}`,
|
|
425
572
|
children: [
|
|
@@ -434,7 +581,7 @@ function R({ className: e, manifest: t, moreInfo: n }) {
|
|
|
434
581
|
className: "cawg-square",
|
|
435
582
|
children: /* @__PURE__ */ i("span", {
|
|
436
583
|
className: "cawg-logo-text",
|
|
437
|
-
children:
|
|
584
|
+
children: f
|
|
438
585
|
})
|
|
439
586
|
}), /* @__PURE__ */ a("div", {
|
|
440
587
|
style: {
|
|
@@ -450,55 +597,53 @@ function R({ className: e, manifest: t, moreInfo: n }) {
|
|
|
450
597
|
})]
|
|
451
598
|
})]
|
|
452
599
|
}),
|
|
453
|
-
|
|
600
|
+
h.length > 0 && /* @__PURE__ */ i("div", {
|
|
454
601
|
className: "cawg-roles",
|
|
455
|
-
children:
|
|
602
|
+
children: h.map((e) => /* @__PURE__ */ i("span", {
|
|
456
603
|
className: "cawg-role-badge",
|
|
457
|
-
children:
|
|
604
|
+
children: I[e] ?? e
|
|
458
605
|
}, e))
|
|
459
606
|
}),
|
|
460
|
-
|
|
607
|
+
p && /* @__PURE__ */ a(r, { children: [
|
|
461
608
|
/* @__PURE__ */ i("div", { className: "cawg-divider" }),
|
|
462
609
|
/* @__PURE__ */ i("div", {
|
|
463
610
|
className: "cawg-section-title",
|
|
464
611
|
children: "Identity Assertion"
|
|
465
612
|
}),
|
|
466
|
-
|
|
613
|
+
_ && /* @__PURE__ */ a("div", {
|
|
467
614
|
className: "cawg-key-value",
|
|
468
615
|
children: [/* @__PURE__ */ i("div", {
|
|
469
616
|
className: "cawg-key-value-label",
|
|
470
617
|
children: "Credential Type"
|
|
471
618
|
}), /* @__PURE__ */ i("div", {
|
|
472
619
|
className: "cawg-key-value-value",
|
|
473
|
-
children:
|
|
620
|
+
children: V[_] ?? _
|
|
474
621
|
})]
|
|
475
622
|
}),
|
|
476
|
-
|
|
623
|
+
v && /* @__PURE__ */ a("div", {
|
|
477
624
|
className: "cawg-key-value",
|
|
478
625
|
children: [/* @__PURE__ */ i("div", {
|
|
479
626
|
className: "cawg-key-value-label",
|
|
480
627
|
children: "Issuer"
|
|
481
628
|
}), /* @__PURE__ */ i("div", {
|
|
482
629
|
className: "cawg-key-value-value",
|
|
483
|
-
children:
|
|
630
|
+
children: v
|
|
484
631
|
})]
|
|
485
632
|
}),
|
|
486
|
-
/* @__PURE__ */ a("div", {
|
|
633
|
+
y.length > 0 && /* @__PURE__ */ a("div", {
|
|
487
634
|
className: "cawg-key-value",
|
|
488
635
|
children: [/* @__PURE__ */ i("div", {
|
|
489
636
|
className: "cawg-key-value-label",
|
|
490
637
|
children: "Trust Registry"
|
|
491
|
-
}), /* @__PURE__ */ i(
|
|
492
|
-
|
|
493
|
-
action: "issue",
|
|
494
|
-
resource: "cawg.identity",
|
|
638
|
+
}), /* @__PURE__ */ i(D, {
|
|
639
|
+
entries: y,
|
|
495
640
|
variant: "full"
|
|
496
641
|
})]
|
|
497
642
|
}),
|
|
498
|
-
|
|
643
|
+
g.length > 0 && /* @__PURE__ */ i("div", {
|
|
499
644
|
className: "cawg-identity-list",
|
|
500
645
|
style: { marginTop: 12 },
|
|
501
|
-
children:
|
|
646
|
+
children: g.map((e, t) => {
|
|
502
647
|
let n = e.type, r = e.name ?? e.username ?? e.address, o = e.provider, s = e.uri, c = e.verifiedAt;
|
|
503
648
|
return /* @__PURE__ */ i("div", {
|
|
504
649
|
className: "cawg-identity-item",
|
|
@@ -507,7 +652,7 @@ function R({ className: e, manifest: t, moreInfo: n }) {
|
|
|
507
652
|
children: [
|
|
508
653
|
/* @__PURE__ */ i("div", {
|
|
509
654
|
className: "cawg-identity-type-label",
|
|
510
|
-
children:
|
|
655
|
+
children: L[n] ?? n
|
|
511
656
|
}),
|
|
512
657
|
r && /* @__PURE__ */ i("div", {
|
|
513
658
|
className: "cawg-identity-name",
|
|
@@ -526,15 +671,27 @@ function R({ className: e, manifest: t, moreInfo: n }) {
|
|
|
526
671
|
}),
|
|
527
672
|
c && /* @__PURE__ */ a("div", {
|
|
528
673
|
className: "cawg-identity-meta",
|
|
529
|
-
children: ["Verified ",
|
|
674
|
+
children: ["Verified ", H(c)]
|
|
530
675
|
})
|
|
531
676
|
]
|
|
532
677
|
})
|
|
533
678
|
}, t);
|
|
534
679
|
})
|
|
535
|
-
})
|
|
680
|
+
}),
|
|
681
|
+
y.length > 0 && /* @__PURE__ */ a(r, { children: [/* @__PURE__ */ i("div", {
|
|
682
|
+
className: "cawg-section-title",
|
|
683
|
+
style: { marginTop: 16 },
|
|
684
|
+
children: "Trust Registries"
|
|
685
|
+
}), /* @__PURE__ */ i("div", {
|
|
686
|
+
className: "cawg-identity-list",
|
|
687
|
+
children: y.map((e, t) => /* @__PURE__ */ i(E, {
|
|
688
|
+
entry: e,
|
|
689
|
+
variant: "full",
|
|
690
|
+
showEntity: !0
|
|
691
|
+
}, t))
|
|
692
|
+
})] })
|
|
536
693
|
] }),
|
|
537
|
-
Object.keys(
|
|
694
|
+
Object.keys(b).length > 0 && /* @__PURE__ */ a(r, { children: [
|
|
538
695
|
/* @__PURE__ */ i("div", { className: "cawg-divider" }),
|
|
539
696
|
/* @__PURE__ */ i("div", {
|
|
540
697
|
className: "cawg-section-title",
|
|
@@ -542,7 +699,7 @@ function R({ className: e, manifest: t, moreInfo: n }) {
|
|
|
542
699
|
}),
|
|
543
700
|
/* @__PURE__ */ i("div", {
|
|
544
701
|
className: "cawg-training-list",
|
|
545
|
-
children: Object.entries(
|
|
702
|
+
children: Object.entries(b).map(([e, t]) => /* @__PURE__ */ a("div", {
|
|
546
703
|
className: "cawg-training-item",
|
|
547
704
|
style: {
|
|
548
705
|
flexDirection: "column",
|
|
@@ -556,10 +713,10 @@ function R({ className: e, manifest: t, moreInfo: n }) {
|
|
|
556
713
|
},
|
|
557
714
|
children: [/* @__PURE__ */ i("span", {
|
|
558
715
|
className: "cawg-training-label",
|
|
559
|
-
children:
|
|
716
|
+
children: R[e] ?? e
|
|
560
717
|
}), /* @__PURE__ */ i("span", {
|
|
561
|
-
className:
|
|
562
|
-
children:
|
|
718
|
+
className: z[t.use] ?? "cawg-use-badge",
|
|
719
|
+
children: B[t.use] ?? t.use
|
|
563
720
|
})]
|
|
564
721
|
}), t.constraint_info && /* @__PURE__ */ i("div", {
|
|
565
722
|
className: "cawg-constraint-info",
|
|
@@ -568,14 +725,14 @@ function R({ className: e, manifest: t, moreInfo: n }) {
|
|
|
568
725
|
}, e))
|
|
569
726
|
})
|
|
570
727
|
] }),
|
|
571
|
-
|
|
728
|
+
S.length > 0 && /* @__PURE__ */ a(r, { children: [
|
|
572
729
|
/* @__PURE__ */ i("div", { className: "cawg-divider" }),
|
|
573
730
|
/* @__PURE__ */ i("div", {
|
|
574
731
|
className: "cawg-section-title",
|
|
575
732
|
children: "Metadata"
|
|
576
733
|
}),
|
|
577
|
-
|
|
578
|
-
let n =
|
|
734
|
+
S.map(([e, t]) => {
|
|
735
|
+
let n = U(t);
|
|
579
736
|
return n ? /* @__PURE__ */ a("div", {
|
|
580
737
|
className: "cawg-key-value",
|
|
581
738
|
children: [/* @__PURE__ */ i("div", {
|
|
@@ -601,7 +758,7 @@ function R({ className: e, manifest: t, moreInfo: n }) {
|
|
|
601
758
|
}
|
|
602
759
|
//#endregion
|
|
603
760
|
//#region src/components/Cawg/Cawg.tsx
|
|
604
|
-
function
|
|
761
|
+
function G(e) {
|
|
605
762
|
return {
|
|
606
763
|
id: e.id ?? "",
|
|
607
764
|
title: e.title ?? "",
|
|
@@ -623,26 +780,26 @@ function z(e) {
|
|
|
623
780
|
ingredients: e.ingredients ?? []
|
|
624
781
|
};
|
|
625
782
|
}
|
|
626
|
-
var
|
|
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] :
|
|
783
|
+
var K = ({ manifest: t, entry: n, level: r, className: a }) => {
|
|
784
|
+
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] : G(n);
|
|
628
785
|
if (!s || !(s.assertions?.["cawg.identity"] != null || s.assertions?.["cawg.training-mining"] != null || s.assertions?.["cawg.metadata"] != null)) return null;
|
|
629
786
|
let [c, l] = e.useState(r || 1);
|
|
630
787
|
switch (c) {
|
|
631
|
-
case 1: return /* @__PURE__ */ i(
|
|
788
|
+
case 1: return /* @__PURE__ */ i(b, {
|
|
632
789
|
className: a,
|
|
633
790
|
manifest: s,
|
|
634
791
|
moreInfo: () => {
|
|
635
792
|
l(2);
|
|
636
793
|
}
|
|
637
794
|
});
|
|
638
|
-
case 2: return /* @__PURE__ */ i(
|
|
795
|
+
case 2: return /* @__PURE__ */ i(F, {
|
|
639
796
|
className: a,
|
|
640
797
|
manifest: s,
|
|
641
798
|
moreInfo: () => {
|
|
642
799
|
l(3);
|
|
643
800
|
}
|
|
644
801
|
});
|
|
645
|
-
case 3: return /* @__PURE__ */ i(
|
|
802
|
+
case 3: return /* @__PURE__ */ i(W, {
|
|
646
803
|
className: a,
|
|
647
804
|
manifest: s,
|
|
648
805
|
moreInfo: () => {
|
|
@@ -652,7 +809,7 @@ var B = ({ manifest: t, entry: n, level: r, className: a }) => {
|
|
|
652
809
|
}
|
|
653
810
|
return /* @__PURE__ */ i("div", { children: "Level Of Detail Not Selected" });
|
|
654
811
|
};
|
|
655
|
-
|
|
812
|
+
K.knownAssertions = [
|
|
656
813
|
"cawg.identity",
|
|
657
814
|
"cawg.training-mining",
|
|
658
815
|
"cawg.metadata",
|
|
@@ -670,4 +827,4 @@ B.knownAssertions = [
|
|
|
670
827
|
"cawg.crypto_wallet"
|
|
671
828
|
];
|
|
672
829
|
//#endregion
|
|
673
|
-
export {
|
|
830
|
+
export { K as CAWGManifest, T as TrustBadge, E as TrustRegistryRow, D as TrustRegistrySummaryBadge, h as getTrustRegistryQueryFn, f as queryTrustRegistry, m as setTrustRegistryQueryFn, g as useTrustRegistryQuery, _ as useTrustRegistrySummary };
|
|
@@ -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=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});
|
|
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=e=>{if(e)return e.signer_payload??e.c2paAsset};async function g(){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 _=g;function v(e){_=e}function y(){return _}function b(e,n,r,i,a,o=y()){let[s,c]=(0,t.useState)(`idle`),[l,u]=(0,t.useState)(null),[d,f]=(0,t.useState)(null);return(0,t.useEffect)(()=>{if(!e){c(`idle`),u(null),f(null);return}let t=!1;return c(`loading`),f(null),o({entityId:e,action:n,resource:r,authorityId:i,trqpAuthorizationUri:a}).then(e=>{t||(u(e),c(`done`))},e=>{t||(u(null),f(e instanceof Error?e:Error(String(e))),c(`error`))}),()=>{t=!0}},[e,n,r,i,a,o]),{status:s,result:l,error:d}}function x(e,n=y()){let[r,i]=(0,t.useState)(`idle`),[a,o]=(0,t.useState)([]),[s,c]=(0,t.useState)(null),l=e.filter(e=>!!e.entity_id);return(0,t.useEffect)(()=>{if(l.length===0){i(`idle`),o([]),c(null);return}let e=!1;return i(`loading`),c(null),Promise.all(l.map(e=>n({entityId:e.entity_id,action:e.action,resource:e.resource,authorityId:e.authority_id,trqpAuthorizationUri:e.trqp_authorization_uri}))).then(t=>{e||(o(t),i(`done`))},t=>{e||(o([]),c(t instanceof Error?t:Error(String(t))),i(`error`))}),()=>{e=!0}},[l.map(e=>`${e.entity_id}|${e.action??``}|${e.resource??``}|${e.authority_id??``}|${e.trqp_authorization_uri??``}`).join(`,`),n]),{status:r,results:a,error:s}}var S=`Identity Unable to be Verified by Trust Registry`,C={"cawg.creator":`Creator`,"cawg.contributor":`Contributor`,"cawg.editor":`Editor`,"cawg.producer":`Producer`,"cawg.publisher":`Publisher`,"cawg.sponsor":`Sponsor`,"cawg.translator":`Translator`};function w({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=h(c),u=l?.role??[],{status:f,results:p}=x(l?.trust_registry??[]),g=p.filter(e=>!e.hide),_=f===`done`&&g.some(e=>!e.authorized);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})]})]}),_&&(0,n.jsx)(`div`,{style:{marginTop:12},children:(0,n.jsx)(`span`,{className:`cawg-trust-badge cawg-trust-unverified`,children:S})}),u.length>0&&(0,n.jsx)(`div`,{className:`cawg-roles`,children:u.map(e=>(0,n.jsx)(`span`,{className:`cawg-role-badge`,children:C[e]??e},e))}),r&&(0,n.jsx)(`div`,{style:{marginTop:16},children:(0,n.jsx)(`button`,{onClick:r,className:`cawg-button`,children:`More Info`})})]})}function T(e){try{return new Date(e).toLocaleDateString(void 0,{year:`numeric`,month:`long`,day:`numeric`})}catch{return e}}var E=`Identity Verified by Trust Registry`,D=`Identity Unable to be Verified by Trust Registry`;function O(e,t,r,i){if(e===`error`)return(0,n.jsx)(`span`,{className:`cawg-trust-badge cawg-trust-unverified`,title:r?.message,children:`Unable to reach trust registry`});if(e!==`done`||!t)return(0,n.jsx)(`span`,{className:`cawg-trust-badge cawg-trust-pending`,children:`Checking trust registry…`});let a=(0,n.jsx)(`span`,{className:t.authorized?`cawg-trust-badge cawg-trust-verified`:`cawg-trust-badge cawg-trust-unverified`,title:t.authorized?`Recognized by ${t.authority_id} · checked ${T(t.time_evaluated)}`:t.message,children:t.authorized?E:D});return i===`compact`?a:(0,n.jsxs)(`div`,{className:`cawg-trust-status`,children:[a,t.authorized?(0,n.jsxs)(`div`,{className:`cawg-trust-meta`,children:[t.authority_id,` · checked `,T(t.time_evaluated)]}):t.message&&(0,n.jsx)(`div`,{className:`cawg-trust-message`,children:t.message})]})}function k({entityId:e,action:t,resource:r,authorityId:i,trqpAuthorizationUri:a,variant:o=`full`,queryFn:s}){let{status:c,result:l,error:u}=b(e,t,r,i,a,s);return!e||c===`done`&&l?.hide?null:(0,n.jsxs)(n.Fragment,{children:[c===`done`&&l?.icon&&(0,n.jsx)(`img`,{src:l.icon,alt:``,className:`cawg-trust-icon`}),O(c,l,u,o)]})}function A({entry:e,variant:t=`full`,showEntity:r=!1,queryFn:i}){let{status:a,result:o,error:s}=b(e.entity_id,e.action,e.resource,e.authority_id,e.trqp_authorization_uri,i);return a===`done`&&o?.hide?null:(0,n.jsxs)(`div`,{className:`cawg-identity-item`,children:[a===`done`&&o?.icon&&(0,n.jsx)(`img`,{src:o.icon,alt:``,className:`cawg-trust-icon`}),(0,n.jsxs)(`div`,{style:{flex:1},children:[e.authority_id&&(0,n.jsxs)(`div`,{className:`cawg-identity-name`,children:[`Authority: `,e.authority_id]}),r&&e.entity_id&&(0,n.jsxs)(`div`,{className:`cawg-identity-provider`,children:[`Entity: `,e.entity_id]}),e.action&&(0,n.jsxs)(`div`,{className:`cawg-identity-meta`,children:[`Action: `,e.action]}),e.resource&&(0,n.jsxs)(`div`,{className:`cawg-identity-meta`,children:[`Resource: `,e.resource]}),e.trqp_authorization_uri&&(0,n.jsx)(`a`,{href:e.trqp_authorization_uri,target:`_blank`,rel:`noopener noreferrer`,className:`cawg-identity-link`,children:e.trqp_authorization_uri}),O(a,o,s,t)]})]})}function j({entries:e,variant:t=`compact`,queryFn:r}){let{status:i,results:a,error:o}=x(e,r);if(e.filter(e=>e.entity_id).length===0)return null;if(i===`error`)return(0,n.jsx)(`span`,{className:`cawg-trust-badge cawg-trust-unverified`,title:o?.message,children:`Unable to reach trust registry`});if(i!==`done`)return(0,n.jsx)(`span`,{className:`cawg-trust-badge cawg-trust-pending`,children:`Checking trust registry…`});let s=a.filter(e=>!e.hide);if(s.length===0)return null;let c=s.every(e=>e.authorized),l=s.filter(e=>!e.authorized),u=s.find(e=>e.icon)?.icon,d=c?`Recognized by ${Array.from(new Set(s.map(e=>e.authority_id))).join(`, `)}`:l.map(e=>e.message).filter(Boolean).join(` · `)||void 0,f=(0,n.jsx)(`span`,{className:c?`cawg-trust-badge cawg-trust-verified`:`cawg-trust-badge cawg-trust-unverified`,title:d,children:c?E:D});return t===`compact`?(0,n.jsxs)(n.Fragment,{children:[u&&(0,n.jsx)(`img`,{src:u,alt:``,className:`cawg-trust-icon`}),f]}):(0,n.jsxs)(`div`,{className:`cawg-trust-status`,children:[u&&(0,n.jsx)(`img`,{src:u,alt:``,className:`cawg-trust-icon`}),f,c?(0,n.jsxs)(`div`,{className:`cawg-trust-meta`,children:[Array.from(new Set(s.map(e=>e.authority_id))).join(`, `),` · checked`,` `,T(s[0].time_evaluated)]}):d&&(0,n.jsx)(`div`,{className:`cawg-trust-message`,children:d})]})}var M={"cawg.creator":`Creator`,"cawg.contributor":`Contributor`,"cawg.editor":`Editor`,"cawg.producer":`Producer`,"cawg.publisher":`Publisher`,"cawg.sponsor":`Sponsor`,"cawg.translator":`Translator`},N={"cawg.document_verification":`ID Verified`,"cawg.web_site":`Website`,"cawg.affiliation":`Affiliation`,"cawg.social_media":`Social Media`,"cawg.crypto_wallet":`Crypto Wallet`},P={"cawg.data_mining":`Data Mining`,"cawg.ai_inference":`AI Inference`,"cawg.ai_training":`AI Training`,"cawg.ai_generative_training":`AI Generative Training`},F={allowed:`cawg-use-badge cawg-use-allowed`,notAllowed:`cawg-use-badge cawg-use-not-allowed`,constrained:`cawg-use-badge cawg-use-constrained`},I={allowed:`Allowed`,notAllowed:`Not Allowed`,constrained:`Constrained`};function L(e){try{return new Date(e).toLocaleDateString(void 0,{year:`numeric`,month:`long`,day:`numeric`})}catch{return e}}function R(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`).join(`, `):typeof e==`string`?e:``}function z({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=h(s),l=c?.role??[],u=s?.verifiedIdentities??[],f=c?.trust_registry??[],p=t.assertions?.[`cawg.training-mining`]?.entries??{},g=t.assertions?.[`cawg.metadata`],_=R(g?.[`dc:creator`]),v=g?.[`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})]})]}),l.length>0&&(0,n.jsx)(`div`,{className:`cawg-roles`,children:l.map(e=>(0,n.jsx)(`span`,{className:`cawg-role-badge`,children:M[e]??e},e))}),u.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`}),f.length>0&&(0,n.jsx)(j,{entries:f,variant:`compact`})]}),(0,n.jsx)(`div`,{className:`cawg-identity-list`,children:u.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:N[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)})})]}),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:`Trust Registries`}),(0,n.jsx)(`div`,{className:`cawg-identity-list`,children:f.map((e,t)=>(0,n.jsx)(A,{entry:e,variant:`compact`},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`,children:[(0,n.jsx)(`span`,{className:`cawg-training-label`,children:P[e]??e}),(0,n.jsx)(`span`,{className:F[t.use]??`cawg-use-badge`,children:I[t.use]??t.use})]},e))})]}),(_||v)&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`div`,{className:`cawg-divider`}),(0,n.jsx)(`div`,{className:`cawg-section-title`,children:`Creator`}),_&&(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:_})]}),v&&(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:L(v)})]})]}),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`},V={"cawg.document_verification":`ID Verified`,"cawg.web_site":`Website`,"cawg.affiliation":`Affiliation`,"cawg.social_media":`Social Media`,"cawg.crypto_wallet":`Crypto Wallet`},H={"cawg.data_mining":`Data Mining`,"cawg.ai_inference":`AI Inference`,"cawg.ai_training":`AI Training`,"cawg.ai_generative_training":`AI Generative Training`},U={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`},G={"cawg.identity_claims_aggregation":`Identity Claims Aggregation`,"cawg.x509.cose":`X.509 Certificate`,"cawg.verifiable_credential_binding":`Verifiable Credential`};function K(e){try{return new Date(e).toLocaleDateString(void 0,{year:`numeric`,month:`long`,day:`numeric`})}catch{return e}}function q(e){return e==null?``:typeof e==`string`||typeof e==`number`||typeof e==`boolean`?String(e):Array.isArray(e)?e.map(e=>q(e)).filter(Boolean).join(`, `):typeof e==`object`?Object.entries(e).filter(([e])=>!e.startsWith(`@`)).map(([e,t])=>`${e}: ${q(t)}`).join(`; `):String(e)}function J({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=h(c),u=l?.role??[],f=c?.verifiedIdentities??[],p=l?.sig_type,g=c?.issuer,_=l?.trust_registry??[],v=t.assertions?.[`cawg.training-mining`]?.entries??{},y=t.assertions?.[`cawg.metadata`],b=y?Object.entries(y).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})]})]}),u.length>0&&(0,n.jsx)(`div`,{className:`cawg-roles`,children:u.map(e=>(0,n.jsx)(`span`,{className:`cawg-role-badge`,children:B[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`}),p&&(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:G[p]??p})]}),g&&(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:g})]}),_.length>0&&(0,n.jsxs)(`div`,{className:`cawg-key-value`,children:[(0,n.jsx)(`div`,{className:`cawg-key-value-label`,children:`Trust Registry`}),(0,n.jsx)(j,{entries:_,variant:`full`})]}),f.length>0&&(0,n.jsx)(`div`,{className:`cawg-identity-list`,style:{marginTop:12},children:f.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:V[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 `,K(s)]})]})},t)})}),_.length>0&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`div`,{className:`cawg-section-title`,style:{marginTop:16},children:`Trust Registries`}),(0,n.jsx)(`div`,{className:`cawg-identity-list`,children:_.map((e,t)=>(0,n.jsx)(A,{entry:e,variant:`full`,showEntity:!0},t))})]})]}),Object.keys(v).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(v).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:H[e]??e}),(0,n.jsx)(`span`,{className:U[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))})]}),b.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`}),b.map(([e,t])=>{let r=q(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 Y(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 X=({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]:Y(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)(w,{className:a,manifest:s,moreInfo:()=>{l(2)}});case 2:return(0,n.jsx)(z,{className:a,manifest:s,moreInfo:()=>{l(3)}});case 3:return(0,n.jsx)(J,{className:a,manifest:s,moreInfo:()=>{l(1)}})}return(0,n.jsx)(`div`,{children:`Level Of Detail Not Selected`})};X.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=X,e.TrustBadge=k,e.TrustRegistryRow=A,e.TrustRegistrySummaryBadge=j,e.getTrustRegistryQueryFn=y,e.queryTrustRegistry=g,e.setTrustRegistryQueryFn=v,e.useTrustRegistryQuery=b,e.useTrustRegistrySummary=x});
|
|
@@ -1,9 +1,35 @@
|
|
|
1
1
|
import { TrustRegistryQueryFn } from './trqp';
|
|
2
|
+
import { TrustRegistryEntry } from './getSignerPayload';
|
|
2
3
|
export interface TrustBadgeProps {
|
|
3
4
|
entityId?: string;
|
|
4
5
|
action?: string;
|
|
5
6
|
resource?: string;
|
|
7
|
+
authorityId?: string;
|
|
8
|
+
trqpAuthorizationUri?: string;
|
|
6
9
|
variant?: 'compact' | 'full';
|
|
7
10
|
queryFn?: TrustRegistryQueryFn;
|
|
8
11
|
}
|
|
9
|
-
export declare function TrustBadge({ entityId, action, resource, variant, queryFn }: TrustBadgeProps): import("react/jsx-runtime").JSX.Element | null;
|
|
12
|
+
export declare function TrustBadge({ entityId, action, resource, authorityId, trqpAuthorizationUri, variant, queryFn }: TrustBadgeProps): import("react/jsx-runtime").JSX.Element | null;
|
|
13
|
+
export interface TrustRegistryRowProps {
|
|
14
|
+
entry: TrustRegistryEntry;
|
|
15
|
+
variant?: 'compact' | 'full';
|
|
16
|
+
showEntity?: boolean;
|
|
17
|
+
queryFn?: TrustRegistryQueryFn;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Renders one trust_registry entry as a full row (authority/action/resource/link
|
|
21
|
+
* plus its trust status). Queries only once for the row: if the result comes back
|
|
22
|
+
* with `hide: true` the whole row is omitted, as if the entry didn't exist; if it
|
|
23
|
+
* comes back with an `icon` URL, that image is placed at the front of the row.
|
|
24
|
+
*/
|
|
25
|
+
export declare function TrustRegistryRow({ entry, variant, showEntity, queryFn }: TrustRegistryRowProps): import("react/jsx-runtime").JSX.Element | null;
|
|
26
|
+
export interface TrustRegistrySummaryBadgeProps {
|
|
27
|
+
entries: TrustRegistryEntry[];
|
|
28
|
+
variant?: 'compact' | 'full';
|
|
29
|
+
queryFn?: TrustRegistryQueryFn;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Reduces every trust_registry entry to one badge: authorized only if all entries
|
|
33
|
+
* pass, so a single failing entry is enough to show the negative message overall.
|
|
34
|
+
*/
|
|
35
|
+
export declare function TrustRegistrySummaryBadge({ entries, variant, queryFn }: TrustRegistrySummaryBadgeProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export type TrustRegistryEntry = {
|
|
2
|
+
trqp_authorization_uri?: string;
|
|
3
|
+
entity_id?: string;
|
|
4
|
+
authority_id?: string;
|
|
5
|
+
action?: string;
|
|
6
|
+
resource?: string;
|
|
7
|
+
};
|
|
8
|
+
export type SignerPayload = {
|
|
9
|
+
sig_type?: string;
|
|
10
|
+
role?: string[];
|
|
11
|
+
referenced_assertions?: unknown[];
|
|
12
|
+
trust_registry?: TrustRegistryEntry[];
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* The cawg.identity assertion's role/sig_type/referenced_assertions data
|
|
16
|
+
* lives under different keys depending on which identity path signed it:
|
|
17
|
+
* the X.509/COSE path puts it at `signer_payload` (there's no VC wrapper,
|
|
18
|
+
* so the assertion data *is* the signer_payload); the ICA (Identity Claims
|
|
19
|
+
* Aggregation) path puts the same data at `c2paAsset` instead — that's the
|
|
20
|
+
* actual field name the CAWG spec uses for it under `credentialSubject`
|
|
21
|
+
* (see credentialSubject.c2paAsset in the Identity Claims Aggregation
|
|
22
|
+
* spec). Consumers that only checked `signer_payload` would see roles for
|
|
23
|
+
* X.509-signed assertions but never for ICA-signed ones, even though the
|
|
24
|
+
* data is there under `c2paAsset`.
|
|
25
|
+
*/
|
|
26
|
+
export declare const getSignerPayload: (identityAssertion: Record<string, unknown> | undefined) => SignerPayload | undefined;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { TrustRegistryEntry } from './getSignerPayload';
|
|
1
2
|
export interface TrqpAuthorizationResponse {
|
|
2
3
|
entity_id: string;
|
|
3
4
|
authority_id: string;
|
|
@@ -7,11 +8,16 @@ export interface TrqpAuthorizationResponse {
|
|
|
7
8
|
time_requested: string;
|
|
8
9
|
time_evaluated: string;
|
|
9
10
|
message?: string;
|
|
11
|
+
/** Image URL rendered at the front of the trust registry row, if provided. */
|
|
12
|
+
icon?: string;
|
|
13
|
+
hide?: boolean;
|
|
10
14
|
}
|
|
11
15
|
export type TrustRegistryQueryFn = (params: {
|
|
12
16
|
entityId: string;
|
|
13
17
|
action?: string;
|
|
14
18
|
resource?: string;
|
|
19
|
+
authorityId?: string;
|
|
20
|
+
trqpAuthorizationUri?: string;
|
|
15
21
|
}) => Promise<TrqpAuthorizationResponse>;
|
|
16
22
|
export declare function queryTrustRegistry(): Promise<TrqpAuthorizationResponse>;
|
|
17
23
|
/**
|
|
@@ -20,10 +26,19 @@ export declare function queryTrustRegistry(): Promise<TrqpAuthorizationResponse>
|
|
|
20
26
|
*/
|
|
21
27
|
export declare function setTrustRegistryQueryFn(fn: TrustRegistryQueryFn): void;
|
|
22
28
|
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): {
|
|
29
|
+
export type QueryStatus = 'idle' | 'loading' | 'done' | 'error';
|
|
30
|
+
export declare function useTrustRegistryQuery(entityId: string | undefined, action?: string, resource?: string, authorityId?: string, trqpAuthorizationUri?: string, queryFn?: TrustRegistryQueryFn): {
|
|
25
31
|
status: QueryStatus;
|
|
26
32
|
result: TrqpAuthorizationResponse | null;
|
|
27
33
|
error: Error | null;
|
|
28
34
|
};
|
|
29
|
-
|
|
35
|
+
/**
|
|
36
|
+
* Queries the trust registry for every entry and reduces the results to a single
|
|
37
|
+
* pass/fail: authorized only when every entry comes back authorized, so one failing
|
|
38
|
+
* registry entry is enough to flip the overall status to unauthorized.
|
|
39
|
+
*/
|
|
40
|
+
export declare function useTrustRegistrySummary(entries: TrustRegistryEntry[], queryFn?: TrustRegistryQueryFn): {
|
|
41
|
+
status: QueryStatus;
|
|
42
|
+
results: TrqpAuthorizationResponse[];
|
|
43
|
+
error: Error | null;
|
|
44
|
+
};
|
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.14",
|
|
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",
|