@reworkdigital.io/rework-proof-mcp 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/package.json +1 -1
- package/src/index.js +60 -0
package/README.md
CHANGED
|
@@ -29,6 +29,7 @@ No API key. No account. Every tool here reads public endpoints.
|
|
|
29
29
|
| `verify_rework_credential` | Checks a VC-JWT's signature and returns the issuer, the subject, and the ceiling on what the credential proves. |
|
|
30
30
|
| `get_rework_issuer_keys` | Fetches REWORK's public JWKS so you can verify offline yourself instead of trusting this server. |
|
|
31
31
|
| `explain_rework_assurance` | Explains what an assurance level proves and what it explicitly does not. |
|
|
32
|
+
| `lookup_rework_attestation` | Checks whether REWORK actually *issued* a credential — a forged-but-well-formed token fails this — and returns the current OpenTimestamps receipt, which may have been upgraded to a Bitcoin confirmation since issue. The credential is hashed locally; it never leaves your machine. |
|
|
32
33
|
|
|
33
34
|
### Why the verdict ships with a caveat
|
|
34
35
|
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -19,6 +19,8 @@
|
|
|
19
19
|
|
|
20
20
|
'use strict';
|
|
21
21
|
|
|
22
|
+
const crypto = require('node:crypto');
|
|
23
|
+
|
|
22
24
|
const API = (process.env.REWORK_API_URL || 'https://api.reworkdigital.io/api/v1').replace(/\/$/, '');
|
|
23
25
|
const SERVER_VERSION = '1.0.0';
|
|
24
26
|
|
|
@@ -113,6 +115,29 @@ const TOOLS = [
|
|
|
113
115
|
additionalProperties: false,
|
|
114
116
|
},
|
|
115
117
|
},
|
|
118
|
+
{
|
|
119
|
+
name: 'lookup_rework_attestation',
|
|
120
|
+
description:
|
|
121
|
+
'Check whether REWORK actually ISSUED a credential - not just whether its '
|
|
122
|
+
+ 'signature verifies. A forged-but-well-formed token fails this; a real one '
|
|
123
|
+
+ 'returns its issuance record and the CURRENT OpenTimestamps receipt, which '
|
|
124
|
+
+ 'may have been upgraded to a Bitcoin confirmation since issue. Pass the '
|
|
125
|
+
+ 'credential (its sha256 is the lookup key) or the digest directly.',
|
|
126
|
+
inputSchema: {
|
|
127
|
+
type: 'object',
|
|
128
|
+
properties: {
|
|
129
|
+
credential: {
|
|
130
|
+
type: 'string',
|
|
131
|
+
description: 'The VC-JWT. Hashed locally; never sent anywhere.',
|
|
132
|
+
},
|
|
133
|
+
digest: {
|
|
134
|
+
type: 'string',
|
|
135
|
+
description: 'sha256 hex of the credential, if you already have it.',
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
additionalProperties: false,
|
|
139
|
+
},
|
|
140
|
+
},
|
|
116
141
|
];
|
|
117
142
|
|
|
118
143
|
async function http(path, { method = 'GET', body } = {}) {
|
|
@@ -174,6 +199,41 @@ async function callTool(name, args) {
|
|
|
174
199
|
return { assurance_levels: ASSURANCE, credential_types: CREDENTIAL_TYPES };
|
|
175
200
|
}
|
|
176
201
|
|
|
202
|
+
if (name === 'lookup_rework_attestation') {
|
|
203
|
+
let digest = args && args.digest;
|
|
204
|
+
if (!digest && args && args.credential) {
|
|
205
|
+
// Hashed locally: the credential itself never leaves this process.
|
|
206
|
+
digest = crypto.createHash('sha256').update(args.credential, 'utf8').digest('hex');
|
|
207
|
+
}
|
|
208
|
+
if (!digest || !/^[0-9a-f]{64}$/.test(String(digest).toLowerCase())) {
|
|
209
|
+
throw new Error('pass either `credential` (the VC-JWT) or `digest` (64 hex chars)');
|
|
210
|
+
}
|
|
211
|
+
digest = String(digest).toLowerCase();
|
|
212
|
+
try {
|
|
213
|
+
const record = await http(`/github-app/attestations/${digest}`);
|
|
214
|
+
return {
|
|
215
|
+
...record,
|
|
216
|
+
assurance_note:
|
|
217
|
+
'Issuance confirms REWORK signed a credential with this digest. It is '
|
|
218
|
+
+ 'still not a review of the code or a claim the work is any good - '
|
|
219
|
+
+ 'and a "submitted" timestamp is a calendar promise, only "confirmed" '
|
|
220
|
+
+ 'means anchored in Bitcoin.',
|
|
221
|
+
};
|
|
222
|
+
} catch (err) {
|
|
223
|
+
if (String(err.message).includes('REWORK API 404')) {
|
|
224
|
+
return {
|
|
225
|
+
issued: false,
|
|
226
|
+
digest_sha256: digest,
|
|
227
|
+
assurance_note:
|
|
228
|
+
'REWORK has no record of issuing a credential with this digest. A '
|
|
229
|
+
+ 'valid signature with no issuance record deserves suspicion: it '
|
|
230
|
+
+ 'could predate the registry, or it could be a key compromise.',
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
throw err;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
177
237
|
throw new Error(`unknown tool: ${name}`);
|
|
178
238
|
}
|
|
179
239
|
|