@trillboards/edge-sdk 0.2.53 → 0.2.55

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.
@@ -11,12 +11,20 @@ import { type HttpPoster } from './AudienceAnalyzeClient';
11
11
  * GetStreamUri → the actual per-profile RTSP URL (no more guessed
12
12
  * /Streaming/Channels/101 paths)
13
13
  *
14
- * Deliberately dependency-free: WS-UsernameToken digest auth + regex XML
15
- * extraction, following the discovery.ts precedent (parseProbeMatches) — a
16
- * full SOAP/XML stack is overkill for three fixed calls and would bloat the
14
+ * Deliberately dependency-free: WS-UsernameToken digest auth, HTTP Digest, and
15
+ * regex XML extraction, following the discovery.ts precedent (parseProbeMatches)
16
+ * — a full SOAP/XML stack is overkill for three fixed calls and would bloat the
17
17
  * self-contained installer. Transport is the same injectable poster the other
18
18
  * clients use (unit tests never touch the network).
19
19
  *
20
+ * TWO AUTH SCHEMES, TWO ENDPOINTS, AND BOTH MUST KEEP WORKING. WS-Security at
21
+ * `/onvif/device_service` is what the installed base speaks. AXIS OS 12 speaks
22
+ * HTTP Digest at `/onvif/services` and refuses the former. Neither is a
23
+ * successor to the other, so this client sends WS-Security ALWAYS, answers a
24
+ * Digest challenge when one arrives, and tries the alternate path only when the
25
+ * first one evaluated no credential (or evaluated one without naming a scheme).
26
+ * See the Digest block below for the lockout budget that shape is protecting.
27
+ *
20
28
  * AUTH-SAFETY: callers (ChannelProber) MUST treat an auth failure here as a
21
29
  * circuit-breaker signal for the whole host — recorders lock accounts after a
22
30
  * handful of bad logins (Hikvision ~5), and locking the owner's own NVR is a
@@ -39,6 +47,68 @@ export declare class OnvifError extends Error {
39
47
  kind: OnvifFailure;
40
48
  constructor(kind: OnvifFailure, message: string);
41
49
  }
50
+ /**
51
+ * Something the DEVICE told us that is true but unusable, recorded rather than
52
+ * thrown. `getStreamUri` still returns the URI it was given — a warning must
53
+ * never turn a working camera into a failed one — but when that URI then
54
+ * produces no media, the prober can NAME the reason instead of reporting a
55
+ * generic timeout.
56
+ */
57
+ export interface OnvifStreamUriWarning {
58
+ kind: 'rtsp_port_equals_onvif_http_port';
59
+ profileToken: string;
60
+ advertisedPort: number;
61
+ onvifHttpPort: number;
62
+ message: string;
63
+ }
64
+ export interface DigestChallenge {
65
+ realm: string;
66
+ nonce: string;
67
+ /** `auth` when the server offers it; null when it offers only qop forms we do not implement. */
68
+ qop: 'auth' | null;
69
+ /** Every qop token the server offered, verbatim, so an unsupported one can be named. */
70
+ offeredQop: string[];
71
+ opaque: string | null;
72
+ /** Raw, as sent. Unsupported values are rejected by `buildDigestAuthorization`, not here. */
73
+ algorithm: string;
74
+ }
75
+ /**
76
+ * Parse a `WWW-Authenticate` header into the Digest challenge, or null when the
77
+ * server did not offer Digest.
78
+ *
79
+ * Tolerant on purpose: the header may arrive as an array (Node repeats it),
80
+ * values may be quoted or bare, and a server may offer several schemes in one
81
+ * header (`Basic realm="x", Digest realm="y", nonce="z"`). Parameters are
82
+ * FIRST-WINS from the point `Digest` appears, so a `Basic` section that follows
83
+ * cannot overwrite the Digest realm with its own.
84
+ */
85
+ export declare function parseDigestChallenge(header: string | string[] | undefined | null): DigestChallenge | null;
86
+ /**
87
+ * The `Authorization: Digest …` value for one request, or null when the
88
+ * challenge asks for something we do not implement (an unknown algorithm, or
89
+ * `auth-int` as the only qop). Null is a REPORTABLE condition, never a silent
90
+ * skip — the caller turns it into a named auth error.
91
+ */
92
+ export declare function buildDigestAuthorization(opts: {
93
+ username: string;
94
+ password: string;
95
+ method: string;
96
+ /** Request-URI: path + query, exactly as it appears on the request line. */
97
+ uri: string;
98
+ challenge: DigestChallenge;
99
+ nc?: string;
100
+ cnonce?: string;
101
+ }): string | null;
102
+ /**
103
+ * ONVIF device-service paths, in the order they are tried.
104
+ *
105
+ * `/onvif/device_service` is the conventional path and stays FIRST so no
106
+ * working recorder changes behaviour. `/onvif/services` is what AXIS OS 12
107
+ * serves. The fallback is bounded by `canFallBackEndpoint` — it is spent only
108
+ * when the first path evaluated no credential, or evaluated one without ever
109
+ * telling us which scheme it wanted.
110
+ */
111
+ export declare const ONVIF_DEVICE_SERVICE_PATHS: readonly ["/onvif/device_service", "/onvif/services"];
42
112
  export interface OnvifClientOptions {
43
113
  host: string;
44
114
  /** ONVIF HTTP port. Default 80 (cheap DVRs often use 8899 — callers try both). */
@@ -67,9 +137,52 @@ export declare class OnvifClient {
67
137
  private readonly poster;
68
138
  /** Media service endpoint discovered via GetServices (falls back to device). */
69
139
  private mediaXAddr;
140
+ /** Device-service path proven to answer on this device. Learned once. */
141
+ private deviceServicePath;
142
+ /** Cached Digest challenge, so later calls authenticate in ONE request. */
143
+ private digestChallenge;
144
+ /** Digest nonce-count, incremented per authenticated request per RFC 7616. */
145
+ private digestNc;
146
+ /**
147
+ * Whether this device has ever answered a request with a Digest challenge.
148
+ * Gates the endpoint fallback: once the device has told us its scheme and
149
+ * refused our answer, the credential is wrong and further paths are wasted
150
+ * login attempts against a lockout budget.
151
+ */
152
+ private digestAttempted;
153
+ private streamUriWarnings;
70
154
  constructor(options: OnvifClientOptions, poster?: HttpPoster);
155
+ /** The device-service endpoint: the proven path, else the conventional one. */
71
156
  deviceEndpoint(): string;
157
+ private endpointFor;
158
+ /**
159
+ * Things the device advertised that are true but unusable. Empty is the
160
+ * normal case; a caller reads this only to explain a failure it already has.
161
+ */
162
+ getStreamUriWarnings(): OnvifStreamUriWarning[];
163
+ /** One POST, with WS-Security always and Digest when we hold a challenge. */
164
+ private post;
165
+ /** Answer a challenge for `endpoint`, or null when we cannot satisfy it. */
166
+ private authorizationFor;
72
167
  private soap;
168
+ /**
169
+ * May we spend an attempt on the NEXT device-service path after `err`?
170
+ *
171
+ * The whole point is to not turn one rejected login into four. Two cases
172
+ * qualify, and nothing else:
173
+ * `not_onvif` — a non-2xx that never evaluated a credential (a 404 from a
174
+ * device that serves ONVIF somewhere else is exactly this).
175
+ * `auth` BEFORE any Digest challenge — the device refused us without ever
176
+ * saying which scheme it wanted, which is what AXIS OS 12 does to a
177
+ * WS-Security-only POST. The alternate path may negotiate properly.
178
+ *
179
+ * `auth` AFTER a challenge was answered means the CREDENTIAL is wrong, and no
180
+ * other path will change that. `unreachable` and `fault` are properties of the
181
+ * host and of a working endpoint respectively — neither is a wrong path.
182
+ */
183
+ private canFallBackEndpoint;
184
+ /** A device-service call, trying the alternate ONVIF path when it is safe. */
185
+ private deviceSoap;
73
186
  /** Stable physical identity (the channelKey backbone). */
74
187
  getDeviceInformation(): Promise<OnvifDeviceInfo>;
75
188
  /** Resolve the media service endpoint (GetServices; fall back to device path). */
@@ -79,5 +192,24 @@ export declare class OnvifClient {
79
192
  getProfiles(): Promise<OnvifProfile[]>;
80
193
  /** The ACTUAL RTSP URI for one profile (no guessed brand paths). */
81
194
  getStreamUri(profileToken: string): Promise<string | null>;
195
+ /**
196
+ * Record — never repair — an advertised RTSP port that cannot be right.
197
+ *
198
+ * A device reached through a port-forward advertises whatever its own config
199
+ * says, and a forwarder that maps HTTP and RTSP to different external ports
200
+ * makes that advertisement wrong. Measured on the Axis Virtual Loan Tool
201
+ * (2026-08-18): ONVIF was served on external port 12095 and the stream URI
202
+ * advertised `rtsp://…:12095/…`, while media was actually on 32095. The tell
203
+ * is exact — the advertised RTSP port EQUALS the port we are speaking ONVIF
204
+ * HTTP on, and one socket does not serve both protocols.
205
+ *
206
+ * We do not guess the real port. 32095 is not derivable from 12095, and a
207
+ * connector that silently sweeps ports is worse than one that says the
208
+ * advertised port did not serve media: the sweep turns one clear finding into
209
+ * a slow scan that can trip a recorder's rate limits and still be wrong. The
210
+ * URI is returned exactly as advertised; this note only lets the prober name
211
+ * the cause if that URI then produces nothing.
212
+ */
213
+ private noteStreamUriPort;
82
214
  }
83
215
  //# sourceMappingURL=OnvifClient.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"OnvifClient.d.ts","sourceRoot":"","sources":["../src/OnvifClient.ts"],"names":[],"mappings":"AACA,OAAO,EAAqB,KAAK,UAAU,EAAE,MAAM,yB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IAChD,2EAA2E;IAC3E,OAAO,CAAC,eAAe,CAAgC;IACvD,8EAA8E;IAC9E,OAAO,CAAC,QAAQ,CAAK;IACrB;;;;;OAKG;IACH,OAAO,CAAC,eAAe,CAAS;IAChC,OAAO,CAAC,iBAAiB,CAA+B;gBAE5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,CAAC,EAAE,UAAU;IAS5D,+EAA+E;IAC/E,cAAc,IAAI,MAAM;IAIxB,OAAO,CAAC,WAAW;IAInB;;;OAGG;IACH,oBAAoB,IAAI,qBAAqB,EAAE;IAI/C,6EAA6E;YAC/D,IAAI;IAgBlB,4EAA4E;IAC5E,OAAO,CAAC,gBAAgB;YAoBV,IAAI;IA8DlB;;;;;;;;;;;;;;OAcG;IACH,OAAO,CAAC,mBAAmB;IAM3B,8EAA8E;YAChE,UAAU;IAmBxB,0DAA0D;IACpD,oBAAoB,IAAI,OAAO,CAAC,eAAe,CAAC;IAYtD,kFAAkF;YACpE,iBAAiB;IA0B/B,OAAO,CAAC,WAAW;IAWnB,gDAAgD;IAC1C,WAAW,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;IAiB5C,oEAAoE;IAC9D,YAAY,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAsBhE;;;;;;;;;;;;;;;;;OAiBG;IACH,OAAO,CAAC,iBAAiB;CAkB1B"}
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.OnvifClient = exports.OnvifError = void 0;
3
+ exports.OnvifClient = exports.ONVIF_DEVICE_SERVICE_PATHS = exports.OnvifError = void 0;
4
+ exports.parseDigestChallenge = parseDigestChallenge;
5
+ exports.buildDigestAuthorization = buildDigestAuthorization;
4
6
  exports.buildUsernameToken = buildUsernameToken;
5
7
  exports.escapeXml = escapeXml;
6
8
  exports.decodeXmlEntities = decodeXmlEntities;
@@ -15,6 +17,130 @@ class OnvifError extends Error {
15
17
  }
16
18
  }
17
19
  exports.OnvifError = OnvifError;
20
+ /** Quote a Digest parameter value per RFC 7616 §3.4. */
21
+ function quoteDigest(value) {
22
+ return String(value).replace(/([\\"])/g, '\\$1');
23
+ }
24
+ /** The hash for a Digest `algorithm`, or null when we do not implement it. */
25
+ function digestHashFor(algorithm) {
26
+ const base = String(algorithm || 'MD5').replace(/-sess$/i, '').toUpperCase();
27
+ // MD5 here is the PROTOCOL's mandated construction, not a security choice of
28
+ // ours: an ONVIF device that offers MD5 accepts nothing else.
29
+ if (base === 'MD5')
30
+ return (input) => (0, crypto_1.createHash)('md5').update(input, 'utf8').digest('hex');
31
+ if (base === 'SHA-256')
32
+ return (input) => (0, crypto_1.createHash)('sha256').update(input, 'utf8').digest('hex');
33
+ return null;
34
+ }
35
+ /**
36
+ * Parse a `WWW-Authenticate` header into the Digest challenge, or null when the
37
+ * server did not offer Digest.
38
+ *
39
+ * Tolerant on purpose: the header may arrive as an array (Node repeats it),
40
+ * values may be quoted or bare, and a server may offer several schemes in one
41
+ * header (`Basic realm="x", Digest realm="y", nonce="z"`). Parameters are
42
+ * FIRST-WINS from the point `Digest` appears, so a `Basic` section that follows
43
+ * cannot overwrite the Digest realm with its own.
44
+ */
45
+ function parseDigestChallenge(header) {
46
+ const raw = Array.isArray(header) ? header.join(', ') : header;
47
+ if (!raw)
48
+ return null;
49
+ const start = /(^|[\s,])Digest\s+/i.exec(raw);
50
+ if (!start)
51
+ return null;
52
+ const params = raw.slice(start.index + start[0].length);
53
+ const found = new Map();
54
+ const re = /([A-Za-z][A-Za-z0-9_-]*)\s*=\s*(?:"((?:[^"\\]|\\.)*)"|([^,\s]*))/g;
55
+ let m;
56
+ while ((m = re.exec(params)) !== null) {
57
+ const key = m[1].toLowerCase();
58
+ if (found.has(key))
59
+ continue; // first wins
60
+ const value = m[2] !== undefined ? m[2].replace(/\\(.)/g, '$1') : (m[3] ?? '');
61
+ found.set(key, value);
62
+ }
63
+ const realm = found.get('realm');
64
+ const nonce = found.get('nonce');
65
+ // A challenge without a nonce cannot be answered. Treat it as "no Digest
66
+ // offered" rather than inventing one — a wrong Authorization header would
67
+ // spend a login attempt to learn nothing.
68
+ if (realm === undefined || !nonce)
69
+ return null;
70
+ const offeredQop = (found.get('qop') ?? '')
71
+ .split(',')
72
+ .map((q) => q.trim().toLowerCase())
73
+ .filter(Boolean);
74
+ return {
75
+ realm,
76
+ nonce,
77
+ qop: offeredQop.includes('auth') ? 'auth' : null,
78
+ offeredQop,
79
+ opaque: found.get('opaque') ?? null,
80
+ algorithm: found.get('algorithm') ?? 'MD5',
81
+ };
82
+ }
83
+ /**
84
+ * The `Authorization: Digest …` value for one request, or null when the
85
+ * challenge asks for something we do not implement (an unknown algorithm, or
86
+ * `auth-int` as the only qop). Null is a REPORTABLE condition, never a silent
87
+ * skip — the caller turns it into a named auth error.
88
+ */
89
+ function buildDigestAuthorization(opts) {
90
+ const { challenge } = opts;
91
+ const hash = digestHashFor(challenge.algorithm);
92
+ if (!hash)
93
+ return null;
94
+ // The server offered qop values, but none we implement (e.g. only auth-int).
95
+ if (challenge.offeredQop.length > 0 && challenge.qop === null)
96
+ return null;
97
+ const nc = opts.nc ?? '00000001';
98
+ const cnonce = opts.cnonce ?? (0, crypto_1.randomBytes)(8).toString('hex');
99
+ const isSess = /-sess$/i.test(challenge.algorithm);
100
+ let ha1 = hash(`${opts.username}:${challenge.realm}:${opts.password}`);
101
+ if (isSess)
102
+ ha1 = hash(`${ha1}:${challenge.nonce}:${cnonce}`);
103
+ const ha2 = hash(`${opts.method}:${opts.uri}`);
104
+ const response = challenge.qop
105
+ ? hash(`${ha1}:${challenge.nonce}:${nc}:${cnonce}:${challenge.qop}:${ha2}`)
106
+ : hash(`${ha1}:${challenge.nonce}:${ha2}`);
107
+ const parts = [
108
+ `username="${quoteDigest(opts.username)}"`,
109
+ `realm="${quoteDigest(challenge.realm)}"`,
110
+ `nonce="${quoteDigest(challenge.nonce)}"`,
111
+ `uri="${quoteDigest(opts.uri)}"`,
112
+ `response="${response}"`,
113
+ ];
114
+ if (challenge.algorithm)
115
+ parts.push(`algorithm=${challenge.algorithm}`);
116
+ if (challenge.qop) {
117
+ parts.push(`qop=${challenge.qop}`, `nc=${nc}`, `cnonce="${quoteDigest(cnonce)}"`);
118
+ }
119
+ if (challenge.opaque !== null)
120
+ parts.push(`opaque="${quoteDigest(challenge.opaque)}"`);
121
+ return `Digest ${parts.join(', ')}`;
122
+ }
123
+ /** Read one header case-insensitively out of a poster response. */
124
+ function headerOf(headers, name) {
125
+ if (!headers)
126
+ return undefined;
127
+ const wanted = name.toLowerCase();
128
+ for (const key of Object.keys(headers)) {
129
+ if (key.toLowerCase() === wanted)
130
+ return headers[key];
131
+ }
132
+ return undefined;
133
+ }
134
+ /**
135
+ * ONVIF device-service paths, in the order they are tried.
136
+ *
137
+ * `/onvif/device_service` is the conventional path and stays FIRST so no
138
+ * working recorder changes behaviour. `/onvif/services` is what AXIS OS 12
139
+ * serves. The fallback is bounded by `canFallBackEndpoint` — it is spent only
140
+ * when the first path evaluated no credential, or evaluated one without ever
141
+ * telling us which scheme it wanted.
142
+ */
143
+ exports.ONVIF_DEVICE_SERVICE_PATHS = ['/onvif/device_service', '/onvif/services'];
18
144
  /** Build the WS-Security UsernameToken header (PasswordDigest per ONVIF core). */
19
145
  function buildUsernameToken(username, password, nonceRaw = (0, crypto_1.randomBytes)(16), created = new Date().toISOString()) {
20
146
  const digest = (0, crypto_1.createHash)('sha1')
@@ -79,6 +205,20 @@ class OnvifClient {
79
205
  constructor(options, poster) {
80
206
  /** Media service endpoint discovered via GetServices (falls back to device). */
81
207
  this.mediaXAddr = null;
208
+ /** Device-service path proven to answer on this device. Learned once. */
209
+ this.deviceServicePath = null;
210
+ /** Cached Digest challenge, so later calls authenticate in ONE request. */
211
+ this.digestChallenge = null;
212
+ /** Digest nonce-count, incremented per authenticated request per RFC 7616. */
213
+ this.digestNc = 0;
214
+ /**
215
+ * Whether this device has ever answered a request with a Digest challenge.
216
+ * Gates the endpoint fallback: once the device has told us its scheme and
217
+ * refused our answer, the credential is wrong and further paths are wasted
218
+ * login attempts against a lockout budget.
219
+ */
220
+ this.digestAttempted = false;
221
+ this.streamUriWarnings = [];
82
222
  this.host = options.host;
83
223
  this.port = options.port ?? 80;
84
224
  this.username = options.username;
@@ -86,21 +226,91 @@ class OnvifClient {
86
226
  this.timeoutMs = options.timeoutMs ?? 5000;
87
227
  this.poster = poster ?? AudienceAnalyzeClient_1.defaultHttpPoster;
88
228
  }
229
+ /** The device-service endpoint: the proven path, else the conventional one. */
89
230
  deviceEndpoint() {
90
- return `http://${this.host}:${this.port}/onvif/device_service`;
231
+ return this.endpointFor(this.deviceServicePath ?? exports.ONVIF_DEVICE_SERVICE_PATHS[0]);
91
232
  }
92
- async soap(endpoint, body) {
93
- let res;
233
+ endpointFor(path) {
234
+ return `http://${this.host}:${this.port}${path}`;
235
+ }
236
+ /**
237
+ * Things the device advertised that are true but unusable. Empty is the
238
+ * normal case; a caller reads this only to explain a failure it already has.
239
+ */
240
+ getStreamUriWarnings() {
241
+ return [...this.streamUriWarnings];
242
+ }
243
+ /** One POST, with WS-Security always and Digest when we hold a challenge. */
244
+ async post(endpoint, xml, authorization) {
245
+ const headers = {
246
+ 'Content-Type': 'application/soap+xml; charset=utf-8',
247
+ };
248
+ if (authorization)
249
+ headers.Authorization = authorization;
94
250
  try {
95
- res = await this.poster(endpoint, {
96
- method: 'POST',
97
- headers: { 'Content-Type': 'application/soap+xml; charset=utf-8' },
98
- timeoutMs: this.timeoutMs,
99
- }, envelope(buildUsernameToken(this.username, this.password), body));
251
+ return await this.poster(endpoint, { method: 'POST', headers, timeoutMs: this.timeoutMs }, xml);
100
252
  }
101
253
  catch (err) {
102
254
  throw new OnvifError('unreachable', `ONVIF ${endpoint} unreachable: ${err.message}`);
103
255
  }
256
+ }
257
+ /** Answer a challenge for `endpoint`, or null when we cannot satisfy it. */
258
+ authorizationFor(endpoint, challenge) {
259
+ let uri = endpoint;
260
+ try {
261
+ const u = new URL(endpoint);
262
+ uri = `${u.pathname}${u.search}`;
263
+ }
264
+ catch {
265
+ /* keep the raw endpoint — a device that gave us an unparseable one is
266
+ already broken, and a wrong uri only costs this one attempt */
267
+ }
268
+ this.digestNc += 1;
269
+ return buildDigestAuthorization({
270
+ username: this.username,
271
+ password: this.password,
272
+ method: 'POST',
273
+ uri,
274
+ challenge,
275
+ nc: this.digestNc.toString(16).padStart(8, '0'),
276
+ });
277
+ }
278
+ async soap(endpoint, body) {
279
+ // A fresh envelope per attempt: WS-Security carries a nonce and a
280
+ // `wsu:Created` timestamp, and replaying a stale one is itself a rejection.
281
+ const envelopeXml = () => envelope(buildUsernameToken(this.username, this.password), body);
282
+ // Pre-emptive Digest once the device has challenged us: without it EVERY
283
+ // call costs two round trips.
284
+ let authorization = this.digestChallenge
285
+ ? this.authorizationFor(endpoint, this.digestChallenge)
286
+ : null;
287
+ let res = await this.post(endpoint, envelopeXml(), authorization);
288
+ if (res.statusCode === 401) {
289
+ // Re-parse: the nonce rotates, and `stale=true` means precisely "retry
290
+ // with this new one". Both land here identically.
291
+ const challenge = parseDigestChallenge(headerOf(res.headers, 'www-authenticate'));
292
+ if (challenge) {
293
+ this.digestChallenge = challenge;
294
+ this.digestNc = 0;
295
+ this.digestAttempted = true;
296
+ authorization = this.authorizationFor(endpoint, challenge);
297
+ if (!authorization) {
298
+ const wanted = challenge.offeredQop.length
299
+ ? `qop=${challenge.offeredQop.join(',')} algorithm=${challenge.algorithm}`
300
+ : `algorithm=${challenge.algorithm}`;
301
+ throw new OnvifError('auth', `ONVIF requires an HTTP Digest form this connector does not implement (${wanted}). ` +
302
+ 'Supported: MD5, MD5-sess, SHA-256, SHA-256-sess with qop=auth or no qop.');
303
+ }
304
+ res = await this.post(endpoint, envelopeXml(), authorization);
305
+ }
306
+ else if (/\bBasic\b/i.test(String(headerOf(res.headers, 'www-authenticate') ?? ''))) {
307
+ // Answering this would put the password on the wire in cleartext —
308
+ // weaker than the UsernameToken digest already sent. Name it instead.
309
+ throw new OnvifError('auth', 'ONVIF auth rejected (HTTP 401). The device offers only HTTP Basic, which this ' +
310
+ 'connector will not use because it sends the password in cleartext. Enable ' +
311
+ 'Digest or WS-Security (ONVIF UsernameToken) on the device.');
312
+ }
313
+ }
104
314
  // 401/403 → bad creds. Many recorders return 400 + a NotAuthorized SOAP
105
315
  // fault instead — treat both as the auth circuit-breaker signal.
106
316
  if (res.statusCode === 401 || res.statusCode === 403) {
@@ -117,9 +327,52 @@ class OnvifClient {
117
327
  }
118
328
  return res.body;
119
329
  }
330
+ /**
331
+ * May we spend an attempt on the NEXT device-service path after `err`?
332
+ *
333
+ * The whole point is to not turn one rejected login into four. Two cases
334
+ * qualify, and nothing else:
335
+ * `not_onvif` — a non-2xx that never evaluated a credential (a 404 from a
336
+ * device that serves ONVIF somewhere else is exactly this).
337
+ * `auth` BEFORE any Digest challenge — the device refused us without ever
338
+ * saying which scheme it wanted, which is what AXIS OS 12 does to a
339
+ * WS-Security-only POST. The alternate path may negotiate properly.
340
+ *
341
+ * `auth` AFTER a challenge was answered means the CREDENTIAL is wrong, and no
342
+ * other path will change that. `unreachable` and `fault` are properties of the
343
+ * host and of a working endpoint respectively — neither is a wrong path.
344
+ */
345
+ canFallBackEndpoint(err) {
346
+ if (err.kind === 'not_onvif')
347
+ return true;
348
+ if (err.kind === 'auth')
349
+ return !this.digestAttempted;
350
+ return false;
351
+ }
352
+ /** A device-service call, trying the alternate ONVIF path when it is safe. */
353
+ async deviceSoap(body) {
354
+ if (this.deviceServicePath)
355
+ return this.soap(this.endpointFor(this.deviceServicePath), body);
356
+ let firstError = null;
357
+ for (const path of exports.ONVIF_DEVICE_SERVICE_PATHS) {
358
+ try {
359
+ const xml = await this.soap(this.endpointFor(path), body);
360
+ this.deviceServicePath = path; // learned: every later call goes straight here
361
+ return xml;
362
+ }
363
+ catch (err) {
364
+ const onvifErr = err instanceof OnvifError ? err : new OnvifError('fault', err.message);
365
+ if (!firstError)
366
+ firstError = onvifErr;
367
+ if (!this.canFallBackEndpoint(onvifErr))
368
+ throw onvifErr;
369
+ }
370
+ }
371
+ throw firstError ?? new OnvifError('not_onvif', 'ONVIF device service did not answer');
372
+ }
120
373
  /** Stable physical identity (the channelKey backbone). */
121
374
  async getDeviceInformation() {
122
- const xml = await this.soap(this.deviceEndpoint(), '<GetDeviceInformation xmlns="http://www.onvif.org/ver10/device/wsdl"/>');
375
+ const xml = await this.deviceSoap('<GetDeviceInformation xmlns="http://www.onvif.org/ver10/device/wsdl"/>');
123
376
  return {
124
377
  manufacturer: xmlTag(xml, 'Manufacturer'),
125
378
  model: xmlTag(xml, 'Model'),
@@ -132,7 +385,7 @@ class OnvifClient {
132
385
  if (this.mediaXAddr)
133
386
  return this.mediaXAddr;
134
387
  try {
135
- const xml = await this.soap(this.deviceEndpoint(), '<GetServices xmlns="http://www.onvif.org/ver10/device/wsdl"><IncludeCapability>false</IncludeCapability></GetServices>');
388
+ const xml = await this.deviceSoap('<GetServices xmlns="http://www.onvif.org/ver10/device/wsdl"><IncludeCapability>false</IncludeCapability></GetServices>');
136
389
  for (const svc of xmlTags(xml, 'Service')) {
137
390
  const ns = xmlTag(svc, 'Namespace') || '';
138
391
  if (ns.includes('/media/')) {
@@ -197,6 +450,7 @@ class OnvifClient {
197
450
  // Rewrite the advertised host (NAT-advertised internals) but keep path/port.
198
451
  try {
199
452
  const u = new URL(uri);
453
+ this.noteStreamUriPort(profileToken, u);
200
454
  u.hostname = this.host;
201
455
  return u.toString();
202
456
  }
@@ -204,6 +458,44 @@ class OnvifClient {
204
458
  return uri;
205
459
  }
206
460
  }
461
+ /**
462
+ * Record — never repair — an advertised RTSP port that cannot be right.
463
+ *
464
+ * A device reached through a port-forward advertises whatever its own config
465
+ * says, and a forwarder that maps HTTP and RTSP to different external ports
466
+ * makes that advertisement wrong. Measured on the Axis Virtual Loan Tool
467
+ * (2026-08-18): ONVIF was served on external port 12095 and the stream URI
468
+ * advertised `rtsp://…:12095/…`, while media was actually on 32095. The tell
469
+ * is exact — the advertised RTSP port EQUALS the port we are speaking ONVIF
470
+ * HTTP on, and one socket does not serve both protocols.
471
+ *
472
+ * We do not guess the real port. 32095 is not derivable from 12095, and a
473
+ * connector that silently sweeps ports is worse than one that says the
474
+ * advertised port did not serve media: the sweep turns one clear finding into
475
+ * a slow scan that can trip a recorder's rate limits and still be wrong. The
476
+ * URI is returned exactly as advertised; this note only lets the prober name
477
+ * the cause if that URI then produces nothing.
478
+ */
479
+ noteStreamUriPort(profileToken, u) {
480
+ if (!/^rtsps?:$/i.test(u.protocol))
481
+ return;
482
+ const advertisedPort = u.port ? Number(u.port) : 554;
483
+ if (!Number.isFinite(advertisedPort) || advertisedPort !== this.port)
484
+ return;
485
+ if (this.streamUriWarnings.some((w) => w.profileToken === profileToken))
486
+ return;
487
+ this.streamUriWarnings.push({
488
+ kind: 'rtsp_port_equals_onvif_http_port',
489
+ profileToken,
490
+ advertisedPort,
491
+ onvifHttpPort: this.port,
492
+ message: `ONVIF advertised RTSP on port ${advertisedPort}, which is the same port this device ` +
493
+ 'answers ONVIF HTTP on — one port cannot serve both. This is the signature of a ' +
494
+ 'port-forward (NAT, or a remote loan/demo tool) that maps HTTP and RTSP to different ' +
495
+ 'external ports, so the advertised port is the HTTP mapping. Enter the RTSP port ' +
496
+ 'explicitly; it cannot be derived from the HTTP one.',
497
+ });
498
+ }
207
499
  }
208
500
  exports.OnvifClient = OnvifClient;
209
501
  //# sourceMappingURL=OnvifClient.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"OnvifClient.js","sourceRoot":"","sources":["../src/OnvifClient.ts"],"names":[],"mappings":";;;AA6DA,gDAoBC;AAED,8BAOC;AAcD,8CASC;AAGD,wBAGC;AAGD,0BASC;AAnID,mCAAiD;AACjD,mEAA6E;AA0C7E,MAAa,UAAW,SAAQ,KAAK;IAEnC,YAAY,IAAkB,EAAE,OAAe;QAC7C,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GA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AAI,cAAc,KAAK,IAAI,CAAC,IAAI;YAAE,OAAO;QAC7E,IAAI,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,YAAY,KAAK,YAAY,CAAC;YAAE,OAAO;QAChF,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC;YAC1B,IAAI,EAAE,kCAAkC;YACxC,YAAY;YACZ,cAAc;YACd,aAAa,EAAE,IAAI,CAAC,IAAI;YACxB,OAAO,EACL,iCAAiC,cAAc,uCAAuC;gBACtF,iFAAiF;gBACjF,sFAAsF;gBACtF,kFAAkF;gBAClF,qDAAqD;SACxD,CAAC,CAAC;IACL,CAAC;CACF;AA/TD,kCA+TC"}
@@ -31,7 +31,7 @@ export interface DiagnosticReport {
31
31
  skipped: number;
32
32
  };
33
33
  }
34
- declare const SDK_VERSION = "0.2.53";
34
+ declare const SDK_VERSION = "0.2.55";
35
35
  declare function checkNodeVersion(): CheckResult;
36
36
  declare function checkPlatform(): CheckResult;
37
37
  declare function checkMemory(): CheckResult;
package/dist/diagnose.js CHANGED
@@ -63,7 +63,7 @@ const localNetworkAccess_1 = require("./localNetworkAccess");
63
63
  // ---------------------------------------------------------------------------
64
64
  // SDK version — mirrors package.json; kept in sync by CI
65
65
  // ---------------------------------------------------------------------------
66
- const SDK_VERSION = '0.2.53';
66
+ const SDK_VERSION = '0.2.55';
67
67
  exports._SDK_VERSION = SDK_VERSION;
68
68
  // ---------------------------------------------------------------------------
69
69
  // ANSI helpers (no external deps)