@ghostlytools/cli 1.8.1 → 1.10.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.
- package/README.md +34 -23
- package/SKILL.md +9 -4
- package/dist/assets/{api-BpQC8dAw.js → api-BF_KwecF.js} +115 -45
- package/dist/assets/api-BF_KwecF.js.map +1 -0
- package/dist/assets/{api-CttDF-S5.js → api-DdrA86Ur.js} +2 -2
- package/dist/assets/{apiKit-CSMeHKgo.js → apiKit-Du1u2l4x.js} +8 -8
- package/dist/assets/apiKit-Du1u2l4x.js.map +1 -0
- package/dist/assets/{apps-DzFMdVt6.js → apps-Bti9fDoW.js} +1 -1
- package/dist/assets/{apps-DqTyZ40T.js → apps-DwPfp54I.js} +5 -3
- package/dist/assets/apps-DwPfp54I.js.map +1 -0
- package/dist/assets/{arkade-Cu3TbPxC.js → arkade-DOWpA2Kr.js} +2 -2
- package/dist/assets/{arkade-Cu3TbPxC.js.map → arkade-DOWpA2Kr.js.map} +1 -1
- package/dist/assets/{backup-CLZOORFC.js → backup-CeRckyl2.js} +1 -1
- package/dist/assets/{backup-CyTZhu28.js → backup-DZ_Q1eSu.js} +6 -6
- package/dist/assets/{backup-CyTZhu28.js.map → backup-DZ_Q1eSu.js.map} +1 -1
- package/dist/assets/{blobFiles-DOQDRdDI.js → blobFiles-BnjN_Vrz.js} +3 -3
- package/dist/assets/{blobFiles-DOQDRdDI.js.map → blobFiles-BnjN_Vrz.js.map} +1 -1
- package/dist/assets/buttons-BxIThdg9.js +332 -0
- package/dist/assets/buttons-BxIThdg9.js.map +1 -0
- package/dist/assets/buttons-D9QBHS9Y.js +2 -0
- package/dist/assets/client-D5E1RQYB.js +473 -0
- package/dist/assets/client-D5E1RQYB.js.map +1 -0
- package/dist/assets/{endpoint-BdaeBw2L.js → endpoint-DWHkXWVM.js} +101 -16
- package/dist/assets/endpoint-DWHkXWVM.js.map +1 -0
- package/dist/assets/{envelope-CGfUsR1m.js → envelope-CugS9qwQ.js} +2 -2
- package/dist/assets/{envelope-CGfUsR1m.js.map → envelope-CugS9qwQ.js.map} +1 -1
- package/dist/assets/{fileBytes-BPDKufla.js → fileBytes-DMzrIdCu.js} +1 -1
- package/dist/assets/{fileBytes-DNgrRL0R.js → fileBytes-DjBYYyXT.js} +3 -3
- package/dist/assets/{fileBytes-DNgrRL0R.js.map → fileBytes-DjBYYyXT.js.map} +1 -1
- package/dist/assets/{fileBytes-Q3ehcEr8.js → fileBytes-Douk1yOp.js} +2 -2
- package/dist/assets/{fileBytes-Q3ehcEr8.js.map → fileBytes-Douk1yOp.js.map} +1 -1
- package/dist/assets/fileBytesIdb-CD5Uv490.js +2 -0
- package/dist/assets/{fileBytesIdb-Dm1EyEbT.js → fileBytesIdb-CkClu9YI.js} +3 -3
- package/dist/assets/{fileBytesIdb-Dm1EyEbT.js.map → fileBytesIdb-CkClu9YI.js.map} +1 -1
- package/dist/assets/{fileBytesOpfs-ZGD21c4Q.js → fileBytesOpfs-WryQuOgK.js} +3 -3
- package/dist/assets/{fileBytesOpfs-ZGD21c4Q.js.map → fileBytesOpfs-WryQuOgK.js.map} +1 -1
- package/dist/assets/{fixedHosts-BiukTsd9.js → fixedHosts-B4E4VrYE.js} +4 -4
- package/dist/assets/{fixedHosts-BiukTsd9.js.map → fixedHosts-B4E4VrYE.js.map} +1 -1
- package/dist/assets/{groupFiles-CeF9nPv9.js → groupFiles-NonOYBKN.js} +380 -650
- package/dist/assets/groupFiles-NonOYBKN.js.map +1 -0
- package/dist/assets/{host-CKAehWP6.js → host-DvcVt5YI.js} +144 -33
- package/dist/assets/host-DvcVt5YI.js.map +1 -0
- package/dist/assets/{hyperdhtRelay-B8Pdykhg.js → hyperdhtRelay-Ce42sR8x.js} +2 -2
- package/dist/assets/{hyperdhtRelay-B8Pdykhg.js.map → hyperdhtRelay-Ce42sR8x.js.map} +1 -1
- package/dist/assets/{idb-BkOJES5_.js → idb-BHsAqENE.js} +37 -6
- package/dist/assets/idb-BHsAqENE.js.map +1 -0
- package/dist/assets/{irohWeb-D6tAPHZa.js → irohWeb-C9ChbD-c.js} +71 -4
- package/dist/assets/{irohWeb-D6tAPHZa.js.map → irohWeb-C9ChbD-c.js.map} +1 -1
- package/dist/assets/{main-BDY-pfpz.js → main-4qE381KM.js} +226 -280
- package/dist/assets/main-4qE381KM.js.map +1 -0
- package/dist/assets/{mainline-3ueXpFQL.js → mainline-DOwZDHVy.js} +2 -2
- package/dist/assets/{mainline-3ueXpFQL.js.map → mainline-DOwZDHVy.js.map} +1 -1
- package/dist/assets/{networkReason-DhJYOomu.js → networkReason-MInk1Y63.js} +3 -3
- package/dist/assets/{networkReason-DhJYOomu.js.map → networkReason-MInk1Y63.js.map} +1 -1
- package/dist/assets/{nwc-B1Quqda-.js → nwc-CHLWFV1R.js} +3 -3
- package/dist/assets/{nwc-B1Quqda-.js.map → nwc-CHLWFV1R.js.map} +1 -1
- package/dist/assets/{nwcProvider-DUB6xO-b.js → nwcProvider-BlkPOJen.js} +2 -2
- package/dist/assets/{nwcProvider-DUB6xO-b.js.map → nwcProvider-BlkPOJen.js.map} +1 -1
- package/dist/assets/{ownDid-BfqHJdA6.js → ownDid-yXtY_1B5.js} +3 -3
- package/dist/assets/ownDid-yXtY_1B5.js.map +1 -0
- package/dist/assets/{profiles-MFtCmJwK.js → profiles-vbXHs0Mq.js} +40 -3
- package/dist/assets/profiles-vbXHs0Mq.js.map +1 -0
- package/dist/assets/{registry-CZTmtSws.js → registry-BN9r2pR4.js} +1 -1
- package/dist/assets/{registry-DwlTNQjr.js → registry-chCD0KWS.js} +5 -5
- package/dist/assets/registry-chCD0KWS.js.map +1 -0
- package/dist/assets/{resolve-BVwhiYjj.js → resolve-Dtzogt2W.js} +2 -2
- package/dist/assets/{resolve-BVwhiYjj.js.map → resolve-Dtzogt2W.js.map} +1 -1
- package/dist/assets/{restoredRows-BCRCjhdF.js → restoredRows-CRYwIx3g.js} +2 -2
- package/dist/assets/{restoredRows-BCRCjhdF.js.map → restoredRows-CRYwIx3g.js.map} +1 -1
- package/dist/assets/secretGuard-CSVNxXVW.js +1081 -0
- package/dist/assets/secretGuard-CSVNxXVW.js.map +1 -0
- package/dist/assets/secretGuard-Q2BKq0q0.js +2 -0
- package/dist/assets/{server-Br3XPwFG.js → server-BZnsm5X5.js} +2510 -569
- package/dist/assets/server-BZnsm5X5.js.map +1 -0
- package/dist/assets/{src-C4sOH4zH.js → src-DZagapGt.js} +2015 -161
- package/dist/assets/src-DZagapGt.js.map +1 -0
- package/dist/assets/{sshForges-CQQomStK.js → sshForges-BkTgy5rx.js} +16 -9
- package/dist/assets/{sshForges-CQQomStK.js.map → sshForges-BkTgy5rx.js.map} +1 -1
- package/dist/assets/{translate-C2aNyUkR.js → translate-B9SMd6uf.js} +15 -8
- package/dist/assets/translate-B9SMd6uf.js.map +1 -0
- package/dist/assets/{usdt-CMwatDnQ.js → usdt-BU4ezonh.js} +3 -3
- package/dist/assets/{usdt-CMwatDnQ.js.map → usdt-BU4ezonh.js.map} +1 -1
- package/dist/assets/{waitNotice-Ck3el3_Z.js → waitNotice-B8D8WhbE.js} +2 -2
- package/dist/assets/waitNotice-B8D8WhbE.js.map +1 -0
- package/dist/assets/{words-CqN2KG1r.js → words-jYy7lTcb.js} +5 -2
- package/dist/assets/words-jYy7lTcb.js.map +1 -0
- package/dist/ghostly.mjs +1 -1
- package/examples/call-echo.mjs +7 -5
- package/package.json +1 -1
- package/dist/assets/api-BpQC8dAw.js.map +0 -1
- package/dist/assets/apiKit-CSMeHKgo.js.map +0 -1
- package/dist/assets/apps-DqTyZ40T.js.map +0 -1
- package/dist/assets/buttons-Bd9fR31r.js +0 -698
- package/dist/assets/buttons-Bd9fR31r.js.map +0 -1
- package/dist/assets/buttons-c4CJnL6i.js +0 -2
- package/dist/assets/daemonProof-DtrL5lE5.js +0 -236
- package/dist/assets/daemonProof-DtrL5lE5.js.map +0 -1
- package/dist/assets/endpoint-BdaeBw2L.js.map +0 -1
- package/dist/assets/fileBytesIdb-DZcESfTt.js +0 -2
- package/dist/assets/groupFiles-CeF9nPv9.js.map +0 -1
- package/dist/assets/host-CKAehWP6.js.map +0 -1
- package/dist/assets/idb-BkOJES5_.js.map +0 -1
- package/dist/assets/main-BDY-pfpz.js.map +0 -1
- package/dist/assets/ownDid-BfqHJdA6.js.map +0 -1
- package/dist/assets/profiles-MFtCmJwK.js.map +0 -1
- package/dist/assets/registry-DwlTNQjr.js.map +0 -1
- package/dist/assets/server-Br3XPwFG.js.map +0 -1
- package/dist/assets/src-C4sOH4zH.js.map +0 -1
- package/dist/assets/translate-C2aNyUkR.js.map +0 -1
- package/dist/assets/waitNotice-Ck3el3_Z.js.map +0 -1
- package/dist/assets/words-CqN2KG1r.js.map +0 -1
|
@@ -1,698 +0,0 @@
|
|
|
1
|
-
import { Ja as BUTTON_STYLES, Mu as toBase64Url, ao as buttonLabelClash, ci as BUTTONS_CAPABILITY, co as checkStatusCard, ju as randomBytes, to as STATUS_CARD_LIMITS } from "./src-C4sOH4zH.js";
|
|
2
|
-
import { t as CliError } from "./errors-R4S2SAEM.js";
|
|
3
|
-
import { _ as oneOf, b as str, g as num, h as node, i as chatOrGroup, n as bool, p as messageOf } from "./apiKit-CSMeHKgo.js";
|
|
4
|
-
import { t as goesOn$1 } from "./waitNotice-Ck3el3_Z.js";
|
|
5
|
-
import { sha256 } from "@noble/hashes/sha2.js";
|
|
6
|
-
import { createBase58check } from "@scure/base";
|
|
7
|
-
import { wordlist } from "@scure/bip39/wordlists/english.js";
|
|
8
|
-
//#region ../../apps/ui/src/lib/parse/monero-words.ts
|
|
9
|
-
/**
|
|
10
|
-
* Monero's English seed words (src/mnemonics/english.h in monero-project/monero), in their order: a word's place is its
|
|
11
|
-
* value. The classic 25-word seed of Monero GUI and monero-wallet-cli, and MyMonero's 13, are made of these.
|
|
12
|
-
*
|
|
13
|
-
* Copyright (c) 2014-2024, The Monero Project, under the BSD 3-Clause licence that file carries: redistributions keep
|
|
14
|
-
* this notice, and the project's name may not endorse this app.
|
|
15
|
-
*/
|
|
16
|
-
var MONERO_WORDS = `
|
|
17
|
-
abbey abducts ability ablaze abnormal abort abrasive absorb abyss academy aces aching acidic acoustic acquire across
|
|
18
|
-
actress acumen adapt addicted adept adhesive adjust adopt adrenalin adult adventure aerial afar affair afield afloat
|
|
19
|
-
afoot afraid after against agenda aggravate agile aglow agnostic agony agreed ahead aided ailments aimless airport
|
|
20
|
-
aisle ajar akin alarms album alchemy alerts algebra alkaline alley almost aloof alpine already also altitude alumni
|
|
21
|
-
always amaze ambush amended amidst ammo amnesty among amply amused anchor android anecdote angled ankle annoyed
|
|
22
|
-
answers antics anvil anxiety anybody apart apex aphid aplomb apology apply apricot aptitude aquarium arbitrary
|
|
23
|
-
archer ardent arena argue arises army around arrow arsenic artistic ascend ashtray aside asked asleep aspire
|
|
24
|
-
assorted asylum athlete atlas atom atrium attire auburn auctions audio august aunt austere autumn avatar avidly
|
|
25
|
-
avoid awakened awesome awful awkward awning awoken axes axis axle aztec azure baby bacon badge baffles bagpipe
|
|
26
|
-
bailed bakery balding bamboo banjo baptism basin batch bawled bays because beer befit begun behind being below
|
|
27
|
-
bemused benches berries bested betting bevel beware beyond bias bicycle bids bifocals biggest bikini bimonthly
|
|
28
|
-
binocular biology biplane birth biscuit bite biweekly blender blip bluntly boat bobsled bodies bogeys boil boldly
|
|
29
|
-
bomb border boss both bounced bovine bowling boxes boyfriend broken brunt bubble buckets budget buffet bugs building
|
|
30
|
-
bulb bumper bunch business butter buying buzzer bygones byline bypass cabin cactus cadets cafe cage cajun cake
|
|
31
|
-
calamity camp candy casket catch cause cavernous cease cedar ceiling cell cement cent certain chlorine chrome cider
|
|
32
|
-
cigar cinema circle cistern citadel civilian claim click clue coal cobra cocoa code coexist coffee cogs cohesive
|
|
33
|
-
coils colony comb cool copy corrode costume cottage cousin cowl criminal cube cucumber cuddled cuffs cuisine cunning
|
|
34
|
-
cupcake custom cycling cylinder cynical dabbing dads daft dagger daily damp dangerous dapper darted dash dating
|
|
35
|
-
dauntless dawn daytime dazed debut decay dedicated deepest deftly degrees dehydrate deity dejected delayed
|
|
36
|
-
demonstrate dented deodorant depth desk devoid dewdrop dexterity dialect dice diet different digit dilute dime
|
|
37
|
-
dinner diode diplomat directed distance ditch divers dizzy doctor dodge does dogs doing dolphin domestic donuts
|
|
38
|
-
doorway dormant dosage dotted double dove down dozen dreams drinks drowning drunk drying dual dubbed duckling dude
|
|
39
|
-
duets duke dullness dummy dunes duplex duration dusted duties dwarf dwelt dwindling dying dynamite dyslexic each
|
|
40
|
-
eagle earth easy eating eavesdrop eccentric echo eclipse economics ecstatic eden edgy edited educated eels efficient
|
|
41
|
-
eggs egotistic eight either eject elapse elbow eldest eleven elite elope else eluded emails ember emerge emit
|
|
42
|
-
emotion empty emulate energy enforce enhanced enigma enjoy enlist enmity enough enraged ensign entrance envy epoxy
|
|
43
|
-
equip erase erected erosion error eskimos espionage essential estate etched eternal ethics etiquette evaluate
|
|
44
|
-
evenings evicted evolved examine excess exhale exit exotic exquisite extra exult fabrics factual fading fainted
|
|
45
|
-
faked fall family fancy farming fatal faulty fawns faxed fazed feast february federal feel feline females fences
|
|
46
|
-
ferry festival fetches fever fewest fiat fibula fictional fidget fierce fifteen fight films firm fishing fitting
|
|
47
|
-
five fixate fizzle fleet flippant flying foamy focus foes foggy foiled folding fonts foolish fossil fountain fowls
|
|
48
|
-
foxes foyer framed friendly frown fruit frying fudge fuel fugitive fully fuming fungal furnished fuselage future
|
|
49
|
-
fuzzy gables gadget gags gained galaxy gambit gang gasp gather gauze gave gawk gaze gearbox gecko geek gels gemstone
|
|
50
|
-
general geometry germs gesture getting geyser ghetto ghost giant giddy gifts gigantic gills gimmick ginger girth
|
|
51
|
-
giving glass gleeful glide gnaw gnome goat goblet godfather goes goggles going goldfish gone goodbye gopher gorilla
|
|
52
|
-
gossip gotten gourmet governing gown greater grunt guarded guest guide gulp gumball guru gusts gutter guys gymnast
|
|
53
|
-
gypsy gyrate habitat hacksaw haggled hairy hamburger happens hashing hatchet haunted having hawk haystack hazard
|
|
54
|
-
hectare hedgehog heels hefty height hemlock hence heron hesitate hexagon hickory hiding highway hijack hiker hills
|
|
55
|
-
himself hinder hippo hire history hitched hive hoax hobby hockey hoisting hold honked hookup hope hornet hospital
|
|
56
|
-
hotel hounded hover howls hubcaps huddle huge hull humid hunter hurried husband huts hybrid hydrogen hyper iceberg
|
|
57
|
-
icing icon identity idiom idled idols igloo ignore iguana illness imagine imbalance imitate impel inactive inbound
|
|
58
|
-
incur industrial inexact inflamed ingested initiate injury inkling inline inmate innocent inorganic input inquest
|
|
59
|
-
inroads insult intended inundate invoke inwardly ionic irate iris irony irritate island isolated issued italics
|
|
60
|
-
itches items itinerary itself ivory jabbed jackets jaded jagged jailed jamming january jargon jaunt javelin jaws
|
|
61
|
-
jazz jeans jeers jellyfish jeopardy jerseys jester jetting jewels jigsaw jingle jittery jive jobs jockey jogger
|
|
62
|
-
joining joking jolted jostle journal joyous jubilee judge juggled juicy jukebox july jump junk jury justice juvenile
|
|
63
|
-
kangaroo karate keep kennel kept kernels kettle keyboard kickoff kidneys king kiosk kisses kitchens kiwi knapsack
|
|
64
|
-
knee knife knowledge knuckle koala laboratory ladder lagoon lair lakes lamb language laptop large last later
|
|
65
|
-
launching lava lawsuit layout lazy lectures ledge leech left legion leisure lemon lending leopard lesson lettuce
|
|
66
|
-
lexicon liar library licks lids lied lifestyle light likewise lilac limits linen lion lipstick liquid listen lively
|
|
67
|
-
loaded lobster locker lodge lofty logic loincloth long looking lopped lordship losing lottery loudly love lower
|
|
68
|
-
loyal lucky luggage lukewarm lullaby lumber lunar lurk lush luxury lymph lynx lyrics macro madness magically mailed
|
|
69
|
-
major makeup malady mammal maps masterful match maul maverick maximum mayor maze meant mechanic medicate meeting
|
|
70
|
-
megabyte melting memoir menu merger mesh metro mews mice midst mighty mime mirror misery mittens mixture moat mobile
|
|
71
|
-
mocked mohawk moisture molten moment money moon mops morsel mostly motherly mouth movement mowing much muddy muffin
|
|
72
|
-
mugged mullet mumble mundane muppet mural musical muzzle myriad mystery myth nabbing nagged nail names nanny napkin
|
|
73
|
-
narrate nasty natural nautical navy nearby necklace needed negative neither neon nephew nerves nestle network
|
|
74
|
-
neutral never newt nexus nibs niche niece nifty nightly nimbly nineteen nirvana nitrogen nobody nocturnal nodes
|
|
75
|
-
noises nomad noodles northern nostril noted nouns novelty nowhere nozzle nuance nucleus nudged nugget nuisance null
|
|
76
|
-
number nuns nurse nutshell nylon oaks oars oasis oatmeal obedient object obliged obnoxious observant obtains obvious
|
|
77
|
-
occur ocean october odds odometer offend often oilfield ointment okay older olive olympics omega omission omnibus
|
|
78
|
-
onboard oncoming oneself ongoing onion online onslaught onto onward oozed opacity opened opposite optical opus
|
|
79
|
-
orange orbit orchid orders organs origin ornament orphans oscar ostrich otherwise otter ouch ought ounce ourselves
|
|
80
|
-
oust outbreak oval oven owed owls owner oxidant oxygen oyster ozone pact paddles pager pairing palace pamphlet
|
|
81
|
-
pancakes paper paradise pastry patio pause pavements pawnshop payment peaches pebbles peculiar pedantic peeled pegs
|
|
82
|
-
pelican pencil people pepper perfect pests petals phase pheasants phone phrases physics piano picked pierce pigment
|
|
83
|
-
piloted pimple pinched pioneer pipeline pirate pistons pitched pivot pixels pizza playful pledge pliers plotting
|
|
84
|
-
plus plywood poaching pockets podcast poetry point poker polar ponies pool popular portents possible potato pouch
|
|
85
|
-
poverty powder pram present pride problems pruned prying psychic public puck puddle puffin pulp pumpkins punch puppy
|
|
86
|
-
purged push putty puzzled pylons pyramid python queen quick quote rabbits racetrack radar rafts rage railway raking
|
|
87
|
-
rally ramped randomly rapid rarest rash rated ravine rays razor react rebel recipe reduce reef refer regular reheat
|
|
88
|
-
reinvest rejoices rekindle relic remedy renting reorder repent request reruns rest return reunion revamp rewind
|
|
89
|
-
rhino rhythm ribbon richly ridges rift rigid rims ringing riots ripped rising ritual river roared robot rockets
|
|
90
|
-
rodent rogue roles romance roomy roped roster rotate rounded rover rowboat royal ruby rudely ruffled rugged ruined
|
|
91
|
-
ruling rumble runway rural rustled ruthless sabotage sack sadness safety saga sailor sake salads sample sanity
|
|
92
|
-
sapling sarcasm sash satin saucepan saved sawmill saxophone sayings scamper scenic school science scoop scrub scuba
|
|
93
|
-
seasons second sedan seeded segments seismic selfish semifinal sensible september sequence serving session setup
|
|
94
|
-
seventh sewage shackles shelter shipped shocking shrugged shuffled shyness siblings sickness sidekick sieve sifting
|
|
95
|
-
sighting silk simplest sincerely sipped siren situated sixteen sizes skater skew skirting skulls skydive slackens
|
|
96
|
-
sleepless slid slower slug smash smelting smidgen smog smuggled snake sneeze sniff snout snug soapy sober soccer
|
|
97
|
-
soda software soggy soil solved somewhere sonic soothe soprano sorry southern sovereign sowed soya space speedy
|
|
98
|
-
sphere spiders splendid spout sprig spud spying square stacking stellar stick stockpile strained stunning stylishly
|
|
99
|
-
subtly succeed suddenly suede suffice sugar suitcase sulking summon sunken superior surfer sushi suture swagger
|
|
100
|
-
swept swiftly sword swung syllabus symptoms syndrome syringe system taboo tacit tadpoles tagged tail taken talent
|
|
101
|
-
tamper tanks tapestry tarnished tasked tattoo taunts tavern tawny taxi teardrop technical tedious teeming tell
|
|
102
|
-
template tender tepid tequila terminal testing tether textbook thaw theatrics thirsty thorn threaten thumbs thwart
|
|
103
|
-
ticket tidy tiers tiger tilt timber tinted tipsy tirade tissue titans toaster tobacco today toenail toffee together
|
|
104
|
-
toilet token tolerant tomorrow tonic toolbox topic torch tossed total touchy towel toxic toyed trash trendy tribal
|
|
105
|
-
trolling truth trying tsunami tubes tucks tudor tuesday tufts tugs tuition tulips tumbling tunnel turnip tusks tutor
|
|
106
|
-
tuxedo twang tweezers twice twofold tycoon typist tyrant ugly ulcers ultimate umbrella umpire unafraid unbending
|
|
107
|
-
uncle under uneven unfit ungainly unhappy union unjustly unknown unlikely unmask unnoticed unopened unplugs unquoted
|
|
108
|
-
unrest unsafe until unusual unveil unwind unzip upbeat upcoming update upgrade uphill upkeep upload upon upper
|
|
109
|
-
upright upstairs uptight upwards urban urchins urgent usage useful usher using usual utensils utility utmost utopia
|
|
110
|
-
uttered vacation vague vain value vampire vane vapidly vary vastness vats vaults vector veered vegan vehicle vein
|
|
111
|
-
velvet venomous verification vessel veteran vexed vials vibrate victim video viewpoint vigilant viking village
|
|
112
|
-
vinegar violin vipers virtual visited vitals vivid vixen vocal vogue voice volcano vortex voted voucher vowels
|
|
113
|
-
voyage vulture wade waffle wagtail waist waking wallets wanted warped washing water waveform waxing wayside weavers
|
|
114
|
-
website wedge weekday weird welders went wept were western wetsuit whale when whipped whole wickets width wield wife
|
|
115
|
-
wiggle wildly winter wipeout wiring wise withdrawn wives wizard wobbly woes woken wolf womanly wonders woozy worry
|
|
116
|
-
wounded woven wrap wrist wrong yacht yahoo yanks yard yawning yearbook yellow yesterday yeti yields yodel yoga
|
|
117
|
-
younger yoyo zapped zeal zebra zero zesty zigzags zinger zippers zodiac zombie zones zoom
|
|
118
|
-
`.trim().split(/\s+/);
|
|
119
|
-
//#endregion
|
|
120
|
-
//#region ../../apps/ui/src/lib/parse/secrets.ts
|
|
121
|
-
var MNEMONIC_LENGTHS = [
|
|
122
|
-
12,
|
|
123
|
-
15,
|
|
124
|
-
18,
|
|
125
|
-
21,
|
|
126
|
-
24
|
|
127
|
-
];
|
|
128
|
-
var BIP39 = {
|
|
129
|
-
index: new Map(wordlist.map((word, index) => [word, index])),
|
|
130
|
-
lengths: MNEMONIC_LENGTHS,
|
|
131
|
-
/**
|
|
132
|
-
* BIP39's lengths, and a Polyseed's 16 (Monero's seed in Feather and Cake Wallet, BIP39's English words with a
|
|
133
|
-
* checksum of its own, which BIP39's caught only by chance, about 3 in 10).
|
|
134
|
-
*/
|
|
135
|
-
wholeMessage: [...MNEMONIC_LENGTHS, 16],
|
|
136
|
-
checksumHolds: bip39ChecksumHolds
|
|
137
|
-
};
|
|
138
|
-
/** Monero's classic seed (Monero GUI, monero-wallet-cli): 25 words of its own list, or MyMonero's 13. */
|
|
139
|
-
var MONERO = {
|
|
140
|
-
index: new Map(MONERO_WORDS.map((word, index) => [word, index])),
|
|
141
|
-
lengths: [25, 13],
|
|
142
|
-
wholeMessage: [25, 13],
|
|
143
|
-
checksumHolds: moneroChecksumHolds
|
|
144
|
-
};
|
|
145
|
-
/** Checksums tried per message and word list at most: a 16 KiB run of seed words stays a few milliseconds. */
|
|
146
|
-
var CHECKSUM_BUDGET = 4096;
|
|
147
|
-
var NSEC = /\bnsec1[02-9ac-hj-np-z]{58}(?![02-9ac-hj-np-z])/i;
|
|
148
|
-
var EXTENDED_PRIVATE = /\b[xtyzuvYZUV]prv[1-9A-HJ-NP-Za-km-z]{100,}/;
|
|
149
|
-
var WIF = /\b[59KLc][1-9A-HJ-NP-Za-km-z]{50,51}\b/g;
|
|
150
|
-
var HEX_SECRET = /\b(?:0x)?(?:[0-9a-fA-F]{128}|[0-9a-fA-F]{64})\b/g;
|
|
151
|
-
/**
|
|
152
|
-
* Monero's keys count too: "Private spend key" and "Spend key (private)" (Cake Wallet, MyMonero). A bare "spend key" or
|
|
153
|
-
* "view key" does not, as a wallet's public keys are written that way too.
|
|
154
|
-
*/
|
|
155
|
-
var SECRET_CONTEXT = /priv(?:ate)?[\s_-]*(?:(?:spend|view)[\s_-]*)?key|(?:spend|view)[\s_-]*key[\s_-]*\(\s*private|secret|seed|mnemonic|nsec|xprv|\bwif\b|recovery|passphrase/i;
|
|
156
|
-
/** How far from a 64-hex string a word like "seed" still counts as saying what it is. */
|
|
157
|
-
var CONTEXT_REACH = 48;
|
|
158
|
-
var CASHU_TOKEN = /\bcashu([AB])([A-Za-z0-9_\-+/]{20,}={0,2})/g;
|
|
159
|
-
/**
|
|
160
|
-
* Characters that take no room on screen: format characters (zero-width space, soft hyphen, word joiner, the joiners,
|
|
161
|
-
* direction marks), control characters that are not white space, variation selectors, the grapheme joiner and the
|
|
162
|
-
* Hangul fillers. A page, a PDF or a terminal puts some of them into long strings as places to break a line.
|
|
163
|
-
*/
|
|
164
|
-
var INVISIBLE = /(?![\t\n\v\f\r\x85])[\p{Cc}\p{Cf}]|\u034f|[\u115f\u1160\u3164\uffa0]|[\ufe00-\ufe0f]|[\u{e0100}-\u{e01ef}]/gu;
|
|
165
|
-
var base58check = createBase58check(sha256);
|
|
166
|
-
/**
|
|
167
|
-
* The first secret in `text`, keys and seeds before ecash; null for anything else. The text is read as it is and as
|
|
168
|
-
* it reads without its invisible characters: a key with one inside is whole again once the reader takes it out.
|
|
169
|
-
*/
|
|
170
|
-
function findSecret(text) {
|
|
171
|
-
const visible = text.replace(INVISIBLE, "");
|
|
172
|
-
const readings = visible === text ? [text] : [text, visible];
|
|
173
|
-
if (readings.some((reading) => hasMnemonic(reading, BIP39) || hasMnemonic(reading, MONERO))) return { kind: "mnemonic" };
|
|
174
|
-
if (readings.some((reading) => NSEC.test(reading))) return { kind: "nsec" };
|
|
175
|
-
if (readings.some((reading) => EXTENDED_PRIVATE.test(reading) || hasWif(reading))) return { kind: "bitcoin-key" };
|
|
176
|
-
if (readings.some(hasHexSecret)) return { kind: "hex-key" };
|
|
177
|
-
const tokens = readings.map(findCashu);
|
|
178
|
-
return tokens.find((found) => found?.kind === "cashu" && found.amount !== null) ?? tokens.find((found) => found) ?? null;
|
|
179
|
-
}
|
|
180
|
-
/**
|
|
181
|
-
* 12 to 24 words in a row from the English BIP39 list whose checksum holds, anywhere in the text; or a message that
|
|
182
|
-
* is nothing but 12, 15, 16, 18, 21 or 24 of those words (a seed with one word mistyped is still most of a seed). The
|
|
183
|
-
* same for Monero's English list, 25 or 13 words. Prose breaks a run at once: "the", "a", "is", "to", "and", "of" and
|
|
184
|
-
* "I" are on neither list.
|
|
185
|
-
*
|
|
186
|
-
* One word said over and over is not a seed, though one in 16 such runs passes a 12-word checksum ("word" does), and
|
|
187
|
-
* every one passes Monero's: a window of a single word never counts, and a window mostly of one word ("abandon …
|
|
188
|
-
* about") counts only when that word does not go on past it on either side.
|
|
189
|
-
*/
|
|
190
|
-
function hasMnemonic(text, seed) {
|
|
191
|
-
const tokens = text.toLowerCase().match(/[a-z]+/g);
|
|
192
|
-
const shortest = Math.min(...seed.lengths);
|
|
193
|
-
if (!tokens || tokens.length < shortest) return false;
|
|
194
|
-
let budget = CHECKSUM_BUDGET;
|
|
195
|
-
let run = [];
|
|
196
|
-
const seedLike = (start, length) => {
|
|
197
|
-
const window = run.slice(start, start + length);
|
|
198
|
-
const counts = /* @__PURE__ */ new Map();
|
|
199
|
-
for (const word of window) counts.set(word, (counts.get(word) ?? 0) + 1);
|
|
200
|
-
if (counts.size === 1) return false;
|
|
201
|
-
const [most, times] = [...counts].reduce((a, b) => b[1] > a[1] ? b : a);
|
|
202
|
-
if (times > length / 2 && (run[start - 1] === most || run[start + length] === most)) return false;
|
|
203
|
-
return seed.checksumHolds(window);
|
|
204
|
-
};
|
|
205
|
-
const check = () => {
|
|
206
|
-
if (run.length >= shortest) {
|
|
207
|
-
for (const length of seed.lengths) for (let start = 0; start + length <= run.length && budget > 0; start++, budget--) if (seedLike(start, length)) return true;
|
|
208
|
-
if (run.length === tokens.length && seed.wholeMessage.includes(run.length) && new Set(run).size > 1) return true;
|
|
209
|
-
}
|
|
210
|
-
run = [];
|
|
211
|
-
return false;
|
|
212
|
-
};
|
|
213
|
-
for (const token of tokens) {
|
|
214
|
-
const index = seed.index.get(token);
|
|
215
|
-
if (index !== void 0) run.push(index);
|
|
216
|
-
else if (check()) return true;
|
|
217
|
-
}
|
|
218
|
-
return check();
|
|
219
|
-
}
|
|
220
|
-
/** BIP39: the words' 11-bit indices are the entropy followed by the first bits of its SHA-256. */
|
|
221
|
-
function bip39ChecksumHolds(indices) {
|
|
222
|
-
const bits = indices.length * 11, checksumBits = bits / 33, entropyBytes = (bits - checksumBits) / 8;
|
|
223
|
-
const bytes = new Uint8Array(Math.ceil(bits / 8));
|
|
224
|
-
indices.forEach((index, i) => {
|
|
225
|
-
for (let b = 0; b < 11; b++) if (index & 1 << 10 - b) {
|
|
226
|
-
const at = i * 11 + b;
|
|
227
|
-
bytes[at >> 3] |= 128 >> (at & 7);
|
|
228
|
-
}
|
|
229
|
-
});
|
|
230
|
-
return sha256(bytes.subarray(0, entropyBytes))[0] >> 8 - checksumBits === bytes[entropyBytes] >> 8 - checksumBits;
|
|
231
|
-
}
|
|
232
|
-
/**
|
|
233
|
-
* Monero (src/mnemonics/electrum-words.cpp): the last word repeats the one at CRC-32 of the other words' first three
|
|
234
|
-
* letters, run together, modulo how many they are.
|
|
235
|
-
*/
|
|
236
|
-
function moneroChecksumHolds(indices) {
|
|
237
|
-
const words = indices.slice(0, -1);
|
|
238
|
-
return words[crc32(words.map((index) => MONERO_WORDS[index].slice(0, 3)).join("")) % words.length] === indices[indices.length - 1];
|
|
239
|
-
}
|
|
240
|
-
var CRC32_TABLE = Uint32Array.from({ length: 256 }, (_, n) => {
|
|
241
|
-
let c = n;
|
|
242
|
-
for (let k = 0; k < 8; k++) c = c & 1 ? 3988292384 ^ c >>> 1 : c >>> 1;
|
|
243
|
-
return c;
|
|
244
|
-
});
|
|
245
|
-
/** CRC-32 (the zlib one) of ASCII text. */
|
|
246
|
-
function crc32(text) {
|
|
247
|
-
let crc = 4294967295;
|
|
248
|
-
for (let i = 0; i < text.length; i++) crc = CRC32_TABLE[(crc ^ text.charCodeAt(i)) & 255] ^ crc >>> 8;
|
|
249
|
-
return (crc ^ 4294967295) >>> 0;
|
|
250
|
-
}
|
|
251
|
-
/** A WIF private key: base58check with version 0x80 (mainnet) or 0xef (testnet), 32 bytes and an optional 0x01. */
|
|
252
|
-
function hasWif(text) {
|
|
253
|
-
for (const [candidate] of text.matchAll(WIF)) try {
|
|
254
|
-
const payload = base58check.decode(candidate);
|
|
255
|
-
if ((payload[0] === 128 || payload[0] === 239) && (payload.length === 33 || payload.length === 34 && payload[33] === 1)) return true;
|
|
256
|
-
} catch {}
|
|
257
|
-
return false;
|
|
258
|
-
}
|
|
259
|
-
/** 64 or 128 hex digits with "private key", "secret", "seed" or the like close by. A bare hash is not asked about. */
|
|
260
|
-
function hasHexSecret(text) {
|
|
261
|
-
for (const match of text.matchAll(HEX_SECRET)) {
|
|
262
|
-
const before = text.slice(Math.max(0, match.index - CONTEXT_REACH), match.index);
|
|
263
|
-
const after = text.slice(match.index + match[0].length, match.index + match[0].length + CONTEXT_REACH);
|
|
264
|
-
if (SECRET_CONTEXT.test(before) || SECRET_CONTEXT.test(after)) return true;
|
|
265
|
-
}
|
|
266
|
-
return false;
|
|
267
|
-
}
|
|
268
|
-
/** Every Cashu token in the text, with their amounts added up when all of them decode and share one unit. */
|
|
269
|
-
function findCashu(text) {
|
|
270
|
-
const tokens = [...text.matchAll(CASHU_TOKEN)].map(([, version, body]) => decodeCashu(version, body));
|
|
271
|
-
if (!tokens.length) return null;
|
|
272
|
-
const unit = tokens.find((token) => token)?.unit ?? "sat";
|
|
273
|
-
return {
|
|
274
|
-
kind: "cashu",
|
|
275
|
-
amount: tokens.every((token) => token && token.unit === unit) ? tokens.reduce((sum, token) => sum + token.amount, 0) : null,
|
|
276
|
-
unit
|
|
277
|
-
};
|
|
278
|
-
}
|
|
279
|
-
/** What a Cashu token is worth, read from the token itself (NUT-00): nothing is asked of the mint. */
|
|
280
|
-
function decodeCashu(version, body) {
|
|
281
|
-
try {
|
|
282
|
-
const bytes = fromBase64(body);
|
|
283
|
-
if (version === "A") {
|
|
284
|
-
const token = JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(bytes));
|
|
285
|
-
return total(token.token?.flatMap((entry) => entry.proofs ?? []).map((proof) => proof.amount), token.unit);
|
|
286
|
-
}
|
|
287
|
-
const token = decodeCbor(bytes);
|
|
288
|
-
return total(token?.t?.flatMap((entry) => entry.p ?? []).map((proof) => proof.a), token?.u);
|
|
289
|
-
} catch {
|
|
290
|
-
return null;
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
function total(amounts, unit) {
|
|
294
|
-
if (!amounts?.length || !amounts.every((a) => Number.isSafeInteger(a) && a >= 0)) return null;
|
|
295
|
-
const amount = amounts.reduce((sum, a) => sum + a, 0);
|
|
296
|
-
return Number.isSafeInteger(amount) ? {
|
|
297
|
-
amount,
|
|
298
|
-
unit: typeof unit === "string" && unit ? unit : "sat"
|
|
299
|
-
} : null;
|
|
300
|
-
}
|
|
301
|
-
function fromBase64(text) {
|
|
302
|
-
const standard = text.replace(/-/g, "+").replace(/_/g, "/").replace(/=+$/, "");
|
|
303
|
-
const binary = atob(standard + "=".repeat((4 - standard.length % 4) % 4));
|
|
304
|
-
return Uint8Array.from(binary, (c) => c.charCodeAt(0));
|
|
305
|
-
}
|
|
306
|
-
/** Enough CBOR (RFC 8949) for a cashuB token: definite lengths, integers, bytes, text, arrays, maps, tags, simple values. */
|
|
307
|
-
function decodeCbor(bytes) {
|
|
308
|
-
let at = 0, depth = 0;
|
|
309
|
-
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
310
|
-
const length = (info) => {
|
|
311
|
-
if (info < 24) return info;
|
|
312
|
-
const size = info === 24 ? 1 : info === 25 ? 2 : info === 26 ? 4 : info === 27 ? 8 : 0;
|
|
313
|
-
if (!size || at + size > bytes.length) throw new Error("cbor");
|
|
314
|
-
let value = 0;
|
|
315
|
-
for (let i = 0; i < size; i++) value = value * 256 + bytes[at + i];
|
|
316
|
-
at += size;
|
|
317
|
-
return value;
|
|
318
|
-
};
|
|
319
|
-
const item = () => {
|
|
320
|
-
if (at >= bytes.length || ++depth > 32) throw new Error("cbor");
|
|
321
|
-
const head = bytes[at++], major = head >> 5, info = head & 31;
|
|
322
|
-
try {
|
|
323
|
-
if (major === 7) {
|
|
324
|
-
if (info === 20) return false;
|
|
325
|
-
if (info === 21) return true;
|
|
326
|
-
if (info === 22 || info === 23) return null;
|
|
327
|
-
if (info === 25) {
|
|
328
|
-
at += 2;
|
|
329
|
-
return NaN;
|
|
330
|
-
}
|
|
331
|
-
if (info === 26) {
|
|
332
|
-
at += 4;
|
|
333
|
-
return view.getFloat32(at - 4);
|
|
334
|
-
}
|
|
335
|
-
if (info === 27) {
|
|
336
|
-
at += 8;
|
|
337
|
-
return view.getFloat64(at - 8);
|
|
338
|
-
}
|
|
339
|
-
throw new Error("cbor");
|
|
340
|
-
}
|
|
341
|
-
const n = length(info);
|
|
342
|
-
switch (major) {
|
|
343
|
-
case 0: return n;
|
|
344
|
-
case 1: return -1 - n;
|
|
345
|
-
case 2:
|
|
346
|
-
case 3: {
|
|
347
|
-
if (at + n > bytes.length) throw new Error("cbor");
|
|
348
|
-
const slice = bytes.subarray(at, at += n);
|
|
349
|
-
return major === 2 ? slice : new TextDecoder("utf-8", { fatal: true }).decode(slice);
|
|
350
|
-
}
|
|
351
|
-
case 4:
|
|
352
|
-
if (n > bytes.length - at) throw new Error("cbor");
|
|
353
|
-
return Array.from({ length: n }, item);
|
|
354
|
-
case 5: {
|
|
355
|
-
if (n > bytes.length - at) throw new Error("cbor");
|
|
356
|
-
const map = Object.create(null);
|
|
357
|
-
for (let i = 0; i < n; i++) {
|
|
358
|
-
const key = item();
|
|
359
|
-
map[String(key)] = item();
|
|
360
|
-
}
|
|
361
|
-
return map;
|
|
362
|
-
}
|
|
363
|
-
default: return item();
|
|
364
|
-
}
|
|
365
|
-
} finally {
|
|
366
|
-
depth--;
|
|
367
|
-
}
|
|
368
|
-
};
|
|
369
|
-
return item();
|
|
370
|
-
}
|
|
371
|
-
//#endregion
|
|
372
|
-
//#region src/waits.ts
|
|
373
|
-
var DELIVERY_RANK = {
|
|
374
|
-
sending: 0,
|
|
375
|
-
waiting: 1,
|
|
376
|
-
queued: 1,
|
|
377
|
-
held: 2,
|
|
378
|
-
sent: 2,
|
|
379
|
-
delivered: 3
|
|
380
|
-
};
|
|
381
|
-
/**
|
|
382
|
-
* What a timed-out wait says of what happens next: a daemon goes on, a one-shot's profile closes now. A one-shot's
|
|
383
|
-
* `edit` and `group edit` said "while this profile is online" too, as it was about to leave. Ctrl-C says the same.
|
|
384
|
-
*/
|
|
385
|
-
var goesOn = (ctx) => goesOn$1(ctx.mode);
|
|
386
|
-
/** Waits until the contact confirmed the latest edit of one of my messages (it is no longer pending). */
|
|
387
|
-
async function waitForEdit(ctx, chat, messageId, ms) {
|
|
388
|
-
const until = Date.now() + ms;
|
|
389
|
-
for (;;) {
|
|
390
|
-
const message = await node(ctx).getMessage(chat, messageId);
|
|
391
|
-
if (!message) throw new CliError("not_found", `No message ${messageId} in this chat`);
|
|
392
|
-
if (!message.edit?.pending) return message;
|
|
393
|
-
if (Date.now() >= until) throw new CliError("timeout", `Timed out after ${Math.round(ms / 1e3)} s: the contact has not confirmed the edit yet (it needs a live chat and a contact's app that shows edits). It ${goesOn(ctx)}`, {
|
|
394
|
-
messageId,
|
|
395
|
-
edits: message.edit.seq
|
|
396
|
-
});
|
|
397
|
-
await new Promise((resolve) => setTimeout(resolve, 250));
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
/** Waits until the contact confirmed my removal of a message, which is already gone here. */
|
|
401
|
-
async function waitForRemoval(ctx, chat, messageId, ms) {
|
|
402
|
-
const until = Date.now() + ms;
|
|
403
|
-
while (node(ctx).removalPending({
|
|
404
|
-
linkId: chat,
|
|
405
|
-
messageId
|
|
406
|
-
})) {
|
|
407
|
-
if (Date.now() >= until) throw new CliError("timeout", `Timed out after ${Math.round(ms / 1e3)} s: the message is gone here and the contact has not confirmed yet. Its removal ${goesOn(ctx)}`, { messageId });
|
|
408
|
-
await new Promise((resolve) => setTimeout(resolve, 250));
|
|
409
|
-
}
|
|
410
|
-
}
|
|
411
|
-
/**
|
|
412
|
-
* Waits until an edge took my group message, or its edit number `edit` (WISP 902: a group has no receipts, so this is
|
|
413
|
-
* as far as the author sees): a member's edge in a private group, an edge to one of my hubs in a community.
|
|
414
|
-
*/
|
|
415
|
-
async function waitForGroupFrame(ctx, groupId, messageId, edit, ms) {
|
|
416
|
-
const until = Date.now() + ms;
|
|
417
|
-
for (;;) {
|
|
418
|
-
const taken = node(ctx).groupTaken({
|
|
419
|
-
groupId,
|
|
420
|
-
messageId,
|
|
421
|
-
...edit ? { edit } : {}
|
|
422
|
-
});
|
|
423
|
-
if (taken > 0) return taken;
|
|
424
|
-
if (Date.now() >= until) throw new CliError("timeout", `Timed out after ${Math.round(ms / 1e3)} s: no member's edge took it yet (it stays in the group and goes when one opens). It ${goesOn(ctx)}`, {
|
|
425
|
-
messageId,
|
|
426
|
-
...edit ? { edits: edit } : {}
|
|
427
|
-
});
|
|
428
|
-
await new Promise((resolve) => setTimeout(resolve, 250));
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
/**
|
|
432
|
-
* A one-shot whose text went over the live link waits this long for its receipt before it leaves (`waitForMessage`).
|
|
433
|
-
* Left at `sent`, the engine stopping took the text for unconfirmed, the next start sent it again on the DHT, and that
|
|
434
|
-
* copy took the chat's one DHT text awaiting a receipt: a script's next one-shot send waited 30 s behind it, every 5-8
|
|
435
|
-
* messages, and the last text showed "Connection closed before receipt" though the contact had it (agents#1640).
|
|
436
|
-
*/
|
|
437
|
-
var ONE_SHOT_RECEIPT_MS = 2e3;
|
|
438
|
-
/**
|
|
439
|
-
* Waits until the contact confirmed my reaction or pin in a 1:1 chat (WISP 401): until `pending` no longer finds it in
|
|
440
|
-
* what the contact has not confirmed (`chatUnconfirmed`). It goes on the live session, a reaction also on the DHT
|
|
441
|
-
* envelopes; one not confirmed in time is kept and said again.
|
|
442
|
-
*/
|
|
443
|
-
async function waitForConfirmed(ctx, chat, what, pending, ms) {
|
|
444
|
-
const until = Date.now() + ms;
|
|
445
|
-
while (pending(node(ctx).chatUnconfirmed({ linkId: chat }))) {
|
|
446
|
-
if (Date.now() >= until) throw new CliError("timeout", `Timed out after ${Math.round(ms / 1e3)} s: the contact has not confirmed the ${what} yet. It is kept here and ${goesOn(ctx)}`, { chat });
|
|
447
|
-
await new Promise((resolve) => setTimeout(resolve, 250));
|
|
448
|
-
}
|
|
449
|
-
}
|
|
450
|
-
/**
|
|
451
|
-
* Waits until a message of mine reached `target` (`sent`: on its way to the contact; `delivered`: acknowledged). A
|
|
452
|
-
* one-shot's text sent over the live link waits a moment more for its receipt (`ONE_SHOT_RECEIPT_MS`).
|
|
453
|
-
*/
|
|
454
|
-
async function waitForMessage(ctx, chat, messageId, target, ms) {
|
|
455
|
-
const reached = await waitForDelivery(ctx, chat, messageId, target, ms);
|
|
456
|
-
if (ctx.mode !== "one-shot" || target !== "sent" || reached.delivery !== "sent" || reached.via !== "datalink") return reached;
|
|
457
|
-
return waitForDelivery(ctx, chat, messageId, "delivered", ONE_SHOT_RECEIPT_MS).catch(async () => await node(ctx).getMessage(chat, messageId) ?? reached);
|
|
458
|
-
}
|
|
459
|
-
async function waitForDelivery(ctx, chat, messageId, target, ms) {
|
|
460
|
-
const want = DELIVERY_RANK[target];
|
|
461
|
-
const look = (message) => {
|
|
462
|
-
if (!message) return void 0;
|
|
463
|
-
const delivery = message.delivery ?? "sent";
|
|
464
|
-
if (delivery === "failed") throw new CliError("engine", message.deliveryError ?? "The message could not be sent", {
|
|
465
|
-
messageId,
|
|
466
|
-
delivery
|
|
467
|
-
});
|
|
468
|
-
return (DELIVERY_RANK[delivery] ?? 0) >= want ? message : void 0;
|
|
469
|
-
};
|
|
470
|
-
return new Promise((resolve, reject) => {
|
|
471
|
-
let settled = false;
|
|
472
|
-
const finish = (error, message) => {
|
|
473
|
-
if (settled) return;
|
|
474
|
-
settled = true;
|
|
475
|
-
clearTimeout(timer);
|
|
476
|
-
off();
|
|
477
|
-
if (error) reject(error);
|
|
478
|
-
else resolve(message);
|
|
479
|
-
};
|
|
480
|
-
const check = (last = false) => void node(ctx).getMessage(chat, messageId).then((message) => {
|
|
481
|
-
try {
|
|
482
|
-
const done = look(message);
|
|
483
|
-
if (done) finish(null, done);
|
|
484
|
-
else if (last) finish(new CliError("timeout", `Timed out after ${Math.round(ms / 1e3)} s: the message is ${message?.delivery ?? "not sent yet"} and ${goesOn(ctx)}`, {
|
|
485
|
-
messageId,
|
|
486
|
-
delivery: message?.delivery ?? null
|
|
487
|
-
}));
|
|
488
|
-
} catch (error) {
|
|
489
|
-
finish(error);
|
|
490
|
-
}
|
|
491
|
-
}, finish);
|
|
492
|
-
const timer = setTimeout(() => check(true), ms);
|
|
493
|
-
const off = ctx.hub.onEvent((event) => {
|
|
494
|
-
if (event.chat === chat && (event.messageId === messageId || event.message?.id === messageId)) check();
|
|
495
|
-
});
|
|
496
|
-
check();
|
|
497
|
-
});
|
|
498
|
-
}
|
|
499
|
-
//#endregion
|
|
500
|
-
//#region src/buttons.ts
|
|
501
|
-
/**
|
|
502
|
-
* `--button id:Label` (again for each, 1 to 6), `--style id=primary|neutral|danger`, `--once` and `--id`, as the
|
|
503
|
-
* method's parameters: `buttons` and `buttonsId`. Nothing when no `--button` is given. The label may hold colons: the
|
|
504
|
-
* id ends at the first one. An id given twice, two labels that read the same (ignoring case and spaces at the ends), a
|
|
505
|
-
* label that is another button's id, or a style not listed are a usage error here, before the profile opens; other
|
|
506
|
-
* bounds (ids, labels, how many) are the card's, checked when it is sent.
|
|
507
|
-
*/
|
|
508
|
-
function buttonsOf(options) {
|
|
509
|
-
const given = Array.isArray(options.button) ? options.button : [];
|
|
510
|
-
if (!given.length) {
|
|
511
|
-
for (const flag of [
|
|
512
|
-
"style",
|
|
513
|
-
"once",
|
|
514
|
-
"id"
|
|
515
|
-
]) if (options[flag] !== void 0) throw new CliError("usage", `--${flag} goes with --button id:Label`);
|
|
516
|
-
return;
|
|
517
|
-
}
|
|
518
|
-
const buttons = given.map((value) => {
|
|
519
|
-
const colon = value.indexOf(":");
|
|
520
|
-
if (colon < 1 || colon === value.length - 1) throw new CliError("usage", `--button takes id:Label, like yes:Yes, not ${JSON.stringify(value)}`);
|
|
521
|
-
return {
|
|
522
|
-
id: value.slice(0, colon),
|
|
523
|
-
label: value.slice(colon + 1).trim()
|
|
524
|
-
};
|
|
525
|
-
});
|
|
526
|
-
const twice = buttons.findIndex((button, at) => buttons.findIndex((other) => other.id === button.id) !== at);
|
|
527
|
-
if (twice !== -1) throw new CliError("usage", `--button ${JSON.stringify(given[twice])} repeats the id ${JSON.stringify(buttons[twice].id)}: each button takes its own`);
|
|
528
|
-
const clash = buttonLabelClash(buttons);
|
|
529
|
-
if (clash) {
|
|
530
|
-
const [at, other] = [JSON.stringify(given[clash.at]), JSON.stringify(given[clash.with])];
|
|
531
|
-
throw new CliError("usage", clash.kind === "label" ? `--button ${at} repeats the label of --button ${other} (ignoring case and spaces): a typed answer could not tell them apart` : `--button ${at} has a label that is the id of --button ${other}: a typed answer could not tell them apart`);
|
|
532
|
-
}
|
|
533
|
-
for (const value of Array.isArray(options.style) ? options.style : []) {
|
|
534
|
-
const eq = value.indexOf("=");
|
|
535
|
-
const button = eq > 0 ? buttons.find((b) => b.id === value.slice(0, eq)) : void 0;
|
|
536
|
-
if (!button) throw new CliError("usage", `--style takes id=primary|neutral|danger for one of the buttons, not ${JSON.stringify(value)}`);
|
|
537
|
-
const style = value.slice(eq + 1);
|
|
538
|
-
if (!BUTTON_STYLES.includes(style)) throw new CliError("usage", `--style ${JSON.stringify(value)}: a button's style is ${BUTTON_STYLES.join(", ")}`);
|
|
539
|
-
button.style = style;
|
|
540
|
-
}
|
|
541
|
-
if (options.once === true) for (const button of buttons) button.once = true;
|
|
542
|
-
return {
|
|
543
|
-
buttons,
|
|
544
|
-
...options.id !== void 0 && { buttonsId: String(options.id) }
|
|
545
|
-
};
|
|
546
|
-
}
|
|
547
|
-
/** A buttons card checked by the sender's rule, or a `bad_request` that says what is wrong. */
|
|
548
|
-
function checked(card) {
|
|
549
|
-
const result = checkStatusCard(card);
|
|
550
|
-
if ("error" in result) throw new CliError("bad_request", `Buttons: ${result.error}`, { card });
|
|
551
|
-
return result.card;
|
|
552
|
-
}
|
|
553
|
-
/**
|
|
554
|
-
* The card a send's `buttons` (and `buttonsId`) make, or undefined when it names none. `buttons` is a list of
|
|
555
|
-
* `{id, label, style?, once?}`; the id of the question is made up (`ask-…`) unless given.
|
|
556
|
-
*/
|
|
557
|
-
function buttonsCard(params) {
|
|
558
|
-
const buttons = params.buttons;
|
|
559
|
-
if (buttons === void 0 || buttons === null) {
|
|
560
|
-
if (params.buttonsId !== void 0) throw new CliError("bad_request", "buttonsId goes with buttons");
|
|
561
|
-
return;
|
|
562
|
-
}
|
|
563
|
-
if (!Array.isArray(buttons)) throw new CliError("bad_request", "buttons must be a list of {id, label, style?, once?}");
|
|
564
|
-
return checked({
|
|
565
|
-
kind: "buttons",
|
|
566
|
-
id: str(params, "buttonsId") ?? `ask-${toBase64Url(randomBytes(6))}`,
|
|
567
|
-
buttons
|
|
568
|
-
});
|
|
569
|
-
}
|
|
570
|
-
/** Whether a 1:1 contact's app shows and presses buttons: null until its app said what it offers. */
|
|
571
|
-
function pressable(link) {
|
|
572
|
-
const peer = link.sessionOffers?.peer;
|
|
573
|
-
return peer ? peer.includes(BUTTONS_CAPABILITY) : null;
|
|
574
|
-
}
|
|
575
|
-
/** The message of mine with buttons that `button update` names, by its id here (or the id both sides know). */
|
|
576
|
-
function buttonsMessage(message, ref, group) {
|
|
577
|
-
if (!message) throw new CliError("not_found", `No message ${JSON.stringify(ref)} of yours in this ${group ? "group" : "chat"}: the messageId send gave`);
|
|
578
|
-
if (message.card?.kind !== "buttons") throw new CliError("bad_request", "That message has no buttons: send one with send --button id:Label");
|
|
579
|
-
return message;
|
|
580
|
-
}
|
|
581
|
-
/**
|
|
582
|
-
* `button update`: the answer shown on a question's buttons (`chosen`), the buttons closed (`close`), or a new text
|
|
583
|
-
* (`text`), by editing the message with the same buttons. What is not given stays as it was.
|
|
584
|
-
*/
|
|
585
|
-
async function updateButtons(ctx, params) {
|
|
586
|
-
const target = chatOrGroup(ctx, str(params, "chat", true));
|
|
587
|
-
const ref = str(params, "message", true);
|
|
588
|
-
const chosen = str(params, "chosen");
|
|
589
|
-
const close = bool(params, "close");
|
|
590
|
-
const newText = str(params, "text");
|
|
591
|
-
if (chosen === void 0 && !close && newText === void 0) throw new CliError("bad_request", "Nothing to update: give chosen, close or text");
|
|
592
|
-
if (newText !== void 0 && !bool(params, "force")) {
|
|
593
|
-
const secret = findSecret(newText);
|
|
594
|
-
if (secret) throw new CliError("confirm", `The text looks like ${secret.kind === "cashu" ? "a Cashu token (money anyone who reads it can take)" : "a secret (a seed or a private key)"}; update with --force if you mean to`, { kind: secret.kind });
|
|
595
|
-
}
|
|
596
|
-
const message = buttonsMessage(await messageOf(ctx, target.linkId, ref, (m) => m.sender === "me"), ref, target.group);
|
|
597
|
-
if ((message.edit?.seq ?? 0) >= STATUS_CARD_LIMITS.edits) throw new CliError("refused", `This message took ${STATUS_CARD_LIMITS.edits} updates, the most one takes: ask again with a new send`, {
|
|
598
|
-
messageId: message.id,
|
|
599
|
-
edits: message.edit.seq
|
|
600
|
-
});
|
|
601
|
-
const before = message.card;
|
|
602
|
-
if (chosen !== void 0 && !before.buttons.some((b) => b.id === chosen)) throw new CliError("bad_request", `That message has no button ${JSON.stringify(chosen)}; its buttons: ${before.buttons.map((b) => b.id).join(", ")}`, { card: before });
|
|
603
|
-
const card = checked({
|
|
604
|
-
...before,
|
|
605
|
-
...chosen !== void 0 && { chosen },
|
|
606
|
-
...(close || before.closed) && { closed: true }
|
|
607
|
-
});
|
|
608
|
-
const text = newText ?? message.text;
|
|
609
|
-
const wait = oneOf(params, "wait", target.group ? ["none", "sent"] : ["none", "confirmed"], "none");
|
|
610
|
-
const ms = num(params, "timeout", 30, {
|
|
611
|
-
min: 1,
|
|
612
|
-
max: 3600
|
|
613
|
-
}) * 1e3;
|
|
614
|
-
const result = await node(ctx).editMessage({
|
|
615
|
-
linkId: target.linkId,
|
|
616
|
-
messageId: message.id,
|
|
617
|
-
text,
|
|
618
|
-
card
|
|
619
|
-
});
|
|
620
|
-
if (result.error) throw new CliError(result.refused ? "refused" : "unavailable", result.error);
|
|
621
|
-
let edited = await node(ctx).getMessage(target.linkId, message.id);
|
|
622
|
-
if (wait === "confirmed" && edited?.edit?.pending) edited = await waitForEdit(ctx, target.linkId, message.id, ms);
|
|
623
|
-
const edges = wait === "sent" && edited?.edit ? await waitForGroupFrame(ctx, target.id, message.id, edited.edit.seq, ms) : void 0;
|
|
624
|
-
return {
|
|
625
|
-
[target.group ? "group" : "chat"]: target.id,
|
|
626
|
-
buttons: card.id,
|
|
627
|
-
messageId: message.id,
|
|
628
|
-
card,
|
|
629
|
-
edits: edited?.edit?.seq ?? 0,
|
|
630
|
-
...target.group ? { ...edges !== void 0 && { edges } } : { confirmed: !!edited && !edited.edit?.pending }
|
|
631
|
-
};
|
|
632
|
-
}
|
|
633
|
-
/**
|
|
634
|
-
* `button press`: the other side of a question, as the app's tap: a press on a button of someone else's message, by
|
|
635
|
-
* its id here (or the id both sides know). The engine sends a reply whose text is the button's label, and refuses what
|
|
636
|
-
* an app would: a button the message does not have, closed buttons, a second answer past `once`, a second press
|
|
637
|
-
* within a second. A one-shot in a chat waits until the press went out, as `send` does.
|
|
638
|
-
*/
|
|
639
|
-
async function pressButton(ctx, params) {
|
|
640
|
-
const target = chatOrGroup(ctx, str(params, "chat", true));
|
|
641
|
-
const ref = str(params, "message", true);
|
|
642
|
-
const buttonId = str(params, "button", true);
|
|
643
|
-
const where = target.group ? "group" : "chat";
|
|
644
|
-
const message = await messageOf(ctx, target.linkId, ref, (m) => m.sender !== "me");
|
|
645
|
-
if (!message) throw new CliError("not_found", `No message ${JSON.stringify(ref)} from someone else in this ${where}: the id its event or history gave`);
|
|
646
|
-
if (message.card?.kind !== "buttons") throw new CliError("bad_request", "That message has no buttons");
|
|
647
|
-
const button = message.card.buttons.find((b) => b.id === buttonId);
|
|
648
|
-
if (!button) throw new CliError("not_found", `That message has no button ${JSON.stringify(buttonId)}; its buttons: ${message.card.buttons.map((b) => b.id).join(", ")}`);
|
|
649
|
-
const wait = target.group ? oneOf(params, "wait", ["none", "sent"], "none") : oneOf(params, "wait", [
|
|
650
|
-
"none",
|
|
651
|
-
"sent",
|
|
652
|
-
"delivered"
|
|
653
|
-
], ctx.mode === "one-shot" ? "sent" : "none");
|
|
654
|
-
const ms = num(params, "timeout", 30, {
|
|
655
|
-
min: 1,
|
|
656
|
-
max: 3600
|
|
657
|
-
}) * 1e3;
|
|
658
|
-
const result = await node(ctx).pressButton({
|
|
659
|
-
linkId: target.linkId,
|
|
660
|
-
messageId: message.id,
|
|
661
|
-
buttonId
|
|
662
|
-
});
|
|
663
|
-
if (result.error) throw new CliError(result.refused ? "refused" : "unavailable", result.error, result.paced ? { paced: true } : void 0);
|
|
664
|
-
const replyId = result.messageId ?? null;
|
|
665
|
-
const answer = {
|
|
666
|
-
[where]: target.id,
|
|
667
|
-
messageId: message.id,
|
|
668
|
-
button: button.id,
|
|
669
|
-
label: button.label,
|
|
670
|
-
replyId
|
|
671
|
-
};
|
|
672
|
-
if (!replyId) return answer;
|
|
673
|
-
if (target.group) {
|
|
674
|
-
const edges = wait === "sent" ? await waitForGroupFrame(ctx, target.id, replyId, void 0, ms) : node(ctx).groupTaken({
|
|
675
|
-
groupId: target.id,
|
|
676
|
-
messageId: replyId
|
|
677
|
-
});
|
|
678
|
-
return {
|
|
679
|
-
...answer,
|
|
680
|
-
edges
|
|
681
|
-
};
|
|
682
|
-
}
|
|
683
|
-
const reply = wait === "none" ? await node(ctx).getMessage(target.linkId, replyId) : await waitForMessage(ctx, target.linkId, replyId, wait, ms);
|
|
684
|
-
return {
|
|
685
|
-
...answer,
|
|
686
|
-
delivery: reply?.delivery ?? null
|
|
687
|
-
};
|
|
688
|
-
}
|
|
689
|
-
var BUTTON_METHODS = {
|
|
690
|
-
/** WISP 406 · Message Buttons: a press on a button of someone else's message, as the app's tap. */
|
|
691
|
-
"button.press": pressButton,
|
|
692
|
-
/** WISP 406 · Message Buttons: the answer chosen on a question of mine, its buttons closed, or its text changed. */
|
|
693
|
-
"button.update": updateButtons
|
|
694
|
-
};
|
|
695
|
-
//#endregion
|
|
696
|
-
export { waitForConfirmed as a, waitForMessage as c, pressable as i, waitForRemoval as l, buttonsCard as n, waitForEdit as o, buttonsOf as r, waitForGroupFrame as s, BUTTON_METHODS as t, findSecret as u };
|
|
697
|
-
|
|
698
|
-
//# sourceMappingURL=buttons-Bd9fR31r.js.map
|