@shadow-corp/nearconnect 1.0.0

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.
Files changed (179) hide show
  1. package/README.md +546 -0
  2. package/build/InjectedWallet.d.ts +22 -0
  3. package/build/InjectedWallet.js +58 -0
  4. package/build/InjectedWallet.js.map +1 -0
  5. package/build/NearConnector.d.ts +151 -0
  6. package/build/NearConnector.js +536 -0
  7. package/build/NearConnector.js.map +1 -0
  8. package/build/ParentFrameWallet.d.ts +22 -0
  9. package/build/ParentFrameWallet.js +66 -0
  10. package/build/ParentFrameWallet.js.map +1 -0
  11. package/build/SandboxedWallet/code.d.ts +7 -0
  12. package/build/SandboxedWallet/code.js +324 -0
  13. package/build/SandboxedWallet/code.js.map +1 -0
  14. package/build/SandboxedWallet/executor.d.ts +23 -0
  15. package/build/SandboxedWallet/executor.js +338 -0
  16. package/build/SandboxedWallet/executor.js.map +1 -0
  17. package/build/SandboxedWallet/iframe.d.ts +18 -0
  18. package/build/SandboxedWallet/iframe.js +78 -0
  19. package/build/SandboxedWallet/iframe.js.map +1 -0
  20. package/build/SandboxedWallet/index.d.ts +24 -0
  21. package/build/SandboxedWallet/index.js +54 -0
  22. package/build/SandboxedWallet/index.js.map +1 -0
  23. package/build/actions/index.d.ts +3 -0
  24. package/build/actions/index.js +105 -0
  25. package/build/actions/index.js.map +1 -0
  26. package/build/actions/types.d.ts +76 -0
  27. package/build/actions/types.js +3 -0
  28. package/build/actions/types.js.map +1 -0
  29. package/build/connection/health.d.ts +213 -0
  30. package/build/connection/health.js +391 -0
  31. package/build/connection/health.js.map +1 -0
  32. package/build/connection/index.d.ts +4 -0
  33. package/build/connection/index.js +48 -0
  34. package/build/connection/index.js.map +1 -0
  35. package/build/connection/reconnect.d.ts +261 -0
  36. package/build/connection/reconnect.js +454 -0
  37. package/build/connection/reconnect.js.map +1 -0
  38. package/build/connection/retry.d.ts +187 -0
  39. package/build/connection/retry.js +427 -0
  40. package/build/connection/retry.js.map +1 -0
  41. package/build/connection/state.d.ts +222 -0
  42. package/build/connection/state.js +431 -0
  43. package/build/connection/state.js.map +1 -0
  44. package/build/errors.d.ts +177 -0
  45. package/build/errors.js +546 -0
  46. package/build/errors.js.map +1 -0
  47. package/build/hardware/errors.d.ts +36 -0
  48. package/build/hardware/errors.js +127 -0
  49. package/build/hardware/errors.js.map +1 -0
  50. package/build/hardware/index.d.ts +7 -0
  51. package/build/hardware/index.js +39 -0
  52. package/build/hardware/index.js.map +1 -0
  53. package/build/hardware/near-app.d.ts +95 -0
  54. package/build/hardware/near-app.js +291 -0
  55. package/build/hardware/near-app.js.map +1 -0
  56. package/build/hardware/transport.d.ts +94 -0
  57. package/build/hardware/transport.js +267 -0
  58. package/build/hardware/transport.js.map +1 -0
  59. package/build/hardware/types.d.ts +98 -0
  60. package/build/hardware/types.js +72 -0
  61. package/build/hardware/types.js.map +1 -0
  62. package/build/helpers/analytics.d.ts +191 -0
  63. package/build/helpers/analytics.js +304 -0
  64. package/build/helpers/analytics.js.map +1 -0
  65. package/build/helpers/base58.d.ts +6 -0
  66. package/build/helpers/base58.js +47 -0
  67. package/build/helpers/base58.js.map +1 -0
  68. package/build/helpers/events.d.ts +42 -0
  69. package/build/helpers/events.js +68 -0
  70. package/build/helpers/events.js.map +1 -0
  71. package/build/helpers/html.d.ts +8 -0
  72. package/build/helpers/html.js +30 -0
  73. package/build/helpers/html.js.map +1 -0
  74. package/build/helpers/indexdb.d.ts +14 -0
  75. package/build/helpers/indexdb.js +166 -0
  76. package/build/helpers/indexdb.js.map +1 -0
  77. package/build/helpers/manifest.d.ts +147 -0
  78. package/build/helpers/manifest.js +329 -0
  79. package/build/helpers/manifest.js.map +1 -0
  80. package/build/helpers/queue.d.ts +11 -0
  81. package/build/helpers/queue.js +48 -0
  82. package/build/helpers/queue.js.map +1 -0
  83. package/build/helpers/session.d.ts +119 -0
  84. package/build/helpers/session.js +289 -0
  85. package/build/helpers/session.js.map +1 -0
  86. package/build/helpers/simulation.d.ts +128 -0
  87. package/build/helpers/simulation.js +441 -0
  88. package/build/helpers/simulation.js.map +1 -0
  89. package/build/helpers/storage.d.ts +58 -0
  90. package/build/helpers/storage.js +190 -0
  91. package/build/helpers/storage.js.map +1 -0
  92. package/build/helpers/trust.d.ts +157 -0
  93. package/build/helpers/trust.js +340 -0
  94. package/build/helpers/trust.js.map +1 -0
  95. package/build/helpers/url.d.ts +1 -0
  96. package/build/helpers/url.js +13 -0
  97. package/build/helpers/url.js.map +1 -0
  98. package/build/helpers/uuid.d.ts +1 -0
  99. package/build/helpers/uuid.js +14 -0
  100. package/build/helpers/uuid.js.map +1 -0
  101. package/build/index.d.ts +21 -0
  102. package/build/index.js +167 -0
  103. package/build/index.js.map +1 -0
  104. package/build/popups/IframeWalletPopup.d.ts +16 -0
  105. package/build/popups/IframeWalletPopup.js +38 -0
  106. package/build/popups/IframeWalletPopup.js.map +1 -0
  107. package/build/popups/NearWalletsPopup.d.ts +25 -0
  108. package/build/popups/NearWalletsPopup.js +153 -0
  109. package/build/popups/NearWalletsPopup.js.map +1 -0
  110. package/build/popups/Popup.d.ts +22 -0
  111. package/build/popups/Popup.js +94 -0
  112. package/build/popups/Popup.js.map +1 -0
  113. package/build/popups/styles.d.ts +1 -0
  114. package/build/popups/styles.js +257 -0
  115. package/build/popups/styles.js.map +1 -0
  116. package/build/security/audit-log.d.ts +123 -0
  117. package/build/security/audit-log.js +268 -0
  118. package/build/security/audit-log.js.map +1 -0
  119. package/build/security/csp.d.ts +68 -0
  120. package/build/security/csp.js +328 -0
  121. package/build/security/csp.js.map +1 -0
  122. package/build/security/index.d.ts +10 -0
  123. package/build/security/index.js +42 -0
  124. package/build/security/index.js.map +1 -0
  125. package/build/security/origin-guard.d.ts +90 -0
  126. package/build/security/origin-guard.js +244 -0
  127. package/build/security/origin-guard.js.map +1 -0
  128. package/build/security/rate-limiter.d.ts +84 -0
  129. package/build/security/rate-limiter.js +212 -0
  130. package/build/security/rate-limiter.js.map +1 -0
  131. package/build/security/secure-storage.d.ts +77 -0
  132. package/build/security/secure-storage.js +242 -0
  133. package/build/security/secure-storage.js.map +1 -0
  134. package/build/security/transaction-guard.d.ts +71 -0
  135. package/build/security/transaction-guard.js +239 -0
  136. package/build/security/transaction-guard.js.map +1 -0
  137. package/build/types.d.ts +508 -0
  138. package/build/types.js +3 -0
  139. package/build/types.js.map +1 -0
  140. package/build/ui/AccountSwitcherModal.d.ts +53 -0
  141. package/build/ui/AccountSwitcherModal.js +239 -0
  142. package/build/ui/AccountSwitcherModal.js.map +1 -0
  143. package/build/ui/Modal.d.ts +84 -0
  144. package/build/ui/Modal.js +278 -0
  145. package/build/ui/Modal.js.map +1 -0
  146. package/build/ui/TransactionModal.d.ts +84 -0
  147. package/build/ui/TransactionModal.js +406 -0
  148. package/build/ui/TransactionModal.js.map +1 -0
  149. package/build/ui/WalletSelectorModal.d.ts +97 -0
  150. package/build/ui/WalletSelectorModal.js +481 -0
  151. package/build/ui/WalletSelectorModal.js.map +1 -0
  152. package/build/ui/icons.d.ts +19 -0
  153. package/build/ui/icons.js +65 -0
  154. package/build/ui/icons.js.map +1 -0
  155. package/build/ui/index.d.ts +10 -0
  156. package/build/ui/index.js +31 -0
  157. package/build/ui/index.js.map +1 -0
  158. package/build/ui/styles.d.ts +5 -0
  159. package/build/ui/styles.js +973 -0
  160. package/build/ui/styles.js.map +1 -0
  161. package/build/ui/theme.d.ts +133 -0
  162. package/build/ui/theme.js +204 -0
  163. package/build/ui/theme.js.map +1 -0
  164. package/build/wallets/external/index.d.ts +4 -0
  165. package/build/wallets/external/index.js +9 -0
  166. package/build/wallets/external/index.js.map +1 -0
  167. package/build/wallets/external/manager.d.ts +152 -0
  168. package/build/wallets/external/manager.js +586 -0
  169. package/build/wallets/external/manager.js.map +1 -0
  170. package/build/wallets/privileged/index.d.ts +5 -0
  171. package/build/wallets/privileged/index.js +12 -0
  172. package/build/wallets/privileged/index.js.map +1 -0
  173. package/build/wallets/privileged/ledger.d.ts +132 -0
  174. package/build/wallets/privileged/ledger.js +563 -0
  175. package/build/wallets/privileged/ledger.js.map +1 -0
  176. package/build/wallets/privileged/manager.d.ts +54 -0
  177. package/build/wallets/privileged/manager.js +174 -0
  178. package/build/wallets/privileged/manager.js.map +1 -0
  179. package/package.json +33 -0
@@ -0,0 +1,190 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EncryptedStorage = exports.IndexedDBStorage = exports.MemoryStorage = exports.SessionStorage = exports.LocalStorage = void 0;
4
+ /**
5
+ * localStorage adapter - persists across browser sessions
6
+ */
7
+ class LocalStorage {
8
+ async get(key) {
9
+ if (typeof window === "undefined")
10
+ return null;
11
+ return localStorage.getItem(key);
12
+ }
13
+ async set(key, value) {
14
+ if (typeof window === "undefined")
15
+ return;
16
+ localStorage.setItem(key, value);
17
+ }
18
+ async remove(key) {
19
+ if (typeof window === "undefined")
20
+ return;
21
+ localStorage.removeItem(key);
22
+ }
23
+ }
24
+ exports.LocalStorage = LocalStorage;
25
+ /**
26
+ * sessionStorage adapter - cleared when browser tab closes
27
+ */
28
+ class SessionStorage {
29
+ async get(key) {
30
+ if (typeof window === "undefined")
31
+ return null;
32
+ return sessionStorage.getItem(key);
33
+ }
34
+ async set(key, value) {
35
+ if (typeof window === "undefined")
36
+ return;
37
+ sessionStorage.setItem(key, value);
38
+ }
39
+ async remove(key) {
40
+ if (typeof window === "undefined")
41
+ return;
42
+ sessionStorage.removeItem(key);
43
+ }
44
+ }
45
+ exports.SessionStorage = SessionStorage;
46
+ /**
47
+ * Memory-only adapter - no persistence, lost on page refresh
48
+ */
49
+ class MemoryStorage {
50
+ data = new Map();
51
+ async get(key) {
52
+ return this.data.get(key) ?? null;
53
+ }
54
+ async set(key, value) {
55
+ this.data.set(key, value);
56
+ }
57
+ async remove(key) {
58
+ this.data.delete(key);
59
+ }
60
+ clear() {
61
+ this.data.clear();
62
+ }
63
+ }
64
+ exports.MemoryStorage = MemoryStorage;
65
+ /**
66
+ * IndexedDB adapter - for larger data, survives browser sessions
67
+ */
68
+ class IndexedDBStorage {
69
+ dbName;
70
+ storeName;
71
+ dbPromise = null;
72
+ constructor(dbName = "near-connect", storeName = "storage") {
73
+ this.dbName = dbName;
74
+ this.storeName = storeName;
75
+ }
76
+ async getDB() {
77
+ if (typeof indexedDB === "undefined") {
78
+ throw new Error("IndexedDB not available");
79
+ }
80
+ if (this.dbPromise)
81
+ return this.dbPromise;
82
+ this.dbPromise = new Promise((resolve, reject) => {
83
+ const request = indexedDB.open(this.dbName, 1);
84
+ request.onerror = () => reject(request.error);
85
+ request.onsuccess = () => resolve(request.result);
86
+ request.onupgradeneeded = () => {
87
+ const db = request.result;
88
+ if (!db.objectStoreNames.contains(this.storeName)) {
89
+ db.createObjectStore(this.storeName);
90
+ }
91
+ };
92
+ });
93
+ return this.dbPromise;
94
+ }
95
+ async get(key) {
96
+ try {
97
+ const db = await this.getDB();
98
+ return new Promise((resolve, reject) => {
99
+ const tx = db.transaction(this.storeName, "readonly");
100
+ const store = tx.objectStore(this.storeName);
101
+ const request = store.get(key);
102
+ request.onerror = () => reject(request.error);
103
+ request.onsuccess = () => resolve(request.result ?? null);
104
+ });
105
+ }
106
+ catch {
107
+ return null;
108
+ }
109
+ }
110
+ async set(key, value) {
111
+ const db = await this.getDB();
112
+ return new Promise((resolve, reject) => {
113
+ const tx = db.transaction(this.storeName, "readwrite");
114
+ const store = tx.objectStore(this.storeName);
115
+ const request = store.put(value, key);
116
+ request.onerror = () => reject(request.error);
117
+ request.onsuccess = () => resolve();
118
+ });
119
+ }
120
+ async remove(key) {
121
+ const db = await this.getDB();
122
+ return new Promise((resolve, reject) => {
123
+ const tx = db.transaction(this.storeName, "readwrite");
124
+ const store = tx.objectStore(this.storeName);
125
+ const request = store.delete(key);
126
+ request.onerror = () => reject(request.error);
127
+ request.onsuccess = () => resolve();
128
+ });
129
+ }
130
+ }
131
+ exports.IndexedDBStorage = IndexedDBStorage;
132
+ /**
133
+ * Encrypted storage wrapper - encrypts data before storing
134
+ * Uses AES-GCM with a derived key from password
135
+ */
136
+ class EncryptedStorage {
137
+ storage;
138
+ keyPromise = null;
139
+ password;
140
+ constructor(storage, password) {
141
+ this.storage = storage;
142
+ this.password = password;
143
+ }
144
+ async getKey() {
145
+ if (this.keyPromise)
146
+ return this.keyPromise;
147
+ this.keyPromise = (async () => {
148
+ const encoder = new TextEncoder();
149
+ const keyMaterial = await crypto.subtle.importKey("raw", encoder.encode(this.password), "PBKDF2", false, ["deriveKey"]);
150
+ return crypto.subtle.deriveKey({
151
+ name: "PBKDF2",
152
+ salt: encoder.encode("near-connect-salt"),
153
+ iterations: 100000,
154
+ hash: "SHA-256",
155
+ }, keyMaterial, { name: "AES-GCM", length: 256 }, false, ["encrypt", "decrypt"]);
156
+ })();
157
+ return this.keyPromise;
158
+ }
159
+ async get(key) {
160
+ const encrypted = await this.storage.get(key);
161
+ if (!encrypted)
162
+ return null;
163
+ try {
164
+ const cryptoKey = await this.getKey();
165
+ const data = JSON.parse(encrypted);
166
+ const iv = Uint8Array.from(atob(data.iv), (c) => c.charCodeAt(0));
167
+ const encryptedData = Uint8Array.from(atob(data.data), (c) => c.charCodeAt(0));
168
+ const decrypted = await crypto.subtle.decrypt({ name: "AES-GCM", iv }, cryptoKey, encryptedData);
169
+ return new TextDecoder().decode(decrypted);
170
+ }
171
+ catch {
172
+ return null;
173
+ }
174
+ }
175
+ async set(key, value) {
176
+ const cryptoKey = await this.getKey();
177
+ const iv = crypto.getRandomValues(new Uint8Array(12));
178
+ const encrypted = await crypto.subtle.encrypt({ name: "AES-GCM", iv }, cryptoKey, new TextEncoder().encode(value));
179
+ const data = {
180
+ iv: btoa(String.fromCharCode(...iv)),
181
+ data: btoa(String.fromCharCode(...new Uint8Array(encrypted))),
182
+ };
183
+ await this.storage.set(key, JSON.stringify(data));
184
+ }
185
+ async remove(key) {
186
+ await this.storage.remove(key);
187
+ }
188
+ }
189
+ exports.EncryptedStorage = EncryptedStorage;
190
+ //# sourceMappingURL=storage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage.js","sourceRoot":"","sources":["../../src/helpers/storage.ts"],"names":[],"mappings":";;;AAMA;;GAEG;AACH,MAAa,YAAY;IACvB,KAAK,CAAC,GAAG,CAAC,GAAW;QACnB,IAAI,OAAO,MAAM,KAAK,WAAW;YAAE,OAAO,IAAI,CAAC;QAC/C,OAAO,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACnC,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,GAAW,EAAE,KAAa;QAClC,IAAI,OAAO,MAAM,KAAK,WAAW;YAAE,OAAO;QAC1C,YAAY,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IACnC,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,GAAW;QACtB,IAAI,OAAO,MAAM,KAAK,WAAW;YAAE,OAAO;QAC1C,YAAY,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;IAC/B,CAAC;CACF;AAfD,oCAeC;AAED;;GAEG;AACH,MAAa,cAAc;IACzB,KAAK,CAAC,GAAG,CAAC,GAAW;QACnB,IAAI,OAAO,MAAM,KAAK,WAAW;YAAE,OAAO,IAAI,CAAC;QAC/C,OAAO,cAAc,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACrC,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,GAAW,EAAE,KAAa;QAClC,IAAI,OAAO,MAAM,KAAK,WAAW;YAAE,OAAO;QAC1C,cAAc,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IACrC,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,GAAW;QACtB,IAAI,OAAO,MAAM,KAAK,WAAW;YAAE,OAAO;QAC1C,cAAc,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;IACjC,CAAC;CACF;AAfD,wCAeC;AAED;;GAEG;AACH,MAAa,aAAa;IAChB,IAAI,GAAG,IAAI,GAAG,EAAkB,CAA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CAAC,GAAG,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;IACpD,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,GAAW;QACtB,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACjC,CAAC;CACF;AApFD,4CAoFC"}
@@ -0,0 +1,157 @@
1
+ import { WalletManifest } from "../types";
2
+ /**
3
+ * Trust score components
4
+ */
5
+ export interface TrustScoreComponents {
6
+ /** Source trust (from manifest source) */
7
+ sourceScore: number;
8
+ /** Verification status (audits, certifications) */
9
+ verificationScore: number;
10
+ /** Age/maturity of the wallet */
11
+ maturityScore: number;
12
+ /** Usage/popularity metrics */
13
+ popularityScore: number;
14
+ /** Security features enabled */
15
+ securityScore: number;
16
+ /** Transparency (open source, etc.) */
17
+ transparencyScore: number;
18
+ }
19
+ /**
20
+ * Trust score result
21
+ */
22
+ export interface TrustScore {
23
+ /** Overall score 0-100 */
24
+ score: number;
25
+ /** Risk level */
26
+ level: TrustLevel;
27
+ /** Individual component scores */
28
+ components: TrustScoreComponents;
29
+ /** Warnings and recommendations */
30
+ warnings: TrustWarning[];
31
+ /** Positive trust signals */
32
+ signals: TrustSignal[];
33
+ }
34
+ /**
35
+ * Trust level categories
36
+ */
37
+ export type TrustLevel = "high" | "medium" | "low" | "unknown";
38
+ /**
39
+ * Trust warning
40
+ */
41
+ export interface TrustWarning {
42
+ type: TrustWarningType;
43
+ message: string;
44
+ severity: "info" | "warning" | "critical";
45
+ }
46
+ /**
47
+ * Warning types
48
+ */
49
+ export type TrustWarningType = "untrusted_source" | "new_wallet" | "unverified" | "excessive_permissions" | "no_audit" | "closed_source" | "sandbox_risks" | "debug_wallet" | "unknown_developer";
50
+ /**
51
+ * Positive trust signal
52
+ */
53
+ export interface TrustSignal {
54
+ type: TrustSignalType;
55
+ message: string;
56
+ }
57
+ /**
58
+ * Signal types
59
+ */
60
+ export type TrustSignalType = "verified" | "audited" | "open_source" | "trusted_source" | "established" | "popular" | "hardware_backed" | "multi_sig";
61
+ /**
62
+ * Known trusted wallet IDs and their metadata
63
+ */
64
+ declare const KNOWN_WALLETS: Record<string, {
65
+ trusted: boolean;
66
+ audited?: boolean;
67
+ openSource?: boolean;
68
+ established?: boolean;
69
+ developer?: string;
70
+ }>;
71
+ /**
72
+ * Trust score configuration
73
+ */
74
+ export interface TrustScorerOptions {
75
+ /** Weight for source trust (default: 0.25) */
76
+ sourceWeight?: number;
77
+ /** Weight for verification (default: 0.20) */
78
+ verificationWeight?: number;
79
+ /** Weight for maturity (default: 0.15) */
80
+ maturityWeight?: number;
81
+ /** Weight for popularity (default: 0.15) */
82
+ popularityWeight?: number;
83
+ /** Weight for security (default: 0.15) */
84
+ securityWeight?: number;
85
+ /** Weight for transparency (default: 0.10) */
86
+ transparencyWeight?: number;
87
+ /** Minimum score to be considered "trusted" */
88
+ trustedThreshold?: number;
89
+ /** Custom known wallets to add/override */
90
+ knownWallets?: Record<string, typeof KNOWN_WALLETS[string]>;
91
+ }
92
+ /**
93
+ * Trust scorer for wallet manifests
94
+ */
95
+ export declare class TrustScorer {
96
+ private weights;
97
+ private trustedThreshold;
98
+ private knownWallets;
99
+ constructor(options?: TrustScorerOptions);
100
+ /**
101
+ * Calculate trust score for a wallet
102
+ */
103
+ score(wallet: WalletManifest, context?: {
104
+ fromTrustedSource?: boolean;
105
+ usageCount?: number;
106
+ firstSeenAt?: number;
107
+ }): TrustScore;
108
+ /**
109
+ * Score source trustworthiness
110
+ */
111
+ private scoreSource;
112
+ /**
113
+ * Score verification status
114
+ */
115
+ private scoreVerification;
116
+ /**
117
+ * Score wallet maturity
118
+ */
119
+ private scoreMaturity;
120
+ /**
121
+ * Score popularity/usage
122
+ */
123
+ private scorePopularity;
124
+ /**
125
+ * Score security features
126
+ */
127
+ private scoreSecurity;
128
+ /**
129
+ * Score transparency
130
+ */
131
+ private scoreTransparency;
132
+ /**
133
+ * Check for risky permission combinations
134
+ */
135
+ private checkRiskyPermissions;
136
+ /**
137
+ * Get trust level from score
138
+ */
139
+ private getLevel;
140
+ /**
141
+ * Check if a wallet meets the trusted threshold
142
+ */
143
+ isTrusted(wallet: WalletManifest, context?: Parameters<TrustScorer["score"]>[1]): boolean;
144
+ /**
145
+ * Get trust badge info for display
146
+ */
147
+ getBadge(score: TrustScore): {
148
+ label: string;
149
+ color: string;
150
+ icon: string;
151
+ };
152
+ }
153
+ /**
154
+ * Create a quick trust check
155
+ */
156
+ export declare function quickTrustCheck(wallet: WalletManifest): TrustLevel;
157
+ export {};
@@ -0,0 +1,340 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TrustScorer = void 0;
4
+ exports.quickTrustCheck = quickTrustCheck;
5
+ /**
6
+ * Known trusted wallet IDs and their metadata
7
+ */
8
+ const KNOWN_WALLETS = {
9
+ "hot-wallet": { trusted: true, audited: true, openSource: true, established: true, developer: "HOT DAO" },
10
+ "meteor-wallet": { trusted: true, audited: true, openSource: true, established: true, developer: "Meteor" },
11
+ "mynearwallet": { trusted: true, audited: true, openSource: true, established: true, developer: "MyNearWallet" },
12
+ "here-wallet": { trusted: true, audited: true, openSource: false, established: true, developer: "HERE" },
13
+ "sender-wallet": { trusted: true, audited: true, openSource: true, established: true, developer: "Sender" },
14
+ "near-mobile": { trusted: true, audited: true, openSource: false, established: true, developer: "NEAR Foundation" },
15
+ "neth": { trusted: true, audited: true, openSource: true, established: true, developer: "NETH" },
16
+ "bitte-wallet": { trusted: true, audited: true, openSource: false, established: false, developer: "Bitte" },
17
+ "ledger": { trusted: true, audited: true, openSource: false, established: true, developer: "Ledger" },
18
+ "wallet-connect": { trusted: true, audited: true, openSource: true, established: true, developer: "WalletConnect" },
19
+ };
20
+ /**
21
+ * Risky permission combinations
22
+ */
23
+ const RISKY_PERMISSIONS = [
24
+ { permissions: ["storage", "cookies", "indexeddb"], risk: "high", message: "Can access all local storage data" },
25
+ { permissions: ["fetch", "storage"], risk: "medium", message: "Can exfiltrate stored data" },
26
+ ];
27
+ /**
28
+ * Trust scorer for wallet manifests
29
+ */
30
+ class TrustScorer {
31
+ weights;
32
+ trustedThreshold;
33
+ knownWallets;
34
+ constructor(options = {}) {
35
+ this.weights = {
36
+ sourceWeight: options.sourceWeight ?? 0.25,
37
+ verificationWeight: options.verificationWeight ?? 0.20,
38
+ maturityWeight: options.maturityWeight ?? 0.15,
39
+ popularityWeight: options.popularityWeight ?? 0.15,
40
+ securityWeight: options.securityWeight ?? 0.15,
41
+ transparencyWeight: options.transparencyWeight ?? 0.10,
42
+ };
43
+ this.trustedThreshold = options.trustedThreshold ?? 70;
44
+ this.knownWallets = { ...KNOWN_WALLETS, ...options.knownWallets };
45
+ }
46
+ /**
47
+ * Calculate trust score for a wallet
48
+ */
49
+ score(wallet, context = {}) {
50
+ const warnings = [];
51
+ const signals = [];
52
+ // Get known wallet data
53
+ const known = this.knownWallets[wallet.id];
54
+ // Calculate component scores
55
+ const components = {
56
+ sourceScore: this.scoreSource(wallet, context.fromTrustedSource, known, warnings, signals),
57
+ verificationScore: this.scoreVerification(wallet, known, warnings, signals),
58
+ maturityScore: this.scoreMaturity(wallet, context.firstSeenAt, known, warnings, signals),
59
+ popularityScore: this.scorePopularity(wallet, context.usageCount, known, signals),
60
+ securityScore: this.scoreSecurity(wallet, warnings, signals),
61
+ transparencyScore: this.scoreTransparency(wallet, known, warnings, signals),
62
+ };
63
+ // Check for debug wallet
64
+ if (wallet.debug) {
65
+ warnings.push({
66
+ type: "debug_wallet",
67
+ message: "This is a debug/development wallet - use with caution",
68
+ severity: "warning",
69
+ });
70
+ // Reduce all scores for debug wallets
71
+ Object.keys(components).forEach((key) => {
72
+ components[key] *= 0.5;
73
+ });
74
+ }
75
+ // Check for risky permission combinations
76
+ this.checkRiskyPermissions(wallet, warnings);
77
+ // Calculate weighted score
78
+ const score = Math.round(components.sourceScore * this.weights.sourceWeight +
79
+ components.verificationScore * this.weights.verificationWeight +
80
+ components.maturityScore * this.weights.maturityWeight +
81
+ components.popularityScore * this.weights.popularityWeight +
82
+ components.securityScore * this.weights.securityWeight +
83
+ components.transparencyScore * this.weights.transparencyWeight);
84
+ // Determine trust level
85
+ const level = this.getLevel(score);
86
+ return { score, level, components, warnings, signals };
87
+ }
88
+ /**
89
+ * Score source trustworthiness
90
+ */
91
+ scoreSource(wallet, fromTrustedSource, known, warnings, signals) {
92
+ let score = 50; // Base score
93
+ if (fromTrustedSource) {
94
+ score += 30;
95
+ signals.push({ type: "trusted_source", message: "From verified manifest source" });
96
+ }
97
+ else {
98
+ warnings.push({
99
+ type: "untrusted_source",
100
+ message: "Wallet is from an unverified source",
101
+ severity: "warning",
102
+ });
103
+ }
104
+ if (known?.trusted) {
105
+ score += 20;
106
+ }
107
+ return Math.min(100, Math.max(0, score));
108
+ }
109
+ /**
110
+ * Score verification status
111
+ */
112
+ scoreVerification(wallet, known, warnings, signals) {
113
+ let score = 30; // Base score
114
+ if (known?.audited) {
115
+ score += 40;
116
+ signals.push({ type: "audited", message: "Security audited" });
117
+ }
118
+ else {
119
+ warnings.push({
120
+ type: "no_audit",
121
+ message: "No known security audit",
122
+ severity: "info",
123
+ });
124
+ }
125
+ if (known?.trusted) {
126
+ score += 30;
127
+ signals.push({ type: "verified", message: "Verified wallet provider" });
128
+ }
129
+ else {
130
+ warnings.push({
131
+ type: "unverified",
132
+ message: "Wallet provider not verified",
133
+ severity: "info",
134
+ });
135
+ }
136
+ return Math.min(100, Math.max(0, score));
137
+ }
138
+ /**
139
+ * Score wallet maturity
140
+ */
141
+ scoreMaturity(wallet, firstSeenAt, known, warnings, signals) {
142
+ let score = 40; // Base score
143
+ if (known?.established) {
144
+ score += 40;
145
+ signals.push({ type: "established", message: "Established wallet with track record" });
146
+ }
147
+ else if (firstSeenAt) {
148
+ const ageMonths = (Date.now() - firstSeenAt) / (30 * 24 * 60 * 60 * 1000);
149
+ if (ageMonths > 12) {
150
+ score += 30;
151
+ }
152
+ else if (ageMonths > 6) {
153
+ score += 20;
154
+ }
155
+ else if (ageMonths > 1) {
156
+ score += 10;
157
+ }
158
+ else {
159
+ warnings.push({
160
+ type: "new_wallet",
161
+ message: "This is a recently added wallet",
162
+ severity: "info",
163
+ });
164
+ }
165
+ }
166
+ // Version can indicate maturity
167
+ const version = wallet.version?.split(".") ?? [];
168
+ if (version.length >= 2) {
169
+ const major = parseInt(version[0], 10);
170
+ if (major >= 2)
171
+ score += 10;
172
+ else if (major >= 1)
173
+ score += 5;
174
+ }
175
+ return Math.min(100, Math.max(0, score));
176
+ }
177
+ /**
178
+ * Score popularity/usage
179
+ */
180
+ scorePopularity(wallet, usageCount, known, signals) {
181
+ let score = 40; // Base score
182
+ if (known?.established) {
183
+ score += 30;
184
+ }
185
+ if (usageCount !== undefined) {
186
+ if (usageCount > 10000) {
187
+ score += 30;
188
+ signals.push({ type: "popular", message: "Widely used wallet" });
189
+ }
190
+ else if (usageCount > 1000) {
191
+ score += 20;
192
+ }
193
+ else if (usageCount > 100) {
194
+ score += 10;
195
+ }
196
+ }
197
+ return Math.min(100, Math.max(0, score));
198
+ }
199
+ /**
200
+ * Score security features
201
+ */
202
+ scoreSecurity(wallet, warnings, signals) {
203
+ let score = 50; // Base score
204
+ // Sandbox type is generally safer
205
+ if (wallet.type === "sandbox") {
206
+ score += 20;
207
+ }
208
+ else if (wallet.type === "privileged") {
209
+ score += 30; // Hardware wallets
210
+ signals.push({ type: "hardware_backed", message: "Hardware wallet security" });
211
+ }
212
+ else if (wallet.type === "injected") {
213
+ // Injected can be risky
214
+ warnings.push({
215
+ type: "sandbox_risks",
216
+ message: "Browser extension has broader access",
217
+ severity: "info",
218
+ });
219
+ }
220
+ // Check permissions
221
+ const permissions = wallet.permissions ?? {};
222
+ const permCount = Object.keys(permissions).filter((k) => permissions[k]).length;
223
+ if (permCount <= 2) {
224
+ score += 20; // Minimal permissions is good
225
+ }
226
+ else if (permCount <= 4) {
227
+ score += 10;
228
+ }
229
+ else {
230
+ score -= 10;
231
+ warnings.push({
232
+ type: "excessive_permissions",
233
+ message: `Wallet requests ${permCount} permissions`,
234
+ severity: "warning",
235
+ });
236
+ }
237
+ // Multi-sig support (check for extended features)
238
+ const extendedFeatures = wallet.features;
239
+ if (extendedFeatures?.multiSig) {
240
+ score += 10;
241
+ signals.push({ type: "multi_sig", message: "Supports multi-signature" });
242
+ }
243
+ return Math.min(100, Math.max(0, score));
244
+ }
245
+ /**
246
+ * Score transparency
247
+ */
248
+ scoreTransparency(wallet, known, warnings, signals) {
249
+ let score = 50; // Base score
250
+ if (known?.openSource) {
251
+ score += 30;
252
+ signals.push({ type: "open_source", message: "Open source wallet" });
253
+ }
254
+ else {
255
+ warnings.push({
256
+ type: "closed_source",
257
+ message: "Wallet source code is not publicly available",
258
+ severity: "info",
259
+ });
260
+ }
261
+ if (known?.developer) {
262
+ score += 20;
263
+ }
264
+ else {
265
+ warnings.push({
266
+ type: "unknown_developer",
267
+ message: "Unknown wallet developer",
268
+ severity: "info",
269
+ });
270
+ }
271
+ // Website and description indicate transparency
272
+ if (wallet.website)
273
+ score += 5;
274
+ if (wallet.description)
275
+ score += 5;
276
+ return Math.min(100, Math.max(0, score));
277
+ }
278
+ /**
279
+ * Check for risky permission combinations
280
+ */
281
+ checkRiskyPermissions(wallet, warnings) {
282
+ if (!wallet.permissions)
283
+ return;
284
+ const enabledPerms = Object.entries(wallet.permissions)
285
+ .filter(([, enabled]) => enabled)
286
+ .map(([perm]) => perm);
287
+ for (const risky of RISKY_PERMISSIONS) {
288
+ if (risky.permissions.every((p) => enabledPerms.includes(p))) {
289
+ warnings.push({
290
+ type: "excessive_permissions",
291
+ message: risky.message,
292
+ severity: risky.risk === "high" ? "critical" : "warning",
293
+ });
294
+ }
295
+ }
296
+ }
297
+ /**
298
+ * Get trust level from score
299
+ */
300
+ getLevel(score) {
301
+ if (score >= this.trustedThreshold)
302
+ return "high";
303
+ if (score >= 50)
304
+ return "medium";
305
+ if (score >= 25)
306
+ return "low";
307
+ return "unknown";
308
+ }
309
+ /**
310
+ * Check if a wallet meets the trusted threshold
311
+ */
312
+ isTrusted(wallet, context) {
313
+ const result = this.score(wallet, context);
314
+ return result.level === "high";
315
+ }
316
+ /**
317
+ * Get trust badge info for display
318
+ */
319
+ getBadge(score) {
320
+ switch (score.level) {
321
+ case "high":
322
+ return { label: "Verified", color: "#22c55e", icon: "shield-check" };
323
+ case "medium":
324
+ return { label: "Known", color: "#f59e0b", icon: "shield" };
325
+ case "low":
326
+ return { label: "Unverified", color: "#ef4444", icon: "shield-alert" };
327
+ default:
328
+ return { label: "Unknown", color: "#6b7280", icon: "shield-question" };
329
+ }
330
+ }
331
+ }
332
+ exports.TrustScorer = TrustScorer;
333
+ /**
334
+ * Create a quick trust check
335
+ */
336
+ function quickTrustCheck(wallet) {
337
+ const scorer = new TrustScorer();
338
+ return scorer.score(wallet).level;
339
+ }
340
+ //# sourceMappingURL=trust.js.map