@arcblock/did 1.32.2 → 1.32.3

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.
@@ -24,6 +24,12 @@ type DnsDidLabelEncoding = 'base36' | 'hex';
24
24
  * - `'hex'`: `f` + 52 lowercase hex chars (53 chars total, <= 63 DNS limit)
25
25
  * - For 20-byte Ethereum DIDs (`0x...`): `e` + 31 base36 chars (or `0x` + 40 hex chars).
26
26
  */
27
+ /**
28
+ * Strict RFC 1035 / RFC 1123 DNS hostname validator (`1..253` chars, labels `1..63` matching
29
+ * `/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/i`, zero wildcards `*`, ports `:`, slashes `/`,
30
+ * underscores `_`, percent-escapes `%`, IPv4 literals, or numeric-only TLDs).
31
+ */
32
+ declare function isValidStrictDnsHostname(host: string): boolean;
27
33
  declare function toDnsDidLabel(did: string, encoding?: DnsDidLabelEncoding): string;
28
34
  /**
29
35
  * Decode a DNS subdomain label (or raw DID string) back into a canonical,
@@ -36,12 +42,26 @@ declare function toDnsDidLabel(did: string, encoding?: DnsDidLabelEncoding): str
36
42
  * - Case-preserved raw Base58btc DID (`z...`) when routed via Cloudflare Worker paths/headers
37
43
  */
38
44
  declare function fromDnsDidLabel(label: string, method?: DIDMethod): string;
45
+ /**
46
+ * Losslessly encode a W3C/OCAP DID into lowercase RFC 1035 DNS labels (`<= 63` chars per label)
47
+ * using unpadded RFC 4648 base32 (`d0-<b32>` single-label or `d0.<chunk1>.<chunk2>...` multi-label),
48
+ * matching `ArcBlock/arc` `encodeDidForDnsLabels` 1:1 (#2025).
49
+ */
50
+ declare function encodeDidForDnsLabels(did: string, defaultMethod?: DIDMethod): string;
51
+ /**
52
+ * Decode DNS label(s) back into a canonical, checksum-verified DID (`did:<method>:...`).
53
+ * Supports all cross-repo `ArcBlock/arc` & `@arcblock/did` encodings:
54
+ * - `d0.<base32chunk1>.<base32chunk2>...` and `d0-<base32>` (`ArcBlock/arc` base32 UTF-8 DID)
55
+ * - `did-<method>-<id>` and `<method>.<id>`
56
+ * - `k<41-char-base36>`, `f<52-char-hex>`, `e<31-char-base36>`, and case-preserved `z1...`/`0x...`
57
+ */
58
+ declare function decodeDidFromDnsLabels(prefix: string, defaultMethod?: DIDMethod): string | null;
39
59
  /**
40
60
  * Format the canonical DID Domain hostname (`<label>.did.abtnet.io`).
41
61
  */
42
62
  declare function toDidDomainHost(did: string, gatewayDomain?: string, encoding?: DnsDidLabelEncoding): string;
43
63
  /**
44
- * Extract and verify the canonical DID from a `<label>.did.abtnet.io` hostname.
64
+ * Extract and verify the canonical DID from a `<label>.did.abtnet.io` (or `d0.<chunks>.did.abtnet.io`) hostname.
45
65
  */
46
66
  declare function extractDidFromDomainHost(hostname: string, gatewayDomain?: string, method?: DIDMethod): string | null;
47
67
  /**
@@ -344,6 +364,20 @@ interface ThreeTierResolutionResult {
344
364
  /** Resolution trace across the 3 tiers */
345
365
  trace: string[];
346
366
  }
367
+ type DidTlsResolutionTier = 'direct-did' | 'wildcard-fallback' | 'custom-domain-nft' | 'name-registry';
368
+ interface ResolveDidTlsTargetOptions {
369
+ nftAssetState?: DomainNftAssetSnapshot;
370
+ keyRotationEvents?: KeyRotationEvent[];
371
+ now?: number;
372
+ }
373
+ interface DidTlsTargetResolution {
374
+ targetDid: string;
375
+ activePublicKeyHex: string | null;
376
+ cnameTargetDidDomain: string;
377
+ endpointUrl: string | null;
378
+ resolutionTier: DidTlsResolutionTier;
379
+ trace: string[];
380
+ }
347
381
  declare function encodeDidEndpointDigest(params: {
348
382
  did: string;
349
383
  endpointUrl: string;
@@ -390,6 +424,7 @@ declare class DIDDomainEdgeRouter implements NameRegistry {
390
424
  private bindingsByDomain;
391
425
  private nftStateByDomain;
392
426
  private endpointsByDidAddr;
427
+ private kelByDidAddr;
393
428
  private simpleNameMap;
394
429
  constructor(options?: {
395
430
  gatewayDomain?: string;
@@ -436,9 +471,19 @@ declare class DIDDomainEdgeRouter implements NameRegistry {
436
471
  */
437
472
  resolveThreeTier(queryInput: string, options?: {
438
473
  nftAssetState?: DomainNftAssetSnapshot;
474
+ keyRotationEvents?: KeyRotationEvent[];
439
475
  now?: number;
440
476
  }): ThreeTierResolutionResult | null;
441
477
  private _buildResult;
478
+ /**
479
+ * Resolve any URL (`https://...`, `wss://...`, `afs://...`), `<did>.arc`, `<label>.did.abtnet.io`,
480
+ * `did:abt:...`, `did:name:...`, or custom DNS-NFT domain into a zero-CA `DID-TLS` target identity
481
+ * (`targetDid`, active Ed25519/KEL public key, Tier-2 CNAME domain, and physical endpoint URL).
482
+ *
483
+ * Fails closed (`null`) on malformed/credentialed URLs, invalid `.arc` DID hosts, expired/sold DNS-NFT bindings,
484
+ * or broken KEL chains.
485
+ */
486
+ resolveDidTlsTarget(input: string, options?: ResolveDidTlsTargetOptions): DidTlsTargetResolution | null;
442
487
  resolve(name: string): string | null;
443
488
  register(name: string, did: string): void;
444
489
  unregister(name: string): void;
@@ -447,4 +492,4 @@ declare class DIDDomainEdgeRouter implements NameRegistry {
447
492
  clear(): void;
448
493
  }
449
494
  //#endregion
450
- export { AccountPreRotationStateData, DEFAULT_DID_DOMAIN_GATEWAY, DIDDomainEdgeRouter, DIDServiceEndpoint, DID_ENDPOINT_DOMAIN_TAG, DNS_NFT_BINDING_DOMAIN_TAG, DidEndpointRecord, DnsDidLabelEncoding, DomainNftAssetSnapshot, DomainNftBindingProof, KEY_ROTATION_DOMAIN_TAG, KeyRotationEvent, MAX_CUSTOM_DOMAINS_PER_DID, MAX_ROTATION_CHAIN_LENGTH, PRE_ROTATION_DOMAIN_TAG, SynthesizeDidDocumentOptions, ThreeTierResolutionResult, W3CDIDDocument, W3CDIDVerificationMethod, createAccountMigratePreRotationData, createDomainNftBindingProof, createKeyRotationEvent, createPreRotationCommitment, encodeDidEndpointDigest, extractAccountPreRotationData, extractDidFromDomainHost, fromDnsDidLabel, isValidPreRotationCommitment, normalizePreRotationCommitment, normalizePublicKeyHex, synthesizeDidDocument, toDidDomainHost, toDidWellKnownUrl, toDnsDidLabel, verifyAccountMigrationChainWithKel, verifyDomainNftBindingProof, verifyKeyRotationChain, verifyPreRotationCommitment, verifySingleKeyRotationEvent };
495
+ export { AccountPreRotationStateData, DEFAULT_DID_DOMAIN_GATEWAY, DIDDomainEdgeRouter, DIDServiceEndpoint, DID_ENDPOINT_DOMAIN_TAG, DNS_NFT_BINDING_DOMAIN_TAG, DidEndpointRecord, DidTlsResolutionTier, DidTlsTargetResolution, DnsDidLabelEncoding, DomainNftAssetSnapshot, DomainNftBindingProof, KEY_ROTATION_DOMAIN_TAG, KeyRotationEvent, MAX_CUSTOM_DOMAINS_PER_DID, MAX_ROTATION_CHAIN_LENGTH, PRE_ROTATION_DOMAIN_TAG, ResolveDidTlsTargetOptions, SynthesizeDidDocumentOptions, ThreeTierResolutionResult, W3CDIDDocument, W3CDIDVerificationMethod, createAccountMigratePreRotationData, createDomainNftBindingProof, createKeyRotationEvent, createPreRotationCommitment, decodeDidFromDnsLabels, encodeDidEndpointDigest, encodeDidForDnsLabels, extractAccountPreRotationData, extractDidFromDomainHost, fromDnsDidLabel, isValidPreRotationCommitment, isValidStrictDnsHostname, normalizePreRotationCommitment, normalizePublicKeyHex, synthesizeDidDocument, toDidDomainHost, toDidWellKnownUrl, toDnsDidLabel, verifyAccountMigrationChainWithKel, verifyDomainNftBindingProof, verifyKeyRotationChain, verifyPreRotationCommitment, verifySingleKeyRotationEvent };
@@ -1,3 +1,4 @@
1
+ import { isCryptoMethod } from "./method.mjs";
1
2
  import { normalizeName } from "./name.mjs";
2
3
  import { extractIdentifier, extractMethod, formatDid } from "./parse.mjs";
3
4
  import { isSameEntity } from "./entity.mjs";
@@ -100,9 +101,32 @@ function parseBase36ToBigInt(str) {
100
101
  * - `'hex'`: `f` + 52 lowercase hex chars (53 chars total, <= 63 DNS limit)
101
102
  * - For 20-byte Ethereum DIDs (`0x...`): `e` + 31 base36 chars (or `0x` + 40 hex chars).
102
103
  */
104
+ /**
105
+ * Strict RFC 1035 / RFC 1123 DNS hostname validator (`1..253` chars, labels `1..63` matching
106
+ * `/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/i`, zero wildcards `*`, ports `:`, slashes `/`,
107
+ * underscores `_`, percent-escapes `%`, IPv4 literals, or numeric-only TLDs).
108
+ */
109
+ function isValidStrictDnsHostname(host) {
110
+ if (!host || typeof host !== "string" || host.length < 1 || host.length > 253) return false;
111
+ if (host !== host.trim() || host.startsWith(".") || host.endsWith(".") || host.includes("..")) return false;
112
+ const labels = host.toLowerCase().split(".");
113
+ for (const lbl of labels) if (lbl.length < 1 || lbl.length > 63 || !/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/.test(lbl)) return false;
114
+ if (/^\d+$/.test(labels[labels.length - 1])) return false;
115
+ return true;
116
+ }
117
+ function normalizeStrictGatewayDomain(gatewayDomain) {
118
+ const trimmed = typeof gatewayDomain === "string" ? gatewayDomain.trim().replace(/\.$/, "") : "";
119
+ if (!isValidStrictDnsHostname(trimmed) || !trimmed.includes(".")) throw new Error(`Invalid gatewayDomain "${String(gatewayDomain)}": must be a strict multi-label RFC 1035 hostname`);
120
+ return trimmed.toLowerCase();
121
+ }
103
122
  function toDnsDidLabel(did, encoding = "base36") {
104
123
  if (!did || typeof did !== "string") throw new Error("DID must be a non-empty string");
105
- const address = toAddress(did.trim());
124
+ const trimmed = did.trim();
125
+ if (/^did:/i.test(trimmed)) {
126
+ const m = /^did:([a-z0-9]+):([^:]+)$/i.exec(trimmed);
127
+ if (!m || !isCryptoMethod(m[1].toLowerCase())) throw new Error(`Unsupported or foreign DID method for DNS label: ${did}`);
128
+ } else if (trimmed.includes(":")) throw new Error(`Cannot encode invalid DID to DNS label: ${did}`);
129
+ const address = toAddress(trimmed);
106
130
  if (!isValid(address)) throw new Error(`Cannot encode invalid DID to DNS label: ${did}`);
107
131
  if (isEthereumDid(address)) {
108
132
  const cleanHex = stripHexPrefix(address).toLowerCase();
@@ -126,9 +150,17 @@ function toDnsDidLabel(did, encoding = "base36") {
126
150
  */
127
151
  function fromDnsDidLabel(label, method = "abt") {
128
152
  if (!label || typeof label !== "string") throw new Error("DNS DID label must be a non-empty string");
153
+ if (!isCryptoMethod(method)) throw new Error(`Unsupported non-crypto DID method: ${String(method)}`);
129
154
  const trimmed = label.trim();
130
155
  if (!trimmed) throw new Error("DNS DID label cannot be empty");
131
- if (isValid(trimmed)) {
156
+ if (/^did:/i.test(trimmed)) {
157
+ const m = /^did:([a-z0-9]+):([^:]+)$/i.exec(trimmed);
158
+ const explicitMethod = m ? m[1].toLowerCase() : "";
159
+ if (!m || !isCryptoMethod(explicitMethod) || !isValid(trimmed)) throw new Error(`Invalid or foreign DID in DNS label: ${label}`);
160
+ const addr = toAddress(trimmed);
161
+ return formatDid(isEthereumDid(addr) ? toChecksumAddress(addr) : addr, explicitMethod);
162
+ }
163
+ if (!trimmed.includes(":") && isValid(trimmed)) {
132
164
  const addr = toAddress(trimmed);
133
165
  return formatDid(isEthereumDid(addr) ? toChecksumAddress(addr) : addr, method);
134
166
  }
@@ -150,27 +182,164 @@ function fromDnsDidLabel(label, method = "abt") {
150
182
  }
151
183
  throw new Error(`Invalid or unrecognized DNS DID label: ${label}`);
152
184
  }
185
+ const DNS_BASE32_LOWER_ALPHABET = "abcdefghijklmnopqrstuvwxyz234567";
186
+ function encodeBytesToBase32Lower(bytes) {
187
+ let bits = 0;
188
+ let value = 0;
189
+ let out = "";
190
+ for (let i = 0; i < bytes.byteLength; i++) {
191
+ value = value << 8 | bytes[i];
192
+ bits += 8;
193
+ while (bits >= 5) {
194
+ out += DNS_BASE32_LOWER_ALPHABET[value >>> bits - 5 & 31];
195
+ bits -= 5;
196
+ }
197
+ }
198
+ if (bits > 0) out += DNS_BASE32_LOWER_ALPHABET[value << 5 - bits & 31];
199
+ return out;
200
+ }
201
+ function decodeBase32LowerToBytes(input) {
202
+ if (!input || !/^[a-z2-7]+$/.test(input)) return null;
203
+ const outLen = Math.floor(input.length * 5 / 8);
204
+ if (outLen === 0) return null;
205
+ const out = new Uint8Array(outLen);
206
+ let bits = 0;
207
+ let value = 0;
208
+ let idx = 0;
209
+ for (let i = 0; i < input.length; i++) {
210
+ const ch = DNS_BASE32_LOWER_ALPHABET.indexOf(input[i]);
211
+ if (ch < 0) return null;
212
+ value = value << 5 | ch;
213
+ bits += 5;
214
+ if (bits >= 8) {
215
+ out[idx++] = value >>> bits - 8 & 255;
216
+ bits -= 8;
217
+ }
218
+ }
219
+ if (bits >= 5 || bits > 0 && (value & (1 << bits) - 1) !== 0) return null;
220
+ return out;
221
+ }
222
+ function canonicalizeDecodedCryptoDid(candidate, fallbackMethod) {
223
+ if (!candidate || !isCryptoMethod(fallbackMethod) || /[/?#\s]/.test(candidate)) return null;
224
+ for (let i = 0; i < candidate.length; i++) {
225
+ const code = candidate.charCodeAt(i);
226
+ if (code <= 32 || code >= 127) return null;
227
+ }
228
+ if (/^did:/i.test(candidate)) {
229
+ const m = /^did:([a-z0-9]+):([^:]+)$/.exec(candidate);
230
+ if (!m || !isCryptoMethod(m[1]) || !isValid(candidate)) return null;
231
+ const addr$1 = toAddress(candidate);
232
+ return formatDid(isEthereumDid(addr$1) ? toChecksumAddress(addr$1) : addr$1, m[1]);
233
+ }
234
+ if (candidate.includes(":") || !isValid(candidate)) return null;
235
+ const addr = toAddress(candidate);
236
+ return formatDid(isEthereumDid(addr) ? toChecksumAddress(addr) : addr, fallbackMethod);
237
+ }
238
+ /**
239
+ * Losslessly encode a W3C/OCAP DID into lowercase RFC 1035 DNS labels (`<= 63` chars per label)
240
+ * using unpadded RFC 4648 base32 (`d0-<b32>` single-label or `d0.<chunk1>.<chunk2>...` multi-label),
241
+ * matching `ArcBlock/arc` `encodeDidForDnsLabels` 1:1 (#2025).
242
+ */
243
+ function encodeDidForDnsLabels(did, defaultMethod = "abt") {
244
+ if (!did || typeof did !== "string") throw new Error("DID must be a non-empty string");
245
+ if (!isCryptoMethod(defaultMethod)) throw new Error(`Unsupported defaultMethod for encodeDidForDnsLabels: ${String(defaultMethod)}`);
246
+ const trimmed = did.trim();
247
+ if (!trimmed || /[/?#\s]/.test(trimmed)) throw new Error(`Cannot encode invalid DID for DNS labels: ${did}`);
248
+ let canonicalDid;
249
+ if (/^did:/i.test(trimmed)) {
250
+ const m = /^did:([a-z0-9]+):([^:]+)$/i.exec(trimmed);
251
+ const explicitMethod = m ? m[1].toLowerCase() : "";
252
+ if (!m || !isCryptoMethod(explicitMethod) || !isValid(trimmed)) throw new Error(`Cannot encode invalid or foreign DID for DNS labels: ${did}`);
253
+ const addr = toAddress(trimmed);
254
+ canonicalDid = formatDid(isEthereumDid(addr) ? toChecksumAddress(addr) : addr, explicitMethod);
255
+ } else {
256
+ if (trimmed.includes(":") || !isValid(trimmed)) throw new Error(`Cannot encode invalid DID for DNS labels: ${did}`);
257
+ const addr = toAddress(trimmed);
258
+ canonicalDid = formatDid(isEthereumDid(addr) ? toChecksumAddress(addr) : addr, defaultMethod);
259
+ }
260
+ const b32 = encodeBytesToBase32Lower(Uint8Array.from(Buffer.from(canonicalDid, "utf8")));
261
+ if (b32.length <= 60) return `d0-${b32}`;
262
+ const chunks = ["d0"];
263
+ for (let i = 0; i < b32.length; i += 60) chunks.push(b32.slice(i, i + 60));
264
+ return chunks.join(".");
265
+ }
266
+ /**
267
+ * Decode DNS label(s) back into a canonical, checksum-verified DID (`did:<method>:...`).
268
+ * Supports all cross-repo `ArcBlock/arc` & `@arcblock/did` encodings:
269
+ * - `d0.<base32chunk1>.<base32chunk2>...` and `d0-<base32>` (`ArcBlock/arc` base32 UTF-8 DID)
270
+ * - `did-<method>-<id>` and `<method>.<id>`
271
+ * - `k<41-char-base36>`, `f<52-char-hex>`, `e<31-char-base36>`, and case-preserved `z1...`/`0x...`
272
+ */
273
+ function decodeDidFromDnsLabels(prefix, defaultMethod = "abt") {
274
+ try {
275
+ if (!prefix || typeof prefix !== "string" || !isCryptoMethod(defaultMethod)) return null;
276
+ const trimmed = prefix.trim();
277
+ if (!trimmed || trimmed.startsWith(".") || trimmed.endsWith(".") || trimmed.includes("..")) return null;
278
+ const rawLabels = trimmed.split(".");
279
+ for (const lbl of rawLabels) if (!lbl || lbl.length > 63 || lbl.startsWith("-") || lbl.endsWith("-")) return null;
280
+ const lower = trimmed.toLowerCase();
281
+ let b32Payload = null;
282
+ if (lower.startsWith("d0-") && !lower.includes(".")) b32Payload = lower.slice(3);
283
+ else if (lower.startsWith("d0.")) {
284
+ const parts = lower.slice(3).split(".");
285
+ if (parts.length > 0 && parts.every((p) => p.length > 0 && p.length <= 63)) b32Payload = parts.join("");
286
+ }
287
+ if (b32Payload !== null) {
288
+ const decodedBytes = decodeBase32LowerToBytes(b32Payload);
289
+ if (!decodedBytes) return null;
290
+ return canonicalizeDecodedCryptoDid(new TextDecoder("utf-8", { fatal: true }).decode(decodedBytes), defaultMethod);
291
+ }
292
+ if (rawLabels.length === 2) {
293
+ const methodPart = rawLabels[0].toLowerCase();
294
+ const idPart = rawLabels[1];
295
+ if (isCryptoMethod(methodPart) && idPart && !idPart.includes(":")) {
296
+ const verified = canonicalizeDecodedCryptoDid(`did:${methodPart}:${idPart}`, methodPart);
297
+ if (verified) return verified;
298
+ }
299
+ return null;
300
+ }
301
+ if (rawLabels.length > 1) return null;
302
+ if (lower.startsWith("did-")) {
303
+ const rest = trimmed.slice(4);
304
+ const dashIdx = rest.indexOf("-");
305
+ if (dashIdx > 0) {
306
+ const methodPart = rest.slice(0, dashIdx).toLowerCase();
307
+ const idPart = rest.slice(dashIdx + 1);
308
+ if (isCryptoMethod(methodPart) && idPart && !idPart.includes(":")) {
309
+ const verified = canonicalizeDecodedCryptoDid(`did:${methodPart}:${idPart}`, methodPart);
310
+ if (verified) return verified;
311
+ }
312
+ }
313
+ return null;
314
+ }
315
+ if (trimmed.includes(":")) return null;
316
+ return fromDnsDidLabel(trimmed, defaultMethod);
317
+ } catch {
318
+ return null;
319
+ }
320
+ }
153
321
  /**
154
322
  * Format the canonical DID Domain hostname (`<label>.did.abtnet.io`).
155
323
  */
156
324
  function toDidDomainHost(did, gatewayDomain = DEFAULT_DID_DOMAIN_GATEWAY, encoding = "base36") {
157
- const cleanGateway = normalizeName(gatewayDomain);
325
+ const cleanGateway = normalizeStrictGatewayDomain(gatewayDomain);
158
326
  return `${toDnsDidLabel(did, encoding)}.${cleanGateway}`;
159
327
  }
160
328
  /**
161
- * Extract and verify the canonical DID from a `<label>.did.abtnet.io` hostname.
329
+ * Extract and verify the canonical DID from a `<label>.did.abtnet.io` (or `d0.<chunks>.did.abtnet.io`) hostname.
162
330
  */
163
331
  function extractDidFromDomainHost(hostname, gatewayDomain = DEFAULT_DID_DOMAIN_GATEWAY, method = "abt") {
332
+ const cleanGateway = normalizeStrictGatewayDomain(gatewayDomain);
164
333
  if (!hostname || typeof hostname !== "string") return null;
165
334
  try {
166
- const cleanGateway = normalizeName(gatewayDomain);
167
335
  const trimmedHost = hostname.trim().replace(/\.$/, "");
336
+ if (!isValidStrictDnsHostname(trimmedHost)) return null;
168
337
  const lowerHost = trimmedHost.toLowerCase();
169
338
  const suffix = `.${cleanGateway}`;
170
339
  if (!lowerHost.endsWith(suffix)) return null;
171
340
  const rawLabel = trimmedHost.slice(0, trimmedHost.length - suffix.length);
172
- if (!rawLabel || rawLabel.includes(".")) return null;
173
- return fromDnsDidLabel(rawLabel, method);
341
+ if (!rawLabel) return null;
342
+ return decodeDidFromDnsLabels(rawLabel, method);
174
343
  } catch {
175
344
  return null;
176
345
  }
@@ -766,6 +935,89 @@ function synthesizeDidDocument(options) {
766
935
  ...options.keyRotationEvents?.length ? { keyRotationHistory: options.keyRotationEvents } : {}
767
936
  };
768
937
  }
938
+ const MAX_DID_TLS_TARGET_INPUT_LENGTH = 2048;
939
+ const ALLOWED_DID_TLS_URL_SCHEMES = new Set([
940
+ "https",
941
+ "wss",
942
+ "afs",
943
+ "http",
944
+ "ws"
945
+ ]);
946
+ function parseValidPortString(portStr) {
947
+ if (!/^[1-9]\d{0,4}$/.test(portStr)) return null;
948
+ const port = Number(portStr);
949
+ return Number.isSafeInteger(port) && port >= 1 && port <= 65535 ? port : null;
950
+ }
951
+ function parseDidTlsTargetCandidate(rawInput) {
952
+ if (!rawInput || typeof rawInput !== "string" || rawInput.length > MAX_DID_TLS_TARGET_INPUT_LENGTH) return null;
953
+ for (let i = 0; i < rawInput.length; i++) {
954
+ const code = rawInput.charCodeAt(i);
955
+ if (code < 32 || code === 127) return null;
956
+ }
957
+ const trimmed = rawInput.trim();
958
+ if (!trimmed || /\s/.test(trimmed)) return null;
959
+ let scheme;
960
+ let hostOrDid;
961
+ if (trimmed.includes("://")) {
962
+ const match = /^([a-zA-Z][a-zA-Z0-9+.-]*):\/\/([^/?#]*)(?:[/?#].*)?$/.exec(trimmed);
963
+ if (!match) return null;
964
+ scheme = match[1].toLowerCase();
965
+ if (!ALLOWED_DID_TLS_URL_SCHEMES.has(scheme)) return null;
966
+ const authority = match[2];
967
+ if (!authority || authority.includes("@") || authority.includes("\\") || authority.includes("%") || authority.startsWith("[") || authority.endsWith("]")) return null;
968
+ if (/^did:/i.test(authority)) {
969
+ const didMatch = /^did:([a-zA-Z0-9]+):([^:]+)(?::(\d+))?$/.exec(authority);
970
+ if (!didMatch) return null;
971
+ if (didMatch[3] !== void 0 && parseValidPortString(didMatch[3]) === null) return null;
972
+ hostOrDid = `did:${didMatch[1].toLowerCase()}:${didMatch[2]}`;
973
+ } else if (authority.includes(":")) {
974
+ const parts = authority.split(":");
975
+ if (parts.length !== 2 || !parts[0] || parseValidPortString(parts[1]) === null) return null;
976
+ hostOrDid = parts[0];
977
+ } else hostOrDid = authority;
978
+ } else {
979
+ if (trimmed.includes("@") || trimmed.includes("/") || trimmed.includes("\\") || trimmed.includes("?") || trimmed.includes("#") || trimmed.includes("%") || trimmed.startsWith("[") || trimmed.endsWith("]")) return null;
980
+ if (/^did:/i.test(trimmed)) {
981
+ const didMatch = /^did:([a-zA-Z0-9]+):([^:]+)$/.exec(trimmed);
982
+ if (!didMatch) return null;
983
+ hostOrDid = `did:${didMatch[1].toLowerCase()}:${didMatch[2]}`;
984
+ } else if (trimmed.includes(":")) {
985
+ const parts = trimmed.split(":");
986
+ if (parts.length !== 2 || !parts[0] || parseValidPortString(parts[1]) === null) return null;
987
+ hostOrDid = parts[0];
988
+ } else hostOrDid = trimmed;
989
+ }
990
+ if (hostOrDid.startsWith("did:")) {
991
+ const m = /^did:([a-z0-9]+):([^:]+)$/.exec(hostOrDid);
992
+ if (!m) return null;
993
+ const didMethod = m[1];
994
+ const didId = m[2];
995
+ if (didMethod === "name") {
996
+ const cleanDomain = didId.endsWith(".") ? didId.slice(0, -1) : didId;
997
+ if (!isValidStrictDnsHostname(cleanDomain)) return null;
998
+ return {
999
+ candidate: `did:name:${cleanDomain.toLowerCase()}`,
1000
+ ...scheme ? { scheme } : {}
1001
+ };
1002
+ }
1003
+ if (!isCryptoMethod(didMethod) || !isValid(hostOrDid)) return null;
1004
+ return {
1005
+ candidate: hostOrDid,
1006
+ ...scheme ? { scheme } : {}
1007
+ };
1008
+ }
1009
+ const withoutTrailingDot = hostOrDid.endsWith(".") ? hostOrDid.slice(0, -1) : hostOrDid;
1010
+ if (!withoutTrailingDot || IPV4_OR_IPV6_REGEX.test(withoutTrailingDot)) return null;
1011
+ if (!withoutTrailingDot.includes(".") && isValid(withoutTrailingDot)) return {
1012
+ candidate: withoutTrailingDot,
1013
+ ...scheme ? { scheme } : {}
1014
+ };
1015
+ if (!isValidStrictDnsHostname(withoutTrailingDot)) return null;
1016
+ return {
1017
+ candidate: withoutTrailingDot,
1018
+ ...scheme ? { scheme } : {}
1019
+ };
1020
+ }
769
1021
  const IPV4_OR_IPV6_REGEX = /^(?:\d{1,3}\.){3}\d{1,3}$|^\[?[0-9a-fA-F:]+\]?$/;
770
1022
  function encodeDidEndpointDigest(params) {
771
1023
  const tuple = encodeLengthPrefixedTuple([
@@ -893,14 +1145,28 @@ function verifyDomainNftBindingProof(proof, options = {}) {
893
1145
  if (options.keyRotationEvents && options.keyRotationEvents.length > 0) {
894
1146
  const rot = verifyKeyRotationChain({
895
1147
  did: proof.ownerDid,
896
- events: options.keyRotationEvents,
897
- expectedCurrentPublicKey: pkClean
1148
+ events: options.keyRotationEvents
898
1149
  });
899
- if (!rot.valid || rot.activeKeyType === null) return {
1150
+ if (!rot.valid || rot.activeKeyType === null || !rot.activePublicKey) return {
900
1151
  valid: false,
901
1152
  reason: `KEY_ROTATION_INVALID:${rot.reason}`
902
1153
  };
903
- signerKeyType = rot.activeKeyType;
1154
+ if (pkClean === stripHexPrefix(rot.activePublicKey).toLowerCase()) signerKeyType = rot.activeKeyType;
1155
+ else {
1156
+ let matchedPriorKeyType = null;
1157
+ for (let i = 0; i < options.keyRotationEvents.length; i++) {
1158
+ const ev = options.keyRotationEvents[i];
1159
+ if (stripHexPrefix(ev.previousPublicKey).toLowerCase() === pkClean && proof.issuedAt <= ev.rotatedAt) {
1160
+ matchedPriorKeyType = i === 0 ? toTypeInfo(proof.ownerDid).pk ?? types.KeyType.ED25519 : options.keyRotationEvents[i - 1].newKeyType;
1161
+ break;
1162
+ }
1163
+ }
1164
+ if (matchedPriorKeyType === null) return {
1165
+ valid: false,
1166
+ reason: "KEY_ROTATION_INVALID:EXPECTED_CURRENT_KEY_MISMATCH"
1167
+ };
1168
+ signerKeyType = matchedPriorKeyType;
1169
+ }
904
1170
  } else if (!doesPublicKeyMatchGenesisDid(proof.ownerDid, pkClean)) return {
905
1171
  valid: false,
906
1172
  reason: "OWNER_PUBLIC_KEY_MISMATCH"
@@ -937,8 +1203,9 @@ var DIDDomainEdgeRouter = class {
937
1203
  this.bindingsByDomain = /* @__PURE__ */ new Map();
938
1204
  this.nftStateByDomain = /* @__PURE__ */ new Map();
939
1205
  this.endpointsByDidAddr = /* @__PURE__ */ new Map();
1206
+ this.kelByDidAddr = /* @__PURE__ */ new Map();
940
1207
  this.simpleNameMap = /* @__PURE__ */ new Map();
941
- this.gatewayDomain = normalizeName(options.gatewayDomain ?? DEFAULT_DID_DOMAIN_GATEWAY);
1208
+ this.gatewayDomain = normalizeStrictGatewayDomain(options.gatewayDomain ?? DEFAULT_DID_DOMAIN_GATEWAY);
942
1209
  }
943
1210
  /**
944
1211
  * Register or update a Tier-3 physical/tunnel endpoint for a DID (`<label>.did.abtnet.io -> endpoint`).
@@ -960,7 +1227,7 @@ var DIDDomainEdgeRouter = class {
960
1227
  if (!Number.isSafeInteger(updatedAt) || updatedAt < 0) throw new Error("updatedAt must be a non-negative safe integer");
961
1228
  const existing = this.endpointsByDidAddr.get(addr);
962
1229
  if (existing && updatedAt < existing.updatedAt) throw new Error("STALE_ENDPOINT_UPDATE: updatedAt cannot regress below existing record");
963
- const effectiveRotationEvents = input.keyRotationEvents ?? existing?.keyRotationEvents;
1230
+ const effectiveRotationEvents = input.keyRotationEvents ?? existing?.keyRotationEvents ?? this.kelByDidAddr.get(addr);
964
1231
  let activeKeyType = toTypeInfo(canonicalDid).pk ?? types.KeyType.ED25519;
965
1232
  let verifiedPkHex = input.publicKey ? `0x${stripHexPrefix(input.publicKey).toLowerCase()}` : void 0;
966
1233
  if (effectiveRotationEvents && effectiveRotationEvents.length > 0) {
@@ -1015,22 +1282,26 @@ var DIDDomainEdgeRouter = class {
1015
1282
  updatedAt
1016
1283
  };
1017
1284
  this.endpointsByDidAddr.set(addr, record);
1285
+ if (effectiveRotationEvents && effectiveRotationEvents.length > 0) this.kelByDidAddr.set(addr, effectiveRotationEvents);
1018
1286
  return record;
1019
1287
  }
1020
1288
  /**
1021
1289
  * Register a Tier-1 -> Tier-2 custom domain binding verified by an on-chain DNS Domain NFT proof.
1022
1290
  */
1023
1291
  registerDomainNftBinding(proof, options = {}) {
1292
+ const ownerAddr = toAddress(proof.ownerDid);
1293
+ const effectiveKel = options.keyRotationEvents ?? this.endpointsByDidAddr.get(ownerAddr)?.keyRotationEvents ?? this.kelByDidAddr.get(ownerAddr);
1024
1294
  const check = verifyDomainNftBindingProof(proof, {
1025
1295
  gatewayDomain: this.gatewayDomain,
1026
1296
  nftAssetState: options.nftAssetState,
1027
- keyRotationEvents: options.keyRotationEvents,
1297
+ keyRotationEvents: effectiveKel,
1028
1298
  now: options.now
1029
1299
  });
1030
1300
  if (!check.valid) throw new Error(`Domain NFT binding verification failed: ${check.reason}`);
1031
1301
  const cleanDomain = normalizeName(proof.customDomain);
1032
1302
  this.bindingsByDomain.set(cleanDomain, proof);
1033
1303
  if (options.nftAssetState) this.nftStateByDomain.set(cleanDomain, options.nftAssetState);
1304
+ if (options.keyRotationEvents && options.keyRotationEvents.length > 0) this.kelByDidAddr.set(ownerAddr, options.keyRotationEvents);
1034
1305
  this.simpleNameMap.set(cleanDomain, proof.ownerDid);
1035
1306
  return proof;
1036
1307
  }
@@ -1050,28 +1321,33 @@ var DIDDomainEdgeRouter = class {
1050
1321
  if (!queryInput || typeof queryInput !== "string") return null;
1051
1322
  const trimmed = queryInput.trim();
1052
1323
  const trace = [];
1053
- if (trimmed.startsWith("did:") && !trimmed.startsWith("did:name:")) {
1054
- if (!isValid(trimmed)) return null;
1055
- const canonicalDid = formatDid(toAddress(trimmed), extractMethod(trimmed) || "abt");
1056
- const cnameTarget = toDidDomainHost(canonicalDid, this.gatewayDomain);
1057
- trace.push(`did:${canonicalDid}`, `cname:${cnameTarget}`);
1058
- return this._buildResult(trimmed, void 0, void 0, cnameTarget, canonicalDid, trace);
1059
- }
1060
- const wildcardDid = extractDidFromDomainHost(trimmed, this.gatewayDomain, "abt");
1061
- if (wildcardDid) {
1062
- const cnameTarget = toDidDomainHost(wildcardDid, this.gatewayDomain);
1063
- trace.push(`wildcard_did_domain:${cnameTarget}`, `did:${wildcardDid}`);
1064
- return this._buildResult(trimmed, void 0, void 0, cnameTarget, wildcardDid, trace);
1065
- }
1066
1324
  try {
1325
+ if (/^did:/i.test(trimmed) && !/^did:name:/i.test(trimmed)) {
1326
+ const m = /^did:([a-z0-9]+):([^:]+)$/i.exec(trimmed);
1327
+ const explicitMethod = m ? m[1].toLowerCase() : "";
1328
+ if (!m || !isCryptoMethod(explicitMethod) || !isValid(trimmed)) return null;
1329
+ const addr = toAddress(trimmed);
1330
+ const canonicalDid = formatDid(isEthereumDid(addr) ? toChecksumAddress(addr) : addr, explicitMethod);
1331
+ const cnameTarget = toDidDomainHost(canonicalDid, this.gatewayDomain);
1332
+ trace.push(`did:${canonicalDid}`, `cname:${cnameTarget}`);
1333
+ return this._buildResult(trimmed, void 0, void 0, cnameTarget, canonicalDid, trace, options.keyRotationEvents);
1334
+ }
1335
+ const wildcardDid = extractDidFromDomainHost(trimmed, this.gatewayDomain, "abt");
1336
+ if (wildcardDid) {
1337
+ const cnameTarget = toDidDomainHost(wildcardDid, this.gatewayDomain);
1338
+ trace.push(`wildcard_did_domain:${cnameTarget}`, `did:${wildcardDid}`);
1339
+ return this._buildResult(trimmed, void 0, void 0, cnameTarget, wildcardDid, trace, options.keyRotationEvents);
1340
+ }
1067
1341
  const cleanName = normalizeName(trimmed.replace(/^did:name:/i, ""));
1068
1342
  const binding = this.bindingsByDomain.get(cleanName);
1069
1343
  if (binding) {
1344
+ const ownerAddr = toAddress(binding.ownerDid);
1070
1345
  const effectiveNftState = options.nftAssetState ?? this.nftStateByDomain.get(cleanName);
1346
+ const effectiveKel = options.keyRotationEvents ?? this.endpointsByDidAddr.get(ownerAddr)?.keyRotationEvents ?? this.kelByDidAddr.get(ownerAddr);
1071
1347
  const recheck = verifyDomainNftBindingProof(binding, {
1072
1348
  gatewayDomain: this.gatewayDomain,
1073
1349
  nftAssetState: effectiveNftState,
1074
- keyRotationEvents: this.endpointsByDidAddr.get(toAddress(binding.ownerDid))?.keyRotationEvents,
1350
+ keyRotationEvents: effectiveKel,
1075
1351
  now: options.now
1076
1352
  });
1077
1353
  if (!recheck.valid) {
@@ -1079,29 +1355,30 @@ var DIDDomainEdgeRouter = class {
1079
1355
  return null;
1080
1356
  }
1081
1357
  trace.push(`custom_domain:${cleanName}`, `nft_verified:${binding.domainNftAssetDid}`, `cname:${binding.cnameTargetDidDomain}`, `did:${binding.ownerDid}`);
1082
- return this._buildResult(trimmed, cleanName, binding.domainNftAssetDid, binding.cnameTargetDidDomain, binding.ownerDid, trace);
1358
+ return this._buildResult(trimmed, cleanName, binding.domainNftAssetDid, binding.cnameTargetDidDomain, binding.ownerDid, trace, options.keyRotationEvents);
1083
1359
  }
1084
1360
  const fallbackDid = this.simpleNameMap.get(cleanName);
1085
1361
  if (fallbackDid && isValid(fallbackDid)) {
1086
1362
  const cnameTarget = toDidDomainHost(fallbackDid, this.gatewayDomain);
1087
1363
  trace.push(`name:${cleanName}`, `cname:${cnameTarget}`, `did:${fallbackDid}`);
1088
- return this._buildResult(trimmed, cleanName, void 0, cnameTarget, fallbackDid, trace);
1364
+ return this._buildResult(trimmed, cleanName, void 0, cnameTarget, fallbackDid, trace, options.keyRotationEvents);
1089
1365
  }
1090
1366
  } catch {
1091
1367
  return null;
1092
1368
  }
1093
1369
  return null;
1094
1370
  }
1095
- _buildResult(query, customDomain, domainNftAssetDid, cnameTargetDidDomain, did, trace) {
1371
+ _buildResult(query, customDomain, domainNftAssetDid, cnameTargetDidDomain, did, trace, overrideKeyRotationEvents) {
1096
1372
  const addr = toAddress(did);
1097
1373
  const endpoint = this.endpointsByDidAddr.get(addr);
1098
1374
  if (endpoint) trace.push(`endpoint:${endpoint.endpointUrl}`);
1099
1375
  const customDomainsForDid = [];
1100
1376
  for (const [dom, b] of this.bindingsByDomain.entries()) if (toAddress(b.ownerDid) === addr && customDomainsForDid.length < MAX_CUSTOM_DOMAINS_PER_DID) customDomainsForDid.push(dom);
1101
1377
  if (customDomain && !customDomainsForDid.includes(customDomain)) customDomainsForDid.push(customDomain);
1378
+ const effectiveKel = overrideKeyRotationEvents ?? endpoint?.keyRotationEvents ?? this.kelByDidAddr.get(addr);
1102
1379
  const didDocument = synthesizeDidDocument({
1103
1380
  did,
1104
- publicKey: endpoint?.publicKey,
1381
+ publicKey: overrideKeyRotationEvents?.length ? void 0 : endpoint?.publicKey,
1105
1382
  x25519PublicKey: endpoint?.x25519PublicKey,
1106
1383
  customDomains: customDomainsForDid,
1107
1384
  gatewayDomain: this.gatewayDomain,
@@ -1109,7 +1386,7 @@ var DIDDomainEdgeRouter = class {
1109
1386
  afsEndpoint: endpoint?.afsEndpoint,
1110
1387
  noiseMeshEndpoint: endpoint?.ipOrMeshAddress,
1111
1388
  nextKeyCommitment: endpoint?.nextKeyCommitment,
1112
- keyRotationEvents: endpoint?.keyRotationEvents
1389
+ keyRotationEvents: effectiveKel
1113
1390
  });
1114
1391
  return {
1115
1392
  found: true,
@@ -1123,6 +1400,76 @@ var DIDDomainEdgeRouter = class {
1123
1400
  trace
1124
1401
  };
1125
1402
  }
1403
+ /**
1404
+ * Resolve any URL (`https://...`, `wss://...`, `afs://...`), `<did>.arc`, `<label>.did.abtnet.io`,
1405
+ * `did:abt:...`, `did:name:...`, or custom DNS-NFT domain into a zero-CA `DID-TLS` target identity
1406
+ * (`targetDid`, active Ed25519/KEL public key, Tier-2 CNAME domain, and physical endpoint URL).
1407
+ *
1408
+ * Fails closed (`null`) on malformed/credentialed URLs, invalid `.arc` DID hosts, expired/sold DNS-NFT bindings,
1409
+ * or broken KEL chains.
1410
+ */
1411
+ resolveDidTlsTarget(input, options = {}) {
1412
+ try {
1413
+ const parsed = parseDidTlsTargetCandidate(input);
1414
+ if (!parsed) return null;
1415
+ const { candidate, scheme } = parsed;
1416
+ const prefixTrace = scheme ? [`scheme:${scheme}`] : [];
1417
+ let resolved = null;
1418
+ let resolutionTier;
1419
+ if (candidate.startsWith("did:") && !candidate.startsWith("did:name:")) {
1420
+ resolved = this.resolveThreeTier(candidate, options);
1421
+ resolutionTier = "direct-did";
1422
+ } else if (!candidate.includes(".") && isValid(candidate)) {
1423
+ const addr = toAddress(candidate);
1424
+ const canonical = formatDid(isEthereumDid(addr) ? toChecksumAddress(addr) : addr, "abt");
1425
+ resolved = this.resolveThreeTier(canonical, options);
1426
+ resolutionTier = "direct-did";
1427
+ } else if (candidate.toLowerCase().endsWith(".arc")) {
1428
+ const decodedArcDid = decodeDidFromDnsLabels(candidate.slice(0, candidate.length - 4), "abt");
1429
+ if (!decodedArcDid) return null;
1430
+ prefixTrace.push(`arc_host:${candidate}`);
1431
+ resolved = this.resolveThreeTier(decodedArcDid, options);
1432
+ resolutionTier = "direct-did";
1433
+ } else {
1434
+ const isGatewaySubdomain = !candidate.startsWith("did:name:") && candidate.toLowerCase().endsWith(`.${this.gatewayDomain}`);
1435
+ if (isGatewaySubdomain && !extractDidFromDomainHost(candidate, this.gatewayDomain, "abt")) return null;
1436
+ resolved = this.resolveThreeTier(candidate, options);
1437
+ if (!resolved || !resolved.found) return null;
1438
+ if (isGatewaySubdomain) resolutionTier = "wildcard-fallback";
1439
+ else if (resolved.domainNftAssetDid) resolutionTier = "custom-domain-nft";
1440
+ else resolutionTier = "name-registry";
1441
+ }
1442
+ if (!resolved || !resolved.found) return null;
1443
+ if (!isValidStrictDnsHostname(resolved.cnameTargetDidDomain) || resolved.customDomain !== void 0 && !isValidStrictDnsHostname(resolved.customDomain)) return null;
1444
+ const targetAddr = toAddress(resolved.did);
1445
+ const trace = [...prefixTrace, ...resolved.trace];
1446
+ const effectiveKel = options.keyRotationEvents ?? resolved.endpoint?.keyRotationEvents ?? this.kelByDidAddr.get(targetAddr);
1447
+ let activePublicKeyHex = null;
1448
+ if (effectiveKel && effectiveKel.length > 0) {
1449
+ const kelCheck = verifyKeyRotationChain({
1450
+ did: resolved.did,
1451
+ events: effectiveKel
1452
+ });
1453
+ if (!kelCheck.valid || !kelCheck.activePublicKey) return null;
1454
+ activePublicKeyHex = stripHexPrefix(kelCheck.activePublicKey).toLowerCase();
1455
+ trace.push(`kel_active_pk:${activePublicKeyHex}`);
1456
+ } else if (resolved.didDocument.verificationMethod[0]?.publicKeyHex) activePublicKeyHex = stripHexPrefix(resolved.didDocument.verificationMethod[0].publicKeyHex).toLowerCase();
1457
+ else if (resolved.customDomain) {
1458
+ const binding = this.bindingsByDomain.get(resolved.customDomain);
1459
+ if (binding?.ownerPublicKey) activePublicKeyHex = stripHexPrefix(binding.ownerPublicKey).toLowerCase();
1460
+ }
1461
+ return {
1462
+ targetDid: resolved.did,
1463
+ activePublicKeyHex,
1464
+ cnameTargetDidDomain: resolved.cnameTargetDidDomain,
1465
+ endpointUrl: resolved.endpoint?.endpointUrl ?? null,
1466
+ resolutionTier,
1467
+ trace
1468
+ };
1469
+ } catch {
1470
+ return null;
1471
+ }
1472
+ }
1126
1473
  resolve(name) {
1127
1474
  const res = this.resolveThreeTier(name);
1128
1475
  return res ? res.did : null;
@@ -1156,8 +1503,9 @@ var DIDDomainEdgeRouter = class {
1156
1503
  this.bindingsByDomain.clear();
1157
1504
  this.nftStateByDomain.clear();
1158
1505
  this.endpointsByDidAddr.clear();
1506
+ this.kelByDidAddr.clear();
1159
1507
  }
1160
1508
  };
1161
1509
 
1162
1510
  //#endregion
1163
- export { DEFAULT_DID_DOMAIN_GATEWAY, DIDDomainEdgeRouter, DID_ENDPOINT_DOMAIN_TAG, DNS_NFT_BINDING_DOMAIN_TAG, KEY_ROTATION_DOMAIN_TAG, MAX_CUSTOM_DOMAINS_PER_DID, MAX_ROTATION_CHAIN_LENGTH, PRE_ROTATION_DOMAIN_TAG, createAccountMigratePreRotationData, createDomainNftBindingProof, createKeyRotationEvent, createPreRotationCommitment, encodeDidEndpointDigest, extractAccountPreRotationData, extractDidFromDomainHost, fromDnsDidLabel, isValidPreRotationCommitment, normalizePreRotationCommitment, normalizePublicKeyHex, synthesizeDidDocument, toDidDomainHost, toDidWellKnownUrl, toDnsDidLabel, verifyAccountMigrationChainWithKel, verifyDomainNftBindingProof, verifyKeyRotationChain, verifyPreRotationCommitment, verifySingleKeyRotationEvent };
1511
+ export { DEFAULT_DID_DOMAIN_GATEWAY, DIDDomainEdgeRouter, DID_ENDPOINT_DOMAIN_TAG, DNS_NFT_BINDING_DOMAIN_TAG, KEY_ROTATION_DOMAIN_TAG, MAX_CUSTOM_DOMAINS_PER_DID, MAX_ROTATION_CHAIN_LENGTH, PRE_ROTATION_DOMAIN_TAG, createAccountMigratePreRotationData, createDomainNftBindingProof, createKeyRotationEvent, createPreRotationCommitment, decodeDidFromDnsLabels, encodeDidEndpointDigest, encodeDidForDnsLabels, extractAccountPreRotationData, extractDidFromDomainHost, fromDnsDidLabel, isValidPreRotationCommitment, isValidStrictDnsHostname, normalizePreRotationCommitment, normalizePublicKeyHex, synthesizeDidDocument, toDidDomainHost, toDidWellKnownUrl, toDnsDidLabel, verifyAccountMigrationChainWithKel, verifyDomainNftBindingProof, verifyKeyRotationChain, verifyPreRotationCommitment, verifySingleKeyRotationEvent };