@didis/client 0.2.2 → 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 +12 -1
- package/dist/index.d.ts +19 -0
- package/dist/index.js +10 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,16 @@ 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
|
+
|
|
7
17
|
## [0.2.2] - 2026-10-18
|
|
8
18
|
|
|
9
19
|
### Added
|
|
@@ -46,7 +56,8 @@ All notable changes to `@didis/client` are listed here. The format follows [Keep
|
|
|
46
56
|
- `DidisError` carrying the RFC 9457 problem body and `Retry-After`.
|
|
47
57
|
- Webhook helpers `verifyWebhookSignature` and `verifyCustomerMonitorSignature`.
|
|
48
58
|
|
|
49
|
-
[Unreleased]: https://github.com/did-is/didis-js/compare/v0.2.
|
|
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
|
|
50
61
|
[0.2.2]: https://github.com/did-is/didis-js/compare/v0.2.1...v0.2.2
|
|
51
62
|
[0.2.1]: https://github.com/did-is/didis-js/compare/v0.2.0...v0.2.1
|
|
52
63
|
[0.2.0]: https://github.com/did-is/didis-js/compare/v0.1.0...v0.2.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
|
}
|
|
@@ -552,6 +567,8 @@ export interface PolicyRules {
|
|
|
552
567
|
requireKeyRelationship?: string;
|
|
553
568
|
domainBinding?: "required" | "optional";
|
|
554
569
|
tlsMinDaysRemaining?: number;
|
|
570
|
+
/** 1–4 bare https origins that must be declared in `alsoKnownAs` and link back to the DID. */
|
|
571
|
+
linkedAccounts?: string[];
|
|
555
572
|
verifiableHistory?: "required";
|
|
556
573
|
maxCacheAgeSeconds?: number;
|
|
557
574
|
credentialStatus?: "active";
|
|
@@ -658,6 +675,8 @@ export interface DidisClientOptions {
|
|
|
658
675
|
}
|
|
659
676
|
/** Public DID.is API. Point `baseUrl` at your own deployment when self-hosting. */
|
|
660
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";
|
|
661
680
|
export declare class DidisClient {
|
|
662
681
|
private readonly baseUrl;
|
|
663
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" });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@didis/client",
|
|
3
|
-
"version": "0.2.
|
|
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",
|