@reworkdigital.io/rework-proof-mcp 1.3.0 → 1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -0
- package/package.json +1 -1
- package/src/index.js +82 -2
- package/src/mcp-spec.json +86 -5
package/README.md
CHANGED
|
@@ -47,6 +47,18 @@ only the digest. With the hosted server the credential travels to REWORK,
|
|
|
47
47
|
which hashes it there and stores nothing; pass `digest` yourself if you would
|
|
48
48
|
rather it never left.
|
|
49
49
|
|
|
50
|
+
A certificate credential (the file a certificate's share page downloads) is
|
|
51
|
+
signed afresh each time, so no two copies share a digest and REWORK keeps no
|
|
52
|
+
issuance record for it. Handed one, the lookup says so instead of "not
|
|
53
|
+
issued", and looks up the certificate it names: only that certificate's id is
|
|
54
|
+
sent, and the id is already public on the certificate's own page.
|
|
55
|
+
|
|
56
|
+
The lookup reads every record REWORK keeps by digest: workflow attestations,
|
|
57
|
+
Hugging Face joins, and Hugging Face repository-control challenges. REWORK
|
|
58
|
+
keeps only the newest challenge for each person and repository, so an older
|
|
59
|
+
one is answered as "no record kept" rather than "not issued". A challenge that
|
|
60
|
+
is found says what its claim's state is now; only `verified` shows control.
|
|
61
|
+
|
|
50
62
|
Every tool only reads, and each one says so (`readOnlyHint`), so a client can
|
|
51
63
|
run them without asking each time.
|
|
52
64
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reworkdigital.io/rework-proof-mcp",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.2",
|
|
4
4
|
"mcpName": "io.github.reworkio/rework-proof",
|
|
5
5
|
"description": "MCP server for verifying REWORK credentials — check whether delivered work is genuinely the author's.",
|
|
6
6
|
"license": "MIT",
|
package/src/index.js
CHANGED
|
@@ -98,7 +98,7 @@ const TOOLS = SPEC.tools.map((t) => JSON.parse(JSON.stringify(t)));
|
|
|
98
98
|
// Here the lookup hashes the credential in this process, which is a stronger
|
|
99
99
|
// promise than the shared wording makes, so this server says so.
|
|
100
100
|
TOOLS.find((t) => t.name === 'lookup_rework_attestation').inputSchema.properties.credential.description =
|
|
101
|
-
'The VC-JWT. Hashed locally
|
|
101
|
+
'The VC-JWT. Hashed locally and never sent anywhere. For a certificate credential, the certificate id it names (already public) is looked up as well.';
|
|
102
102
|
|
|
103
103
|
async function http(path, { method = 'GET', body } = {}) {
|
|
104
104
|
const ctl = new AbortController();
|
|
@@ -120,6 +120,60 @@ async function http(path, { method = 'GET', body } = {}) {
|
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
+
/**
|
|
124
|
+
* What a credential SAYS it is, read without checking its signature: the kind
|
|
125
|
+
* of REWORK credential, and the certificate it names when it is a certificate
|
|
126
|
+
* credential. Never evidence on its own: a forger writes these too.
|
|
127
|
+
*/
|
|
128
|
+
function stated(credential) {
|
|
129
|
+
const out = { type: null, certificate_id: null };
|
|
130
|
+
const parts = typeof credential === 'string' ? credential.trim().split('.') : [];
|
|
131
|
+
if (parts.length !== 3) return out;
|
|
132
|
+
let payload;
|
|
133
|
+
try {
|
|
134
|
+
payload = JSON.parse(Buffer.from(parts[1], 'base64url').toString('utf8'));
|
|
135
|
+
} catch {
|
|
136
|
+
return out;
|
|
137
|
+
}
|
|
138
|
+
const vc = payload && typeof payload === 'object' ? payload.vc : null;
|
|
139
|
+
if (!vc || typeof vc !== 'object' || Array.isArray(vc)) return out;
|
|
140
|
+
for (const kind of Array.isArray(vc.type) ? vc.type : []) {
|
|
141
|
+
if (typeof kind === 'string' && Object.prototype.hasOwnProperty.call(CREDENTIAL_TYPES, kind)) {
|
|
142
|
+
out.type = kind;
|
|
143
|
+
break;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
if (out.type === SPEC.registry.certificate_type) {
|
|
147
|
+
const subject = vc.credentialSubject;
|
|
148
|
+
const achievement = subject && typeof subject === 'object' ? subject.achievement : null;
|
|
149
|
+
const found = (achievement && typeof achievement === 'object' ? achievement.identifier : null) || payload.jti;
|
|
150
|
+
if (typeof found === 'string' && /^[A-Za-z0-9_-]{1,64}$/.test(found)) out.certificate_id = found;
|
|
151
|
+
}
|
|
152
|
+
return out;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* What REWORK holds for a certificate id. Only the id is sent, and it is
|
|
157
|
+
* already public on the certificate's own page; `found` and `revoked` are null
|
|
158
|
+
* when the API could not be reached, so "could not look" is never reported as
|
|
159
|
+
* "no such certificate".
|
|
160
|
+
*/
|
|
161
|
+
async function certificateRecord(id) {
|
|
162
|
+
const fallback = { id, found: null, revoked: null, verify_url: `${SPEC.site}/verify/${id}` };
|
|
163
|
+
try {
|
|
164
|
+
const res = await http(`/proofs/certificates/${encodeURIComponent(id)}/status`);
|
|
165
|
+
return {
|
|
166
|
+
id,
|
|
167
|
+
found: typeof res.found === 'boolean' ? res.found : null,
|
|
168
|
+
revoked: typeof res.revoked === 'boolean' ? res.revoked : null,
|
|
169
|
+
verify_url: fallback.verify_url,
|
|
170
|
+
};
|
|
171
|
+
} catch (err) {
|
|
172
|
+
log(`certificate ${id} could not be read: ${err.message}`);
|
|
173
|
+
return fallback;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
123
177
|
async function callTool(name, args) {
|
|
124
178
|
if (name === 'verify_rework_credential') {
|
|
125
179
|
const credential = (args && args.credential) || '';
|
|
@@ -135,15 +189,22 @@ async function callTool(name, args) {
|
|
|
135
189
|
// check, or it could not be read); a server that predates the check
|
|
136
190
|
// sends nothing, which is null too.
|
|
137
191
|
const revoked = typeof res.revoked === 'boolean' ? res.revoked : null;
|
|
192
|
+
// The API has checked the signature by here, so what the credential
|
|
193
|
+
// states about its kind is REWORK's word.
|
|
194
|
+
const kind = (res.valid === true || revoked === true) ? stated(credential).type : null;
|
|
138
195
|
let note;
|
|
139
196
|
if (revoked === true) note = SPEC.notes.revoked;
|
|
140
197
|
else if (assurance && ASSURANCE[assurance]) note = ASSURANCE[assurance].does_not_mean;
|
|
198
|
+
// A kind of credential with no assurance level by design (a certificate,
|
|
199
|
+
// a receipt, a passport): say what it is and its ceiling.
|
|
200
|
+
else if ((assurance === undefined || assurance === null) && kind) note = `${CREDENTIAL_TYPES[kind]} ${SPEC.notes.no_assurance_level}`;
|
|
141
201
|
else note = SPEC.notes.unknown_assurance;
|
|
142
202
|
return {
|
|
143
203
|
valid: res.valid === true,
|
|
144
204
|
reason: res.reason || null,
|
|
145
205
|
revoked,
|
|
146
206
|
issuer: res.issuer || null,
|
|
207
|
+
credential_type: kind,
|
|
147
208
|
credential_subject: subject,
|
|
148
209
|
// An agent that only reads `valid` would treat every credential as
|
|
149
210
|
// equally strong. Ship the ceiling alongside the verdict.
|
|
@@ -184,12 +245,31 @@ async function callTool(name, args) {
|
|
|
184
245
|
digest = String(digest).toLowerCase();
|
|
185
246
|
try {
|
|
186
247
|
const record = await http(`/github-app/attestations/${digest}`);
|
|
248
|
+
// A repository-control challenge can be genuine and still prove
|
|
249
|
+
// nothing today: say so unless its claim is verified.
|
|
250
|
+
const claim = record && typeof record.claim === 'object' && record.claim !== null ? record.claim : null;
|
|
251
|
+
const note = claim && claim.status !== 'verified'
|
|
252
|
+
? SPEC.notes.claim_not_current.replace('{status}', String(claim.status || 'unknown'))
|
|
253
|
+
: SPEC.notes.issued;
|
|
187
254
|
return {
|
|
188
255
|
...record,
|
|
189
|
-
assurance_note:
|
|
256
|
+
assurance_note: note,
|
|
190
257
|
};
|
|
191
258
|
} catch (err) {
|
|
192
259
|
if (String(err.message).includes('REWORK API 404')) {
|
|
260
|
+
const said = args && args.credential ? stated(args.credential) : { type: null, certificate_id: null };
|
|
261
|
+
if (SPEC.registry.newest_only.includes(said.type)) {
|
|
262
|
+
return { issued: null, digest_sha256: digest, credential_type: said.type, assurance_note: SPEC.notes.registry_newest_only };
|
|
263
|
+
}
|
|
264
|
+
if (SPEC.registry.signed_afresh.includes(said.type)) {
|
|
265
|
+
// Signed afresh on every download: no two copies share a digest, so
|
|
266
|
+
// there was never a record to find, and "not issued" would be a
|
|
267
|
+
// false alarm about a genuine credential.
|
|
268
|
+
const answer = { issued: null, digest_sha256: digest, credential_type: said.type };
|
|
269
|
+
if (said.certificate_id) answer.certificate = await certificateRecord(said.certificate_id);
|
|
270
|
+
answer.assurance_note = SPEC.notes.registry_not_kept;
|
|
271
|
+
return answer;
|
|
272
|
+
}
|
|
193
273
|
return {
|
|
194
274
|
issued: false,
|
|
195
275
|
digest_sha256: digest,
|
package/src/mcp-spec.json
CHANGED
|
@@ -67,6 +67,13 @@
|
|
|
67
67
|
"assurance_note": {
|
|
68
68
|
"type": "string",
|
|
69
69
|
"description": "The ceiling on what this result proves. Read it before relying on the result."
|
|
70
|
+
},
|
|
71
|
+
"credential_type": {
|
|
72
|
+
"type": [
|
|
73
|
+
"string",
|
|
74
|
+
"null"
|
|
75
|
+
],
|
|
76
|
+
"description": "Which kind of REWORK credential this is, as the credential states it; null when it is not valid or not a known kind."
|
|
70
77
|
}
|
|
71
78
|
},
|
|
72
79
|
"required": [
|
|
@@ -170,13 +177,13 @@
|
|
|
170
177
|
{
|
|
171
178
|
"name": "lookup_rework_attestation",
|
|
172
179
|
"title": "Look up whether REWORK issued a credential",
|
|
173
|
-
"description": "Check whether REWORK actually ISSUED a credential - not just whether its signature verifies. A forged-but-well-formed token fails this; a real one returns its issuance record and the CURRENT OpenTimestamps receipt, which may have been upgraded to a Bitcoin confirmation since issue. Pass the credential (its sha256 is the lookup key) or the digest directly.",
|
|
180
|
+
"description": "Check whether REWORK actually ISSUED a credential - not just whether its signature verifies. A forged-but-well-formed token fails this; a real one returns its issuance record and the CURRENT OpenTimestamps receipt, which may have been upgraded to a Bitcoin confirmation since issue. Pass the credential (its sha256 is the lookup key) or the digest directly. Workflow attestations and Hugging Face credentials are recorded. Certificate, video-receipt and passport credentials are signed afresh on every download and have no issuance record: pass the credential itself (not its digest) and the answer says so, with the certificate it names looked up instead.",
|
|
174
181
|
"inputSchema": {
|
|
175
182
|
"type": "object",
|
|
176
183
|
"properties": {
|
|
177
184
|
"credential": {
|
|
178
185
|
"type": "string",
|
|
179
|
-
"description": "The VC-JWT. Only its sha256 digest is used as the lookup key; the credential itself is not stored."
|
|
186
|
+
"description": "The VC-JWT. Only its sha256 digest is used as the lookup key; the credential itself is not stored. For a certificate credential, the certificate id it names is looked up as well."
|
|
180
187
|
},
|
|
181
188
|
"digest": {
|
|
182
189
|
"type": "string",
|
|
@@ -189,8 +196,11 @@
|
|
|
189
196
|
"type": "object",
|
|
190
197
|
"properties": {
|
|
191
198
|
"issued": {
|
|
192
|
-
"type":
|
|
193
|
-
|
|
199
|
+
"type": [
|
|
200
|
+
"boolean",
|
|
201
|
+
"null"
|
|
202
|
+
],
|
|
203
|
+
"description": "Whether REWORK has a record of issuing a credential with this digest. Null when REWORK keeps no per-digest record for this kind of credential, so the lookup can neither confirm nor deny it."
|
|
194
204
|
},
|
|
195
205
|
"digest_sha256": {
|
|
196
206
|
"type": "string"
|
|
@@ -198,6 +208,59 @@
|
|
|
198
208
|
"assurance_note": {
|
|
199
209
|
"type": "string",
|
|
200
210
|
"description": "The ceiling on what this result proves. Read it before relying on the result."
|
|
211
|
+
},
|
|
212
|
+
"credential_type": {
|
|
213
|
+
"type": "string",
|
|
214
|
+
"description": "The kind of credential: from REWORK's record when one was found, otherwise as the credential states it (unverified)."
|
|
215
|
+
},
|
|
216
|
+
"certificate": {
|
|
217
|
+
"type": "object",
|
|
218
|
+
"description": "Present for a certificate credential: the certificate it names, looked up by id.",
|
|
219
|
+
"properties": {
|
|
220
|
+
"id": {
|
|
221
|
+
"type": "string"
|
|
222
|
+
},
|
|
223
|
+
"found": {
|
|
224
|
+
"type": [
|
|
225
|
+
"boolean",
|
|
226
|
+
"null"
|
|
227
|
+
],
|
|
228
|
+
"description": "Whether REWORK has that certificate; null when it could not be read."
|
|
229
|
+
},
|
|
230
|
+
"revoked": {
|
|
231
|
+
"type": [
|
|
232
|
+
"boolean",
|
|
233
|
+
"null"
|
|
234
|
+
],
|
|
235
|
+
"description": "Whether it has been revoked; null when not found or not read."
|
|
236
|
+
},
|
|
237
|
+
"verify_url": {
|
|
238
|
+
"type": "string",
|
|
239
|
+
"description": "Its public page."
|
|
240
|
+
}
|
|
241
|
+
},
|
|
242
|
+
"required": [
|
|
243
|
+
"id",
|
|
244
|
+
"found",
|
|
245
|
+
"revoked",
|
|
246
|
+
"verify_url"
|
|
247
|
+
]
|
|
248
|
+
},
|
|
249
|
+
"github": {
|
|
250
|
+
"type": "object",
|
|
251
|
+
"description": "For a Hugging Face join: the GitHub Actions run, as REWORK recorded it."
|
|
252
|
+
},
|
|
253
|
+
"huggingface": {
|
|
254
|
+
"type": "object",
|
|
255
|
+
"description": "For a Hugging Face credential: the repository (and for a join, the exact content state) REWORK recorded."
|
|
256
|
+
},
|
|
257
|
+
"claim": {
|
|
258
|
+
"type": "object",
|
|
259
|
+
"description": "For a repository-control challenge: the claim's state now (status, verdict, lease). Only a status of verified shows control today."
|
|
260
|
+
},
|
|
261
|
+
"timestamp": {
|
|
262
|
+
"type": "object",
|
|
263
|
+
"description": "The OpenTimestamps receipt as REWORK holds it now. Only a status of confirmed is anchored in Bitcoin."
|
|
201
264
|
}
|
|
202
265
|
},
|
|
203
266
|
"required": [
|
|
@@ -218,6 +281,7 @@
|
|
|
218
281
|
"credential_types": {
|
|
219
282
|
"REWORKWorkflowAttestation": "A CI run whose repository identity GitHub attested via OIDC.",
|
|
220
283
|
"REWORKHfJoinedPublication": "A Hugging Face publication joined to the CI run that preceded it, confirmed by REWORK's own read of the Hub.",
|
|
284
|
+
"REWORKHfRepoControl": "A challenge REWORK issued to prove write control of a Hugging Face repository. It shows control only while REWORK holds the claim as verified.",
|
|
221
285
|
"REWORKProofOfWorkCredential": "A submitted piece of work that passed REWORK verification.",
|
|
222
286
|
"REWORKVideoProvenanceReceipt": "A reviewed demonstration video, fingerprinted against reuse.",
|
|
223
287
|
"REWORKReputationPassport": "A holder's full verified history in one signed credential.",
|
|
@@ -233,10 +297,27 @@
|
|
|
233
297
|
"issued": "Issuance confirms REWORK signed a credential with this digest. It is still not a review of the code or a claim the work is any good - and a \"submitted\" timestamp is a calendar promise, only \"confirmed\" means anchored in Bitcoin.",
|
|
234
298
|
"not_issued": "REWORK has no record of issuing a credential with this digest. A valid signature with no issuance record deserves suspicion: it could predate the registry, or it could be a key compromise.",
|
|
235
299
|
"revoked": "REWORK revoked this credential after issuing it. Its signature still verifies, which is exactly why revocation has to be checked: do not rely on it.",
|
|
236
|
-
"revocation_unchecked": "Whether this credential has since been revoked could not be checked just now. The signature is valid; treat the result as incomplete."
|
|
300
|
+
"revocation_unchecked": "Whether this credential has since been revoked could not be checked just now. The signature is valid; treat the result as incomplete.",
|
|
301
|
+
"no_assurance_level": "This type of credential carries no assurance level. A valid signature shows REWORK issued it and that it has not been altered; it is not a review of how good the work is.",
|
|
302
|
+
"registry_not_kept": "REWORK keeps no per-digest record for this type of credential: it is signed afresh each time it is downloaded, so no two copies share a digest, and this lookup can neither confirm nor deny it. That is not a sign of forgery. Check its signature with verify_rework_credential; what the credential says about itself here is unverified until then.",
|
|
303
|
+
"registry_newest_only": "REWORK keeps a record of only the newest repository-control challenge for each person and repository: starting the ceremony again replaces it. An older challenge missing here is not a sign of forgery. Check its signature and expiry with verify_rework_credential; what the credential says about itself here is unverified until then.",
|
|
304
|
+
"claim_not_current": "REWORK issued this challenge, but the claim it belongs to is now {status}: it does not show control of the repository today."
|
|
237
305
|
},
|
|
238
306
|
"errors": {
|
|
239
307
|
"credential_required": "credential is required: pass the compact VC-JWT (three base64url segments separated by dots)",
|
|
240
308
|
"digest_required": "pass either `credential` (the VC-JWT) or `digest` (64 hex chars)"
|
|
309
|
+
},
|
|
310
|
+
"site": "https://reworkio.com",
|
|
311
|
+
"registry": {
|
|
312
|
+
"signed_afresh": [
|
|
313
|
+
"REWORKProofOfWorkCredential",
|
|
314
|
+
"REWORKVideoProvenanceReceipt",
|
|
315
|
+
"REWORKReputationPassport",
|
|
316
|
+
"REWORKReputationSummary"
|
|
317
|
+
],
|
|
318
|
+
"certificate_type": "REWORKProofOfWorkCredential",
|
|
319
|
+
"newest_only": [
|
|
320
|
+
"REWORKHfRepoControl"
|
|
321
|
+
]
|
|
241
322
|
}
|
|
242
323
|
}
|