@metalabel/dfos-web-relay 0.12.0 → 0.13.1
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/index.js +5 -28
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -995,11 +995,13 @@ var createHttpPeerClient = () => {
|
|
|
995
995
|
};
|
|
996
996
|
|
|
997
997
|
// src/relay.ts
|
|
998
|
-
import { createRequire } from "module";
|
|
999
998
|
import { dagCborCanonicalEncode as dagCborCanonicalEncode2, decodeJwsUnsafe as decodeJwsUnsafe3 } from "@metalabel/dfos-protocol/crypto";
|
|
1000
999
|
import { Hono } from "hono";
|
|
1001
1000
|
import { z } from "zod";
|
|
1002
1001
|
|
|
1002
|
+
// package.json
|
|
1003
|
+
var version = "0.13.1";
|
|
1004
|
+
|
|
1003
1005
|
// src/auth.ts
|
|
1004
1006
|
import {
|
|
1005
1007
|
matchesResource,
|
|
@@ -1062,27 +1064,6 @@ var hasPublicStandingAuth = async (contentId, action, store) => {
|
|
|
1062
1064
|
}
|
|
1063
1065
|
return false;
|
|
1064
1066
|
};
|
|
1065
|
-
var derivePublicGrants = async (contentId, creatorDID, store) => {
|
|
1066
|
-
const resource = `chain:${contentId}`;
|
|
1067
|
-
const publicCreds = await store.getPublicCredentials(resource);
|
|
1068
|
-
if (publicCreds.length === 0) return [];
|
|
1069
|
-
const resolveIdentity = createHistoricalIdentityResolver(store);
|
|
1070
|
-
const isRevoked = async (issuerDID, credentialCID) => store.isCredentialRevoked(issuerDID, credentialCID);
|
|
1071
|
-
const grants = [];
|
|
1072
|
-
for (const credJws of publicCreds) {
|
|
1073
|
-
try {
|
|
1074
|
-
const cred = await verifyDFOSCredential2(credJws, { resolveIdentity });
|
|
1075
|
-
if (await isRevoked(cred.iss, cred.credentialCID)) continue;
|
|
1076
|
-
if (!await matchesResource(cred.att, resource, "read")) continue;
|
|
1077
|
-
await verifyDelegationChain(cred, { resolveIdentity, rootDID: creatorDID, isRevoked });
|
|
1078
|
-
grants.push(credJws);
|
|
1079
|
-
} catch {
|
|
1080
|
-
continue;
|
|
1081
|
-
}
|
|
1082
|
-
}
|
|
1083
|
-
grants.sort();
|
|
1084
|
-
return grants;
|
|
1085
|
-
};
|
|
1086
1067
|
var verifyContentAccess = async (options) => {
|
|
1087
1068
|
const { credentialJWS, requestedResource, action, store, creatorDID, requesterDID } = options;
|
|
1088
1069
|
if (requesterDID && requesterDID === creatorDID) {
|
|
@@ -1168,8 +1149,6 @@ var sequenceOps = async (store) => {
|
|
|
1168
1149
|
};
|
|
1169
1150
|
|
|
1170
1151
|
// src/relay.ts
|
|
1171
|
-
var require2 = createRequire(import.meta.url);
|
|
1172
|
-
var { version: RELAY_VERSION } = require2("../package.json");
|
|
1173
1152
|
var MAX_OPERATIONS_PER_BATCH = 100;
|
|
1174
1153
|
var IngestBody = z.object({
|
|
1175
1154
|
operations: z.array(z.string()).min(1).max(MAX_OPERATIONS_PER_BATCH)
|
|
@@ -1260,12 +1239,11 @@ var createRelay = async (options) => {
|
|
|
1260
1239
|
return c.json({
|
|
1261
1240
|
did: relayDID,
|
|
1262
1241
|
protocol: "dfos-web-relay",
|
|
1263
|
-
version
|
|
1242
|
+
version,
|
|
1264
1243
|
capabilities: {
|
|
1265
1244
|
proof: true,
|
|
1266
1245
|
write: writeEnabled,
|
|
1267
1246
|
content: contentEnabled,
|
|
1268
|
-
documents: contentEnabled,
|
|
1269
1247
|
log: logEnabled
|
|
1270
1248
|
},
|
|
1271
1249
|
profile: profileArtifactJws
|
|
@@ -1427,8 +1405,7 @@ var createRelay = async (options) => {
|
|
|
1427
1405
|
contentId: chain.contentId,
|
|
1428
1406
|
genesisCID: chain.genesisCID,
|
|
1429
1407
|
headCID: chain.state.headCID,
|
|
1430
|
-
state: chain.state
|
|
1431
|
-
publicGrants: await derivePublicGrants(contentId, chain.state.creatorDID, store)
|
|
1408
|
+
state: chain.state
|
|
1432
1409
|
});
|
|
1433
1410
|
});
|
|
1434
1411
|
app.get(`${PROOF_BASE_PATH}/countersignatures/:cid`, async (c) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metalabel/dfos-web-relay",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "DFOS Web Relay — verifying HTTP relay for identity chains, content chains, and content blobs",
|
|
6
6
|
"license": "MIT",
|
|
@@ -45,14 +45,14 @@
|
|
|
45
45
|
"zod": "^4.4.3"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
|
-
"@metalabel/dfos-protocol": "^0.
|
|
48
|
+
"@metalabel/dfos-protocol": "^0.13.1"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@types/node": "^24.10.4",
|
|
52
52
|
"tsup": "^8.5.1",
|
|
53
53
|
"tsx": "^4.22.4",
|
|
54
54
|
"vitest": "^4.1.8",
|
|
55
|
-
"@metalabel/dfos-protocol": "0.
|
|
55
|
+
"@metalabel/dfos-protocol": "0.13.1"
|
|
56
56
|
},
|
|
57
57
|
"scripts": {
|
|
58
58
|
"build": "tsup",
|