@metalabel/dfos-protocol 0.49.0 → 0.50.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/dist/chain/index.js
CHANGED
|
@@ -52,8 +52,8 @@ import {
|
|
|
52
52
|
verifyIdentityExtensionFromTrustedState,
|
|
53
53
|
verifyRevocation,
|
|
54
54
|
verifySignRequest
|
|
55
|
-
} from "../chunk-
|
|
56
|
-
import "../chunk-
|
|
55
|
+
} from "../chunk-JGFFADPR.js";
|
|
56
|
+
import "../chunk-MHSBBYDO.js";
|
|
57
57
|
import "../chunk-JVSC67DC.js";
|
|
58
58
|
import {
|
|
59
59
|
ED25519_PRIV_MULTICODEC,
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
MAX_CREDENTIAL_SIZE,
|
|
3
|
+
carryDependencyMissing,
|
|
3
4
|
decodeDFOSCredentialUnsafe,
|
|
5
|
+
markDependencyMissing,
|
|
4
6
|
matchesResource,
|
|
5
7
|
verifyDFOSCredential,
|
|
6
8
|
verifyDelegationChain
|
|
7
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-MHSBBYDO.js";
|
|
8
10
|
import {
|
|
9
11
|
KEY_ADD_JWS_TYP,
|
|
10
12
|
KEY_ROLES,
|
|
@@ -846,7 +848,10 @@ var verifyContentChain = async (input) => {
|
|
|
846
848
|
});
|
|
847
849
|
} catch (err) {
|
|
848
850
|
const message = err instanceof Error ? err.message : "unknown error";
|
|
849
|
-
throw
|
|
851
|
+
throw carryDependencyMissing(
|
|
852
|
+
err,
|
|
853
|
+
new Error(`log[${idx}]: authorization verification failed: ${message}`)
|
|
854
|
+
);
|
|
850
855
|
}
|
|
851
856
|
}
|
|
852
857
|
const encoded = await dagCborCanonicalEncode(op);
|
|
@@ -951,7 +956,7 @@ var verifyContentExtensionFromTrustedState = async (input) => {
|
|
|
951
956
|
});
|
|
952
957
|
} catch (err) {
|
|
953
958
|
const message = err instanceof Error ? err.message : "unknown error";
|
|
954
|
-
throw new Error(`authorization verification failed: ${message}`);
|
|
959
|
+
throw carryDependencyMissing(err, new Error(`authorization verification failed: ${message}`));
|
|
955
960
|
}
|
|
956
961
|
}
|
|
957
962
|
const encoded = await dagCborCanonicalEncode(op);
|
|
@@ -1151,7 +1156,7 @@ var resolveKeyFromIdentity = (identity, kid) => {
|
|
|
1151
1156
|
const allKeys = [...identity.authKeys, ...identity.assertKeys, ...identity.controllerKeys];
|
|
1152
1157
|
const key = allKeys.find((k) => k.id === keyId);
|
|
1153
1158
|
if (!key) {
|
|
1154
|
-
throw invalid(`key ${keyId} not found on identity ${identity.did}`);
|
|
1159
|
+
throw markDependencyMissing(invalid(`key ${keyId} not found on identity ${identity.did}`));
|
|
1155
1160
|
}
|
|
1156
1161
|
const { keyBytes } = decodeMultikey(key.publicKeyMultibase);
|
|
1157
1162
|
return keyBytes;
|
|
@@ -1241,7 +1246,7 @@ var verifyCreditClaim = async (jwsToken, options) => {
|
|
|
1241
1246
|
throw unverifiable(`could not resolve claimant identity ${payload.did}: ${detail}`);
|
|
1242
1247
|
}
|
|
1243
1248
|
if (!identity) {
|
|
1244
|
-
throw unverifiable(`claimant identity not found: ${payload.did}`);
|
|
1249
|
+
throw markDependencyMissing(unverifiable(`claimant identity not found: ${payload.did}`));
|
|
1245
1250
|
}
|
|
1246
1251
|
const publicKey = resolveKeyFromIdentity(identity, kid);
|
|
1247
1252
|
try {
|
|
@@ -364,6 +364,11 @@ var verifyProofEnvelope = async (input, shape, resolvePresenter) => {
|
|
|
364
364
|
var verifyIdentityProofEnvelope = (input, resolvePresenter) => verifyProofEnvelope(input, IDENTITY_PROOF_SHAPE, resolvePresenter);
|
|
365
365
|
var verifyRequestProofEnvelope = (input, resolvePresenter) => verifyProofEnvelope(input, REQUEST_PROOF_SHAPE, resolvePresenter);
|
|
366
366
|
|
|
367
|
+
// src/dependency.ts
|
|
368
|
+
var markDependencyMissing = (err) => Object.assign(err, { dependencyMissing: true });
|
|
369
|
+
var isDependencyMissing = (err) => err instanceof Error && err.dependencyMissing === true;
|
|
370
|
+
var carryDependencyMissing = (cause, wrapped) => isDependencyMissing(cause) ? markDependencyMissing(wrapped) : wrapped;
|
|
371
|
+
|
|
367
372
|
// src/credentials/dfos-credential.ts
|
|
368
373
|
var resolveKeyFromIdentity = (identity, kid) => {
|
|
369
374
|
const hashIdx = kid.indexOf("#");
|
|
@@ -372,7 +377,9 @@ var resolveKeyFromIdentity = (identity, kid) => {
|
|
|
372
377
|
const allKeys = [...identity.authKeys, ...identity.assertKeys, ...identity.controllerKeys];
|
|
373
378
|
const key = allKeys.find((k) => k.id === keyId);
|
|
374
379
|
if (!key) {
|
|
375
|
-
throw
|
|
380
|
+
throw markDependencyMissing(
|
|
381
|
+
new CredentialVerificationError(`key ${keyId} not found on identity ${identity.did}`)
|
|
382
|
+
);
|
|
376
383
|
}
|
|
377
384
|
const { keyBytes } = decodeMultikey(key.publicKeyMultibase);
|
|
378
385
|
return keyBytes;
|
|
@@ -430,7 +437,9 @@ var verifyDFOSCredential = async (jwsToken, options) => {
|
|
|
430
437
|
}
|
|
431
438
|
const identity = await options.resolveIdentity(payload.iss);
|
|
432
439
|
if (!identity) {
|
|
433
|
-
throw
|
|
440
|
+
throw markDependencyMissing(
|
|
441
|
+
new CredentialVerificationError(`issuer identity not found: ${payload.iss}`)
|
|
442
|
+
);
|
|
434
443
|
}
|
|
435
444
|
if (identity.isDeleted) {
|
|
436
445
|
throw new CredentialVerificationError(`issuer identity is deleted: ${payload.iss}`);
|
|
@@ -594,6 +603,9 @@ var CredentialVerificationError = class extends Error {
|
|
|
594
603
|
};
|
|
595
604
|
|
|
596
605
|
export {
|
|
606
|
+
markDependencyMissing,
|
|
607
|
+
isDependencyMissing,
|
|
608
|
+
carryDependencyMissing,
|
|
597
609
|
MAX_CREDENTIAL_SIZE,
|
|
598
610
|
Attenuation,
|
|
599
611
|
DFOSCredentialPayload,
|
package/dist/index.d.ts
CHANGED
|
@@ -7,3 +7,24 @@ export { FoldOperation, INDEX_V1_SCHEMA, IndexDelta, IndexDocument, IndexEntry,
|
|
|
7
7
|
import 'multiformats';
|
|
8
8
|
import 'multiformats/cid';
|
|
9
9
|
import 'zod';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Mark an error as "a referenced identity or key is not resolvable HERE".
|
|
13
|
+
*
|
|
14
|
+
* Returns the same error so it can be marked inline at a throw site:
|
|
15
|
+
* `throw markDependencyMissing(new CredentialVerificationError(...))`.
|
|
16
|
+
*/
|
|
17
|
+
declare const markDependencyMissing: <E extends Error>(err: E) => E;
|
|
18
|
+
/** True if `err` carries the marker. */
|
|
19
|
+
declare const isDependencyMissing: (err: unknown) => boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Carry the marker from a caught error onto the error that replaces it.
|
|
22
|
+
*
|
|
23
|
+
* This is the TypeScript spelling of Go's `%w`: a layer that re-throws with more
|
|
24
|
+
* context must not eat the one fact only the inner layer knew. Every re-wrap
|
|
25
|
+
* between a resolver and a relay's classifier goes through this, or the marker
|
|
26
|
+
* is lost at that boundary and the classification silently reverts to a guess.
|
|
27
|
+
*/
|
|
28
|
+
declare const carryDependencyMissing: <E extends Error>(cause: unknown, wrapped: E) => E;
|
|
29
|
+
|
|
30
|
+
export { carryDependencyMissing, isDependencyMissing, markDependencyMissing };
|
package/dist/index.js
CHANGED
|
@@ -52,7 +52,7 @@ import {
|
|
|
52
52
|
verifyIdentityExtensionFromTrustedState,
|
|
53
53
|
verifyRevocation,
|
|
54
54
|
verifySignRequest
|
|
55
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-JGFFADPR.js";
|
|
56
56
|
import {
|
|
57
57
|
ApiRequestVerifyError,
|
|
58
58
|
Attenuation,
|
|
@@ -74,10 +74,13 @@ import {
|
|
|
74
74
|
buildApiAuthHeaders,
|
|
75
75
|
buildApiIdentityHeaders,
|
|
76
76
|
canonicalExtraMembers,
|
|
77
|
+
carryDependencyMissing,
|
|
77
78
|
createDFOSCredential,
|
|
78
79
|
decodeDFOSCredentialUnsafe,
|
|
79
80
|
invalidProof,
|
|
80
81
|
isAttenuated,
|
|
82
|
+
isDependencyMissing,
|
|
83
|
+
markDependencyMissing,
|
|
81
84
|
matchesResource,
|
|
82
85
|
misconfiguredProof,
|
|
83
86
|
parseDfosAuthorization,
|
|
@@ -89,7 +92,7 @@ import {
|
|
|
89
92
|
verifyDelegationChain,
|
|
90
93
|
verifyIdentityProofEnvelope,
|
|
91
94
|
verifyRequestProofEnvelope
|
|
92
|
-
} from "./chunk-
|
|
95
|
+
} from "./chunk-MHSBBYDO.js";
|
|
93
96
|
import {
|
|
94
97
|
DEFAULT_KEY_PROOF_SKEW_SECONDS,
|
|
95
98
|
KEY_ADD_JWS_TYP,
|
|
@@ -213,6 +216,7 @@ export {
|
|
|
213
216
|
buildSignRequest,
|
|
214
217
|
byteCompare,
|
|
215
218
|
canonicalExtraMembers,
|
|
219
|
+
carryDependencyMissing,
|
|
216
220
|
classifyAnchor,
|
|
217
221
|
compareHeadPreference,
|
|
218
222
|
compareLinear,
|
|
@@ -237,12 +241,14 @@ export {
|
|
|
237
241
|
isAttenuated,
|
|
238
242
|
isCanonicalRoleSet,
|
|
239
243
|
isCanonicallyEqual,
|
|
244
|
+
isDependencyMissing,
|
|
240
245
|
isRecognizedServiceType,
|
|
241
246
|
isValidEd25519Signature,
|
|
242
247
|
isValidId,
|
|
243
248
|
keyProofSigningInput,
|
|
244
249
|
keyWordFingerprint,
|
|
245
250
|
linearize,
|
|
251
|
+
markDependencyMissing,
|
|
246
252
|
matchesResource,
|
|
247
253
|
misconfiguredProof,
|
|
248
254
|
normalizedId,
|