@metalabel/dfos-protocol 0.31.0 → 0.32.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.
@@ -49,14 +49,14 @@ import {
49
49
  verifyIdentityExtensionFromTrustedState,
50
50
  verifyRevocation,
51
51
  verifySignRequest
52
- } from "../chunk-W4ESJVMO.js";
52
+ } from "../chunk-W7IFQNUH.js";
53
53
  import {
54
54
  ED25519_PRIV_MULTICODEC,
55
55
  ED25519_PUB_MULTICODEC,
56
56
  decodeMultikey,
57
57
  encodeEd25519Multikey
58
- } from "../chunk-6HVYO5OS.js";
59
- import "../chunk-4QQ5HK5M.js";
58
+ } from "../chunk-XP644GQK.js";
59
+ import "../chunk-4LG2GEB2.js";
60
60
  export {
61
61
  ARTIFACT_CID_ANCHOR_RE,
62
62
  ArtifactPayload,
@@ -37,6 +37,10 @@ var isValidEd25519Signature = (payload, signature, publicKey) => {
37
37
  return ed25519.verify(signature, payload, publicKey);
38
38
  };
39
39
 
40
+ // src/crypto/hash.ts
41
+ import { sha256 as nobleSha256 } from "@noble/hashes/sha2.js";
42
+ var sha256 = (data) => nobleSha256(data);
43
+
40
44
  // src/crypto/id.ts
41
45
  import { sha256 as sha256Hash } from "@noble/hashes/sha2.js";
42
46
  var alphabet = "2346789acdefhknrtvz";
@@ -225,7 +229,7 @@ var JwtVerificationError = class extends Error {
225
229
  import * as dagCborCodec from "@ipld/dag-cbor";
226
230
  import * as Block from "multiformats/block";
227
231
  import { CID } from "multiformats/cid";
228
- import { sha256 } from "multiformats/hashes/sha2";
232
+ import { sha256 as sha2562 } from "multiformats/hashes/sha2";
229
233
  var dagCborCanonicalEncode = async (value) => {
230
234
  assertCanonicalNumbers(value);
231
235
  const serialized = JSON.parse(JSON.stringify(value));
@@ -235,7 +239,7 @@ var dagCborCanonicalEncode = async (value) => {
235
239
  // -0 to 0)
236
240
  value: serialized,
237
241
  codec: dagCborCodec,
238
- hasher: sha256
242
+ hasher: sha2562
239
243
  });
240
244
  };
241
245
  var MAX_SAFE_CANONICAL_INTEGER = 9007199254740991;
@@ -284,6 +288,7 @@ export {
284
288
  importEd25519Keypair,
285
289
  signPayloadEd25519,
286
290
  isValidEd25519Signature,
291
+ sha256,
287
292
  generateIdNoPrefix,
288
293
  generateId,
289
294
  isValidId,
@@ -5,7 +5,7 @@ import {
5
5
  matchesResource,
6
6
  verifyDFOSCredential,
7
7
  verifyDelegationChain
8
- } from "./chunk-6HVYO5OS.js";
8
+ } from "./chunk-XP644GQK.js";
9
9
  import {
10
10
  assertJwsProfile,
11
11
  base64urlDecode,
@@ -15,7 +15,7 @@ import {
15
15
  decodeJwsUnsafe,
16
16
  generateIdNoPrefix,
17
17
  verifyJws
18
- } from "./chunk-4QQ5HK5M.js";
18
+ } from "./chunk-4LG2GEB2.js";
19
19
 
20
20
  // src/chain/schemas.ts
21
21
  import { z } from "zod";
@@ -5,7 +5,7 @@ import {
5
5
  decodeJwsUnsafe,
6
6
  verifyJws,
7
7
  verifyJwt
8
- } from "./chunk-4QQ5HK5M.js";
8
+ } from "./chunk-4LG2GEB2.js";
9
9
 
10
10
  // src/credentials/schemas.ts
11
11
  import { z } from "zod";
@@ -13,8 +13,8 @@ import {
13
13
  verifyAuthToken,
14
14
  verifyDFOSCredential,
15
15
  verifyDelegationChain
16
- } from "../chunk-6HVYO5OS.js";
17
- import "../chunk-4QQ5HK5M.js";
16
+ } from "../chunk-XP644GQK.js";
17
+ import "../chunk-4LG2GEB2.js";
18
18
  export {
19
19
  Attenuation,
20
20
  AuthTokenClaims,
@@ -35,6 +35,9 @@ declare const signPayloadEd25519: (payload: Uint8Array, privateKey: Uint8Array)
35
35
  */
36
36
  declare const isValidEd25519Signature: (payload: Uint8Array, signature: Uint8Array, publicKey: Uint8Array) => boolean;
37
37
 
38
+ /** SHA-256 of the given octets, as 32 raw bytes. */
39
+ declare const sha256: (data: Uint8Array) => Uint8Array;
40
+
38
41
  type PrefixedID<T extends string> = `${T}_${string}`;
39
42
  /**
40
43
  * Generate an ID without a prefix
@@ -211,4 +214,4 @@ declare const parseDagCborCID: (cid: string) => CID<unknown, number, number, mul
211
214
  */
212
215
  declare const isCanonicallyEqual: (data1: unknown, data2: unknown) => Promise<boolean>;
213
216
 
214
- export { type JwsHeader, JwsVerificationError, type JwtClaims, type JwtCreateOptions, type JwtHeader, JwtVerificationError, type JwtVerifyOptions, type PrefixedID, assertJwsProfile, base64urlDecode, base64urlEncode, createJws, createJwt, createNewEd25519Keypair, dagCborCanonicalEncode, decodeJwsUnsafe, decodeJwtUnsafe, generateId, generateIdNoPrefix, importEd25519Keypair, isCanonicallyEqual, isValidEd25519Signature, isValidId, normalizedId, parseDagCborCID, signPayloadEd25519, verifyJws, verifyJwt };
217
+ export { type JwsHeader, JwsVerificationError, type JwtClaims, type JwtCreateOptions, type JwtHeader, JwtVerificationError, type JwtVerifyOptions, type PrefixedID, assertJwsProfile, base64urlDecode, base64urlEncode, createJws, createJwt, createNewEd25519Keypair, dagCborCanonicalEncode, decodeJwsUnsafe, decodeJwtUnsafe, generateId, generateIdNoPrefix, importEd25519Keypair, isCanonicallyEqual, isValidEd25519Signature, isValidId, normalizedId, parseDagCborCID, sha256, signPayloadEd25519, verifyJws, verifyJwt };
@@ -18,10 +18,11 @@ import {
18
18
  isValidId,
19
19
  normalizedId,
20
20
  parseDagCborCID,
21
+ sha256,
21
22
  signPayloadEd25519,
22
23
  verifyJws,
23
24
  verifyJwt
24
- } from "../chunk-4QQ5HK5M.js";
25
+ } from "../chunk-4LG2GEB2.js";
25
26
  export {
26
27
  JwsVerificationError,
27
28
  JwtVerificationError,
@@ -42,6 +43,7 @@ export {
42
43
  isValidId,
43
44
  normalizedId,
44
45
  parseDagCborCID,
46
+ sha256,
45
47
  signPayloadEd25519,
46
48
  verifyJws,
47
49
  verifyJwt
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { JwsHeader, JwsVerificationError, JwtClaims, JwtCreateOptions, JwtHeader, JwtVerificationError, JwtVerifyOptions, PrefixedID, assertJwsProfile, base64urlDecode, base64urlEncode, createJws, createJwt, createNewEd25519Keypair, dagCborCanonicalEncode, decodeJwsUnsafe, decodeJwtUnsafe, generateId, generateIdNoPrefix, importEd25519Keypair, isCanonicallyEqual, isValidEd25519Signature, isValidId, normalizedId, parseDagCborCID, signPayloadEd25519, verifyJws, verifyJwt } from './crypto/index.js';
1
+ export { JwsHeader, JwsVerificationError, JwtClaims, JwtCreateOptions, JwtHeader, JwtVerificationError, JwtVerifyOptions, PrefixedID, assertJwsProfile, base64urlDecode, base64urlEncode, createJws, createJwt, createNewEd25519Keypair, dagCborCanonicalEncode, decodeJwsUnsafe, decodeJwtUnsafe, generateId, generateIdNoPrefix, importEd25519Keypair, isCanonicallyEqual, isValidEd25519Signature, isValidId, normalizedId, parseDagCborCID, sha256, signPayloadEd25519, verifyJws, verifyJwt } from './crypto/index.js';
2
2
  export { A as ARTIFACT_CID_ANCHOR_RE, a as ArtifactPayload, b as Attenuation, c as AuthTokenClaims, C as CONTENT_ID_ANCHOR_RE, d as ContentOperation, e as CountersignPayload, f as CredentialVerificationError, g as CreditClaimPayload, D as DFOSCredentialPayload, I as IdentityOperation, h as Iso8601, M as MAX_ARTIFACT_PAYLOAD_SIZE, i as MAX_CREDENTIAL_SIZE, j as MAX_CREDIT_CLAIM_SIZE, k as MAX_OPERATION_SIZE, l as MAX_SERVICES_ENTRIES, m as MAX_SERVICES_PAYLOAD_SIZE, n as MAX_SIGN_REQUEST_PAYLOAD_SIZE, o as MAX_SIGN_REQUEST_SIZE, p as MultikeyPublicKey, R as RevocationChecker, q as RevocationPayload, S as ServiceEntry, r as ServicesArray, s as SignRequestPayload, t as Signer, V as VerifiedDFOSCredential, u as VerifiedDelegationChain, v as VerifiedIdentity, w as createDFOSCredential, x as decodeDFOSCredentialUnsafe, y as isAttenuated, z as matchesResource, B as parseProtocolTimestampUnix, E as verifyDFOSCredential, F as verifyDelegationChain } from './dfos-credential-DU7WvoHE.js';
3
3
  export { AnchorKind, CreditClaimFailureReason, CreditClaimVerifyError, CreditEntry, CreditEntryState, ED25519_PRIV_MULTICODEC, ED25519_PUB_MULTICODEC, RECOGNIZED_SERVICE_TYPES, SignRequestFailureReason, SignRequestVerifyError, VerifiedArtifact, VerifiedContentChain, VerifiedCountersignature, VerifiedCreditClaim, VerifiedCreditEntry, VerifiedRevocation, VerifiedSignRequest, anchorsByLabel, assertCanonicalSignRequestPayload, assertServicesWithinCap, buildSignRequest, classifyAnchor, decodeMultikey, deriveChainIdentifier, deriveContentId, encodeEd25519Multikey, isRecognizedServiceType, relayEndpoints, signArtifact, signContentOperation, signCountersignature, signCreditClaim, signIdentityOperation, signRevocation, verifyArtifact, verifyContentChain, verifyContentExtensionFromTrustedState, verifyCountersignature, verifyCreditClaim, verifyCreditEntry, verifyIdentityChain, verifyIdentityExtensionFromTrustedState, verifyRevocation, verifySignRequest } from './chain/index.js';
4
4
  export { AuthTokenCreateOptions, AuthTokenVerificationError, AuthTokenVerifyOptions, VerifiedAuthToken, createAuthToken, verifyAuthToken } from './credentials/index.js';
package/dist/index.js CHANGED
@@ -49,7 +49,7 @@ import {
49
49
  verifyIdentityExtensionFromTrustedState,
50
50
  verifyRevocation,
51
51
  verifySignRequest
52
- } from "./chunk-W4ESJVMO.js";
52
+ } from "./chunk-W7IFQNUH.js";
53
53
  import {
54
54
  Attenuation,
55
55
  AuthTokenClaims,
@@ -69,7 +69,7 @@ import {
69
69
  verifyAuthToken,
70
70
  verifyDFOSCredential,
71
71
  verifyDelegationChain
72
- } from "./chunk-6HVYO5OS.js";
72
+ } from "./chunk-XP644GQK.js";
73
73
  import {
74
74
  JwsVerificationError,
75
75
  JwtVerificationError,
@@ -90,10 +90,11 @@ import {
90
90
  isValidId,
91
91
  normalizedId,
92
92
  parseDagCborCID,
93
+ sha256,
93
94
  signPayloadEd25519,
94
95
  verifyJws,
95
96
  verifyJwt
96
- } from "./chunk-4QQ5HK5M.js";
97
+ } from "./chunk-4LG2GEB2.js";
97
98
  import {
98
99
  INDEX_V1_SCHEMA,
99
100
  byteCompare,
@@ -179,6 +180,7 @@ export {
179
180
  parseDagCborCID,
180
181
  parseProtocolTimestampUnix,
181
182
  relayEndpoints,
183
+ sha256,
182
184
  signArtifact,
183
185
  signContentOperation,
184
186
  signCountersignature,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metalabel/dfos-protocol",
3
- "version": "0.31.0",
3
+ "version": "0.32.0",
4
4
  "type": "module",
5
5
  "description": "DFOS Protocol — Ed25519 signed chain primitives, services, credentials, and verification",
6
6
  "license": "MIT",