@meshconnect/uwc-types 0.20.0-snapshot.aac13dd → 0.20.0-snapshot.b4e39d1

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.
@@ -17,9 +17,16 @@ export type LogLevel = 'debug' | 'info' | 'warn' | 'error';
17
17
  * drive a reuse-outcome dashboard without high cardinality. Emitted via
18
18
  * `WalletConnectConfig.onSessionReuseSkipped`.
19
19
  *
20
+ * - `unscoped` — reuse is on but no `sessionReuseScopeId` was supplied (e.g. the
21
+ * link token carries no end-user id), so reuse is disabled by
22
+ * the user-binding rule. Split from `no_record` so the funnel
23
+ * separates "first connect" from "this consumer/user can never
24
+ * reuse" — the latter sizes the traffic where the integration
25
+ * (not the user) blocks adoption.
20
26
  * - `no_record` — no topic recorded for the selected wallet (e.g. first connect),
21
27
  * or the recorded session is no longer in storage.
22
- * - `expired` — the recorded session exists but is past its expiry.
28
+ * - `expired` — the recorded session exists but is past its expiry, or expires
29
+ * too soon to survive the signing flow (min-remaining-TTL guard).
23
30
  * - `no_address` — the session carries no account for the requested network.
24
31
  * - `ping_timeout`— the liveness ping got NO ack within the bounded window (peer
25
32
  * slow/suspended or the relay socket is dead — CARE-263). Split
@@ -30,7 +37,7 @@ export type LogLevel = 'debug' | 'info' | 'warn' | 'error';
30
37
  * unknown liveness state rather than a confirmed no-ack.
31
38
  * - `superseded` — a disconnect()/newer connect() invalidated the attempt mid-ping.
32
39
  */
33
- export type WalletConnectSessionReuseSkipReason = 'no_record' | 'expired' | 'no_address' | 'ping_timeout' | 'ping_error' | 'superseded';
40
+ export type WalletConnectSessionReuseSkipReason = 'unscoped' | 'no_record' | 'expired' | 'no_address' | 'ping_timeout' | 'ping_error' | 'superseded';
34
41
  /**
35
42
  * Payload for `WalletConnectConfig.onSessionReuseSkipped`. Carries the coarse
36
43
  * reason plus, for the two ping outcomes, the ping round-trip in ms — so a
@@ -43,6 +50,28 @@ export interface WalletConnectSessionReuseSkip {
43
50
  /** Ping round-trip in ms; present only for `ping_timeout` / `ping_error`. */
44
51
  pingMs?: number;
45
52
  }
53
+ /**
54
+ * Payload for `WalletConnectConfig.onSessionRestored` — context about the
55
+ * adopted session, for triaging reused-session failures per wallet (e.g. "does
56
+ * wallet X only fail when the session is close to expiry / was adopted stale?").
57
+ * Telemetry-only; adoption itself is decided before this fires.
58
+ */
59
+ export interface WalletConnectSessionRestored {
60
+ /**
61
+ * Seconds until the adopted session's WC expiry. WC v2 extends expiry on
62
+ * activity, so LOW values mean the session sat unused — the stale-session
63
+ * facet to correlate with a subsequent sign timeout on the same session.
64
+ */
65
+ expiresInSeconds: number;
66
+ /**
67
+ * The peer's self-reported wallet name (`session.peer.metadata.name`).
68
+ * UNAUTHENTICATED — never a trust input (adoption is keyed by the app-recorded
69
+ * topic, see the connector's reuse trust anchor); carried only so telemetry can
70
+ * facet reused-session outcomes by what the wallet claims to be, e.g. to isolate
71
+ * a wallet-specific reuse quirk (Rainbow, CARE-263).
72
+ */
73
+ peerName?: string;
74
+ }
46
75
  /**
47
76
  * Pluggable logger. The default implementation (`createLogger`) is console-backed
48
77
  * and level-gated; inject your own to redirect UWC's internal logging into your
@@ -1 +1 @@
1
- {"version":3,"file":"observability.d.ts","sourceRoot":"","sources":["../src/observability.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAA;AAE1D;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,MAAM,mCAAmC,GAC3C,WAAW,GACX,SAAS,GACT,YAAY,GACZ,cAAc,GACd,YAAY,GACZ,YAAY,CAAA;AAEhB;;;;;;GAMG;AACH,MAAM,WAAW,6BAA6B;IAC5C,MAAM,EAAE,mCAAmC,CAAA;IAC3C,6EAA6E;IAC7E,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED;;;;;GAKG;AACH,MAAM,WAAW,MAAM;IACrB,KAAK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M,WAAW,GACnB,eAAe,GACf,gBAAgB,GAChB,cAAc,GACd,eAAe;AACjB,iFAAiF;GAC/E,mBAAmB,GACnB,oBAAoB,GACpB,gBAAgB,GAChB,SAAS;AACX,gFAAgF;GAC9E,oBAAoB,GACpB,SAAS,CAAA;AAEb;;;;GAIG;AACH,MAAM,MAAM,WAAW,GACnB,UAAU,GACV,WAAW,GACX,QAAQ,GACR,KAAK,GACL,SAAS,CAAA;AAEb;;;;GAIG;AACH,MAAM,MAAM,0BAA0B;AACpC,gGAAgG;AAC9F,mCAAmC;AACrC,uFAAuF;GACrF,iCAAiC;AACnC,oEAAoE;GAClE,uBAAuB;AACzB;;;;GAIG;GACD,mBAAmB;AACrB;;;GAGG;GACD,cAAc,CAAA"}
@@ -1,4 +1,4 @@
1
- import type { WalletConnectSessionReuseSkip } from './observability';
1
+ import type { WalletConnectSessionRestored, WalletConnectSessionReuseSkip } from './observability';
2
2
  /**
3
3
  * Configuration for WalletConnect connector
4
4
  */
@@ -29,12 +29,13 @@ export interface WalletConnectConfig {
29
29
  enableSessionReuse?: boolean;
30
30
  /**
31
31
  * Fired once when connect() resolves from a reused stored session instead of a
32
- * fresh pairing handshake. Intended for a single telemetry tag (e.g.
33
- * restored: true). Optional — omitting it keeps reuse working, only the signal
34
- * is dropped. No-op unless enableSessionReuse is on. Mirrors
35
- * TonConnectConfig.onSessionRestored.
32
+ * fresh pairing handshake, with context about the adopted session — time to WC
33
+ * expiry and the peer's (unauthenticated) self-reported name — so reused-session
34
+ * failures can be triaged per wallet and correlated with session staleness.
35
+ * Optional — omitting it keeps reuse working, only the signal is dropped.
36
+ * No-op unless enableSessionReuse is on. Mirrors TonConnectConfig.onSessionRestored.
36
37
  */
37
- onSessionRestored?: () => void;
38
+ onSessionRestored?: (restored: WalletConnectSessionRestored) => void;
38
39
  /**
39
40
  * Fired when reuse was attempted (enableSessionReuse on + wallet known) but fell
40
41
  * back to a fresh pairing. Carries the coarse `reason` plus, for the ping
@@ -50,8 +51,10 @@ export interface WalletConnectConfig {
50
51
  * bound to the authenticated Link user — otherwise a later user on the same
51
52
  * device could silently adopt an earlier user's live session without a fresh
52
53
  * approval. Pass a stable per-user id (the Link user id). Reuse is DISABLED when
53
- * this is empty/absent, regardless of `enableSessionReuse` — origin persistence
54
- * alone is never sufficient. No-op unless enableSessionReuse is on.
54
+ * this is empty/absent, regardless of `enableSessionReuse` (skips report as
55
+ * `unscoped`) — origin persistence alone is never sufficient. The id is hashed
56
+ * before it is persisted, so a PII-bearing id (merchants sometimes use emails as
57
+ * user ids) never lands in storage verbatim. No-op unless enableSessionReuse is on.
55
58
  */
56
59
  sessionReuseScopeId?: string;
57
60
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"wallet-connect-connector.d.ts","sourceRoot":"","sources":["../src/wallet-connect-connector.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,iBAAiB,CAAA;AAEpE;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE;QACT,IAAI,EAAE,MAAM,CAAA;QACZ,WAAW,EAAE,MAAM,CAAA;QACnB,GAAG,EAAE,MAAM,CAAA;QACX,KAAK,EAAE,MAAM,EAAE,CAAA;KAChB,CAAA;IACD;;;;;;;;;;;;;;;OAeG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B;;;;;;OAMG;IACH,iBAAiB,CAAC,EAAE,MAAM,IAAI,CAAA;IAC9B;;;;;;;OAOG;IACH,qBAAqB,CAAC,EAAE,CAAC,IAAI,EAAE,6BAA6B,KAAK,IAAI,CAAA;IACrE;;;;;;;;OAQG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B;;;;;;;;;;;OAWG;IACH,yBAAyB,CAAC,EAAE,MAAM,CAAA;CACnC"}
1
+ {"version":3,"file":"wallet-connect-connector.d.ts","sourceRoot":"","sources":["../src/wallet-connect-connector.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,4BAA4B,EAC5B,6BAA6B,EAC9B,MAAM,iBAAiB,CAAA;AAExB;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE;QACT,IAAI,EAAE,MAAM,CAAA;QACZ,WAAW,EAAE,MAAM,CAAA;QACnB,GAAG,EAAE,MAAM,CAAA;QACX,KAAK,EAAE,MAAM,EAAE,CAAA;KAChB,CAAA;IACD;;;;;;;;;;;;;;;OAeG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B;;;;;;;OAOG;IACH,iBAAiB,CAAC,EAAE,CAAC,QAAQ,EAAE,4BAA4B,KAAK,IAAI,CAAA;IACpE;;;;;;;OAOG;IACH,qBAAqB,CAAC,EAAE,CAAC,IAAI,EAAE,6BAA6B,KAAK,IAAI,CAAA;IACrE;;;;;;;;;;OAUG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B;;;;;;;;;;;OAWG;IACH,yBAAyB,CAAC,EAAE,MAAM,CAAA;CACnC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meshconnect/uwc-types",
3
- "version": "0.20.0-snapshot.aac13dd",
3
+ "version": "0.20.0-snapshot.b4e39d1",
4
4
  "description": "TypeScript types for Universal Wallet Connector",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -19,9 +19,16 @@ export type LogLevel = 'debug' | 'info' | 'warn' | 'error'
19
19
  * drive a reuse-outcome dashboard without high cardinality. Emitted via
20
20
  * `WalletConnectConfig.onSessionReuseSkipped`.
21
21
  *
22
+ * - `unscoped` — reuse is on but no `sessionReuseScopeId` was supplied (e.g. the
23
+ * link token carries no end-user id), so reuse is disabled by
24
+ * the user-binding rule. Split from `no_record` so the funnel
25
+ * separates "first connect" from "this consumer/user can never
26
+ * reuse" — the latter sizes the traffic where the integration
27
+ * (not the user) blocks adoption.
22
28
  * - `no_record` — no topic recorded for the selected wallet (e.g. first connect),
23
29
  * or the recorded session is no longer in storage.
24
- * - `expired` — the recorded session exists but is past its expiry.
30
+ * - `expired` — the recorded session exists but is past its expiry, or expires
31
+ * too soon to survive the signing flow (min-remaining-TTL guard).
25
32
  * - `no_address` — the session carries no account for the requested network.
26
33
  * - `ping_timeout`— the liveness ping got NO ack within the bounded window (peer
27
34
  * slow/suspended or the relay socket is dead — CARE-263). Split
@@ -33,6 +40,7 @@ export type LogLevel = 'debug' | 'info' | 'warn' | 'error'
33
40
  * - `superseded` — a disconnect()/newer connect() invalidated the attempt mid-ping.
34
41
  */
35
42
  export type WalletConnectSessionReuseSkipReason =
43
+ | 'unscoped'
36
44
  | 'no_record'
37
45
  | 'expired'
38
46
  | 'no_address'
@@ -53,6 +61,29 @@ export interface WalletConnectSessionReuseSkip {
53
61
  pingMs?: number
54
62
  }
55
63
 
64
+ /**
65
+ * Payload for `WalletConnectConfig.onSessionRestored` — context about the
66
+ * adopted session, for triaging reused-session failures per wallet (e.g. "does
67
+ * wallet X only fail when the session is close to expiry / was adopted stale?").
68
+ * Telemetry-only; adoption itself is decided before this fires.
69
+ */
70
+ export interface WalletConnectSessionRestored {
71
+ /**
72
+ * Seconds until the adopted session's WC expiry. WC v2 extends expiry on
73
+ * activity, so LOW values mean the session sat unused — the stale-session
74
+ * facet to correlate with a subsequent sign timeout on the same session.
75
+ */
76
+ expiresInSeconds: number
77
+ /**
78
+ * The peer's self-reported wallet name (`session.peer.metadata.name`).
79
+ * UNAUTHENTICATED — never a trust input (adoption is keyed by the app-recorded
80
+ * topic, see the connector's reuse trust anchor); carried only so telemetry can
81
+ * facet reused-session outcomes by what the wallet claims to be, e.g. to isolate
82
+ * a wallet-specific reuse quirk (Rainbow, CARE-263).
83
+ */
84
+ peerName?: string
85
+ }
86
+
56
87
  /**
57
88
  * Pluggable logger. The default implementation (`createLogger`) is console-backed
58
89
  * and level-gated; inject your own to redirect UWC's internal logging into your
@@ -1,4 +1,7 @@
1
- import type { WalletConnectSessionReuseSkip } from './observability'
1
+ import type {
2
+ WalletConnectSessionRestored,
3
+ WalletConnectSessionReuseSkip
4
+ } from './observability'
2
5
 
3
6
  /**
4
7
  * Configuration for WalletConnect connector
@@ -30,12 +33,13 @@ export interface WalletConnectConfig {
30
33
  enableSessionReuse?: boolean
31
34
  /**
32
35
  * Fired once when connect() resolves from a reused stored session instead of a
33
- * fresh pairing handshake. Intended for a single telemetry tag (e.g.
34
- * restored: true). Optional — omitting it keeps reuse working, only the signal
35
- * is dropped. No-op unless enableSessionReuse is on. Mirrors
36
- * TonConnectConfig.onSessionRestored.
36
+ * fresh pairing handshake, with context about the adopted session — time to WC
37
+ * expiry and the peer's (unauthenticated) self-reported name — so reused-session
38
+ * failures can be triaged per wallet and correlated with session staleness.
39
+ * Optional — omitting it keeps reuse working, only the signal is dropped.
40
+ * No-op unless enableSessionReuse is on. Mirrors TonConnectConfig.onSessionRestored.
37
41
  */
38
- onSessionRestored?: () => void
42
+ onSessionRestored?: (restored: WalletConnectSessionRestored) => void
39
43
  /**
40
44
  * Fired when reuse was attempted (enableSessionReuse on + wallet known) but fell
41
45
  * back to a fresh pairing. Carries the coarse `reason` plus, for the ping
@@ -51,8 +55,10 @@ export interface WalletConnectConfig {
51
55
  * bound to the authenticated Link user — otherwise a later user on the same
52
56
  * device could silently adopt an earlier user's live session without a fresh
53
57
  * approval. Pass a stable per-user id (the Link user id). Reuse is DISABLED when
54
- * this is empty/absent, regardless of `enableSessionReuse` — origin persistence
55
- * alone is never sufficient. No-op unless enableSessionReuse is on.
58
+ * this is empty/absent, regardless of `enableSessionReuse` (skips report as
59
+ * `unscoped`) — origin persistence alone is never sufficient. The id is hashed
60
+ * before it is persisted, so a PII-bearing id (merchants sometimes use emails as
61
+ * user ids) never lands in storage verbatim. No-op unless enableSessionReuse is on.
56
62
  */
57
63
  sessionReuseScopeId?: string
58
64
  /**