@atproto/did 0.4.0 → 0.5.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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atproto/did
2
2
 
3
+ ## 0.5.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#4967](https://github.com/bluesky-social/atproto/pull/4967) [`9fc720c`](https://github.com/bluesky-social/atproto/commit/9fc720ce75f3ee88a5e48a9be919b07c7647f6f5) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Use TypeScript 7 to build package
8
+
9
+ ## 0.5.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [#4992](https://github.com/bluesky-social/atproto/pull/4992) [`622d365`](https://github.com/bluesky-social/atproto/commit/622d365aeb240133f40763a3b1c43981112837fc) Thanks [@devinivy](https://github.com/devinivy)! - **BREAKING:** Remove `AtprotoAudience` and `isAtprotoAudience`. They are superseded by `AtprotoDidRefAbsolute` and `isAtprotoDidRefAbsolute`. Adds the related `DidRefAbsolute` and `DidRefRelative` types and predicates.
14
+
3
15
  ## 0.4.0
4
16
 
5
17
  ### Minor Changes
package/dist/atproto.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { DidDocument, DidService } from './did-document.js';
3
+ import { DidRefAbsolute } from './did-ref.js';
3
4
  import { Did } from './did.js';
4
5
  import { Identifier } from './utils.js';
5
6
  export type AtprotoIdentityDidMethods = 'plc' | 'web';
@@ -14,8 +15,6 @@ export declare function assertAtprotoDidWeb(input: unknown): asserts input is Di
14
15
  * @see {@link https://atproto.com/specs/did#blessed-did-methods}
15
16
  */
16
17
  export declare function isAtprotoDidWeb(input: unknown): input is Did<'web'>;
17
- export type AtprotoAudience = `${AtprotoDid}#${string}`;
18
- export declare const isAtprotoAudience: (value: unknown) => value is AtprotoAudience;
19
18
  export type AtprotoData<M extends AtprotoIdentityDidMethods = AtprotoIdentityDidMethods> = {
20
19
  did: Did<M>;
21
20
  aka?: string;
@@ -41,5 +40,10 @@ export type AtprotoVerificationMethod<M extends AtprotoIdentityDidMethods = Atpr
41
40
  publicKeyMultibase: string;
42
41
  };
43
42
  export declare function isAtprotoVerificationMethod<M extends AtprotoIdentityDidMethods = AtprotoIdentityDidMethods>(this: DidDocument<M>, method: null | undefined | NonNullable<DidDocument<M>['verificationMethod']>[number]): method is AtprotoVerificationMethod<M>;
43
+ /**
44
+ * An atproto-constrained absolute DID reference: `${AtprotoDid}#${fragment}`.
45
+ */
46
+ export type AtprotoDidRefAbsolute = DidRefAbsolute<AtprotoIdentityDidMethods>;
47
+ export declare function isAtprotoDidRefAbsolute(value: unknown): value is AtprotoDidRefAbsolute;
44
48
  export {};
45
49
  //# sourceMappingURL=atproto.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"atproto.d.ts","sourceRoot":"","sources":["../src/atproto.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAE3D,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAU9B,OAAO,EAAE,UAAU,EAAqB,MAAM,YAAY,CAAA;AAI1D,MAAM,MAAM,yBAAyB,GAAG,KAAK,GAAG,KAAK,CAAA;AACrD,MAAM,MAAM,UAAU,GAAG,GAAG,CAAC,yBAAyB,CAAC,CAAA;AACvD,MAAM,MAAM,kBAAkB,GAAG,WAAW,CAAC,yBAAyB,CAAC,CAAA;AAEvE,eAAO,MAAM,gBAAgB,8EAE6C,CAAA;AAE1E,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,UAAU,CAEhE;AAED,wBAAgB,YAAY,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,yDAGvC;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,KAAK,IAAI,UAAU,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CAAC,CAAC,MAAM,CAAC,GAC5D,MAAM,IAAI,yBAAyB,CAAC,CAAC,CAAC,CASxC;AAED;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG,cAAc,CAAC,yBAAyB,CAAC,CAAA;AAE7E,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,qBAAqB,CAGhC"}
package/dist/atproto.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { z } from 'zod';
2
2
  import { DidError, InvalidDidError } from './did-error.js';
3
- import { canParse, isFragment } from './lib/uri.js';
3
+ import { isDidRefAbsolute } from './did-ref.js';
4
+ import { canParse } from './lib/uri.js';
4
5
  import { DID_PLC_PREFIX, DID_WEB_PREFIX, assertDidPlc, assertDidWeb, isDidPlc, isDidWeb, } from './methods.js';
5
6
  import { matchesIdentifier } from './utils.js';
6
7
  export const atprotoDidSchema = z
@@ -72,22 +73,12 @@ function isDidWebWithHttpsPort(did) {
72
73
  did.lastIndexOf('%3A', pathIdx) !== -1;
73
74
  return hasPort;
74
75
  }
75
- export const isAtprotoAudience = (value) => {
76
- if (typeof value !== 'string')
77
- return false;
78
- const hashIndex = value.indexOf('#');
79
- if (hashIndex === -1)
80
- return false;
81
- if (value.indexOf('#', hashIndex + 1) !== -1)
82
- return false;
83
- return (isFragment(value, hashIndex + 1) && isAtprotoDid(value.slice(0, hashIndex)));
84
- };
85
76
  export function extractAtprotoData(document) {
86
77
  return {
87
78
  did: document.id,
88
79
  aka: document.alsoKnownAs?.find(isAtprotoAka)?.slice(5),
89
- key: document.verificationMethod?.find((isAtprotoVerificationMethod), document),
90
- pds: document.service?.find((isAtprotoPersonalDataServerService), document),
80
+ key: document.verificationMethod?.find(isAtprotoVerificationMethod, document),
81
+ pds: document.service?.find(isAtprotoPersonalDataServerService, document),
91
82
  };
92
83
  }
93
84
  export function extractPdsUrl(document) {
@@ -117,4 +108,9 @@ export function isAtprotoVerificationMethod(method) {
117
108
  ATPROTO_VERIFICATION_METHOD_TYPES.includes(method.type) &&
118
109
  matchesIdentifier(this.id, 'atproto', method.id));
119
110
  }
111
+ export function isAtprotoDidRefAbsolute(value) {
112
+ if (!isDidRefAbsolute(value))
113
+ return false;
114
+ return isAtprotoDid(value.slice(0, value.indexOf('#')));
115
+ }
120
116
  //# sourceMappingURL=atproto.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"atproto.js","sourceRoot":"","sources":["../src/atproto.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAE1D,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACnD,OAAO,EACL,cAAc,EACd,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,QAAQ,EACR,QAAQ,GACT,MAAM,cAAc,CAAA;AACrB,OAAO,EAAc,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAQ1D,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC;KAC9B,MAAM,EAAE;KACR,MAAM,CAAC,YAAY,EAAE,iDAAiD,CAAC,CAAA;AAE1E,MAAM,UAAU,YAAY,CAAC,KAAc;IACzC,OAAO,QAAQ,CAAC,KAAK,CAAC,IAAI,eAAe,CAAC,KAAK,CAAC,CAAA;AAClD,CAAC;AAED,MAAM,UAAU,YAAY,CAAI,KAAQ;IACtC,gBAAgB,CAAC,KAAK,CAAC,CAAA;IACvB,OAAO,KAAK,CAAA;AACd,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,KAAc;IAC7C,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,MAAM,IAAI,eAAe,CAAC,OAAO,KAAK,EAAE,sBAAsB,CAAC,CAAA;IACjE,CAAC;SAAM,IAAI,KAAK,CAAC,UAAU,CAAC,cAAc,CAAC,EAAE,CAAC;QAC5C,YAAY,CAAC,KAAK,CAAC,CAAA;IACr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AC,IAAI,CAAC,EAAE,EAAE,SAAS,EAAE,MAAM,CAAC,EAAE,CAAC,CACjD,CAAA;AACH,CAAC","sourcesContent":["import { z } from 'zod'\nimport { DidDocument, DidService } from './did-document.js'\nimport { DidError, InvalidDidError } from './did-error.js'\nimport { Did } from './did.js'\nimport { canParse, isFragment } from './lib/uri.js'\nimport {\n DID_PLC_PREFIX,\n DID_WEB_PREFIX,\n assertDidPlc,\n assertDidWeb,\n isDidPlc,\n isDidWeb,\n} from './methods.js'\nimport { Identifier, matchesIdentifier } from './utils.js'\n\n// This file contains atproto-specific DID validation utilities.\n\nexport type AtprotoIdentityDidMethods = 'plc' | 'web'\nexport type AtprotoDid = Did<AtprotoIdentityDidMethods>\nexport type AtprotoDidDocument = DidDocument<AtprotoIdentityDidMethods>\n\nexport const atprotoDidSchema = z\n .string()\n .refine(isAtprotoDid, `Atproto only allows \"plc\" and \"web\" DID methods`)\n\nexport function isAtprotoDid(input: unknown): input is AtprotoDid {\n return isDidPlc(input) || isAtprotoDidWeb(input)\n}\n\nexport function asAtprotoDid<T>(input: T) {\n assertAtprotoDid(input)\n return input\n}\n\nexport function assertAtprotoDid(input: unknown): asserts input is AtprotoDid {\n if (typeof input !== 'string') {\n throw new InvalidDidError(typeof input, `DID must be a string`)\n } else if (input.startsWith(DID_PLC_PREFIX)) {\n assertDidPlc(input)\n } else if (input.startsWith(DID_WEB_PREFIX)) {\n assertAtprotoDidWeb(input)\n } else {\n throw new InvalidDidError(\n input,\n `Atproto only allows \"plc\" and \"web\" DID methods`,\n )\n }\n}\n\nexport function assertAtprotoDidWeb(\n input: unknown,\n): asserts input is Did<'web'> {\n assertDidWeb(input)\n\n if (isDidWebWithPath(input)) {\n throw new InvalidDidError(\n input,\n `Atproto does not allow path components in Web DIDs`,\n )\n }\n\n if (isDidWebWithHttpsPort(input)) {\n throw new InvalidDidError(\n input,\n `Atproto does not allow port numbers in Web DIDs, except for localhost`,\n )\n }\n}\n\n/**\n * @see {@link https://atproto.com/specs/did#blessed-did-methods}\n */\nexport function isAtprotoDidWeb(input: unknown): input is Did<'web'> {\n if (!isDidWeb(input)) {\n return false\n }\n\n if (isDidWebWithPath(input)) {\n return false\n }\n\n if (isDidWebWithHttpsPort(input)) {\n return false\n }\n\n return true\n}\n\nfunction isDidWebWithPath(did: Did<'web'>): boolean {\n return did.includes(':', DID_WEB_PREFIX.length)\n}\n\nfunction isLocalhostDid(did: Did<'web'>): boolean {\n return (\n did === 'did:web:localhost' ||\n did.startsWith('did:web:localhost:') ||\n did.startsWith('did:web:localhost%3A')\n )\n}\n\nfunction isDidWebWithHttpsPort(did: Did<'web'>): boolean {\n if (isLocalhostDid(did)) return false\n\n const pathIdx = did.indexOf(':', DID_WEB_PREFIX.length)\n\n const hasPort =\n pathIdx === -1\n ? // No path component, check if there's a port separator anywhere after\n // the \"did:web:\" prefix\n did.includes('%3A', DID_WEB_PREFIX.length)\n : // There is a path component; if there is an encoded colon *before* it,\n // then there is a port number\n did.lastIndexOf('%3A', pathIdx) !== -1\n\n return hasPort\n}\n\nexport type AtprotoAudience = `${AtprotoDid}#${string}`\nexport const isAtprotoAudience = (value: unknown): value is AtprotoAudience => {\n if (typeof value !== 'string') return false\n const hashIndex = value.indexOf('#')\n if (hashIndex === -1) return false\n if (value.indexOf('#', hashIndex + 1) !== -1) return false\n return (\n isFragment(value, hashIndex + 1) && isAtprotoDid(value.slice(0, hashIndex))\n )\n}\n\nexport type AtprotoData<\n M extends AtprotoIdentityDidMethods = AtprotoIdentityDidMethods,\n> = {\n did: Did<M>\n aka?: string\n key?: AtprotoVerificationMethod<M>\n pds?: AtprotoPersonalDataServerService<M>\n}\n\nexport function extractAtprotoData<M extends AtprotoIdentityDidMethods>(\n document: DidDocument<M>,\n): AtprotoData<M> {\n return {\n did: document.id,\n aka: document.alsoKnownAs?.find(isAtprotoAka)?.slice(5),\n key: document.verificationMethod?.find(\n isAtprotoVerificationMethod<M>,\n document,\n ),\n pds: document.service?.find(\n isAtprotoPersonalDataServerService<M>,\n document,\n ),\n }\n}\n\nexport function extractPdsUrl(document: AtprotoDidDocument): URL {\n const service = document.service?.find(\n isAtprotoPersonalDataServerService,\n document,\n )\n\n if (!service) {\n throw new DidError(\n document.id,\n `Document ${document.id} does not contain a (valid) #atproto_pds service URL`,\n 'did-service-not-found',\n )\n }\n\n return new URL(service.serviceEndpoint)\n}\n\nexport type AtprotoAka = `at://${string}`\nexport function isAtprotoAka(value: string): value is AtprotoAka {\n return value.startsWith('at://')\n}\n\nexport type AtprotoPersonalDataServerService<\n M extends AtprotoIdentityDidMethods = AtprotoIdentityDidMethods,\n> = DidService & {\n id: Identifier<Did<M>, 'atproto_pds'>\n type: 'AtprotoPersonalDataServer'\n serviceEndpoint: string\n}\n\nexport function isAtprotoPersonalDataServerService<\n M extends AtprotoIdentityDidMethods = AtprotoIdentityDidMethods,\n>(\n this: DidDocument<M>,\n service: null | undefined | DidService,\n): service is AtprotoPersonalDataServerService<M> {\n return (\n service?.type === 'AtprotoPersonalDataServer' &&\n typeof service.serviceEndpoint === 'string' &&\n canParse(service.serviceEndpoint) &&\n matchesIdentifier(this.id, 'atproto_pds', service.id)\n )\n}\n\nexport const ATPROTO_VERIFICATION_METHOD_TYPES = Object.freeze([\n 'EcdsaSecp256r1VerificationKey2019',\n 'EcdsaSecp256k1VerificationKey2019',\n 'Multikey',\n] as const)\nexport type SupportedAtprotoVerificationMethodType =\n (typeof ATPROTO_VERIFICATION_METHOD_TYPES)[number]\n\ntype VerificationMethod = NonNullable<DidDocument['verificationMethod']>[number]\nexport type AtprotoVerificationMethod<\n M extends AtprotoIdentityDidMethods = AtprotoIdentityDidMethods,\n> = Extract<VerificationMethod, object> & {\n id: Identifier<Did<M>, 'atproto'>\n type: SupportedAtprotoVerificationMethodType\n publicKeyMultibase: string\n}\n\nexport function isAtprotoVerificationMethod<\n M extends AtprotoIdentityDidMethods = AtprotoIdentityDidMethods,\n>(\n this: DidDocument<M>,\n method:\n | null\n | undefined\n | NonNullable<DidDocument<M>['verificationMethod']>[number],\n): method is AtprotoVerificationMethod<M> {\n return (\n typeof method === 'object' &&\n typeof method?.publicKeyMultibase === 'string' &&\n (ATPROTO_VERIFICATION_METHOD_TYPES as readonly unknown[]).includes(\n method.type,\n ) &&\n matchesIdentifier(this.id, 'atproto', method.id)\n )\n}\n"]}
1
+ {"version":3,"file":"atproto.js","sourceRoot":"","sources":["../src/atproto.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAC1D,OAAO,EAAkB,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAE/D,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AACvC,OAAO,EACL,cAAc,EACd,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,QAAQ,EACR,QAAQ,GACT,MAAM,cAAc,CAAA;AACrB,OAAO,EAAc,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAQ1D,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC;KAC9B,MAAM,EAAE;KACR,MAAM,CAAC,YAAY,EAAE,iDAAiD,CAAC,CAAA;AAE1E,MAAM,UAAU,YAAY,CAAC,KAAc;IACzC,OAAO,QAAQ,CAAC,KAAK,CAAC,IAAI,eAAe,CAAC,KAAK,CAAC,CAAA;AAClD,CAAC;AAED,MAAM,UAAU,YAAY,CAAI,KAAQ;IACtC,gBAAgB,CAAC,KAAK,CAAC,CAAA;IACvB,OAAO,KAAK,CAAA;AACd,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,KAAc;IAC7C,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,MAAM,IAAI,eAAe,CAAC,OAAO,KAAK,EAAE,sBAAsB,CAAC,CAAA;IACjE,CAAC;SAAM,IAAI,KAAK,CAAC,UAAU,CAAC,cAAc,CAAC,EAAE,CAAC;QAC5C,YAAY,CA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U,YAAY,CAAC,KAAa;IACxC,OAAO,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,CAAA;AAClC,CAAC;AAUD,MAAM,UAAU,kCAAkC,CAIhD,OAAsC;IAEtC,OAAO,CACL,OAAO,EAAE,IAAI,KAAK,2BAA2B;QAC7C,OAAO,OAAO,CAAC,eAAe,KAAK,QAAQ;QAC3C,QAAQ,CAAC,OAAO,CAAC,eAAe,CAAC;QACjC,iBAAiB,CAAC,IAAI,CAAC,EAAE,EAAE,aAAa,EAAE,OAAO,CAAC,EAAE,CAAC,CACtD,CAAA;AACH,CAAC;AAED,MAAM,CAAC,MAAM,iCAAiC,GAAG,MAAM,CAAC,MAAM,CAAC;IAC7D,mCAAmC;IACnC,mCAAmC;IACnC,UAAU;CACF,CAAC,CAAA;AAaX,MAAM,UAAU,2BAA2B,CAIzC,MAG6D;IAE7D,OAAO,CACL,OAAO,MAAM,KAAK,QAAQ;QAC1B,OAAO,MAAM,EAAE,kBAAkB,KAAK,QAAQ;QAC7C,iCAAwD,CAAC,QAAQ,CAChE,MAAM,CAAC,IAAI,CACZ;QACD,iBAAiB,CAAC,IAAI,CAAC,EAAE,EAAE,SAAS,EAAE,MAAM,CAAC,EAAE,CAAC,CACjD,CAAA;AACH,CAAC;AAOD,MAAM,UAAU,uBAAuB,CACrC,KAAc;IAEd,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAA;IAC1C,OAAO,YAAY,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;AACzD,CAAC","sourcesContent":["import { z } from 'zod'\nimport { DidDocument, DidService } from './did-document.js'\nimport { DidError, InvalidDidError } from './did-error.js'\nimport { DidRefAbsolute, isDidRefAbsolute } from './did-ref.js'\nimport { Did } from './did.js'\nimport { canParse } from './lib/uri.js'\nimport {\n DID_PLC_PREFIX,\n DID_WEB_PREFIX,\n assertDidPlc,\n assertDidWeb,\n isDidPlc,\n isDidWeb,\n} from './methods.js'\nimport { Identifier, matchesIdentifier } from './utils.js'\n\n// This file contains atproto-specific DID validation utilities.\n\nexport type AtprotoIdentityDidMethods = 'plc' | 'web'\nexport type AtprotoDid = Did<AtprotoIdentityDidMethods>\nexport type AtprotoDidDocument = DidDocument<AtprotoIdentityDidMethods>\n\nexport const atprotoDidSchema = z\n .string()\n .refine(isAtprotoDid, `Atproto only allows \"plc\" and \"web\" DID methods`)\n\nexport function isAtprotoDid(input: unknown): input is AtprotoDid {\n return isDidPlc(input) || isAtprotoDidWeb(input)\n}\n\nexport function asAtprotoDid<T>(input: T) {\n assertAtprotoDid(input)\n return input\n}\n\nexport function assertAtprotoDid(input: unknown): asserts input is AtprotoDid {\n if (typeof input !== 'string') {\n throw new InvalidDidError(typeof input, `DID must be a string`)\n } else if (input.startsWith(DID_PLC_PREFIX)) {\n assertDidPlc(input)\n } else if (input.startsWith(DID_WEB_PREFIX)) {\n assertAtprotoDidWeb(input)\n } else {\n throw new InvalidDidError(\n input,\n `Atproto only allows \"plc\" and \"web\" DID methods`,\n )\n }\n}\n\nexport function assertAtprotoDidWeb(\n input: unknown,\n): asserts input is Did<'web'> {\n assertDidWeb(input)\n\n if (isDidWebWithPath(input)) {\n throw new InvalidDidError(\n input,\n `Atproto does not allow path components in Web DIDs`,\n )\n }\n\n if (isDidWebWithHttpsPort(input)) {\n throw new InvalidDidError(\n input,\n `Atproto does not allow port numbers in Web DIDs, except for localhost`,\n )\n }\n}\n\n/**\n * @see {@link https://atproto.com/specs/did#blessed-did-methods}\n */\nexport function isAtprotoDidWeb(input: unknown): input is Did<'web'> {\n if (!isDidWeb(input)) {\n return false\n }\n\n if (isDidWebWithPath(input)) {\n return false\n }\n\n if (isDidWebWithHttpsPort(input)) {\n return false\n }\n\n return true\n}\n\nfunction isDidWebWithPath(did: Did<'web'>): boolean {\n return did.includes(':', DID_WEB_PREFIX.length)\n}\n\nfunction isLocalhostDid(did: Did<'web'>): boolean {\n return (\n did === 'did:web:localhost' ||\n did.startsWith('did:web:localhost:') ||\n did.startsWith('did:web:localhost%3A')\n )\n}\n\nfunction isDidWebWithHttpsPort(did: Did<'web'>): boolean {\n if (isLocalhostDid(did)) return false\n\n const pathIdx = did.indexOf(':', DID_WEB_PREFIX.length)\n\n const hasPort =\n pathIdx === -1\n ? // No path component, check if there's a port separator anywhere after\n // the \"did:web:\" prefix\n did.includes('%3A', DID_WEB_PREFIX.length)\n : // There is a path component; if there is an encoded colon *before* it,\n // then there is a port number\n did.lastIndexOf('%3A', pathIdx) !== -1\n\n return hasPort\n}\n\nexport type AtprotoData<\n M extends AtprotoIdentityDidMethods = AtprotoIdentityDidMethods,\n> = {\n did: Did<M>\n aka?: string\n key?: AtprotoVerificationMethod<M>\n pds?: AtprotoPersonalDataServerService<M>\n}\n\nexport function extractAtprotoData<M extends AtprotoIdentityDidMethods>(\n document: DidDocument<M>,\n): AtprotoData<M> {\n return {\n did: document.id,\n aka: document.alsoKnownAs?.find(isAtprotoAka)?.slice(5),\n key: document.verificationMethod?.find(\n isAtprotoVerificationMethod<M>,\n document,\n ),\n pds: document.service?.find(\n isAtprotoPersonalDataServerService<M>,\n document,\n ),\n }\n}\n\nexport function extractPdsUrl(document: AtprotoDidDocument): URL {\n const service = document.service?.find(\n isAtprotoPersonalDataServerService,\n document,\n )\n\n if (!service) {\n throw new DidError(\n document.id,\n `Document ${document.id} does not contain a (valid) #atproto_pds service URL`,\n 'did-service-not-found',\n )\n }\n\n return new URL(service.serviceEndpoint)\n}\n\nexport type AtprotoAka = `at://${string}`\nexport function isAtprotoAka(value: string): value is AtprotoAka {\n return value.startsWith('at://')\n}\n\nexport type AtprotoPersonalDataServerService<\n M extends AtprotoIdentityDidMethods = AtprotoIdentityDidMethods,\n> = DidService & {\n id: Identifier<Did<M>, 'atproto_pds'>\n type: 'AtprotoPersonalDataServer'\n serviceEndpoint: string\n}\n\nexport function isAtprotoPersonalDataServerService<\n M extends AtprotoIdentityDidMethods = AtprotoIdentityDidMethods,\n>(\n this: DidDocument<M>,\n service: null | undefined | DidService,\n): service is AtprotoPersonalDataServerService<M> {\n return (\n service?.type === 'AtprotoPersonalDataServer' &&\n typeof service.serviceEndpoint === 'string' &&\n canParse(service.serviceEndpoint) &&\n matchesIdentifier(this.id, 'atproto_pds', service.id)\n )\n}\n\nexport const ATPROTO_VERIFICATION_METHOD_TYPES = Object.freeze([\n 'EcdsaSecp256r1VerificationKey2019',\n 'EcdsaSecp256k1VerificationKey2019',\n 'Multikey',\n] as const)\nexport type SupportedAtprotoVerificationMethodType =\n (typeof ATPROTO_VERIFICATION_METHOD_TYPES)[number]\n\ntype VerificationMethod = NonNullable<DidDocument['verificationMethod']>[number]\nexport type AtprotoVerificationMethod<\n M extends AtprotoIdentityDidMethods = AtprotoIdentityDidMethods,\n> = Extract<VerificationMethod, object> & {\n id: Identifier<Did<M>, 'atproto'>\n type: SupportedAtprotoVerificationMethodType\n publicKeyMultibase: string\n}\n\nexport function isAtprotoVerificationMethod<\n M extends AtprotoIdentityDidMethods = AtprotoIdentityDidMethods,\n>(\n this: DidDocument<M>,\n method:\n | null\n | undefined\n | NonNullable<DidDocument<M>['verificationMethod']>[number],\n): method is AtprotoVerificationMethod<M> {\n return (\n typeof method === 'object' &&\n typeof method?.publicKeyMultibase === 'string' &&\n (ATPROTO_VERIFICATION_METHOD_TYPES as readonly unknown[]).includes(\n method.type,\n ) &&\n matchesIdentifier(this.id, 'atproto', method.id)\n )\n}\n\n/**\n * An atproto-constrained absolute DID reference: `${AtprotoDid}#${fragment}`.\n */\nexport type AtprotoDidRefAbsolute = DidRefAbsolute<AtprotoIdentityDidMethods>\n\nexport function isAtprotoDidRefAbsolute(\n value: unknown,\n): value is AtprotoDidRefAbsolute {\n if (!isDidRefAbsolute(value)) return false\n return isAtprotoDid(value.slice(0, value.indexOf('#')))\n}\n"]}
@@ -9,12 +9,12 @@ declare const didServiceSchema: z.ZodObject<{
9
9
  type: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>;
10
10
  serviceEndpoint: z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>, z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>, "atleastone">]>;
11
11
  }, "strip", z.ZodTypeAny, {
12
- type: string | string[];
13
12
  id: string;
13
+ type: string | string[];
14
14
  serviceEndpoint: string | Record<string, string> | [string | Record<string, string>, ...(string | Record<string, string>)[]];
15
15
  }, {
16
- type: string | string[];
17
16
  id: string;
17
+ type: string | string[];
18
18
  serviceEndpoint: string | Record<string, string> | [string | Record<string, string>, ...(string | Record<string, string>)[]];
19
19
  }>;
20
20
  export type DidService = z.infer<typeof didServiceSchema>;
@@ -32,12 +32,12 @@ export declare const didDocumentSchema: z.ZodObject<{
32
32
  type: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>;
33
33
  serviceEndpoint: z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>, z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>, "atleastone">]>;
34
34
  }, "strip", z.ZodTypeAny, {
35
- type: string | string[];
36
35
  id: string;
36
+ type: string | string[];
37
37
  serviceEndpoint: string | Record<string, string> | [string | Record<string, string>, ...(string | Record<string, string>)[]];
38
38
  }, {
39
- type: string | string[];
40
39
  id: string;
40
+ type: string | string[];
41
41
  serviceEndpoint: string | Record<string, string> | [string | Record<string, string>, ...(string | Record<string, string>)[]];
42
42
  }>, "many">>;
43
43
  authentication: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>]>, z.ZodObject<{
@@ -47,14 +47,14 @@ export declare const didDocumentSchema: z.ZodObject<{
47
47
  publicKeyJwk: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
48
48
  publicKeyMultibase: z.ZodOptional<z.ZodString>;
49
49
  }, "strip", z.ZodTypeAny, {
50
- type: string;
51
50
  id: string;
52
- controller: `did:${string}:${string}` | `did:${string}:${string}`[];
51
+ type: string;
52
+ controller: `did:${string}:${string}`[] | `did:${string}:${string}`;
53
53
  publicKeyJwk?: Record<string, unknown> | undefined;
54
54
  publicKeyMultibase?: string | undefined;
55
55
  }, {
56
- type: string;
57
56
  id: string;
57
+ type: string;
58
58
  controller: string | string[];
59
59
  publicKeyJwk?: Record<string, unknown> | undefined;
60
60
  publicKeyMultibase?: string | undefined;
@@ -66,62 +66,62 @@ export declare const didDocumentSchema: z.ZodObject<{
66
66
  publicKeyJwk: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
67
67
  publicKeyMultibase: z.ZodOptional<z.ZodString>;
68
68
  }, "strip", z.ZodTypeAny, {
69
- type: string;
70
69
  id: string;
71
- controller: `did:${string}:${string}` | `did:${string}:${string}`[];
70
+ type: string;
71
+ controller: `did:${string}:${string}`[] | `did:${string}:${string}`;
72
72
  publicKeyJwk?: Record<string, unknown> | undefined;
73
73
  publicKeyMultibase?: string | undefined;
74
74
  }, {
75
- type: string;
76
75
  id: string;
76
+ type: string;
77
77
  controller: string | string[];
78
78
  publicKeyJwk?: Record<string, unknown> | undefined;
79
79
  publicKeyMultibase?: string | undefined;
80
80
  }>, "many">>;
81
81
  }, "strip", z.ZodTypeAny, {
82
- id: `did:${string}:${string}`;
83
- controller?: `did:${string}:${string}` | `did:${string}:${string}`[] | undefined;
84
82
  '@context'?: "https://www.w3.org/ns/did/v1" | [string, ...string[]] | undefined;
83
+ id: `did:${string}:${string}`;
84
+ controller?: `did:${string}:${string}`[] | `did:${string}:${string}` | undefined;
85
85
  alsoKnownAs?: string[] | undefined;
86
86
  service?: {
87
- type: string | string[];
88
87
  id: string;
88
+ type: string | string[];
89
89
  serviceEndpoint: string | Record<string, string> | [string | Record<string, string>, ...(string | Record<string, string>)[]];
90
90
  }[] | undefined;
91
91
  authentication?: (string | {
92
- type: string;
93
92
  id: string;
94
- controller: `did:${string}:${string}` | `did:${string}:${string}`[];
93
+ type: string;
94
+ controller: `did:${string}:${string}`[] | `did:${string}:${string}`;
95
95
  publicKeyJwk?: Record<string, unknown> | undefined;
96
96
  publicKeyMultibase?: string | undefined;
97
97
  })[] | undefined;
98
98
  verificationMethod?: {
99
- type: string;
100
99
  id: string;
101
- controller: `did:${string}:${string}` | `did:${string}:${string}`[];
100
+ type: string;
101
+ controller: `did:${string}:${string}`[] | `did:${string}:${string}`;
102
102
  publicKeyJwk?: Record<string, unknown> | undefined;
103
103
  publicKeyMultibase?: string | undefined;
104
104
  }[] | undefined;
105
105
  }, {
106
+ '@context'?: "https://www.w3.org/ns/did/v1" | [string, ...string[]] | undefined;
106
107
  id: string;
107
108
  controller?: string | string[] | undefined;
108
- '@context'?: "https://www.w3.org/ns/did/v1" | [string, ...string[]] | undefined;
109
109
  alsoKnownAs?: string[] | undefined;
110
110
  service?: {
111
- type: string | string[];
112
111
  id: string;
112
+ type: string | string[];
113
113
  serviceEndpoint: string | Record<string, string> | [string | Record<string, string>, ...(string | Record<string, string>)[]];
114
114
  }[] | undefined;
115
115
  authentication?: (string | {
116
- type: string;
117
116
  id: string;
117
+ type: string;
118
118
  controller: string | string[];
119
119
  publicKeyJwk?: Record<string, unknown> | undefined;
120
120
  publicKeyMultibase?: string | undefined;
121
121
  })[] | undefined;
122
122
  verificationMethod?: {
123
- type: string;
124
123
  id: string;
124
+ type: string;
125
125
  controller: string | string[];
126
126
  publicKeyJwk?: Record<string, unknown> | undefined;
127
127
  publicKeyMultibase?: string | undefined;
@@ -140,12 +140,12 @@ export declare const didDocumentValidator: z.ZodEffects<z.ZodObject<{
140
140
  type: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>;
141
141
  serviceEndpoint: z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>, z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>, "atleastone">]>;
142
142
  }, "strip", z.ZodTypeAny, {
143
- type: string | string[];
144
143
  id: string;
144
+ type: string | string[];
145
145
  serviceEndpoint: string | Record<string, string> | [string | Record<string, string>, ...(string | Record<string, string>)[]];
146
146
  }, {
147
- type: string | string[];
148
147
  id: string;
148
+ type: string | string[];
149
149
  serviceEndpoint: string | Record<string, string> | [string | Record<string, string>, ...(string | Record<string, string>)[]];
150
150
  }>, "many">>;
151
151
  authentication: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>]>, z.ZodObject<{
@@ -155,14 +155,14 @@ export declare const didDocumentValidator: z.ZodEffects<z.ZodObject<{
155
155
  publicKeyJwk: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
156
156
  publicKeyMultibase: z.ZodOptional<z.ZodString>;
157
157
  }, "strip", z.ZodTypeAny, {
158
- type: string;
159
158
  id: string;
160
- controller: `did:${string}:${string}` | `did:${string}:${string}`[];
159
+ type: string;
160
+ controller: `did:${string}:${string}`[] | `did:${string}:${string}`;
161
161
  publicKeyJwk?: Record<string, unknown> | undefined;
162
162
  publicKeyMultibase?: string | undefined;
163
163
  }, {
164
- type: string;
165
164
  id: string;
165
+ type: string;
166
166
  controller: string | string[];
167
167
  publicKeyJwk?: Record<string, unknown> | undefined;
168
168
  publicKeyMultibase?: string | undefined;
@@ -174,110 +174,110 @@ export declare const didDocumentValidator: z.ZodEffects<z.ZodObject<{
174
174
  publicKeyJwk: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
175
175
  publicKeyMultibase: z.ZodOptional<z.ZodString>;
176
176
  }, "strip", z.ZodTypeAny, {
177
- type: string;
178
177
  id: string;
179
- controller: `did:${string}:${string}` | `did:${string}:${string}`[];
178
+ type: string;
179
+ controller: `did:${string}:${string}`[] | `did:${string}:${string}`;
180
180
  publicKeyJwk?: Record<string, unknown> | undefined;
181
181
  publicKeyMultibase?: string | undefined;
182
182
  }, {
183
- type: string;
184
183
  id: string;
184
+ type: string;
185
185
  controller: string | string[];
186
186
  publicKeyJwk?: Record<string, unknown> | undefined;
187
187
  publicKeyMultibase?: string | undefined;
188
188
  }>, "many">>;
189
189
  }, "strip", z.ZodTypeAny, {
190
- id: `did:${string}:${string}`;
191
- controller?: `did:${string}:${string}` | `did:${string}:${string}`[] | undefined;
192
190
  '@context'?: "https://www.w3.org/ns/did/v1" | [string, ...string[]] | undefined;
191
+ id: `did:${string}:${string}`;
192
+ controller?: `did:${string}:${string}`[] | `did:${string}:${string}` | undefined;
193
193
  alsoKnownAs?: string[] | undefined;
194
194
  service?: {
195
- type: string | string[];
196
195
  id: string;
196
+ type: string | string[];
197
197
  serviceEndpoint: string | Record<string, string> | [string | Record<string, string>, ...(string | Record<string, string>)[]];
198
198
  }[] | undefined;
199
199
  authentication?: (string | {
200
- type: string;
201
200
  id: string;
202
- controller: `did:${string}:${string}` | `did:${string}:${string}`[];
201
+ type: string;
202
+ controller: `did:${string}:${string}`[] | `did:${string}:${string}`;
203
203
  publicKeyJwk?: Record<string, unknown> | undefined;
204
204
  publicKeyMultibase?: string | undefined;
205
205
  })[] | undefined;
206
206
  verificationMethod?: {
207
- type: string;
208
207
  id: string;
209
- controller: `did:${string}:${string}` | `did:${string}:${string}`[];
208
+ type: string;
209
+ controller: `did:${string}:${string}`[] | `did:${string}:${string}`;
210
210
  publicKeyJwk?: Record<string, unknown> | undefined;
211
211
  publicKeyMultibase?: string | undefined;
212
212
  }[] | undefined;
213
213
  }, {
214
+ '@context'?: "https://www.w3.org/ns/did/v1" | [string, ...string[]] | undefined;
214
215
  id: string;
215
216
  controller?: string | string[] | undefined;
216
- '@context'?: "https://www.w3.org/ns/did/v1" | [string, ...string[]] | undefined;
217
217
  alsoKnownAs?: string[] | undefined;
218
218
  service?: {
219
- type: string | string[];
220
219
  id: string;
220
+ type: string | string[];
221
221
  serviceEndpoint: string | Record<string, string> | [string | Record<string, string>, ...(string | Record<string, string>)[]];
222
222
  }[] | undefined;
223
223
  authentication?: (string | {
224
- type: string;
225
224
  id: string;
225
+ type: string;
226
226
  controller: string | string[];
227
227
  publicKeyJwk?: Record<string, unknown> | undefined;
228
228
  publicKeyMultibase?: string | undefined;
229
229
  })[] | undefined;
230
230
  verificationMethod?: {
231
- type: string;
232
231
  id: string;
232
+ type: string;
233
233
  controller: string | string[];
234
234
  publicKeyJwk?: Record<string, unknown> | undefined;
235
235
  publicKeyMultibase?: string | undefined;
236
236
  }[] | undefined;
237
237
  }>, {
238
- id: `did:${string}:${string}`;
239
- controller?: `did:${string}:${string}` | `did:${string}:${string}`[] | undefined;
240
238
  '@context'?: "https://www.w3.org/ns/did/v1" | [string, ...string[]] | undefined;
239
+ id: `did:${string}:${string}`;
240
+ controller?: `did:${string}:${string}`[] | `did:${string}:${string}` | undefined;
241
241
  alsoKnownAs?: string[] | undefined;
242
242
  service?: {
243
- type: string | string[];
244
243
  id: string;
244
+ type: string | string[];
245
245
  serviceEndpoint: string | Record<string, string> | [string | Record<string, string>, ...(string | Record<string, string>)[]];
246
246
  }[] | undefined;
247
247
  authentication?: (string | {
248
- type: string;
249
248
  id: string;
250
- controller: `did:${string}:${string}` | `did:${string}:${string}`[];
249
+ type: string;
250
+ controller: `did:${string}:${string}`[] | `did:${string}:${string}`;
251
251
  publicKeyJwk?: Record<string, unknown> | undefined;
252
252
  publicKeyMultibase?: string | undefined;
253
253
  })[] | undefined;
254
254
  verificationMethod?: {
255
- type: string;
256
255
  id: string;
257
- controller: `did:${string}:${string}` | `did:${string}:${string}`[];
256
+ type: string;
257
+ controller: `did:${string}:${string}`[] | `did:${string}:${string}`;
258
258
  publicKeyJwk?: Record<string, unknown> | undefined;
259
259
  publicKeyMultibase?: string | undefined;
260
260
  }[] | undefined;
261
261
  }, {
262
+ '@context'?: "https://www.w3.org/ns/did/v1" | [string, ...string[]] | undefined;
262
263
  id: string;
263
264
  controller?: string | string[] | undefined;
264
- '@context'?: "https://www.w3.org/ns/did/v1" | [string, ...string[]] | undefined;
265
265
  alsoKnownAs?: string[] | undefined;
266
266
  service?: {
267
- type: string | string[];
268
267
  id: string;
268
+ type: string | string[];
269
269
  serviceEndpoint: string | Record<string, string> | [string | Record<string, string>, ...(string | Record<string, string>)[]];
270
270
  }[] | undefined;
271
271
  authentication?: (string | {
272
- type: string;
273
272
  id: string;
273
+ type: string;
274
274
  controller: string | string[];
275
275
  publicKeyJwk?: Record<string, unknown> | undefined;
276
276
  publicKeyMultibase?: string | undefined;
277
277
  })[] | undefined;
278
278
  verificationMethod?: {
279
- type: string;
280
279
  id: string;
280
+ type: string;
281
281
  controller: string | string[];
282
282
  publicKeyJwk?: Record<string, unknown> | undefined;
283
283
  publicKeyMultibase?: string | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"did-error.d.ts","sourceRoot":"","sources":["../src/did-error.ts"],"names":[],"mappings":"AAAA,qBAAa,QAAS,SAAQ,KAAK;aAEf,GAAG,EAAE,MAAM;aAEX,IAAI,EAAE,MAAM;aACZ,MAAM;gBAHN,GAAG,EAAE,MAAM,EAC3B,OAAO,EAAE,MAAM,EACC,IAAI,EAAE,MAAM,EACZ,MAAM,SAAM,EAC5B,KAAK,CAAC,EAAE,OAAO;IAKjB;;OAEG;IACH,IAAI,UAAU,WAEb;IAEQ,QAAQ;IAIjB,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,GAAG,QAAQ;CAoBnD;AAED,qBAAa,eAAgB,SAAQ,QAAQ;gBAC/B,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO;CAG1D"}
1
+ {"version":3,"file":"did-error.d.ts","sourceRoot":"","sources":["../src/did-error.ts"],"names":[],"mappings":"AAAA,qBAAa,QAAS,SAAQ,KAAK;aAEf,GAAG,EAAE,MAAM;aAEX,IAAI,EAAE,MAAM;aACZ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C,CAAC,OAAO,KAAK,KAAK,QAAQ;gBACzB,CAAC,CAAC,KAAK;gBACP,CAAC,CAAC,2BAA2B,CAAA;QAEnC,MAAM,MAAM,GACV,CAAC,OAAO,KAAK,EAAE,CAAC,YAAY,CAAC,KAAK,QAAQ;YACxC,CAAC,CAAC,KAAK,CAAC,YAAY,CAAC;YACrB,CAAC,CAAC,SAAS,CAAC;YACd,CAAC,OAAO,KAAK,EAAE,CAAC,QAAQ,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAA;QAEvE,OAAO,IAAI,QAAQ,CAAC,GAAG,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,EAAE,KAAK,CAAC,CAAA;IACvE,CAAC;CACF;AAED,MAAM,OAAO,eAAgB,SAAQ,QAAQ;IAC3C,YAAY,GAAW,EAAE,OAAe,EAAE,KAAe;QACvD,KAAK,CAAC,GAAG,EAAE,OAAO,EAAE,aAAa,EAAE,GAAG,EAAE,KAAK,CAAC,CAAA;IAChD,CAAC;CACF","sourcesContent":["export class DidError extends Error {\n constructor(\n public readonly did: string,\n message: string,\n public readonly code: string,\n public readonly status = 400,\n cause?: unknown,\n ) {\n super(message, { cause })\n }\n\n /**\n * For compatibility with error handlers in common HTTP frameworks.\n */\n get statusCode() {\n return this.status\n }\n\n override toString() {\n return `${this.constructor.name} ${this.code} (${this.did}): ${this.message}`\n }\n\n static from(cause: unknown, did: string): DidError {\n if (cause instanceof DidError) {\n return cause\n }\n\n const message =\n cause instanceof Error\n ? cause.message\n : typeof cause === 'string'\n ? cause\n : 'An unknown error occurred'\n\n const status =\n (typeof cause?.['statusCode'] === 'number'\n ? cause['statusCode']\n : undefined) ??\n (typeof cause?.['status'] === 'number' ? cause['status'] : undefined)\n\n return new DidError(did, message, 'did-unknown-error', status, cause)\n }\n}\n\nexport class InvalidDidError extends DidError {\n constructor(did: string, message: string, cause?: unknown) {\n super(did, message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M,EAAE,KAAK,CAAC,CAAA;IACvE,CAAC;CACF;AAED,MAAM,OAAO,eAAgB,SAAQ,QAAQ;IAC3C,YAAY,GAAW,EAAE,OAAe,EAAE,KAAe;QACvD,KAAK,CAAC,GAAG,EAAE,OAAO,EAAE,aAAa,EAAE,GAAG,EAAE,KAAK,CAAC,CAAA;IAChD,CAAC;CACF","sourcesContent":["export class DidError extends Error {\n constructor(\n public readonly did: string,\n message: string,\n public readonly code: string,\n public readonly status = 400,\n cause?: unknown,\n ) {\n super(message, { cause })\n }\n\n /**\n * For compatibility with error handlers in common HTTP frameworks.\n */\n get statusCode() {\n return this.status\n }\n\n override toString() {\n return `${this.constructor.name} ${this.code} (${this.did}): ${this.message}`\n }\n\n static from(cause: unknown, did: string): DidError {\n if (cause instanceof DidError) {\n return cause\n }\n\n const message =\n cause instanceof Error\n ? cause.message\n : typeof cause === 'string'\n ? cause\n : 'An unknown error occurred'\n\n const status =\n (typeof cause?.['statusCode'] === 'number'\n ? cause['statusCode']\n : undefined) ??\n (typeof cause?.['status'] === 'number' ? cause['status'] : undefined)\n\n return new DidError(did, message, 'did-unknown-error', status, cause)\n }\n}\n\nexport class InvalidDidError extends DidError {\n constructor(did: string, message: string, cause?: unknown) {\n super(did, message, 'did-invalid', 400, cause)\n }\n}\n"]}
@@ -0,0 +1,15 @@
1
+ import { Did } from './did.js';
2
+ /**
3
+ * An absolute DID reference: `${Did}#${fragment}`.
4
+ *
5
+ * @see {@link https://www.w3.org/TR/did-core/#did-url-syntax}
6
+ */
7
+ export type DidRefAbsolute<M extends string = string> = `${Did<M>}#${string}`;
8
+ export declare const isDidRefAbsolute: (value: unknown) => value is DidRefAbsolute;
9
+ /**
10
+ * A relative DID reference (a `#fragment` resolved against the surrounding
11
+ * DID document's `id`). The optional `id` parameter narrows the fragment.
12
+ */
13
+ export type DidRefRelative<I extends string = string> = `#${I}`;
14
+ export declare function isDidRefRelative<I extends string = string>(value: unknown, id?: I): value is DidRefRelative<I>;
15
+ //# sourceMappingURL=did-ref.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"did-ref.d.ts","sourceRoot":"","sources":["../src/did-ref.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAS,MAAM,UAAU,CAAA;AAGrC;;;;GAIG;AACH,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,IAAI,GAAG,GAAG,CAAC,CAAC,CAAC,IAAI,MAAM,EAAE,CAAA;AAE7E,eAAO,MAAM,gBAAgB,UAAW,OAAO,KAAG,KAAK,IAAI,cAO1D,CAAA;AAED;;;GAGG;AACH,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,IAAI,IAAI,CAAC,EAAE,CAAA;AAE/D,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,EACxD,KAAK,EAAE,OAAO,EACd,EAAE,CAAC,EAAE,CAAC,GACL,KAAK,IAAI,cAAc,CAAC,CAAC,CAAC,CAQ5B"}
@@ -0,0 +1,30 @@
1
+ import { isDid } from './did.js';
2
+ import { isFragment } from './lib/uri.js';
3
+ export const isDidRefAbsolute = (value) => {
4
+ if (typeof value !== 'string')
5
+ return false;
6
+ const hashIndex = value.indexOf('#');
7
+ if (hashIndex === -1)
8
+ return false; // no '#'
9
+ if (hashIndex === value.length - 1)
10
+ return false; // empty fragment
11
+ if (value.includes('#', hashIndex + 1))
12
+ return false; // more than one '#'
13
+ return isFragment(value, hashIndex + 1) && isDid(value.slice(0, hashIndex));
14
+ };
15
+ export function isDidRefRelative(value, id) {
16
+ if (typeof value !== 'string')
17
+ return false;
18
+ if (value.charCodeAt(0) !== 35 /* '#' */)
19
+ return false; // doesn't start with '#'
20
+ if (value.length < 2)
21
+ return false; // empty fragment
22
+ if (value.includes('#', 1))
23
+ return false; // more than one '#'
24
+ if (!isFragment(value, 1))
25
+ return false;
26
+ if (id !== undefined && value !== `#${id}`)
27
+ return false; // id mismatch
28
+ return true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,CAAA,CAAC,oBAAoB;IAC7D,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC,CAAC;QAAE,OAAO,KAAK,CAAA;IACvC,IAAI,EAAE,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,EAAE,EAAE;QAAE,OAAO,KAAK,CAAA,CAAC,cAAc;IACvE,OAAO,IAAI,CAAA;AACb,CAAC","sourcesContent":["import { Did, isDid } from './did.js'\nimport { isFragment } from './lib/uri.js'\n\n/**\n * An absolute DID reference: `${Did}#${fragment}`.\n *\n * @see {@link https://www.w3.org/TR/did-core/#did-url-syntax}\n */\nexport type DidRefAbsolute<M extends string = string> = `${Did<M>}#${string}`\n\nexport const isDidRefAbsolute = (value: unknown): value is DidRefAbsolute => {\n if (typeof value !== 'string') return false\n const hashIndex = value.indexOf('#')\n if (hashIndex === -1) return false // no '#'\n if (hashIndex === value.length - 1) return false // empty fragment\n if (value.includes('#', hashIndex + 1)) return false // more than one '#'\n return isFragment(value, hashIndex + 1) && isDid(value.slice(0, hashIndex))\n}\n\n/**\n * A relative DID reference (a `#fragment` resolved against the surrounding\n * DID document's `id`). The optional `id` parameter narrows the fragment.\n */\nexport type DidRefRelative<I extends string = string> = `#${I}`\n\nexport function isDidRefRelative<I extends string = string>(\n value: unknown,\n id?: I,\n): value is DidRefRelative<I> {\n if (typeof value !== 'string') return false\n if (value.charCodeAt(0) !== 35 /* '#' */) return false // doesn't start with '#'\n if (value.length < 2) return false // empty fragment\n if (value.includes('#', 1)) return false // more than one '#'\n if (!isFragment(value, 1)) return false\n if (id !== undefined && value !== `#${id}`) return false // id mismatch\n return true\n}\n"]}
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export * from './atproto.js';
2
2
  export * from './did-document.js';
3
3
  export * from './did-error.js';
4
+ export * from './did-ref.js';
4
5
  export * from './did.js';
5
6
  export * from './methods.js';
6
7
  export * from './utils.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,mBAAmB,CAAA;AACjC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,UAAU,CAAA;AACxB,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,mBAAmB,CAAA;AACjC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,cAAc,CAAA;AAC5B,cAAc,UAAU,CAAA;AACxB,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA"}
package/dist/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  export * from './atproto.js';
2
2
  export * from './did-document.js';
3
3
  export * from './did-error.js';
4
+ export * from './did-ref.js';
4
5
  export * from './did.js';
5
6
  export * from './methods.js';
6
7
  export * from './utils.js';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,mBAAmB,CAAA;AACjC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,UAAU,CAAA;AACxB,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA","sourcesContent":["export * from './atproto.js'\nexport * from './did-document.js'\nexport * from './did-error.js'\nexport * from './did.js'\nexport * from './methods.js'\nexport * from './utils.js'\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,mBAAmB,CAAA;AACjC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,cAAc,CAAA;AAC5B,cAAc,UAAU,CAAA;AACxB,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA","sourcesContent":["export * from './atproto.js'\nexport * from './did-document.js'\nexport * from './did-error.js'\nexport * from './did-ref.js'\nexport * from './did.js'\nexport * from './methods.js'\nexport * from './utils.js'\n"]}
@@ -7,7 +7,7 @@ export declare function isDidWeb(input: unknown): input is Did<'web'>;
7
7
  export declare function asDidWeb<T>(input: T): T & `did:web:${string}`;
8
8
  export declare function assertDidWeb(input: unknown): asserts input is Did<'web'>;
9
9
  export declare function didWebToUrl(did: Did<'web'>): URL & {
10
- protocol: "http:" | "https:";
10
+ protocol: 'http:' | 'https:';
11
11
  };
12
12
  export declare function urlToDidWeb(url: URL): Did<'web'>;
13
13
  export declare function buildDidWebUrl(did: Did<'web'>): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atproto/did",
3
- "version": "0.4.0",
3
+ "version": "0.5.1",
4
4
  "engines": {
5
5
  "node": ">=22"
6
6
  },
@@ -30,11 +30,10 @@
30
30
  },
31
31
  "devDependencies": {
32
32
  "@swc/jest": "^0.2.24",
33
- "jest": "^30.0.0",
34
- "typescript": "^6.0.3"
33
+ "jest": "^30.0.0"
35
34
  },
36
35
  "scripts": {
37
- "build": "tsc --build tsconfig.build.json",
36
+ "build": "tsgo --build tsconfig.build.json",
38
37
  "test": "NODE_OPTIONS=--experimental-vm-modules jest"
39
38
  }
40
39
  }
package/src/atproto.ts CHANGED
@@ -1,8 +1,9 @@
1
1
  import { z } from 'zod'
2
2
  import { DidDocument, DidService } from './did-document.js'
3
3
  import { DidError, InvalidDidError } from './did-error.js'
4
+ import { DidRefAbsolute, isDidRefAbsolute } from './did-ref.js'
4
5
  import { Did } from './did.js'
5
- import { canParse, isFragment } from './lib/uri.js'
6
+ import { canParse } from './lib/uri.js'
6
7
  import {
7
8
  DID_PLC_PREFIX,
8
9
  DID_WEB_PREFIX,
@@ -115,17 +116,6 @@ function isDidWebWithHttpsPort(did: Did<'web'>): boolean {
115
116
  return hasPort
116
117
  }
117
118
 
118
- export type AtprotoAudience = `${AtprotoDid}#${string}`
119
- export const isAtprotoAudience = (value: unknown): value is AtprotoAudience => {
120
- if (typeof value !== 'string') return false
121
- const hashIndex = value.indexOf('#')
122
- if (hashIndex === -1) return false
123
- if (value.indexOf('#', hashIndex + 1) !== -1) return false
124
- return (
125
- isFragment(value, hashIndex + 1) && isAtprotoDid(value.slice(0, hashIndex))
126
- )
127
- }
128
-
129
119
  export type AtprotoData<
130
120
  M extends AtprotoIdentityDidMethods = AtprotoIdentityDidMethods,
131
121
  > = {
@@ -231,3 +221,15 @@ export function isAtprotoVerificationMethod<
231
221
  matchesIdentifier(this.id, 'atproto', method.id)
232
222
  )
233
223
  }
224
+
225
+ /**
226
+ * An atproto-constrained absolute DID reference: `${AtprotoDid}#${fragment}`.
227
+ */
228
+ export type AtprotoDidRefAbsolute = DidRefAbsolute<AtprotoIdentityDidMethods>
229
+
230
+ export function isAtprotoDidRefAbsolute(
231
+ value: unknown,
232
+ ): value is AtprotoDidRefAbsolute {
233
+ if (!isDidRefAbsolute(value)) return false
234
+ return isAtprotoDid(value.slice(0, value.indexOf('#')))
235
+ }
package/src/did-ref.ts ADDED
@@ -0,0 +1,37 @@
1
+ import { Did, isDid } from './did.js'
2
+ import { isFragment } from './lib/uri.js'
3
+
4
+ /**
5
+ * An absolute DID reference: `${Did}#${fragment}`.
6
+ *
7
+ * @see {@link https://www.w3.org/TR/did-core/#did-url-syntax}
8
+ */
9
+ export type DidRefAbsolute<M extends string = string> = `${Did<M>}#${string}`
10
+
11
+ export const isDidRefAbsolute = (value: unknown): value is DidRefAbsolute => {
12
+ if (typeof value !== 'string') return false
13
+ const hashIndex = value.indexOf('#')
14
+ if (hashIndex === -1) return false // no '#'
15
+ if (hashIndex === value.length - 1) return false // empty fragment
16
+ if (value.includes('#', hashIndex + 1)) return false // more than one '#'
17
+ return isFragment(value, hashIndex + 1) && isDid(value.slice(0, hashIndex))
18
+ }
19
+
20
+ /**
21
+ * A relative DID reference (a `#fragment` resolved against the surrounding
22
+ * DID document's `id`). The optional `id` parameter narrows the fragment.
23
+ */
24
+ export type DidRefRelative<I extends string = string> = `#${I}`
25
+
26
+ export function isDidRefRelative<I extends string = string>(
27
+ value: unknown,
28
+ id?: I,
29
+ ): value is DidRefRelative<I> {
30
+ if (typeof value !== 'string') return false
31
+ if (value.charCodeAt(0) !== 35 /* '#' */) return false // doesn't start with '#'
32
+ if (value.length < 2) return false // empty fragment
33
+ if (value.includes('#', 1)) return false // more than one '#'
34
+ if (!isFragment(value, 1)) return false
35
+ if (id !== undefined && value !== `#${id}`) return false // id mismatch
36
+ return true
37
+ }
package/src/index.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export * from './atproto.js'
2
2
  export * from './did-document.js'
3
3
  export * from './did-error.js'
4
+ export * from './did-ref.js'
4
5
  export * from './did.js'
5
6
  export * from './methods.js'
6
7
  export * from './utils.js'
@@ -0,0 +1,69 @@
1
+ import { isAtprotoDidRefAbsolute } from '../src/atproto.js'
2
+ import { isDidRefRelative } from '../src/did-ref.js'
3
+
4
+ describe('isAtprotoDidRefAbsolute', () => {
5
+ it('accepts well-formed absolute references', () => {
6
+ expect(
7
+ isAtprotoDidRefAbsolute('did:plc:l3rouwludahu3ui3bt66mfvj#atproto'),
8
+ ).toBe(true)
9
+ expect(isAtprotoDidRefAbsolute('did:web:example.com#service_id')).toBe(true)
10
+ expect(isAtprotoDidRefAbsolute('did:web:example.com#atproto_label')).toBe(
11
+ true,
12
+ )
13
+ })
14
+
15
+ it('rejects bare DIDs', () => {
16
+ expect(isAtprotoDidRefAbsolute('did:plc:l3rouwludahu3ui3bt66mfvj')).toBe(
17
+ false,
18
+ )
19
+ expect(isAtprotoDidRefAbsolute('did:web:example.com')).toBe(false)
20
+ })
21
+
22
+ it('rejects relative references', () => {
23
+ expect(isAtprotoDidRefAbsolute('#atproto')).toBe(false)
24
+ })
25
+
26
+ it('rejects malformed input', () => {
27
+ expect(isAtprotoDidRefAbsolute('')).toBe(false)
28
+ expect(isAtprotoDidRefAbsolute('did:plc:l3rouwludahu3ui3bt66mfvj#')).toBe(
29
+ false,
30
+ )
31
+ expect(
32
+ isAtprotoDidRefAbsolute('did:plc:l3rouwludahu3ui3bt66mfvj##foo'),
33
+ ).toBe(false)
34
+ expect(
35
+ isAtprotoDidRefAbsolute('did:plc:l3rouwludahu3ui3bt66mfvj#a#b'),
36
+ ).toBe(false)
37
+ expect(isAtprotoDidRefAbsolute('did:foo:bar#baz')).toBe(false)
38
+ expect(isAtprotoDidRefAbsolute(null)).toBe(false)
39
+ expect(isAtprotoDidRefAbsolute(123)).toBe(false)
40
+ })
41
+ })
42
+
43
+ describe('isDidRefRelative', () => {
44
+ it('accepts well-formed relative references', () => {
45
+ expect(isDidRefRelative('#atproto')).toBe(true)
46
+ expect(isDidRefRelative('#atproto_label')).toBe(true)
47
+ expect(isDidRefRelative('#a')).toBe(true)
48
+ })
49
+
50
+ it('narrows on a specific id when supplied', () => {
51
+ expect(isDidRefRelative('#atproto', 'atproto')).toBe(true)
52
+ expect(isDidRefRelative('#atproto_label', 'atproto')).toBe(false)
53
+ })
54
+
55
+ it('rejects absolute references and bare strings', () => {
56
+ expect(isDidRefRelative('did:plc:l3rouwludahu3ui3bt66mfvj#atproto')).toBe(
57
+ false,
58
+ )
59
+ expect(isDidRefRelative('atproto')).toBe(false)
60
+ })
61
+
62
+ it('rejects malformed input', () => {
63
+ expect(isDidRefRelative('')).toBe(false)
64
+ expect(isDidRefRelative('#')).toBe(false)
65
+ expect(isDidRefRelative('#a#b')).toBe(false)
66
+ expect(isDidRefRelative(null)).toBe(false)
67
+ expect(isDidRefRelative(123)).toBe(false)
68
+ })
69
+ })
@@ -2,7 +2,7 @@
2
2
  "extends": "../../tsconfig/isomorphic.json",
3
3
  "compilerOptions": {
4
4
  "rootDir": "./src",
5
- "outDir": "./dist"
5
+ "outDir": "./dist",
6
6
  },
7
- "include": ["./src"]
7
+ "include": ["./src"],
8
8
  }
@@ -1 +1 @@
1
- {"root":["./src/atproto.ts","./src/did-document.ts","./src/did-error.ts","./src/did.ts","./src/index.ts","./src/methods.ts","./src/utils.ts","./src/lib/uri.ts","./src/methods/plc.ts","./src/methods/web.ts"],"version":"6.0.3"}
1
+ {"version":"7.0.0-dev.20260614.1","root":["./src/atproto.ts","./src/did-document.ts","./src/did-error.ts","./src/did-ref.ts","./src/did.ts","./src/index.ts","./src/methods.ts","./src/utils.ts","./src/lib/uri.ts","./src/methods/plc.ts","./src/methods/web.ts"]}
package/tsconfig.json CHANGED
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "include": [],
3
- "references": [{ "path": "./tsconfig.build.json" }]
3
+ "references": [{ "path": "./tsconfig.build.json" }],
4
4
  }