oculon 0.1.5 → 0.1.7

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 (58) hide show
  1. package/README.md +72 -4
  2. package/dist/cli/main.js +184 -0
  3. package/dist/core/calls.d.ts +63 -0
  4. package/dist/core/calls.js +120 -0
  5. package/dist/core/evm.d.ts +20 -0
  6. package/dist/core/evm.js +165 -0
  7. package/dist/core/http.d.ts +11 -0
  8. package/dist/core/http.js +113 -30
  9. package/dist/core/pdf.d.ts +51 -0
  10. package/dist/core/pdf.js +211 -0
  11. package/dist/core/quota.js +3 -0
  12. package/dist/core/verdict.d.ts +30 -0
  13. package/dist/core/verdict.js +164 -0
  14. package/dist/index.d.ts +38 -0
  15. package/dist/index.js +54 -0
  16. package/dist/mcp.d.ts +1 -0
  17. package/dist/mcp.js +159 -5
  18. package/dist/modules/address.d.ts +32 -0
  19. package/dist/modules/address.js +91 -0
  20. package/dist/modules/checks.d.ts +59 -0
  21. package/dist/modules/checks.js +134 -0
  22. package/dist/modules/doc.d.ts +61 -0
  23. package/dist/modules/doc.js +715 -0
  24. package/dist/modules/headers.d.ts +50 -0
  25. package/dist/modules/headers.js +108 -0
  26. package/dist/modules/honeypot.d.ts +36 -0
  27. package/dist/modules/honeypot.js +53 -0
  28. package/dist/modules/iban.d.ts +30 -0
  29. package/dist/modules/iban.js +82 -0
  30. package/dist/modules/lookalike.d.ts +34 -0
  31. package/dist/modules/lookalike.js +122 -0
  32. package/dist/modules/personal.d.ts +1 -1
  33. package/dist/modules/personal.js +14 -4
  34. package/dist/modules/utility.d.ts +147 -0
  35. package/dist/modules/utility.js +403 -0
  36. package/dist/report-pdf.d.ts +7 -0
  37. package/dist/report-pdf.js +81 -0
  38. package/dist/telegram.d.ts +2 -0
  39. package/dist/telegram.js +43 -6
  40. package/dist/web/assets/logo-200.png +0 -0
  41. package/dist/web/burns.d.ts +21 -0
  42. package/dist/web/burns.js +53 -0
  43. package/dist/web/card.d.ts +28 -0
  44. package/dist/web/card.js +75 -0
  45. package/dist/web/index.html +76 -4
  46. package/dist/web/landing.html +1 -1
  47. package/dist/web/legal.html +1 -1
  48. package/dist/web/mcp.html +1 -1
  49. package/dist/web/openapi.js +6 -0
  50. package/dist/web/pages.d.ts +24 -0
  51. package/dist/web/pages.js +139 -0
  52. package/dist/web/public.js +7 -1
  53. package/dist/web/server.d.ts +17 -0
  54. package/dist/web/server.js +207 -7
  55. package/dist/web/token.html +98 -0
  56. package/dist/web/token.json +9 -0
  57. package/dist/web/utility.html +251 -0
  58. package/package.json +1 -1
package/README.md CHANGED
@@ -2,12 +2,13 @@
2
2
 
3
3
  **Open-source intelligence engine for the physical and digital world.** Oculon watches more than 50 public data sources (routing tables, exploit catalogs, transponders, satellites, ship trackers, registries and prediction markets), finds what is unusual, fuses observations about the same subject from independent sources into scored signals, and labels every result with where it came from and how fresh it is. An AI agent on top answers plain-language questions with sources.
4
4
 
5
- [oculon.live](https://oculon.live) · [Documentation](https://oculon.live/docs) · [Privacy](https://oculon.live/privacy) · [Terms](https://oculon.live/terms)
5
+ [oculon.live](https://oculon.live) · [Documentation](https://oculon.live/docs) · [Privacy](https://oculon.live/privacy) · [Terms](https://oculon.live/terms) · [Token](#official-token)
6
6
 
7
7
  [![CI](https://github.com/oculonlive/oculon/actions/workflows/ci.yml/badge.svg)](https://github.com/oculonlive/oculon/actions/workflows/ci.yml)
8
8
  [![License: MIT](https://img.shields.io/badge/license-MIT-00f0ff.svg)](LICENSE)
9
9
  ![Node 22.13+](https://img.shields.io/badge/node-%E2%89%A522.13-00f0ff.svg)
10
10
  ![Runtime dependencies: 0](https://img.shields.io/badge/runtime%20dependencies-0-00f0ff.svg)
11
+ [![Oculon safety](https://oculon.live/badge/0x12a3f1a05d827007f17a43a250cce44868c4a263.svg)](https://oculon.live/safety/0x12a3f1a05d827007f17a43a250cce44868c4a263)
11
12
 
12
13
  It ships as a CLI, a TypeScript SDK, an MCP server for Claude and other agents (local, or remote at `https://mcp.oculon.live` with nothing to install), a web app and a Telegram bot, all over the same result objects. It has no runtime dependencies. About 20 sources work with no key; optional free-tier keys switch on the rest (see `.env.example`).
13
14
 
@@ -21,7 +22,10 @@ npx oculon ask "why is Nvidia in the news this week?"
21
22
  - **Sourced by design.** Every answer names the sources it used and whether each one was live, cached or unavailable. Nothing is presented without provenance.
22
23
  - **Cross-source signals.** When independent sources move on the same subject, Oculon fuses them into one scored signal with the evidence behind it, and storylines are tracked across days.
23
24
  - **Measured, not claimed.** A time machine replays past days to calibrate the radar, a first-to-know check compares Oculon against media coverage, and forecasts are timestamped on Bitcoin so they cannot be edited later.
24
- - **Built for agents.** 83 MCP tools locally over stdio, and 74 of them remotely at `https://mcp.oculon.live`; the SDK and CLI return the same objects, and `--json` works on every command.
25
+ - **Robinhood Chain, read block by block.** Oculon watches pools the minute they open, follows each token back to the wallet that deployed it (directly or through a launchpad) and counts how many of that wallet's launches are already dead. See [On-chain](#on-chain-robinhood-chain).
26
+ - **Built for agents.** 91 MCP tools locally over stdio (98 with the on-chain tools on), and 89 remotely at `https://mcp.oculon.live`; the SDK and CLI return the same objects, and `--json` works on every command. Check results show up as verdict cards inside Claude and ChatGPT, `brief: true` gives any tool a short answer with fewer tokens, and `/llms.txt` explains every tool to an agent.
27
+ - **Every check is kept and can be replayed.** Each check gets an id: `/replay/<id>` lists every source it called, in order, with status and time, and `/report/<id>.pdf` is the same check as a PDF to send on. Checking the same thing again says what changed since last time.
28
+ - **Honest about its sources.** `/status` shows which sources are up, slow or down, measured from real calls. A source that keeps failing is skipped for a few minutes and a mirror or the last cached answer is used instead, and the result says so.
25
29
  - **Everyday checks.** Is this message a scam? Is this link dangerous? Is this claim true? Is my car recalled? Can someone spoof my email domain? Are my dependencies safe? What should I know before I travel? Who is calling me? Has my password leaked? Is this supplier real? Each answer names its sources, and any result can be shared as a link with a preview card.
26
30
  - **Monitors in plain words.** "Tell me when there is an internet outage in Iran" becomes a rule that is re-checked on a schedule and reports only what changed, by email, in Telegram or in the app. Every visitor keeps their own monitors, with no account.
27
31
  - **Everywhere people are.** A public Telegram bot ([@oculon_radar_bot](https://t.me/oculon_radar_bot)): forward it a suspicious message and it checks it. An OpenAPI spec at `/openapi.json` for ChatGPT Actions, n8n and Zapier.
@@ -29,7 +33,7 @@ npx oculon ask "why is Nvidia in the news this week?"
29
33
 
30
34
  ## Contents
31
35
 
32
- [What it does](#what-it-does) · [Install](#install) · [CLI](#cli) · [MCP server](#mcp-server) · [Remote MCP](#remote-mcp) · [Analyst](#oculon-analyst) · [SDK](#sdk) · [Web app](#dashboard-and-schedule) · [Telegram bot](#telegram-bot) · [Configuration](#configuration) · [Deploy](#deploy) · [How it works](#how-it-works) · [Limits](#limits) · [Development](#development)
36
+ [What it does](#what-it-does) · [Install](#install) · [CLI](#cli) · [MCP server](#mcp-server) · [Remote MCP](#remote-mcp) · [Analyst](#oculon-analyst) · [SDK](#sdk) · [Web app](#dashboard-and-schedule) · [Telegram bot](#telegram-bot) · [Configuration](#configuration) · [Deploy](#deploy) · [How it works](#how-it-works) · [Limits](#limits) · [Development](#development) · [On-chain](#on-chain-robinhood-chain) · [Official token](#official-token)
33
37
 
34
38
  ## What it does
35
39
 
@@ -46,6 +50,12 @@ npx oculon ask "why is Nvidia in the news this week?"
46
50
  | Country | `oculon country <name>` | One-page country brief: GDP, growth, GDP per person, inflation, unemployment and population, the IMF outlook for this year and next, head of state and government, capital, currency and its rate to the dollar, US and UK travel advice, internet outages, disaster alerts and the latest headlines | World Bank, IMF, Wikidata, open.er-api.com, US State Department, UK FCDO, Cloudflare Radar, GDACS, Guardian |
47
51
  | Airport | `oculon airport <JFK\|EGLL\|name>` | Is an airport running normally? Current METAR and TAF (flight category, wind, visibility, ceiling), FAA ground stops, ground delay programs, delays and closures at US airports, and aircraft squawking an emergency within 150 km | aviationweather.gov (NOAA), FAA NAS status, adsb.lol, OurAirports |
48
52
  | Phone | `oculon phone <+number> [--country US]` | Who is behind a number in a suspicious SMS or a missed call: country from the calling code, line type (mobile, landline, VoIP, premium rate), carrier and location, and warnings for premium-rate numbers, UK 070 personal numbers and the Caribbean area codes the FCC names in "one ring" callback scams. Never looks up the owner | ITU calling codes (offline), Numverify (free key, 100 a month) |
53
+ | IBAN | `oculon iban <IBAN> [--country NL]` | Checks an IBAN before you pay: country, length, ISO 13616 check digits and bank code, and a warning when the account is in a different country than the supplier. A valid IBAN does not prove who owns the account | Offline |
54
+ | Email headers | `oculon headers < headers.txt` | Paste the raw headers of a suspicious email: SPF, DKIM and DMARC results, the delivery path, the origin IP and country, and spoofing signs such as a Reply-To elsewhere or a display name posing as an address | Offline, ip-api.com |
55
+ | Lookalike domains | `oculon lookalike <domain>` | Typos, swapped letters, homoglyphs, extra words and other endings of a brand that exist in DNS, with mail servers, plus certificates issued in the last 90 days for names containing the brand | Google DNS, crt.sh, CertSpotter |
56
+ | Honeypot | `oculon honeypot <token> [--chain eth\|bsc\|base]` | Can this token be sold? A buy and sell simulation on its main pool plus recent holders' sells: honeypot verdict, buy and sell tax, holders who could not sell | honeypot.is |
57
+ | Crypto address | `oculon address <address>` | Before you send funds: chain from the format (Bitcoin, EVM, Solana, Tron), US OFAC sanctions, balance, transactions and labels, contracts posing as wallets, unused addresses | mempool.space, Blockscout, Solana RPC, OFAC |
58
+ | Document | `oculon doc <file.pdf\|.png\|.jpg>` · web app upload | Was this invoice, bank statement or payment screenshot edited? Reads the file itself: the programs that made and saved it (online PDF editors, image editors, word processors), creation vs modification date, how many times it was saved, the same font embedded twice, white boxes over text, annotations, digital signatures, and dangerous parts (JavaScript, launch actions, embedded files). Every IBAN in its text is checked. Screenshots and scans are read with a free AI vision model when a key is set. A clean result is not proof that a document is genuine | Offline; OpenRouter or Gemini (free) for text in images |
49
59
  | Password | `oculon password` · web app | Has a password appeared in a data breach? Only the first 5 characters of its SHA-1 hash are sent and the match happens locally (in the web app, in the browser); the password is never stored, logged or shown | Have I Been Pwned (Pwned Passwords) |
50
60
  | Breaches | `oculon breaches [domain]` | The newest breaches added to Have I Been Pwned, or every breach of one domain or company: date, accounts affected and the kinds of data exposed. Sensitive breaches are left out | Have I Been Pwned (CC BY 4.0) |
51
61
  | Company | `oculon company <name\|LEI\|EU VAT>` | Is a supplier real before you pay its invoice? An EU VAT number is checked live (valid or not, registered name and address); a name or LEI returns the legal entity, registered address, status, registration number and ultimate parent, with warnings for invalid numbers, inactive companies and lapsed records | EU VIES, GLEIF (Global LEI Index) |
@@ -53,6 +63,8 @@ npx oculon ask "why is Nvidia in the news this week?"
53
63
  | Hash check | `oculon hash <md5\|sha1\|sha256>` | Is a file known malware, a known good file, or unknown? Malware family, first seen, detections, and the known-software sets it belongs to | CIRCL hashlookup (NIST NSRL), MalwareBazaar, ThreatFox, AlienVault OTX, VirusTotal |
54
64
  | Ransomware | `oculon ransomware [CC\|sector\|name]` | Claims posted on ransomware leak sites, newest first, by country, sector or a company or domain, with counts by group, country and sector. Leak-site links are never passed on | ransomware.live |
55
65
  | Satellites | `oculon satellite [name\|NORAD id]` | Everything launched in the last 30 days grouped by launch, or one object's orbit (perigee, apogee, period, inclination), owner, launch date and status | CelesTrak |
66
+ | Check history | every check · `oculon replay <id> [--pdf file]` | Each check is kept for 90 days with its verdict and every source call: a replay log at `/replay/<id>`, a PDF report at `/report/<id>.pdf`, and "seen before" with what changed when the same thing is checked again | Oculon |
67
+ | Status | `oculon status` · `/status` | Which sources are up, slow, degraded or down over the last day, from real calls: success rate, median time, last error, and sources being skipped. DNS falls back from Google to Cloudflare and Bitcoin lookups from mempool.space to Blockstream when one is down | Oculon |
56
68
  | Share | web app · `/r/<id>` | Any everyday check can be shared as a link: the server runs the check, keeps a snapshot and serves it as a page with a preview card for X, Telegram, WhatsApp and Slack | Oculon |
57
69
  | Personal monitors | web app · Telegram `/monitor` | Each visitor (a random id in a cookie, no account) or Telegram chat keeps up to 10 monitors of its own, written in plain language and re-checked about hourly; changes are kept as alerts and sent by email (after a confirmation link, with one-click unsubscribe) or to the Telegram chat | Resend (email), Meerkat |
58
70
  | Monitor | `oculon monitor "<request>"` | Watch anything in plain language: "internet outages in Iran", "critical CVEs for nginx", "earthquakes above 6 near Tokyo", "news about OpenAI", "travel risk changes for Bangkok", "flood or cyclone alerts for the Philippines". The request becomes a watchlist rule; only changes are reported, with evidence, in the app, Telegram and the signal feed | Groq, Gemini, Mistral (with a pattern fallback), Meerkat |
@@ -138,6 +150,11 @@ oculon watch run # report only what changed since l
138
150
  oculon brief # today's brief
139
151
  oculon quota # today's API usage vs daily budgets
140
152
  oculon phone "+1 876 555 0100" # who is calling? one-ring scam area code
153
+ oculon iban "DE89 3704 0044 0532 0130 00" --country NL # IBAN valid? account in another country?
154
+ oculon headers < headers.txt # was this email spoofed?
155
+ oculon lookalike example.com # lookalike domains and new certificates
156
+ oculon honeypot 0x6982508145454Ce325dDbE47a25d4ec3d2311933 # can this token be sold?
157
+ oculon address bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh # sanctions, balance, activity
141
158
  oculon password # has my password leaked? (asked without echo)
142
159
  oculon breaches adobe.com # breaches of a domain
143
160
  oculon company NL004495445B01 # EU VAT number, LEI or company name
@@ -186,7 +203,12 @@ Or with any MCP client that launches stdio servers:
186
203
  { "mcpServers": { "oculon": { "command": "npx", "args": ["-y", "oculon", "mcp"] } } }
187
204
  ```
188
205
 
189
- Every module is a tool (about 50, plus one per installed plugin tool; `tools/list` returns them with schemas). A few: `oculon_ask`, `oculon_radar`, `oculon_dossier`, `oculon_case_new`, `oculon_calendar`, `oculon_connect`, `oculon_markets_crosscheck`, `oculon_sanctions`, `oculon_health`, `oculon_narratives`, `oculon_ships`, `oculon_military_air`, `oculon_satellite_image` (returns the image), `oculon_forecast`, `oculon_verify_proof`, `oculon_watch_add`, `oculon_brief`, `oculon_signals`, `oculon_entity`.
206
+ Every module is a tool (91, plus one per installed plugin tool; `tools/list` returns them with schemas). A few: `oculon_ask`, `oculon_radar`, `oculon_dossier`, `oculon_case_new`, `oculon_calendar`, `oculon_connect`, `oculon_markets_crosscheck`, `oculon_sanctions`, `oculon_health`, `oculon_narratives`, `oculon_ships`, `oculon_military_air`, `oculon_satellite_image` (returns the image), `oculon_forecast`, `oculon_verify_proof`, `oculon_watch_add`, `oculon_brief`, `oculon_signals`, `oculon_entity`.
207
+
208
+ - **Brief mode.** Every tool takes `brief: true` and then answers with the verdict, risk, top reasons, which sources answered and the check id, instead of the full result.
209
+ - **Verdict cards.** Check tools (scam, link, document, IBAN, email headers, phone, IP, token and more) return `structuredContent` and point to a UI resource, so chat apps that render MCP UI (MCP Apps hosts and ChatGPT apps) show a card with the verdict, risk, reasons, sources and links to the replay log and PDF report.
210
+ - **Replay.** Check results carry `check.id`; `oculon_replay` returns every source call of that check and its history, and `oculon_status` the health of every source.
211
+ - **For agents reading docs:** `/llms.txt` and `/llms-full.txt` on every install.
190
212
 
191
213
  ## Oculon Analyst
192
214
 
@@ -338,6 +360,7 @@ The repository includes a `Dockerfile` (on Railway, set the service health check
338
360
  - Owl fuses items by shared keywords, then (when an LLM key is set) asks the model to link items about the same event; every AI link carries the model's stated reason.
339
361
  - The watchlist and geofences need two runs before they can report a change; the first run records a baseline.
340
362
  - First to Know is deliberately strict: Wikipedia spikes usually follow the news, so most such signals score "media first". Lead time is most likely on footprint, chain and flight signals.
363
+ - The document check looks for traces that editing leaves. A careful forger, or a fake made from scratch, leaves none, so "no signs of editing" is not proof that a document is genuine. Text in screenshots is read by an AI vision model, which can misread characters.
341
364
  - Lynx only reports pairs an LLM confirms as the same question; exact matches across venues are rare, so an empty result is common and honest.
342
365
  - AIS coverage depends on community receivers and is absent in some regions; empty windows say so.
343
366
  - Sanctions screening uses exact matches on the OFAC SDN list only; it is not legal advice and does not cover other jurisdictions.
@@ -371,6 +394,51 @@ npm run build
371
394
 
372
395
  Issues and pull requests are welcome; see [CONTRIBUTING.md](CONTRIBUTING.md). Please report vulnerabilities privately as described in [SECURITY.md](SECURITY.md).
373
396
 
397
+ ## On-chain: Robinhood Chain
398
+
399
+ Robinhood Chain pools, token and deployer checks, wallet checks and DeFi are live on [oculon.live](https://oculon.live) and on the remote MCP server. In your own install they are off by default; set `OCULON_ONCHAIN=1` to turn on the commands, MCP and agent tools, the schedule task, watch kinds and web sections.
400
+
401
+ | Check | Command | What it does | Sources |
402
+ |---|---|---|---|
403
+ | Robinhood Chain pools | `oculon rh` | Activity, trending and newly created pools with risk flags: thin liquidity, buys without sells, sudden dumps | GeckoTerminal, Blockscout |
404
+ | Deployer reputation | `oculon deployer <address>` | Every token a wallet launched, directly or through a launchpad, and how many are already dead | Blockscout, Robinhood Chain RPC |
405
+ | Token risk | `oculon token <address> --chain robinhood` (also eth, base, arbitrum, bsc, polygon) | Honeypot, tax and owner flags, contract verification, holder concentration, DEX liquidity and price, with a DANGER, CAUTION or OK verdict | GoPlus, Webacy, DexScreener, Blockscout |
406
+ | Wallet | `oculon wallet <address>` | Portfolio, age, transactions, known entities it trades with and risk labels (EVM, Solana, Robinhood Chain) | Zerion, Etherscan, Helius, Robinhood Chain RPC |
407
+ | DeFi | `oculon defi` | TVL crashes, stablecoin depegs, hacks, fear and greed | DefiLlama |
408
+
409
+ ```sh
410
+ OCULON_ONCHAIN=1 npx oculon rh
411
+ OCULON_ONCHAIN=1 npx oculon deployer 0x...
412
+ ```
413
+
414
+ Token and deployer verdicts are heuristics over pool and explorer data, not contract audits, and a verdict can be wrong.
415
+
416
+ ## Official token
417
+
418
+ The only official Oculon token is `$OCULON` on Robinhood Chain:
419
+
420
+ [![Oculon safety](https://oculon.live/badge/0x12a3f1a05d827007f17a43a250cce44868c4a263.svg)](https://oculon.live/safety/0x12a3f1a05d827007f17a43a250cce44868c4a263)
421
+
422
+ The badge is Oculon's own live safety check of the token, re-run about every 15 minutes (funded by a 2,288,777 OCULON burn). It is a heuristic over pool and explorer data, not an audit.
423
+
424
+ ```
425
+ 0x12a3f1a05d827007f17a43a250cce44868c4a263
426
+ ```
427
+
428
+ The same address is posted on [x.com/oculonlive](https://x.com/oculonlive) and at [oculon.live/thetoken](https://oculon.live/thetoken). If an address does not match all three exactly, it is not Oculon. Launchpad page: [ponsfamily.com](https://ponsfamily.com/launchpad/0x12a3f1a05d827007f17a43a250cce44868c4a263). Nothing here is financial advice.
429
+
430
+ ### Utility
431
+
432
+ Everything is read from Robinhood Chain: nothing is custodied and nothing is paid to anyone. Holding is the main way in: the wallet signs a one-time request and its balance is read live. Burning is optional: a burn goes to the dead address, counts once, and only the wallet that burned can use it. Oculon itself stays free.
433
+
434
+ | Use | Hold | Or burn | What you get |
435
+ |---|---|---|---|
436
+ | Deep investigation | 1,500,000 OCULON, one every 30 days per wallet | 1,500,000 for one | One domain, wallet, token or company checked against every relevant source, published as a public page |
437
+ | Live safety badge | 2,000,000 OCULON, live while the wallet keeps that balance (checked daily, one badge per wallet) | 1,000,000 for 30 days | Live monitoring of one Robinhood Chain token, with an embeddable badge (`/badge/<token>.svg`) that turns red on danger. Paying never changes the verdict |
438
+ | Holder tier | 3,500,000 OCULON, sign once | | Up to 30 personal monitors, checked every 15 minutes instead of every hour |
439
+
440
+ Start at [oculon.live/utility](https://oculon.live/utility). Wallet sign-in is checked with keccak256 and secp256k1 written in this repo (`src/core/evm.ts`), so it adds no dependency.
441
+
374
442
  ## License
375
443
 
376
444
  [MIT](LICENSE). Data from third-party sources remains subject to each provider's terms.
package/dist/cli/main.js CHANGED
@@ -162,6 +162,8 @@ ${c.bold('Graph')}
162
162
  oculon connect <A> to <B> how two things are linked (shortest path)
163
163
  oculon resolve merge duplicates: org:nvidia = company:nvidia = nvidia.com
164
164
  oculon quota today's API usage vs daily budgets
165
+ oculon status [--hours 24] which sources are up, slow or down (from real calls)
166
+ oculon replay <check id> [--pdf f] every source a check called; --pdf writes the report
165
167
 
166
168
  ${c.bold('Radar')}
167
169
  oculon radar what the world is suddenly paying attention to
@@ -193,10 +195,16 @@ ${c.bold('Everyday checks')}
193
195
  oculon password has this password leaked? (asked without echo; k-anonymity)
194
196
  oculon breaches [domain] newest data breaches, or every breach of one domain (HIBP)
195
197
  oculon company <name|LEI|EU VAT> is this supplier real? VAT check (VIES), LEI register (GLEIF)
198
+ oculon iban <IBAN> [--country NL] is this IBAN valid, and is the account in the supplier's country?
199
+ oculon headers < headers.txt raw email headers: SPF, DKIM, DMARC, path, origin, spoofing signs
200
+ oculon address <crypto address> chain, OFAC sanctions, balance and activity, no keys needed
201
+ oculon doc <file.pdf|.png|.jpg> was this invoice, statement or screenshot edited? checks its IBANs too
196
202
 
197
203
  ${c.bold('Threat intel')}
198
204
  oculon ip <IP|domain> abuse reports, scanners, threat reports, Tor, Spamhaus DROP, open ports
199
205
  oculon hash <md5|sha1|sha256> is this file known malware or a known good file?
206
+ oculon lookalike <domain> lookalike domains that exist, new certificates naming the brand
207
+ oculon honeypot <token> [--chain eth|bsc|base] can this token be sold? buy/sell simulation, taxes
200
208
  oculon ransomware [CC|sector|name] ransomware leak-site claims, newest first
201
209
  oculon satellite [name|NORAD id] launches of the last 30 days, or one object's orbit (CelesTrak)
202
210
 
@@ -880,6 +888,181 @@ export const COMMANDS = {
880
888
  printSources(r);
881
889
  });
882
890
  },
891
+ async iban(o, a) {
892
+ const q = a.pos.slice(1).join(' ').trim();
893
+ if (!q)
894
+ throw new UsageError('usage: oculon iban <IBAN> [--country NL]');
895
+ const r = await o.ibanCheck(q, typeof a.flags.country === 'string' ? { country: a.flags.country } : {});
896
+ emit(a, r, () => {
897
+ const d = r.result;
898
+ out(`${c.bold(d.formatted ?? d.input)} ${d.valid ? c.green('VALID FORMAT') : c.red('NOT VALID')}`);
899
+ if (d.countryName)
900
+ out(` ${[d.countryName, d.bank ? `${d.bank.kind} ${d.bank.code}` : null, d.sortCode ? `sort code ${d.sortCode}` : null].filter(Boolean).join(' · ')}`);
901
+ for (const p of d.problems)
902
+ out(c.red(` x ${p}`));
903
+ for (const w of d.warnings)
904
+ out(c.yellow(` ! ${w}`));
905
+ for (const x of d.advice)
906
+ out(` → ${x}`);
907
+ });
908
+ },
909
+ async headers(o, a) {
910
+ let raw = a.pos.slice(1).join(' ').trim();
911
+ if (raw && existsSync(raw))
912
+ raw = readFileSync(raw, 'utf8');
913
+ if (!raw && !process.stdin.isTTY)
914
+ raw = readFileSync(0, 'utf8');
915
+ if (!raw)
916
+ throw new UsageError('usage: oculon headers <file> (or pipe the raw headers in: oculon headers < headers.txt)');
917
+ const r = await o.headerCheck(raw);
918
+ emit(a, r, () => {
919
+ const d = r.result;
920
+ const tone = d.verdict === 'likely spoofed' ? c.red : d.verdict === 'suspicious' ? c.yellow : c.green;
921
+ out(`${c.bold(d.from.address ?? 'unknown sender')} ${tone(d.verdict.toUpperCase())} ${c.dim(`risk ${d.risk}/100`)}`);
922
+ out(` SPF ${d.auth.spf ?? '?'} · DKIM ${d.auth.dkim ?? '?'} · DMARC ${d.auth.dmarc ?? '?'}`);
923
+ if (d.origin.ip)
924
+ out(` sent from ${d.origin.ip}${d.origin.country ? ` · ${d.origin.country}` : ''}${d.origin.isp ? ` · ${d.origin.isp}` : ''}`);
925
+ for (const f of d.flags)
926
+ out(c.yellow(` ! ${f}`));
927
+ for (const x of d.advice)
928
+ out(` → ${x}`);
929
+ printSources(r);
930
+ });
931
+ },
932
+ async doc(o, a) {
933
+ const file = a.pos.slice(1).join(' ').trim();
934
+ if (!file)
935
+ throw new UsageError('usage: oculon doc <file.pdf|file.png|file.jpg>');
936
+ if (!existsSync(file))
937
+ throw new UsageError(`no such file: ${file}`);
938
+ const bytes = readFileSync(file);
939
+ const { createHash } = await import('node:crypto');
940
+ const name = file.split(/[\\/]/).pop();
941
+ const { value: r, check } = await o.recordCheck('doc', createHash('sha256').update(bytes).digest('hex'), () => o.docCheck(bytes, name), { label: name });
942
+ emit(a, { ...r, check }, () => {
943
+ const d = r.result;
944
+ const tone = d.verdict === 'dangerous file' || d.verdict === 'likely edited' ? c.red : d.verdict === 'signs of editing' ? c.yellow : c.green;
945
+ out(`${c.bold(d.name)} ${tone(d.verdict.toUpperCase())} ${c.dim(`risk ${d.risk}/100 · ${d.type} · ${(d.bytes / 1024).toFixed(0)} KB`)}`);
946
+ const meta = ['producer', 'creator', 'creator tool', 'software', 'created', 'modified'].filter((k) => d.metadata[k]).map((k) => `${k} ${d.metadata[k]}`);
947
+ if (meta.length)
948
+ out(c.dim(` ${meta.join(' · ')}`));
949
+ if (d.revisions && d.revisions > 1)
950
+ out(c.dim(` saved ${d.revisions} times${d.signed ? ' (digitally signed)' : ''}`));
951
+ for (const f of d.flags)
952
+ out(c.yellow(` ! ${f}`));
953
+ for (const ib of d.ibans)
954
+ out(` IBAN ${ib.iban} ${ib.valid ? c.green('valid') : c.red('NOT VALID')}${ib.country ? c.dim(` · ${ib.country}`) : ''}`);
955
+ if (d.domains.length)
956
+ out(c.dim(` domains in the text: ${d.domains.join(', ')}`));
957
+ out(c.dim(` text: ${d.text.chars} characters from the ${d.text.from}`));
958
+ for (const n of d.notes)
959
+ out(c.dim(` ${n}`));
960
+ for (const x of d.advice)
961
+ out(` → ${x}`);
962
+ if (check.seenBefore)
963
+ out(c.cyan(` seen before ${check.seenBefore.at.slice(0, 16).replace('T', ' ')} UTC${check.seenBefore.changes.length ? `: ${check.seenBefore.changes.join('; ')}` : ', nothing changed'}`));
964
+ out(c.dim(` check ${check.id} · oculon replay ${check.id} --pdf report.pdf`));
965
+ printSources(r);
966
+ });
967
+ },
968
+ async replay(o, a) {
969
+ const id = String(a.pos[1] ?? '').trim();
970
+ if (!id)
971
+ throw new UsageError('usage: oculon replay <check id> [--pdf report.pdf]');
972
+ const ck = o.check(id);
973
+ if (!ck)
974
+ throw new UsageError(`no check ${id} in this install's database (checks are kept for 90 days)`);
975
+ if (typeof a.flags.pdf === 'string') {
976
+ const { writeFileSync } = await import('node:fs');
977
+ writeFileSync(a.flags.pdf, o.checkPdf(id));
978
+ out(`wrote ${a.flags.pdf}`);
979
+ return;
980
+ }
981
+ if (a.flags.json)
982
+ return out(JSON.stringify({ ...ck, history: o.checkHistory(id) }, null, 2));
983
+ const v = ck.verdict;
984
+ out(`${c.bold(ck.label)} ${c.cyan(ck.kind)} ${(v.tone === 'bad' ? c.red : v.tone === 'warn' ? c.yellow : c.green)((v.verdict ?? 'result').toUpperCase())}${v.risk !== null ? c.dim(` risk ${v.risk}/100`) : ''}`);
985
+ out(c.dim(` checked ${ck.createdAt.slice(0, 19).replace('T', ' ')} UTC · ${(ck.durationMs / 1000).toFixed(1)} s · ${ck.calls.length} source calls`));
986
+ for (const p of v.points.slice(0, 8))
987
+ out(` - ${p}`);
988
+ if (ck.seenBefore)
989
+ out(c.cyan(` seen before ${ck.seenBefore.at.slice(0, 16).replace('T', ' ')} UTC${ck.seenBefore.changes.length ? `: ${ck.seenBefore.changes.join('; ')}` : ', nothing changed'}`));
990
+ out(c.bold('\n Source calls'));
991
+ for (const k of ck.calls) {
992
+ const st = k.status === 'LIVE' ? c.green(k.status) : k.status === 'CACHED' ? c.cyan(k.status) : c.yellow(k.status);
993
+ out(` ${k.at.slice(11, 19)} ${k.source.padEnd(22)} ${st.padEnd(20)} ${String(k.ms).padStart(6)} ms ${c.dim(k.host + (k.via ? ' (mirror)' : ''))}${k.note ? c.dim(` ${trunc(k.note, 80)}`) : ''}`);
994
+ }
995
+ if (!ck.calls.length)
996
+ out(c.dim(' none: this check ran on the input alone'));
997
+ },
998
+ async status(o, a) {
999
+ const hours = Math.min(48, Number(a.flags.hours ?? 24) || 24);
1000
+ const list = o.sourceStatus(hours);
1001
+ if (a.flags.json)
1002
+ return out(JSON.stringify({ hours, sources: list }, null, 2));
1003
+ if (!list.length)
1004
+ return out(c.dim(`No live source calls in the last ${hours} hours on this install.`));
1005
+ out(c.bold(`Sources, last ${hours} hours`));
1006
+ for (const s of list) {
1007
+ const st = s.state === 'up' ? c.green('UP') : s.state === 'down' ? c.red('DOWN') : c.yellow(s.state.toUpperCase());
1008
+ out(` ${s.source.padEnd(26)} ${st.padEnd(18)} ${String(s.okPct).padStart(3)}% ${String(s.calls).padStart(4)} calls ${s.medianMs === null ? ' -' : `${String(s.medianMs).padStart(6)} ms`}${s.skippedUntil ? c.yellow(` skipped until ${s.skippedUntil.slice(11, 16)} UTC`) : ''}${s.lastError ? c.dim(` last error ${s.lastError.at.slice(11, 16)} ${trunc(s.lastError.note, 50)}`) : ''}`);
1009
+ }
1010
+ },
1011
+ async lookalike(o, a) {
1012
+ const q = String(a.pos[1] ?? '').trim();
1013
+ if (!q)
1014
+ throw new UsageError('usage: oculon lookalike <domain>');
1015
+ const r = await o.lookalikes(q);
1016
+ emit(a, r, () => {
1017
+ const d = r.result;
1018
+ const tone = d.risk === 'high' ? c.red : d.risk === 'medium' ? c.yellow : c.green;
1019
+ out(`${c.bold(d.domain)} ${tone(`${d.risk.toUpperCase()} RISK`)} ${c.dim(`${d.live.length} of ${d.checked} lookalikes exist`)}`);
1020
+ for (const l of d.live.slice(0, 25))
1021
+ out(` ${l.domain.padEnd(34)} ${c.dim(l.kind)}${l.mx ? c.yellow(' mail') : ''}${l.certSeen ? c.red(` cert ${l.certSeen.slice(0, 10)}`) : ''}`);
1022
+ if (d.certs.length) {
1023
+ out(c.bold(' Certificates naming the brand, last 90 days'));
1024
+ for (const x of d.certs.slice(0, 12))
1025
+ out(` ${x.firstSeen.slice(0, 10)} ${x.name} ${c.dim(x.issuer)}`);
1026
+ }
1027
+ out(c.dim(` ${d.note}`));
1028
+ printSources(r);
1029
+ });
1030
+ },
1031
+ async honeypot(o, a) {
1032
+ const q = String(a.pos[1] ?? '').trim();
1033
+ if (!q)
1034
+ throw new UsageError('usage: oculon honeypot <token address> [--chain eth|bsc|base]');
1035
+ const r = await o.honeypotCheck(q, typeof a.flags.chain === 'string' ? { chain: a.flags.chain } : {});
1036
+ emit(a, r, () => {
1037
+ const d = r.result;
1038
+ const tone = d.verdict === 'honeypot' || d.verdict === 'high risk' ? c.red : d.verdict === 'caution' ? c.yellow : c.green;
1039
+ out(`${c.bold(d.symbol ?? d.address)} on ${d.chain} ${tone(d.verdict.toUpperCase())}`);
1040
+ out(` buy tax ${d.buyTax ?? '?'}% · sell tax ${d.sellTax ?? '?'}%${d.holders ? ` · ${d.holders.failed} of ${d.holders.checked} recent holders could not sell` : ''}`);
1041
+ for (const x of d.reasons)
1042
+ out(c.yellow(` ! ${x}`));
1043
+ for (const x of d.advice)
1044
+ out(` → ${x}`);
1045
+ printSources(r);
1046
+ });
1047
+ },
1048
+ async address(o, a) {
1049
+ const q = String(a.pos[1] ?? '').trim();
1050
+ if (!q)
1051
+ throw new UsageError('usage: oculon address <crypto address> [--network robinhood]');
1052
+ const r = await o.addressCheck(q, typeof a.flags.network === 'string' ? { network: a.flags.network } : {});
1053
+ emit(a, r, () => {
1054
+ const d = r.result;
1055
+ out(`${c.bold(d.address)} ${d.sanctioned ? c.red('SANCTIONED') : d.warnings.length ? c.yellow('CHECK FIRST') : c.green('NO RED FLAGS')}`);
1056
+ out(` ${d.format}${d.network ? ` · ${d.network}` : ''}`);
1057
+ if (d.activity)
1058
+ out(` ${[d.activity.label, d.activity.balance, d.activity.txCount !== null ? `${d.activity.txCount} transactions` : null, d.activity.isContract ? 'smart contract' : null].filter(Boolean).join(' · ')}`);
1059
+ for (const w of d.warnings)
1060
+ out(c.yellow(` ! ${w}`));
1061
+ for (const x of d.advice)
1062
+ out(` → ${x}`);
1063
+ printSources(r);
1064
+ });
1065
+ },
883
1066
  async satellite(o, a) {
884
1067
  const r = await o.satellites(a.pos.slice(1).join(' ').trim());
885
1068
  emit(a, r, () => {
@@ -1993,6 +2176,7 @@ export const COMMANDS = {
1993
2176
  allowedChats: (process.env.TELEGRAM_ALLOWED_CHATS ?? '').split(',').map((s) => s.trim()).filter(Boolean),
1994
2177
  alertMinScore: Number(process.env.TELEGRAM_ALERT_MIN_SCORE ?? 70),
1995
2178
  watchMinutes: 0,
2179
+ scheduleMinutes: Number(a.flags.watch ?? 0),
1996
2180
  oculon: o,
1997
2181
  log: (m) => log(`telegram ${m}`),
1998
2182
  });
@@ -0,0 +1,63 @@
1
+ import type { Store } from './store.js';
2
+ import type { Status } from './types.js';
3
+ export interface CallEntry {
4
+ source: string;
5
+ /** Host only; full URLs can carry query text the user typed. */
6
+ host: string;
7
+ status: Status;
8
+ /** Wall time of the request, 0 for cache hits. */
9
+ ms: number;
10
+ at: string;
11
+ note?: string;
12
+ /** Answered by a mirror after the primary host failed or was skipped. */
13
+ via?: string;
14
+ }
15
+ /** Run `fn` and collect every source call it makes, including calls made by modules it calls. */
16
+ export declare function withCallLog<T>(fn: () => Promise<T>): Promise<{
17
+ value: T;
18
+ calls: CallEntry[];
19
+ }>;
20
+ export declare function logCall(e: CallEntry): void;
21
+ /** One live fetch (not cache hits). Rows older than two days are pruned now and then. */
22
+ export declare function recordSourceCall(store: Store, source: string, host: string, ok: boolean, ms: number, note?: string): void;
23
+ export type SourceState = 'up' | 'slow' | 'down' | 'degraded';
24
+ export interface SourceStatus {
25
+ source: string;
26
+ hosts: string[];
27
+ state: SourceState;
28
+ calls: number;
29
+ failed: number;
30
+ /** Share of calls that worked, 0-100. */
31
+ okPct: number;
32
+ medianMs: number | null;
33
+ lastOk: string | null;
34
+ lastError: {
35
+ at: string;
36
+ note: string;
37
+ } | null;
38
+ /** Skipped right now because it kept failing; a mirror or cached data answers instead. */
39
+ skippedUntil: string | null;
40
+ }
41
+ /** Every source that made a live call in the last `hours`, worst first. */
42
+ export declare function sourceStatus(store: Store, hours?: number, now?: number): SourceStatus[];
43
+ /** Failures in a row before a host is skipped, and for how long. */
44
+ export declare const BREAKER: {
45
+ failures: number;
46
+ skipMs: number;
47
+ };
48
+ export declare function breakerOpenUntil(host: string, now?: number): number | null;
49
+ export declare function breakerResult(host: string, ok: boolean, now?: number): void;
50
+ export declare function resetBreakers(): void;
51
+ export interface Mirror {
52
+ host: string;
53
+ /** Same request on the mirror, or null when this URL has no equivalent there. */
54
+ rewrite: (u: URL) => {
55
+ url: string;
56
+ headers?: Record<string, string>;
57
+ } | null;
58
+ }
59
+ /**
60
+ * Hosts with a drop-in equivalent: same query, same JSON shape. Used when the primary fails after its retries
61
+ * or is being skipped. Sources with a different shape keep their own fallbacks in their modules.
62
+ */
63
+ export declare const MIRRORS: Record<string, Mirror>;
@@ -0,0 +1,120 @@
1
+ /**
2
+ * What happened on the wire, for three features that share one hook in Http:
3
+ * - replay log: every source call made while a check runs (AsyncLocalStorage ties calls to that check);
4
+ * - /status: per-source success, failures and latency over the last day, from every live fetch;
5
+ * - auto fallback: a host that keeps failing is skipped for a few minutes (cached data or a mirror answers instead).
6
+ * No dependencies: node:async_hooks and the install's own SQLite database.
7
+ */
8
+ import { AsyncLocalStorage } from 'node:async_hooks';
9
+ const log = new AsyncLocalStorage();
10
+ /** Run `fn` and collect every source call it makes, including calls made by modules it calls. */
11
+ export async function withCallLog(fn) {
12
+ const calls = [];
13
+ const value = await log.run(calls, fn);
14
+ return { value, calls };
15
+ }
16
+ export function logCall(e) {
17
+ const calls = log.getStore();
18
+ if (calls && calls.length < 2000)
19
+ calls.push(e);
20
+ }
21
+ /* ---------- source stats for /status ---------- */
22
+ const ensured = new WeakSet();
23
+ function ensure(store) {
24
+ if (ensured.has(store))
25
+ return;
26
+ store.db.exec(`CREATE TABLE IF NOT EXISTS source_calls (source TEXT NOT NULL, host TEXT NOT NULL, at INTEGER NOT NULL, ok INTEGER NOT NULL, ms INTEGER NOT NULL, note TEXT);
27
+ CREATE INDEX IF NOT EXISTS source_calls_at ON source_calls (at);`);
28
+ ensured.add(store);
29
+ }
30
+ let inserts = 0;
31
+ /** One live fetch (not cache hits). Rows older than two days are pruned now and then. */
32
+ export function recordSourceCall(store, source, host, ok, ms, note) {
33
+ try {
34
+ ensure(store);
35
+ const now = Date.now();
36
+ store.db.prepare('INSERT INTO source_calls (source, host, at, ok, ms, note) VALUES (?, ?, ?, ?, ?, ?)').run(source, host, now, ok ? 1 : 0, Math.round(ms), note ? note.slice(0, 200) : null);
37
+ if (++inserts % 500 === 0)
38
+ store.db.prepare('DELETE FROM source_calls WHERE at < ?').run(now - 2 * 86_400_000);
39
+ }
40
+ catch {
41
+ // Stats are best effort: a read-only or closed database must never break a check.
42
+ }
43
+ }
44
+ const median = (xs) => {
45
+ if (!xs.length)
46
+ return null;
47
+ const s = [...xs].sort((a, b) => a - b);
48
+ return s[Math.floor(s.length / 2)];
49
+ };
50
+ /** Every source that made a live call in the last `hours`, worst first. */
51
+ export function sourceStatus(store, hours = 24, now = Date.now()) {
52
+ ensure(store);
53
+ const rows = store.db.prepare('SELECT source, host, at, ok, ms, note FROM source_calls WHERE at >= ? ORDER BY at ASC').all(now - hours * 3_600_000);
54
+ const by = new Map();
55
+ for (const r of rows)
56
+ (by.get(r.source) ?? by.set(r.source, []).get(r.source)).push(r);
57
+ const out = [];
58
+ for (const [source, rs] of by) {
59
+ const failed = rs.filter((r) => !r.ok);
60
+ const okRows = rs.filter((r) => r.ok);
61
+ const recent = rs.slice(-5);
62
+ const med = median(okRows.map((r) => r.ms));
63
+ const lastErr = failed[failed.length - 1];
64
+ const lastOk = okRows[okRows.length - 1];
65
+ const hosts = [...new Set(rs.map((r) => r.host))];
66
+ const skipped = hosts.map((h) => breakerOpenUntil(h, now)).filter((x) => x !== null);
67
+ const recentFail = recent.filter((r) => !r.ok).length;
68
+ const state = skipped.length || (recent.length >= 2 && recentFail === recent.length) ? 'down' : recentFail ? 'degraded' : med !== null && med > 5000 ? 'slow' : 'up';
69
+ out.push({
70
+ source,
71
+ hosts,
72
+ state,
73
+ calls: rs.length,
74
+ failed: failed.length,
75
+ okPct: Math.round((okRows.length / rs.length) * 100),
76
+ medianMs: med,
77
+ lastOk: lastOk ? new Date(lastOk.at).toISOString() : null,
78
+ lastError: lastErr ? { at: new Date(lastErr.at).toISOString(), note: lastErr.note ?? 'failed' } : null,
79
+ skippedUntil: skipped.length ? new Date(Math.max(...skipped)).toISOString() : null,
80
+ });
81
+ }
82
+ const rank = { down: 0, degraded: 1, slow: 2, up: 3 };
83
+ return out.sort((a, b) => rank[a.state] - rank[b.state] || b.calls - a.calls);
84
+ }
85
+ /* ---------- breaker: skip a host that keeps failing ---------- */
86
+ /** Failures in a row before a host is skipped, and for how long. */
87
+ export const BREAKER = { failures: 3, skipMs: 5 * 60_000 };
88
+ const breakers = new Map();
89
+ export function breakerOpenUntil(host, now = Date.now()) {
90
+ const b = breakers.get(host);
91
+ return b && b.openUntil > now ? b.openUntil : null;
92
+ }
93
+ export function breakerResult(host, ok, now = Date.now()) {
94
+ if (ok) {
95
+ breakers.delete(host);
96
+ return;
97
+ }
98
+ const b = breakers.get(host) ?? { fails: 0, openUntil: 0 };
99
+ b.fails++;
100
+ if (b.fails >= BREAKER.failures) {
101
+ b.openUntil = now + BREAKER.skipMs;
102
+ b.fails = 0;
103
+ }
104
+ breakers.set(host, b);
105
+ }
106
+ export function resetBreakers() {
107
+ breakers.clear();
108
+ }
109
+ /**
110
+ * Hosts with a drop-in equivalent: same query, same JSON shape. Used when the primary fails after its retries
111
+ * or is being skipped. Sources with a different shape keep their own fallbacks in their modules.
112
+ */
113
+ export const MIRRORS = {
114
+ // Google and Cloudflare DNS-over-HTTPS share the JSON format (RFC 8484 JSON flavour).
115
+ 'dns.google': { host: 'cloudflare-dns.com', rewrite: (u) => (u.pathname === '/resolve' ? { url: `https://cloudflare-dns.com/dns-query${u.search}`, headers: { accept: 'application/dns-json' } } : null) },
116
+ 'cloudflare-dns.com': { host: 'dns.google', rewrite: (u) => (u.pathname === '/dns-query' ? { url: `https://dns.google/resolve${u.search}` } : null) },
117
+ // mempool.space and Blockstream both run the Esplora API.
118
+ 'mempool.space': { host: 'blockstream.info', rewrite: (u) => (u.pathname.startsWith('/api/') ? { url: `https://blockstream.info${u.pathname}${u.search}` } : null) },
119
+ 'blockstream.info': { host: 'mempool.space', rewrite: (u) => (u.pathname.startsWith('/api/') ? { url: `https://mempool.space${u.pathname}${u.search}` } : null) },
120
+ };
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Minimal EVM cryptography with no dependencies: keccak256 and secp256k1 public-key recovery, enough to
3
+ * check an Ethereum "personal_sign" signature (Sign-In with Ethereum) and turn it into the signer's address.
4
+ * Plain BigInt arithmetic: slow next to native code, but a sign-in needs one recovery.
5
+ */
6
+ /** Keccak-256 as used by Ethereum (original Keccak padding, not NIST SHA3-256). */
7
+ export declare function keccak256(data: Uint8Array | string): Uint8Array;
8
+ export declare const toHex: (b: Uint8Array) => string;
9
+ export declare const fromHex: (h: string) => Uint8Array<ArrayBuffer>;
10
+ /** Recover the uncompressed public key (64 bytes, x||y) from a message hash and an (r, s, recovery id) signature. */
11
+ export declare function recoverPublicKey(hash: Uint8Array, r: bigint, s: bigint, recId: number): Uint8Array | null;
12
+ export declare const addressOf: (pub64: Uint8Array) => string;
13
+ /** The address of a private key (used by tests to build signatures). */
14
+ export declare function addressFromPrivateKey(priv: bigint): string;
15
+ /** A 65-byte Ethereum signature (r, s, v) over a 32-byte hash, low-s. `k` must be a fresh random nonce. Tests use it; Oculon never holds keys. */
16
+ export declare function signHash(hash: Uint8Array, priv: bigint, k: bigint): string;
17
+ /** The hash Ethereum wallets sign for personal_sign: keccak256("\x19Ethereum Signed Message:\n" + length + message). */
18
+ export declare function personalHash(message: string): Uint8Array;
19
+ /** The lower-case address that signed a personal_sign message, or null if the signature is malformed. */
20
+ export declare function recoverPersonalSigner(message: string, signature: string): string | null;