@metalabel/dfos-protocol 0.52.0 → 0.52.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/chain/index.js +4 -4
- package/dist/{chunk-QRCOMLAP.js → chunk-BMIOY5W5.js} +1 -1
- package/dist/{chunk-IV3TIYKP.js → chunk-FZHHSC5N.js} +3 -2
- package/dist/{chunk-QTJZGXMH.js → chunk-KAW4MT4P.js} +1 -1
- package/dist/{chunk-OU2DPHCN.js → chunk-Q7FREWMY.js} +12 -6
- package/dist/credentials/index.js +2 -2
- package/dist/crypto/index.d.ts +4 -2
- package/dist/crypto/index.js +1 -1
- package/dist/index.js +4 -4
- package/dist/key-proof/index.d.ts +1 -1
- package/dist/key-proof/index.js +2 -2
- package/package.json +1 -1
package/dist/chain/index.js
CHANGED
|
@@ -52,9 +52,9 @@ import {
|
|
|
52
52
|
verifyIdentityExtensionFromTrustedState,
|
|
53
53
|
verifyRevocation,
|
|
54
54
|
verifySignRequest
|
|
55
|
-
} from "../chunk-
|
|
56
|
-
import "../chunk-
|
|
57
|
-
import "../chunk-
|
|
55
|
+
} from "../chunk-Q7FREWMY.js";
|
|
56
|
+
import "../chunk-FZHHSC5N.js";
|
|
57
|
+
import "../chunk-BMIOY5W5.js";
|
|
58
58
|
import {
|
|
59
59
|
ED25519_PRIV_MULTICODEC,
|
|
60
60
|
ED25519_PUB_MULTICODEC,
|
|
@@ -62,7 +62,7 @@ import {
|
|
|
62
62
|
decodeMultikey,
|
|
63
63
|
encodeEd25519Multikey
|
|
64
64
|
} from "../chunk-F7RHI2CK.js";
|
|
65
|
-
import "../chunk-
|
|
65
|
+
import "../chunk-KAW4MT4P.js";
|
|
66
66
|
export {
|
|
67
67
|
ARTIFACT_CID_ANCHOR_RE,
|
|
68
68
|
ArtifactPayload,
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
decodeJwsUnsafe,
|
|
11
11
|
sha256,
|
|
12
12
|
verifyJws
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-KAW4MT4P.js";
|
|
14
14
|
|
|
15
15
|
// src/credentials/schemas.ts
|
|
16
16
|
import { z } from "zod";
|
|
@@ -438,6 +438,7 @@ var verifyDFOSCredential = async (jwsToken, options) => {
|
|
|
438
438
|
}
|
|
439
439
|
const payload = result.data;
|
|
440
440
|
const kid = decoded.header.kid;
|
|
441
|
+
if (kid === void 0) throw new CredentialVerificationError("credential kid must be present");
|
|
441
442
|
const hashIdx = kid.indexOf("#");
|
|
442
443
|
if (hashIdx < 0) throw new CredentialVerificationError("credential kid must be a DID URL");
|
|
443
444
|
const kidDid = kid.substring(0, hashIdx);
|
|
@@ -596,7 +597,7 @@ var matchesResource = async (att, resource, action) => {
|
|
|
596
597
|
};
|
|
597
598
|
var decodeDFOSCredentialUnsafe = (jwsToken) => {
|
|
598
599
|
const decoded = decodeJwsUnsafe(jwsToken);
|
|
599
|
-
if (!decoded) return null;
|
|
600
|
+
if (!decoded || decoded.header.kid === void 0) return null;
|
|
600
601
|
const result = DFOSCredentialPayload.safeParse(decoded.payload);
|
|
601
602
|
if (!result.success) return null;
|
|
602
603
|
return {
|
|
@@ -178,7 +178,7 @@ var decodeJwsSegment = (segmentB64) => {
|
|
|
178
178
|
var asJwsHeader = (raw) => {
|
|
179
179
|
if (typeof raw["alg"] !== "string") return null;
|
|
180
180
|
if (typeof raw["typ"] !== "string") return null;
|
|
181
|
-
if (typeof raw["kid"] !== "string") return null;
|
|
181
|
+
if ("kid" in raw && typeof raw["kid"] !== "string") return null;
|
|
182
182
|
if ("cid" in raw && typeof raw["cid"] !== "string") return null;
|
|
183
183
|
return raw;
|
|
184
184
|
};
|
|
@@ -6,13 +6,13 @@ import {
|
|
|
6
6
|
matchesResource,
|
|
7
7
|
verifyDFOSCredential,
|
|
8
8
|
verifyDelegationChain
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-FZHHSC5N.js";
|
|
10
10
|
import {
|
|
11
11
|
KEY_ADD_JWS_TYP,
|
|
12
12
|
KEY_ROLES,
|
|
13
13
|
unsafeKeyProofSubject,
|
|
14
14
|
verifyChainKeyProof
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-BMIOY5W5.js";
|
|
16
16
|
import {
|
|
17
17
|
decodeEd25519PublicMultikey
|
|
18
18
|
} from "./chunk-F7RHI2CK.js";
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
decodeJwsUnsafe,
|
|
26
26
|
generateIdNoPrefix,
|
|
27
27
|
verifyJws
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-KAW4MT4P.js";
|
|
29
29
|
|
|
30
30
|
// src/chain/schemas.ts
|
|
31
31
|
import { z } from "zod";
|
|
@@ -560,6 +560,7 @@ var verifyIdentityChain = async (input) => {
|
|
|
560
560
|
throw new Error(`log[${idx}]: cid mismatch in protected header`);
|
|
561
561
|
}
|
|
562
562
|
const kid = decoded.header.kid;
|
|
563
|
+
if (kid === void 0) throw new Error(`log[${idx}]: kid must be present`);
|
|
563
564
|
let signingKeyId;
|
|
564
565
|
if (kid.includes("#")) {
|
|
565
566
|
const hashIdx = kid.indexOf("#");
|
|
@@ -704,6 +705,7 @@ var verifyIdentityExtensionFromTrustedState = async (input) => {
|
|
|
704
705
|
if (!decoded.header.cid) throw new Error("missing cid in protected header");
|
|
705
706
|
if (decoded.header.cid !== operationCID) throw new Error("cid mismatch in protected header");
|
|
706
707
|
const kid = decoded.header.kid;
|
|
708
|
+
if (kid === void 0) throw new Error("kid must be present");
|
|
707
709
|
if (!kid.includes("#")) {
|
|
708
710
|
throw new Error("non-genesis op kid must be DID URL, got bare key ID");
|
|
709
711
|
}
|
|
@@ -892,6 +894,7 @@ var verifyContentChain = async (input) => {
|
|
|
892
894
|
}
|
|
893
895
|
}
|
|
894
896
|
const kid = decoded.header.kid;
|
|
897
|
+
if (kid === void 0) throw new Error(`log[${idx}]: kid must be present`);
|
|
895
898
|
const hashIdx = kid.indexOf("#");
|
|
896
899
|
if (hashIdx < 0) throw new Error(`log[${idx}]: kid must be a DID URL`);
|
|
897
900
|
const kidDid = kid.substring(0, hashIdx);
|
|
@@ -1002,6 +1005,7 @@ var verifyContentExtensionFromTrustedState = async (input) => {
|
|
|
1002
1005
|
throw new Error("createdAt must be after last op");
|
|
1003
1006
|
}
|
|
1004
1007
|
const kid = decoded.header.kid;
|
|
1008
|
+
if (kid === void 0) throw new Error("kid must be present");
|
|
1005
1009
|
const hashIdx = kid.indexOf("#");
|
|
1006
1010
|
if (hashIdx < 0) throw new Error("kid must be a DID URL");
|
|
1007
1011
|
const kidDid = kid.substring(0, hashIdx);
|
|
@@ -1080,6 +1084,7 @@ var verifyCountersignature = async (input) => {
|
|
|
1080
1084
|
}
|
|
1081
1085
|
const payload = result.data;
|
|
1082
1086
|
const kid = decoded.header.kid;
|
|
1087
|
+
if (kid === void 0) throw new Error("kid must be present");
|
|
1083
1088
|
const hashIdx = kid.indexOf("#");
|
|
1084
1089
|
if (hashIdx < 0) throw new Error("countersignature kid must be a DID URL");
|
|
1085
1090
|
const kidDid = kid.substring(0, hashIdx);
|
|
@@ -1133,6 +1138,7 @@ var verifyArtifact = async (input) => {
|
|
|
1133
1138
|
throw new Error(`invalid artifact typ: ${decoded.header.typ}`);
|
|
1134
1139
|
}
|
|
1135
1140
|
const kid = decoded.header.kid;
|
|
1141
|
+
if (kid === void 0) throw new Error("kid must be present");
|
|
1136
1142
|
const hashIdx = kid.indexOf("#");
|
|
1137
1143
|
if (hashIdx < 0) throw new Error("artifact kid must be a DID URL");
|
|
1138
1144
|
const kidDid = kid.substring(0, hashIdx);
|
|
@@ -1190,6 +1196,7 @@ var verifyRevocation = async (input) => {
|
|
|
1190
1196
|
throw new Error(`invalid revocation typ: ${decoded.header.typ}`);
|
|
1191
1197
|
}
|
|
1192
1198
|
const kid = decoded.header.kid;
|
|
1199
|
+
if (kid === void 0) throw new Error("kid must be present");
|
|
1193
1200
|
const hashIdx = kid.indexOf("#");
|
|
1194
1201
|
if (hashIdx < 0) throw new Error("revocation kid must be a DID URL");
|
|
1195
1202
|
const kidDid = kid.substring(0, hashIdx);
|
|
@@ -1295,8 +1302,7 @@ var verifyCreditClaim = async (jwsToken, options) => {
|
|
|
1295
1302
|
}
|
|
1296
1303
|
const decoded = decodeJwsUnsafe(jwsToken);
|
|
1297
1304
|
if (!decoded) throw invalid("failed to decode credit claim JWS");
|
|
1298
|
-
|
|
1299
|
-
if (typeof rawHeader["typ"] !== "string" || typeof rawHeader["kid"] !== "string") {
|
|
1305
|
+
if (typeof decoded.header.kid !== "string") {
|
|
1300
1306
|
throw invalid("credit claim header must carry a string typ and kid");
|
|
1301
1307
|
}
|
|
1302
1308
|
if (decoded.header.typ !== "did:dfos:credit-claim") {
|
|
@@ -1522,7 +1528,7 @@ var verifySignRequest = async (jwsToken, options) => {
|
|
|
1522
1528
|
throw invalid2("sign request protected header must be an object");
|
|
1523
1529
|
}
|
|
1524
1530
|
assertJwsProfile(rawHeader, invalid2);
|
|
1525
|
-
if (typeof rawHeader["typ"] !== "string" || typeof
|
|
1531
|
+
if (typeof rawHeader["typ"] !== "string" || typeof decoded.header.kid !== "string") {
|
|
1526
1532
|
throw invalid2("sign request header must carry a string typ and kid");
|
|
1527
1533
|
}
|
|
1528
1534
|
if (decoded.header.typ !== "did:dfos:sign-request") {
|
|
@@ -34,9 +34,9 @@ import {
|
|
|
34
34
|
verifyDelegationChain,
|
|
35
35
|
verifyIdentityProofEnvelope,
|
|
36
36
|
verifyRequestProofEnvelope
|
|
37
|
-
} from "../chunk-
|
|
37
|
+
} from "../chunk-FZHHSC5N.js";
|
|
38
38
|
import "../chunk-F7RHI2CK.js";
|
|
39
|
-
import "../chunk-
|
|
39
|
+
import "../chunk-KAW4MT4P.js";
|
|
40
40
|
export {
|
|
41
41
|
ApiRequestVerifyError,
|
|
42
42
|
Attenuation,
|
package/dist/crypto/index.d.ts
CHANGED
|
@@ -85,7 +85,7 @@ declare const normalizedId: <T extends string>(prefix: T, id: string) => `${T}_$
|
|
|
85
85
|
interface JwsHeader {
|
|
86
86
|
alg: 'EdDSA';
|
|
87
87
|
typ: string;
|
|
88
|
-
kid
|
|
88
|
+
kid?: string;
|
|
89
89
|
/** CIDv1 of the operation payload (dag-cbor + SHA-256), signed in the protected header */
|
|
90
90
|
cid?: string;
|
|
91
91
|
}
|
|
@@ -96,7 +96,9 @@ interface JwsHeader {
|
|
|
96
96
|
* signature (64 bytes)
|
|
97
97
|
*/
|
|
98
98
|
declare const createJws: (options: {
|
|
99
|
-
header: JwsHeader
|
|
99
|
+
header: JwsHeader & {
|
|
100
|
+
kid: string;
|
|
101
|
+
};
|
|
100
102
|
payload: Record<string, unknown>;
|
|
101
103
|
sign: (message: Uint8Array) => Promise<Uint8Array>;
|
|
102
104
|
}) => Promise<string>;
|
package/dist/crypto/index.js
CHANGED
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-Q7FREWMY.js";
|
|
56
56
|
import {
|
|
57
57
|
ApiRequestVerifyError,
|
|
58
58
|
Attenuation,
|
|
@@ -92,7 +92,7 @@ import {
|
|
|
92
92
|
verifyDelegationChain,
|
|
93
93
|
verifyIdentityProofEnvelope,
|
|
94
94
|
verifyRequestProofEnvelope
|
|
95
|
-
} from "./chunk-
|
|
95
|
+
} from "./chunk-FZHHSC5N.js";
|
|
96
96
|
import {
|
|
97
97
|
DEFAULT_KEY_PROOF_SKEW_SECONDS,
|
|
98
98
|
KEY_ADD_JWS_TYP,
|
|
@@ -109,7 +109,7 @@ import {
|
|
|
109
109
|
unsafeKeyProofSubject,
|
|
110
110
|
verifyChainKeyProof,
|
|
111
111
|
verifyKeyProof
|
|
112
|
-
} from "./chunk-
|
|
112
|
+
} from "./chunk-BMIOY5W5.js";
|
|
113
113
|
import {
|
|
114
114
|
ED25519_PRIV_MULTICODEC,
|
|
115
115
|
ED25519_PUB_MULTICODEC,
|
|
@@ -142,7 +142,7 @@ import {
|
|
|
142
142
|
signPayloadEd25519,
|
|
143
143
|
verifyJws,
|
|
144
144
|
verifyJwt
|
|
145
|
-
} from "./chunk-
|
|
145
|
+
} from "./chunk-KAW4MT4P.js";
|
|
146
146
|
import {
|
|
147
147
|
INDEX_V1_SCHEMA,
|
|
148
148
|
byteCompare,
|
|
@@ -143,7 +143,7 @@ interface SignKeyProofInput {
|
|
|
143
143
|
* The protected header is EXACTLY `{"alg":"EdDSA","typ":"<purpose>"}` — two
|
|
144
144
|
* members, no `kid` (the key is in no chain and rides in the payload) and no
|
|
145
145
|
* `cid` (there is no operation to bind). It is assembled by hand rather than
|
|
146
|
-
* through `createJws`, whose
|
|
146
|
+
* through `createJws`, whose header input requires a `kid` this envelope must not
|
|
147
147
|
* carry.
|
|
148
148
|
*
|
|
149
149
|
* HOLDER OBLIGATIONS THIS FUNCTION CANNOT DISCHARGE (INTEGRATIONS.md, Holder
|
package/dist/key-proof/index.js
CHANGED
|
@@ -14,9 +14,9 @@ import {
|
|
|
14
14
|
unsafeKeyProofSubject,
|
|
15
15
|
verifyChainKeyProof,
|
|
16
16
|
verifyKeyProof
|
|
17
|
-
} from "../chunk-
|
|
17
|
+
} from "../chunk-BMIOY5W5.js";
|
|
18
18
|
import "../chunk-F7RHI2CK.js";
|
|
19
|
-
import "../chunk-
|
|
19
|
+
import "../chunk-KAW4MT4P.js";
|
|
20
20
|
export {
|
|
21
21
|
DEFAULT_KEY_PROOF_SKEW_SECONDS,
|
|
22
22
|
KEY_ADD_JWS_TYP,
|