c2pa-react-cawg-component 0.1.13 → 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 +285 -130
- 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 +8 -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*/
|
|
@@ -40,7 +40,83 @@ var o = "<svg width=\"34\" height=\"34\" viewBox=\"0 0 34 34\" fill=\"none\" xml
|
|
|
40
40
|
return !t || l.includes(t.type) ? "Unknown" : t.name;
|
|
41
41
|
}, d = (e) => {
|
|
42
42
|
if (e) return e.signer_payload ?? e.c2paAsset;
|
|
43
|
-
}
|
|
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 = {
|
|
44
120
|
"cawg.creator": "Creator",
|
|
45
121
|
"cawg.contributor": "Contributor",
|
|
46
122
|
"cawg.editor": "Editor",
|
|
@@ -49,8 +125,8 @@ var o = "<svg width=\"34\" height=\"34\" viewBox=\"0 0 34 34\" fill=\"none\" xml
|
|
|
49
125
|
"cawg.sponsor": "Sponsor",
|
|
50
126
|
"cawg.translator": "Translator"
|
|
51
127
|
};
|
|
52
|
-
function
|
|
53
|
-
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("") || "?",
|
|
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);
|
|
54
130
|
return /* @__PURE__ */ a("div", {
|
|
55
131
|
className: `cawg-card ${e ?? ""}`,
|
|
56
132
|
children: [
|
|
@@ -81,11 +157,18 @@ function p({ className: e, manifest: t, moreInfo: n }) {
|
|
|
81
157
|
})]
|
|
82
158
|
})]
|
|
83
159
|
}),
|
|
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
|
+
}),
|
|
84
167
|
m.length > 0 && /* @__PURE__ */ i("div", {
|
|
85
168
|
className: "cawg-roles",
|
|
86
169
|
children: m.map((e) => /* @__PURE__ */ i("span", {
|
|
87
170
|
className: "cawg-role-badge",
|
|
88
|
-
children:
|
|
171
|
+
children: y[e] ?? e
|
|
89
172
|
}, e))
|
|
90
173
|
}),
|
|
91
174
|
n && /* @__PURE__ */ i("div", {
|
|
@@ -100,50 +183,8 @@ function p({ className: e, manifest: t, moreInfo: n }) {
|
|
|
100
183
|
});
|
|
101
184
|
}
|
|
102
185
|
//#endregion
|
|
103
|
-
//#region src/components/Cawg/helper/trqp.ts
|
|
104
|
-
async function m() {
|
|
105
|
-
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.");
|
|
106
|
-
}
|
|
107
|
-
var h = m;
|
|
108
|
-
function g(e) {
|
|
109
|
-
h = e;
|
|
110
|
-
}
|
|
111
|
-
function _() {
|
|
112
|
-
return h;
|
|
113
|
-
}
|
|
114
|
-
function v(e, r, i, a = _()) {
|
|
115
|
-
let [o, s] = n("idle"), [c, l] = n(null), [u, d] = n(null);
|
|
116
|
-
return t(() => {
|
|
117
|
-
if (!e) {
|
|
118
|
-
s("idle"), l(null), d(null);
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
|
-
let t = !1;
|
|
122
|
-
return s("loading"), d(null), a({
|
|
123
|
-
entityId: e,
|
|
124
|
-
action: r,
|
|
125
|
-
resource: i
|
|
126
|
-
}).then((e) => {
|
|
127
|
-
t || (l(e), s("done"));
|
|
128
|
-
}, (e) => {
|
|
129
|
-
t || (l(null), d(e instanceof Error ? e : Error(String(e))), s("error"));
|
|
130
|
-
}), () => {
|
|
131
|
-
t = !0;
|
|
132
|
-
};
|
|
133
|
-
}, [
|
|
134
|
-
e,
|
|
135
|
-
r,
|
|
136
|
-
i,
|
|
137
|
-
a
|
|
138
|
-
]), {
|
|
139
|
-
status: o,
|
|
140
|
-
result: c,
|
|
141
|
-
error: u
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
//#endregion
|
|
145
186
|
//#region src/components/Cawg/helper/TrustBadge.tsx
|
|
146
|
-
function
|
|
187
|
+
function x(e) {
|
|
147
188
|
try {
|
|
148
189
|
return new Date(e).toLocaleDateString(void 0, {
|
|
149
190
|
year: "numeric",
|
|
@@ -154,42 +195,134 @@ function y(e) {
|
|
|
154
195
|
return e;
|
|
155
196
|
}
|
|
156
197
|
}
|
|
157
|
-
var
|
|
158
|
-
function
|
|
159
|
-
|
|
160
|
-
if (!e) return null;
|
|
161
|
-
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", {
|
|
162
201
|
className: "cawg-trust-badge cawg-trust-unverified",
|
|
163
|
-
title:
|
|
202
|
+
title: n?.message,
|
|
164
203
|
children: "Unable to reach trust registry"
|
|
165
204
|
});
|
|
166
|
-
if (
|
|
205
|
+
if (e !== "done" || !t) return /* @__PURE__ */ i("span", {
|
|
167
206
|
className: "cawg-trust-badge cawg-trust-pending",
|
|
168
207
|
children: "Checking trust registry…"
|
|
169
208
|
});
|
|
170
|
-
let
|
|
171
|
-
className:
|
|
172
|
-
title:
|
|
173
|
-
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
|
|
174
213
|
});
|
|
175
|
-
return r === "compact" ?
|
|
214
|
+
return r === "compact" ? o : /* @__PURE__ */ a("div", {
|
|
176
215
|
className: "cawg-trust-status",
|
|
177
|
-
children: [
|
|
216
|
+
children: [o, t.authorized ? /* @__PURE__ */ a("div", {
|
|
178
217
|
className: "cawg-trust-meta",
|
|
179
218
|
children: [
|
|
180
|
-
|
|
219
|
+
t.authority_id,
|
|
181
220
|
" · checked ",
|
|
182
|
-
|
|
221
|
+
x(t.time_evaluated)
|
|
183
222
|
]
|
|
184
|
-
}) :
|
|
223
|
+
}) : t.message && /* @__PURE__ */ i("div", {
|
|
185
224
|
className: "cawg-trust-message",
|
|
186
|
-
children:
|
|
225
|
+
children: t.message
|
|
187
226
|
})]
|
|
188
227
|
});
|
|
189
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
|
+
]
|
|
273
|
+
})]
|
|
274
|
+
});
|
|
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
|
+
}
|
|
190
323
|
//#endregion
|
|
191
324
|
//#region src/components/Cawg/levels/L2/CAWGL2.tsx
|
|
192
|
-
var
|
|
325
|
+
var O = {
|
|
193
326
|
"cawg.creator": "Creator",
|
|
194
327
|
"cawg.contributor": "Contributor",
|
|
195
328
|
"cawg.editor": "Editor",
|
|
@@ -197,27 +330,27 @@ var C = {
|
|
|
197
330
|
"cawg.publisher": "Publisher",
|
|
198
331
|
"cawg.sponsor": "Sponsor",
|
|
199
332
|
"cawg.translator": "Translator"
|
|
200
|
-
},
|
|
333
|
+
}, k = {
|
|
201
334
|
"cawg.document_verification": "ID Verified",
|
|
202
335
|
"cawg.web_site": "Website",
|
|
203
336
|
"cawg.affiliation": "Affiliation",
|
|
204
337
|
"cawg.social_media": "Social Media",
|
|
205
338
|
"cawg.crypto_wallet": "Crypto Wallet"
|
|
206
|
-
},
|
|
339
|
+
}, A = {
|
|
207
340
|
"cawg.data_mining": "Data Mining",
|
|
208
341
|
"cawg.ai_inference": "AI Inference",
|
|
209
342
|
"cawg.ai_training": "AI Training",
|
|
210
343
|
"cawg.ai_generative_training": "AI Generative Training"
|
|
211
|
-
},
|
|
344
|
+
}, j = {
|
|
212
345
|
allowed: "cawg-use-badge cawg-use-allowed",
|
|
213
346
|
notAllowed: "cawg-use-badge cawg-use-not-allowed",
|
|
214
347
|
constrained: "cawg-use-badge cawg-use-constrained"
|
|
215
|
-
},
|
|
348
|
+
}, M = {
|
|
216
349
|
allowed: "Allowed",
|
|
217
350
|
notAllowed: "Not Allowed",
|
|
218
351
|
constrained: "Constrained"
|
|
219
352
|
};
|
|
220
|
-
function
|
|
353
|
+
function N(e) {
|
|
221
354
|
try {
|
|
222
355
|
return new Date(e).toLocaleDateString(void 0, {
|
|
223
356
|
year: "numeric",
|
|
@@ -228,11 +361,11 @@ function O(e) {
|
|
|
228
361
|
return e;
|
|
229
362
|
}
|
|
230
363
|
}
|
|
231
|
-
function
|
|
364
|
+
function P(e) {
|
|
232
365
|
return Array.isArray(e) ? e.filter((e) => typeof e == "string").join(", ") : typeof e == "string" ? e : "";
|
|
233
366
|
}
|
|
234
|
-
function
|
|
235
|
-
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)?.role ?? [],
|
|
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"];
|
|
236
369
|
return /* @__PURE__ */ a("div", {
|
|
237
370
|
className: `cawg-card ${e ?? ""}`,
|
|
238
371
|
children: [
|
|
@@ -263,14 +396,14 @@ function A({ className: e, manifest: t, moreInfo: n }) {
|
|
|
263
396
|
})]
|
|
264
397
|
})]
|
|
265
398
|
}),
|
|
266
|
-
|
|
399
|
+
m.length > 0 && /* @__PURE__ */ i("div", {
|
|
267
400
|
className: "cawg-roles",
|
|
268
|
-
children:
|
|
401
|
+
children: m.map((e) => /* @__PURE__ */ i("span", {
|
|
269
402
|
className: "cawg-role-badge",
|
|
270
|
-
children:
|
|
403
|
+
children: O[e] ?? e
|
|
271
404
|
}, e))
|
|
272
405
|
}),
|
|
273
|
-
|
|
406
|
+
h.length > 0 && /* @__PURE__ */ a(r, { children: [
|
|
274
407
|
/* @__PURE__ */ i("div", { className: "cawg-divider" }),
|
|
275
408
|
/* @__PURE__ */ a("div", {
|
|
276
409
|
className: "cawg-section-title",
|
|
@@ -280,16 +413,14 @@ function A({ className: e, manifest: t, moreInfo: n }) {
|
|
|
280
413
|
justifyContent: "space-between",
|
|
281
414
|
gap: 8
|
|
282
415
|
},
|
|
283
|
-
children: [/* @__PURE__ */ i("span", { children: "Identity" }), /* @__PURE__ */ i(
|
|
284
|
-
|
|
285
|
-
action: "issue",
|
|
286
|
-
resource: "cawg.identity",
|
|
416
|
+
children: [/* @__PURE__ */ i("span", { children: "Identity" }), g.length > 0 && /* @__PURE__ */ i(D, {
|
|
417
|
+
entries: g,
|
|
287
418
|
variant: "compact"
|
|
288
419
|
})]
|
|
289
420
|
}),
|
|
290
421
|
/* @__PURE__ */ i("div", {
|
|
291
422
|
className: "cawg-identity-list",
|
|
292
|
-
children:
|
|
423
|
+
children: h.map((e, t) => {
|
|
293
424
|
let n = e.type, r = e.name ?? e.username, o = e.provider;
|
|
294
425
|
return /* @__PURE__ */ i("div", {
|
|
295
426
|
className: "cawg-identity-item",
|
|
@@ -298,7 +429,7 @@ function A({ className: e, manifest: t, moreInfo: n }) {
|
|
|
298
429
|
children: [
|
|
299
430
|
/* @__PURE__ */ i("div", {
|
|
300
431
|
className: "cawg-identity-type-label",
|
|
301
|
-
children:
|
|
432
|
+
children: k[n] ?? n
|
|
302
433
|
}),
|
|
303
434
|
r && /* @__PURE__ */ i("div", {
|
|
304
435
|
className: "cawg-identity-name",
|
|
@@ -314,7 +445,21 @@ function A({ className: e, manifest: t, moreInfo: n }) {
|
|
|
314
445
|
})
|
|
315
446
|
})
|
|
316
447
|
] }),
|
|
317
|
-
|
|
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: [
|
|
318
463
|
/* @__PURE__ */ i("div", { className: "cawg-divider" }),
|
|
319
464
|
/* @__PURE__ */ i("div", {
|
|
320
465
|
className: "cawg-section-title",
|
|
@@ -322,42 +467,42 @@ function A({ className: e, manifest: t, moreInfo: n }) {
|
|
|
322
467
|
}),
|
|
323
468
|
/* @__PURE__ */ i("div", {
|
|
324
469
|
className: "cawg-training-list",
|
|
325
|
-
children: Object.entries(
|
|
470
|
+
children: Object.entries(_).map(([e, t]) => /* @__PURE__ */ a("div", {
|
|
326
471
|
className: "cawg-training-item",
|
|
327
472
|
children: [/* @__PURE__ */ i("span", {
|
|
328
473
|
className: "cawg-training-label",
|
|
329
|
-
children:
|
|
474
|
+
children: A[e] ?? e
|
|
330
475
|
}), /* @__PURE__ */ i("span", {
|
|
331
|
-
className:
|
|
332
|
-
children:
|
|
476
|
+
className: j[t.use] ?? "cawg-use-badge",
|
|
477
|
+
children: M[t.use] ?? t.use
|
|
333
478
|
})]
|
|
334
479
|
}, e))
|
|
335
480
|
})
|
|
336
481
|
] }),
|
|
337
|
-
(
|
|
482
|
+
(y || b) && /* @__PURE__ */ a(r, { children: [
|
|
338
483
|
/* @__PURE__ */ i("div", { className: "cawg-divider" }),
|
|
339
484
|
/* @__PURE__ */ i("div", {
|
|
340
485
|
className: "cawg-section-title",
|
|
341
486
|
children: "Creator"
|
|
342
487
|
}),
|
|
343
|
-
|
|
488
|
+
y && /* @__PURE__ */ a("div", {
|
|
344
489
|
className: "cawg-key-value",
|
|
345
490
|
children: [/* @__PURE__ */ i("div", {
|
|
346
491
|
className: "cawg-key-value-label",
|
|
347
492
|
children: "Name"
|
|
348
493
|
}), /* @__PURE__ */ i("div", {
|
|
349
494
|
className: "cawg-key-value-value",
|
|
350
|
-
children:
|
|
495
|
+
children: y
|
|
351
496
|
})]
|
|
352
497
|
}),
|
|
353
|
-
|
|
498
|
+
b && /* @__PURE__ */ a("div", {
|
|
354
499
|
className: "cawg-key-value",
|
|
355
500
|
children: [/* @__PURE__ */ i("div", {
|
|
356
501
|
className: "cawg-key-value-label",
|
|
357
502
|
children: "Date Created"
|
|
358
503
|
}), /* @__PURE__ */ i("div", {
|
|
359
504
|
className: "cawg-key-value-value",
|
|
360
|
-
children:
|
|
505
|
+
children: N(b)
|
|
361
506
|
})]
|
|
362
507
|
})
|
|
363
508
|
] }),
|
|
@@ -374,7 +519,7 @@ function A({ className: e, manifest: t, moreInfo: n }) {
|
|
|
374
519
|
}
|
|
375
520
|
//#endregion
|
|
376
521
|
//#region src/components/Cawg/levels/L3/CAWGL3.tsx
|
|
377
|
-
var
|
|
522
|
+
var I = {
|
|
378
523
|
"cawg.creator": "Creator",
|
|
379
524
|
"cawg.contributor": "Contributor",
|
|
380
525
|
"cawg.editor": "Editor",
|
|
@@ -382,31 +527,31 @@ var j = {
|
|
|
382
527
|
"cawg.publisher": "Publisher",
|
|
383
528
|
"cawg.sponsor": "Sponsor",
|
|
384
529
|
"cawg.translator": "Translator"
|
|
385
|
-
},
|
|
530
|
+
}, L = {
|
|
386
531
|
"cawg.document_verification": "ID Verified",
|
|
387
532
|
"cawg.web_site": "Website",
|
|
388
533
|
"cawg.affiliation": "Affiliation",
|
|
389
534
|
"cawg.social_media": "Social Media",
|
|
390
535
|
"cawg.crypto_wallet": "Crypto Wallet"
|
|
391
|
-
},
|
|
536
|
+
}, R = {
|
|
392
537
|
"cawg.data_mining": "Data Mining",
|
|
393
538
|
"cawg.ai_inference": "AI Inference",
|
|
394
539
|
"cawg.ai_training": "AI Training",
|
|
395
540
|
"cawg.ai_generative_training": "AI Generative Training"
|
|
396
|
-
},
|
|
541
|
+
}, z = {
|
|
397
542
|
allowed: "cawg-use-badge cawg-use-allowed",
|
|
398
543
|
notAllowed: "cawg-use-badge cawg-use-not-allowed",
|
|
399
544
|
constrained: "cawg-use-badge cawg-use-constrained"
|
|
400
|
-
},
|
|
545
|
+
}, B = {
|
|
401
546
|
allowed: "Allowed",
|
|
402
547
|
notAllowed: "Not Allowed",
|
|
403
548
|
constrained: "Constrained"
|
|
404
|
-
},
|
|
549
|
+
}, V = {
|
|
405
550
|
"cawg.identity_claims_aggregation": "Identity Claims Aggregation",
|
|
406
551
|
"cawg.x509.cose": "X.509 Certificate",
|
|
407
552
|
"cawg.verifiable_credential_binding": "Verifiable Credential"
|
|
408
553
|
};
|
|
409
|
-
function
|
|
554
|
+
function H(e) {
|
|
410
555
|
try {
|
|
411
556
|
return new Date(e).toLocaleDateString(void 0, {
|
|
412
557
|
year: "numeric",
|
|
@@ -417,11 +562,11 @@ function L(e) {
|
|
|
417
562
|
return e;
|
|
418
563
|
}
|
|
419
564
|
}
|
|
420
|
-
function
|
|
421
|
-
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);
|
|
422
567
|
}
|
|
423
|
-
function
|
|
424
|
-
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 = t.assertions?.["cawg.training-mining"]?.entries ?? {},
|
|
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("@")) : [];
|
|
425
570
|
return /* @__PURE__ */ a("div", {
|
|
426
571
|
className: `cawg-card ${e ?? ""}`,
|
|
427
572
|
children: [
|
|
@@ -456,7 +601,7 @@ function z({ className: e, manifest: t, moreInfo: n }) {
|
|
|
456
601
|
className: "cawg-roles",
|
|
457
602
|
children: h.map((e) => /* @__PURE__ */ i("span", {
|
|
458
603
|
className: "cawg-role-badge",
|
|
459
|
-
children:
|
|
604
|
+
children: I[e] ?? e
|
|
460
605
|
}, e))
|
|
461
606
|
}),
|
|
462
607
|
p && /* @__PURE__ */ a(r, { children: [
|
|
@@ -472,7 +617,7 @@ function z({ className: e, manifest: t, moreInfo: n }) {
|
|
|
472
617
|
children: "Credential Type"
|
|
473
618
|
}), /* @__PURE__ */ i("div", {
|
|
474
619
|
className: "cawg-key-value-value",
|
|
475
|
-
children:
|
|
620
|
+
children: V[_] ?? _
|
|
476
621
|
})]
|
|
477
622
|
}),
|
|
478
623
|
v && /* @__PURE__ */ a("div", {
|
|
@@ -485,15 +630,13 @@ function z({ className: e, manifest: t, moreInfo: n }) {
|
|
|
485
630
|
children: v
|
|
486
631
|
})]
|
|
487
632
|
}),
|
|
488
|
-
/* @__PURE__ */ a("div", {
|
|
633
|
+
y.length > 0 && /* @__PURE__ */ a("div", {
|
|
489
634
|
className: "cawg-key-value",
|
|
490
635
|
children: [/* @__PURE__ */ i("div", {
|
|
491
636
|
className: "cawg-key-value-label",
|
|
492
637
|
children: "Trust Registry"
|
|
493
|
-
}), /* @__PURE__ */ i(
|
|
494
|
-
|
|
495
|
-
action: "issue",
|
|
496
|
-
resource: "cawg.identity",
|
|
638
|
+
}), /* @__PURE__ */ i(D, {
|
|
639
|
+
entries: y,
|
|
497
640
|
variant: "full"
|
|
498
641
|
})]
|
|
499
642
|
}),
|
|
@@ -509,7 +652,7 @@ function z({ className: e, manifest: t, moreInfo: n }) {
|
|
|
509
652
|
children: [
|
|
510
653
|
/* @__PURE__ */ i("div", {
|
|
511
654
|
className: "cawg-identity-type-label",
|
|
512
|
-
children:
|
|
655
|
+
children: L[n] ?? n
|
|
513
656
|
}),
|
|
514
657
|
r && /* @__PURE__ */ i("div", {
|
|
515
658
|
className: "cawg-identity-name",
|
|
@@ -528,15 +671,27 @@ function z({ className: e, manifest: t, moreInfo: n }) {
|
|
|
528
671
|
}),
|
|
529
672
|
c && /* @__PURE__ */ a("div", {
|
|
530
673
|
className: "cawg-identity-meta",
|
|
531
|
-
children: ["Verified ",
|
|
674
|
+
children: ["Verified ", H(c)]
|
|
532
675
|
})
|
|
533
676
|
]
|
|
534
677
|
})
|
|
535
678
|
}, t);
|
|
536
679
|
})
|
|
537
|
-
})
|
|
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
|
+
})] })
|
|
538
693
|
] }),
|
|
539
|
-
Object.keys(
|
|
694
|
+
Object.keys(b).length > 0 && /* @__PURE__ */ a(r, { children: [
|
|
540
695
|
/* @__PURE__ */ i("div", { className: "cawg-divider" }),
|
|
541
696
|
/* @__PURE__ */ i("div", {
|
|
542
697
|
className: "cawg-section-title",
|
|
@@ -544,7 +699,7 @@ function z({ className: e, manifest: t, moreInfo: n }) {
|
|
|
544
699
|
}),
|
|
545
700
|
/* @__PURE__ */ i("div", {
|
|
546
701
|
className: "cawg-training-list",
|
|
547
|
-
children: Object.entries(
|
|
702
|
+
children: Object.entries(b).map(([e, t]) => /* @__PURE__ */ a("div", {
|
|
548
703
|
className: "cawg-training-item",
|
|
549
704
|
style: {
|
|
550
705
|
flexDirection: "column",
|
|
@@ -558,10 +713,10 @@ function z({ className: e, manifest: t, moreInfo: n }) {
|
|
|
558
713
|
},
|
|
559
714
|
children: [/* @__PURE__ */ i("span", {
|
|
560
715
|
className: "cawg-training-label",
|
|
561
|
-
children:
|
|
716
|
+
children: R[e] ?? e
|
|
562
717
|
}), /* @__PURE__ */ i("span", {
|
|
563
|
-
className:
|
|
564
|
-
children:
|
|
718
|
+
className: z[t.use] ?? "cawg-use-badge",
|
|
719
|
+
children: B[t.use] ?? t.use
|
|
565
720
|
})]
|
|
566
721
|
}), t.constraint_info && /* @__PURE__ */ i("div", {
|
|
567
722
|
className: "cawg-constraint-info",
|
|
@@ -570,14 +725,14 @@ function z({ className: e, manifest: t, moreInfo: n }) {
|
|
|
570
725
|
}, e))
|
|
571
726
|
})
|
|
572
727
|
] }),
|
|
573
|
-
|
|
728
|
+
S.length > 0 && /* @__PURE__ */ a(r, { children: [
|
|
574
729
|
/* @__PURE__ */ i("div", { className: "cawg-divider" }),
|
|
575
730
|
/* @__PURE__ */ i("div", {
|
|
576
731
|
className: "cawg-section-title",
|
|
577
732
|
children: "Metadata"
|
|
578
733
|
}),
|
|
579
|
-
|
|
580
|
-
let n =
|
|
734
|
+
S.map(([e, t]) => {
|
|
735
|
+
let n = U(t);
|
|
581
736
|
return n ? /* @__PURE__ */ a("div", {
|
|
582
737
|
className: "cawg-key-value",
|
|
583
738
|
children: [/* @__PURE__ */ i("div", {
|
|
@@ -603,7 +758,7 @@ function z({ className: e, manifest: t, moreInfo: n }) {
|
|
|
603
758
|
}
|
|
604
759
|
//#endregion
|
|
605
760
|
//#region src/components/Cawg/Cawg.tsx
|
|
606
|
-
function
|
|
761
|
+
function G(e) {
|
|
607
762
|
return {
|
|
608
763
|
id: e.id ?? "",
|
|
609
764
|
title: e.title ?? "",
|
|
@@ -625,26 +780,26 @@ function B(e) {
|
|
|
625
780
|
ingredients: e.ingredients ?? []
|
|
626
781
|
};
|
|
627
782
|
}
|
|
628
|
-
var
|
|
629
|
-
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);
|
|
630
785
|
if (!s || !(s.assertions?.["cawg.identity"] != null || s.assertions?.["cawg.training-mining"] != null || s.assertions?.["cawg.metadata"] != null)) return null;
|
|
631
786
|
let [c, l] = e.useState(r || 1);
|
|
632
787
|
switch (c) {
|
|
633
|
-
case 1: return /* @__PURE__ */ i(
|
|
788
|
+
case 1: return /* @__PURE__ */ i(b, {
|
|
634
789
|
className: a,
|
|
635
790
|
manifest: s,
|
|
636
791
|
moreInfo: () => {
|
|
637
792
|
l(2);
|
|
638
793
|
}
|
|
639
794
|
});
|
|
640
|
-
case 2: return /* @__PURE__ */ i(
|
|
795
|
+
case 2: return /* @__PURE__ */ i(F, {
|
|
641
796
|
className: a,
|
|
642
797
|
manifest: s,
|
|
643
798
|
moreInfo: () => {
|
|
644
799
|
l(3);
|
|
645
800
|
}
|
|
646
801
|
});
|
|
647
|
-
case 3: return /* @__PURE__ */ i(
|
|
802
|
+
case 3: return /* @__PURE__ */ i(W, {
|
|
648
803
|
className: a,
|
|
649
804
|
manifest: s,
|
|
650
805
|
moreInfo: () => {
|
|
@@ -654,7 +809,7 @@ var V = ({ manifest: t, entry: n, level: r, className: a }) => {
|
|
|
654
809
|
}
|
|
655
810
|
return /* @__PURE__ */ i("div", { children: "Level Of Detail Not Selected" });
|
|
656
811
|
};
|
|
657
|
-
|
|
812
|
+
K.knownAssertions = [
|
|
658
813
|
"cawg.identity",
|
|
659
814
|
"cawg.training-mining",
|
|
660
815
|
"cawg.metadata",
|
|
@@ -672,4 +827,4 @@ V.knownAssertions = [
|
|
|
672
827
|
"cawg.crypto_wallet"
|
|
673
828
|
];
|
|
674
829
|
//#endregion
|
|
675
|
-
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=e=>{if(e)return e.signer_payload??e.c2paAsset},g={"cawg.creator":`Creator`,"cawg.contributor":`Contributor`,"cawg.editor":`Editor`,"cawg.producer":`Producer`,"cawg.publisher":`Publisher`,"cawg.sponsor":`Sponsor`,"cawg.translator":`Translator`};function _({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)?.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})]})]}),l.length>0&&(0,n.jsx)(`div`,{className:`cawg-roles`,children:l.map(e=>(0,n.jsx)(`span`,{className:`cawg-role-badge`,children:g[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 v(){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 y=v;function b(e){y=e}function x(){return y}function S(e,n,r,i=x()){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 C(e){try{return new Date(e).toLocaleDateString(void 0,{year:`numeric`,month:`long`,day:`numeric`})}catch{return e}}var w=`Identity Verified by Trust Registry`,T=`Identity Unable to be Verified by Trust Registry`;function E({entityId:e,action:t,resource:r,variant:i=`full`,queryFn:a}){let{status:o,result:s,error:c}=S(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 ${C(s.time_evaluated)}`:s.message,children:s.authorized?w:T});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 `,C(s.time_evaluated)]}):s.message&&(0,n.jsx)(`div`,{className:`cawg-trust-message`,children:s.message})]})}var D={"cawg.creator":`Creator`,"cawg.contributor":`Contributor`,"cawg.editor":`Editor`,"cawg.producer":`Producer`,"cawg.publisher":`Publisher`,"cawg.sponsor":`Sponsor`,"cawg.translator":`Translator`},O={"cawg.document_verification":`ID Verified`,"cawg.web_site":`Website`,"cawg.affiliation":`Affiliation`,"cawg.social_media":`Social Media`,"cawg.crypto_wallet":`Crypto Wallet`},k={"cawg.data_mining":`Data Mining`,"cawg.ai_inference":`AI Inference`,"cawg.ai_training":`AI Training`,"cawg.ai_generative_training":`AI Generative Training`},A={allowed:`cawg-use-badge cawg-use-allowed`,notAllowed:`cawg-use-badge cawg-use-not-allowed`,constrained:`cawg-use-badge cawg-use-constrained`},j={allowed:`Allowed`,notAllowed:`Not Allowed`,constrained:`Constrained`};function M(e){try{return new Date(e).toLocaleDateString(void 0,{year:`numeric`,month:`long`,day:`numeric`})}catch{return e}}function N(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`).join(`, `):typeof e==`string`?e:``}function P({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)?.role??[],l=s?.verifiedIdentities??[],u=s?.issuer,f=t.assertions?.[`cawg.training-mining`]?.entries??{},p=t.assertions?.[`cawg.metadata`],g=N(p?.[`dc:creator`]),_=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:D[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)(E,{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:O[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:k[e]??e}),(0,n.jsx)(`span`,{className:A[t.use]??`cawg-use-badge`,children:j[t.use]??t.use})]},e))})]}),(g||_)&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(`div`,{className:`cawg-divider`}),(0,n.jsx)(`div`,{className:`cawg-section-title`,children:`Creator`}),g&&(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: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:M(_)})]})]}),r&&(0,n.jsx)(`div`,{style:{marginTop:16},children:(0,n.jsx)(`button`,{onClick:r,className:`cawg-button`,children:`More Info`})})]})}var F={"cawg.creator":`Creator`,"cawg.contributor":`Contributor`,"cawg.editor":`Editor`,"cawg.producer":`Producer`,"cawg.publisher":`Publisher`,"cawg.sponsor":`Sponsor`,"cawg.translator":`Translator`},I={"cawg.document_verification":`ID Verified`,"cawg.web_site":`Website`,"cawg.affiliation":`Affiliation`,"cawg.social_media":`Social Media`,"cawg.crypto_wallet":`Crypto Wallet`},L={"cawg.data_mining":`Data Mining`,"cawg.ai_inference":`AI Inference`,"cawg.ai_training":`AI Training`,"cawg.ai_generative_training":`AI Generative Training`},R={allowed:`cawg-use-badge cawg-use-allowed`,notAllowed:`cawg-use-badge cawg-use-not-allowed`,constrained:`cawg-use-badge cawg-use-constrained`},z={allowed:`Allowed`,notAllowed:`Not Allowed`,constrained:`Constrained`},B={"cawg.identity_claims_aggregation":`Identity Claims Aggregation`,"cawg.x509.cose":`X.509 Certificate`,"cawg.verifiable_credential_binding":`Verifiable Credential`};function V(e){try{return new Date(e).toLocaleDateString(void 0,{year:`numeric`,month:`long`,day:`numeric`})}catch{return e}}function H(e){return e==null?``:typeof e==`string`||typeof e==`number`||typeof e==`boolean`?String(e):Array.isArray(e)?e.map(e=>H(e)).filter(Boolean).join(`, `):typeof e==`object`?Object.entries(e).filter(([e])=>!e.startsWith(`@`)).map(([e,t])=>`${e}: ${H(t)}`).join(`; `):String(e)}function U({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,_=t.assertions?.[`cawg.training-mining`]?.entries??{},v=t.assertions?.[`cawg.metadata`],y=v?Object.entries(v).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:F[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:B[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})]}),(0,n.jsxs)(`div`,{className:`cawg-key-value`,children:[(0,n.jsx)(`div`,{className:`cawg-key-value-label`,children:`Trust Registry`}),(0,n.jsx)(E,{entityId:g,action:`issue`,resource:`cawg.identity`,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:I[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 `,V(s)]})]})},t)})})]}),Object.keys(_).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(_).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:L[e]??e}),(0,n.jsx)(`span`,{className:R[t.use]??`cawg-use-badge`,children:z[t.use]??t.use})]}),t.constraint_info&&(0,n.jsx)(`div`,{className:`cawg-constraint-info`,children:t.constraint_info})]},e))})]}),y.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`}),y.map(([e,t])=>{let r=H(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 W(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 G=({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]:W(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)(_,{className:a,manifest:s,moreInfo:()=>{l(2)}});case 2:return(0,n.jsx)(P,{className:a,manifest:s,moreInfo:()=>{l(3)}});case 3:return(0,n.jsx)(U,{className:a,manifest:s,moreInfo:()=>{l(1)}})}return(0,n.jsx)(`div`,{children:`Level Of Detail Not Selected`})};G.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=G,e.TrustBadge=E,e.getTrustRegistryQueryFn=x,e.queryTrustRegistry=v,e.setTrustRegistryQueryFn=b,e.useTrustRegistryQuery=S});
|
|
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;
|
|
@@ -1,7 +1,15 @@
|
|
|
1
|
+
export type TrustRegistryEntry = {
|
|
2
|
+
trqp_authorization_uri?: string;
|
|
3
|
+
entity_id?: string;
|
|
4
|
+
authority_id?: string;
|
|
5
|
+
action?: string;
|
|
6
|
+
resource?: string;
|
|
7
|
+
};
|
|
1
8
|
export type SignerPayload = {
|
|
2
9
|
sig_type?: string;
|
|
3
10
|
role?: string[];
|
|
4
11
|
referenced_assertions?: unknown[];
|
|
12
|
+
trust_registry?: TrustRegistryEntry[];
|
|
5
13
|
};
|
|
6
14
|
/**
|
|
7
15
|
* The cawg.identity assertion's role/sig_type/referenced_assertions data
|
|
@@ -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",
|