@didis/client 0.2.1 → 0.2.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.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,22 @@ All notable changes to `@didis/client` are listed here. The format follows [Keep
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [0.2.3] - 2026-10-18
8
+
9
+ ### Added
10
+
11
+ - Requests now carry `user-agent: didis-client/<version>` (Node, Deno, Bun and other non-browser runtimes; browsers keep their own user agent). Only the package name and version are sent, so DID.is can count SDK use separately from other HTTP clients. New export `VERSION`.
12
+
13
+ - Type `LinkedAccountEvidence` and `Evidence.linkedAccounts`: each `alsoKnownAs` value with whether that website links back to the DID (`CONFIRMED`, `NOT_CONFIRMED`, `FAILED`, `UNSUPPORTED`, `UNREACHABLE`, `NOT_CHECKABLE`). A confirmation proves the same party controls the website origin and the DID; it does not prove who that party is.
14
+
15
+ - Policy rule `linkedAccounts` in `PolicyRules`: 1–4 https origins (for example `["https://shop.example"]`) that must be listed in the DID's `alsoKnownAs` and confirm the DID back. Use it to require "this DID belongs to our official website" in one policy call.
16
+
17
+ ## [0.2.2] - 2026-10-18
18
+
19
+ ### Added
20
+
21
+ - `verifyCredential` option `requiredClaims` (`ClaimRequirement[]`): check conditions such as `{ path: "/age_over_18", equals: true }` without receiving claim values. The response field `requirements` (`RequirementsOutcome`) reports `met` and a per-path result; conditions are evaluated only for a `VALID` credential.
22
+
7
23
  ## [0.2.1] - 2026-10-14
8
24
 
9
25
  ### Added
@@ -40,7 +56,9 @@ All notable changes to `@didis/client` are listed here. The format follows [Keep
40
56
  - `DidisError` carrying the RFC 9457 problem body and `Retry-After`.
41
57
  - Webhook helpers `verifyWebhookSignature` and `verifyCustomerMonitorSignature`.
42
58
 
43
- [Unreleased]: https://github.com/did-is/didis-js/compare/v0.2.1...HEAD
59
+ [Unreleased]: https://github.com/did-is/didis-js/compare/v0.2.3...HEAD
60
+ [0.2.3]: https://github.com/did-is/didis-js/compare/v0.2.2...v0.2.3
61
+ [0.2.2]: https://github.com/did-is/didis-js/compare/v0.2.1...v0.2.2
44
62
  [0.2.1]: https://github.com/did-is/didis-js/compare/v0.2.0...v0.2.1
45
63
  [0.2.0]: https://github.com/did-is/didis-js/compare/v0.1.0...v0.2.0
46
64
  [0.1.0]: https://github.com/did-is/didis-js/releases/tag/v0.1.0
package/dist/index.d.ts CHANGED
@@ -128,6 +128,19 @@ export interface DomainBindingEvidence {
128
128
  credentials: LinkageCredentialEvidence[];
129
129
  detail: string;
130
130
  }
131
+ /** One `alsoKnownAs` value checked for a reciprocal link back to the DID. */
132
+ export interface LinkedAccountEvidence {
133
+ /** The `alsoKnownAs` value exactly as declared. */
134
+ value: string;
135
+ /** `WEB_ORIGIN` | `WEB_PAGE` | `SAME_ORIGIN` | `DID` | `OTHER` */
136
+ kind: string;
137
+ origin?: string;
138
+ /** `CONFIRMED` | `NOT_CONFIRMED` | `FAILED` | `UNSUPPORTED` | `UNREACHABLE` | `NOT_CHECKABLE` */
139
+ status: string;
140
+ configurationStatus?: string;
141
+ configurationSha256?: string;
142
+ detail: string;
143
+ }
131
144
  export interface LogEntryEvidence {
132
145
  versionId: string;
133
146
  versionNumber: number;
@@ -195,6 +208,8 @@ export interface Evidence {
195
208
  keys: KeyEvidence[];
196
209
  services: ServiceEvidence[];
197
210
  domainBinding?: DomainBindingEvidence;
211
+ /** Reciprocal checks of `alsoKnownAs`; absent when nothing is declared. */
212
+ linkedAccounts?: LinkedAccountEvidence[];
198
213
  tls?: TlsEvidence;
199
214
  history?: HistoryEvidence;
200
215
  }
@@ -254,6 +269,24 @@ export interface CredentialVerifyOptions {
254
269
  expectedNonce?: string;
255
270
  /** Caller-chosen X.509 anchors (PEM or base64 DER) for SD-JWT VC `x5c`. Without them `x5c` is never VALID. */
256
271
  trustedIssuerCertificates?: string[];
272
+ /**
273
+ * Conditions checked without returning claim values, e.g. `[{ path: "/age_over_18", equals: true }]`.
274
+ * Paths are JSON Pointers into the issuer-signed claims; `equals` is a boolean, integer or string.
275
+ * Evaluated only for a VALID credential; see `CredentialVerification.requirements`.
276
+ */
277
+ requiredClaims?: ClaimRequirement[];
278
+ }
279
+ export interface ClaimRequirement {
280
+ path: string;
281
+ equals: boolean | number | string;
282
+ }
283
+ export interface RequirementsOutcome {
284
+ /** True only when the credential is VALID and every condition is SATISFIED. */
285
+ met: boolean;
286
+ results: {
287
+ path: string;
288
+ result: "SATISFIED" | "NOT_SATISFIED" | "NOT_DISCLOSED" | "NOT_EVALUATED";
289
+ }[];
257
290
  }
258
291
  export interface CredentialVerification {
259
292
  status: string;
@@ -304,6 +337,8 @@ export interface CredentialVerification {
304
337
  issuerTrust?: IssuerTrust;
305
338
  /** SD-JWT VC only. No disclosed claim values are ever returned. */
306
339
  sdJwt?: SdJwtEvidence;
340
+ /** Present only when `requiredClaims` was sent. Never contains claim values. */
341
+ requirements?: RequirementsOutcome;
307
342
  /** For SD-JWT VC: disclosed claim paths and digests only, never values. */
308
343
  claims: unknown;
309
344
  credential: unknown;
@@ -532,6 +567,8 @@ export interface PolicyRules {
532
567
  requireKeyRelationship?: string;
533
568
  domainBinding?: "required" | "optional";
534
569
  tlsMinDaysRemaining?: number;
570
+ /** 1–4 bare https origins that must be declared in `alsoKnownAs` and link back to the DID. */
571
+ linkedAccounts?: string[];
535
572
  verifiableHistory?: "required";
536
573
  maxCacheAgeSeconds?: number;
537
574
  credentialStatus?: "active";
@@ -638,6 +675,8 @@ export interface DidisClientOptions {
638
675
  }
639
676
  /** Public DID.is API. Point `baseUrl` at your own deployment when self-hosting. */
640
677
  export declare const DEFAULT_BASE_URL = "https://did.is/api";
678
+ /** Package version, kept equal to package.json (checked by the test suite). */
679
+ export declare const VERSION = "0.2.3";
641
680
  export declare class DidisClient {
642
681
  private readonly baseUrl;
643
682
  private readonly adminToken?;
package/dist/index.js CHANGED
@@ -14,6 +14,14 @@ export class DidisError extends Error {
14
14
  }
15
15
  /** Public DID.is API. Point `baseUrl` at your own deployment when self-hosting. */
16
16
  export const DEFAULT_BASE_URL = "https://did.is/api";
17
+ /** Package version, kept equal to package.json (checked by the test suite). */
18
+ export const VERSION = "0.2.3";
19
+ /**
20
+ * Identifies the SDK to the API so DID.is can count SDK use apart from other HTTP clients.
21
+ * Only the product name and version are sent. Browsers are left alone: there the browser
22
+ * controls the user agent and an extra header would add a CORS preflight to every call.
23
+ */
24
+ const SDK_HEADERS = typeof globalThis.document === "undefined" ? { "user-agent": `didis-client/${VERSION}` } : {};
17
25
  const enc = (s) => encodeURIComponent(s.trim());
18
26
  export class DidisClient {
19
27
  baseUrl;
@@ -34,7 +42,7 @@ export class DidisClient {
34
42
  const res = await this.fetchImpl(`${this.baseUrl}${path}`, {
35
43
  method,
36
44
  signal: controller.signal,
37
- headers: { accept: "application/json", ...(body !== undefined ? { "content-type": "application/json" } : {}), ...headers },
45
+ headers: { ...SDK_HEADERS, accept: "application/json", ...(body !== undefined ? { "content-type": "application/json" } : {}), ...headers },
38
46
  body: body !== undefined ? JSON.stringify(body) : undefined,
39
47
  });
40
48
  const text = await res.text();
@@ -79,7 +87,7 @@ export class DidisClient {
79
87
  /** Live resolution over server-sent events. */
80
88
  async *stream(did, opts = { noCache: true }) {
81
89
  const res = await this.fetchImpl(`${this.baseUrl}/v1/stream/${enc(did)}${opts.noCache ? "?noCache=true" : ""}`, {
82
- headers: { accept: "text/event-stream" },
90
+ headers: { ...SDK_HEADERS, accept: "text/event-stream" },
83
91
  });
84
92
  if (!res.ok || !res.body)
85
93
  throw new DidisError(res.status, { type: "about:blank", title: `HTTP ${res.status}`, detail: "stream failed" });
@@ -137,6 +145,7 @@ export class DidisClient {
137
145
  expectedAudience: options.expectedAudience,
138
146
  expectedNonce: options.expectedNonce,
139
147
  trustedIssuerCertificates: options.trustedIssuerCertificates,
148
+ requiredClaims: options.requiredClaims,
140
149
  });
141
150
  }
142
151
  evaluatePolicy(did, policy, credential) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@didis/client",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "description": "Official TypeScript/JavaScript SDK for the DID.is public API: DID resolution with evidence, credentials, policies and agent trust",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",