@abraca/dabra 1.3.1 → 1.3.3

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.
@@ -31,6 +31,7 @@ yjs = __toESM(yjs);
31
31
  let _lifeomic_attempt = require("@lifeomic/attempt");
32
32
  let _noble_ed25519 = require("@noble/ed25519");
33
33
  _noble_ed25519 = __toESM(_noble_ed25519);
34
+ let _scure_bip39 = require("@scure/bip39");
34
35
 
35
36
  //#region packages/provider/src/awarenessStatesToArray.ts
36
37
  const awarenessStatesToArray = (states) => {
@@ -3066,6 +3067,7 @@ var AbracadabraProvider = class AbracadabraProvider extends AbracadabraBaseProvi
3066
3067
  if (origin === this) return;
3067
3068
  if (this.offlineStore !== null && origin === this.offlineStore) return;
3068
3069
  this.offlineStore?.persistUpdate(update).catch(() => null);
3070
+ if (!this.canWrite) return;
3069
3071
  super.documentUpdateHandler(update, origin);
3070
3072
  }
3071
3073
  /**
@@ -3079,6 +3081,7 @@ var AbracadabraProvider = class AbracadabraProvider extends AbracadabraBaseProvi
3079
3081
  * errors across async await boundaries.
3080
3082
  */
3081
3083
  async flushPendingUpdates() {
3084
+ if (!this.canWrite) return;
3082
3085
  const store = this.offlineStore;
3083
3086
  if (!store) return;
3084
3087
  const updates = await store.getPendingUpdates();
@@ -7120,23 +7123,2202 @@ const ristretto255_oprf = createORPF({
7120
7123
  hashToScalar: ristretto255_hasher.hashToScalar
7121
7124
  });
7122
7125
 
7126
+ //#endregion
7127
+ //#region node_modules/@scure/bip39/esm/wordlists/english.js
7128
+ const wordlist = `abandon
7129
+ ability
7130
+ able
7131
+ about
7132
+ above
7133
+ absent
7134
+ absorb
7135
+ abstract
7136
+ absurd
7137
+ abuse
7138
+ access
7139
+ accident
7140
+ account
7141
+ accuse
7142
+ achieve
7143
+ acid
7144
+ acoustic
7145
+ acquire
7146
+ across
7147
+ act
7148
+ action
7149
+ actor
7150
+ actress
7151
+ actual
7152
+ adapt
7153
+ add
7154
+ addict
7155
+ address
7156
+ adjust
7157
+ admit
7158
+ adult
7159
+ advance
7160
+ advice
7161
+ aerobic
7162
+ affair
7163
+ afford
7164
+ afraid
7165
+ again
7166
+ age
7167
+ agent
7168
+ agree
7169
+ ahead
7170
+ aim
7171
+ air
7172
+ airport
7173
+ aisle
7174
+ alarm
7175
+ album
7176
+ alcohol
7177
+ alert
7178
+ alien
7179
+ all
7180
+ alley
7181
+ allow
7182
+ almost
7183
+ alone
7184
+ alpha
7185
+ already
7186
+ also
7187
+ alter
7188
+ always
7189
+ amateur
7190
+ amazing
7191
+ among
7192
+ amount
7193
+ amused
7194
+ analyst
7195
+ anchor
7196
+ ancient
7197
+ anger
7198
+ angle
7199
+ angry
7200
+ animal
7201
+ ankle
7202
+ announce
7203
+ annual
7204
+ another
7205
+ answer
7206
+ antenna
7207
+ antique
7208
+ anxiety
7209
+ any
7210
+ apart
7211
+ apology
7212
+ appear
7213
+ apple
7214
+ approve
7215
+ april
7216
+ arch
7217
+ arctic
7218
+ area
7219
+ arena
7220
+ argue
7221
+ arm
7222
+ armed
7223
+ armor
7224
+ army
7225
+ around
7226
+ arrange
7227
+ arrest
7228
+ arrive
7229
+ arrow
7230
+ art
7231
+ artefact
7232
+ artist
7233
+ artwork
7234
+ ask
7235
+ aspect
7236
+ assault
7237
+ asset
7238
+ assist
7239
+ assume
7240
+ asthma
7241
+ athlete
7242
+ atom
7243
+ attack
7244
+ attend
7245
+ attitude
7246
+ attract
7247
+ auction
7248
+ audit
7249
+ august
7250
+ aunt
7251
+ author
7252
+ auto
7253
+ autumn
7254
+ average
7255
+ avocado
7256
+ avoid
7257
+ awake
7258
+ aware
7259
+ away
7260
+ awesome
7261
+ awful
7262
+ awkward
7263
+ axis
7264
+ baby
7265
+ bachelor
7266
+ bacon
7267
+ badge
7268
+ bag
7269
+ balance
7270
+ balcony
7271
+ ball
7272
+ bamboo
7273
+ banana
7274
+ banner
7275
+ bar
7276
+ barely
7277
+ bargain
7278
+ barrel
7279
+ base
7280
+ basic
7281
+ basket
7282
+ battle
7283
+ beach
7284
+ bean
7285
+ beauty
7286
+ because
7287
+ become
7288
+ beef
7289
+ before
7290
+ begin
7291
+ behave
7292
+ behind
7293
+ believe
7294
+ below
7295
+ belt
7296
+ bench
7297
+ benefit
7298
+ best
7299
+ betray
7300
+ better
7301
+ between
7302
+ beyond
7303
+ bicycle
7304
+ bid
7305
+ bike
7306
+ bind
7307
+ biology
7308
+ bird
7309
+ birth
7310
+ bitter
7311
+ black
7312
+ blade
7313
+ blame
7314
+ blanket
7315
+ blast
7316
+ bleak
7317
+ bless
7318
+ blind
7319
+ blood
7320
+ blossom
7321
+ blouse
7322
+ blue
7323
+ blur
7324
+ blush
7325
+ board
7326
+ boat
7327
+ body
7328
+ boil
7329
+ bomb
7330
+ bone
7331
+ bonus
7332
+ book
7333
+ boost
7334
+ border
7335
+ boring
7336
+ borrow
7337
+ boss
7338
+ bottom
7339
+ bounce
7340
+ box
7341
+ boy
7342
+ bracket
7343
+ brain
7344
+ brand
7345
+ brass
7346
+ brave
7347
+ bread
7348
+ breeze
7349
+ brick
7350
+ bridge
7351
+ brief
7352
+ bright
7353
+ bring
7354
+ brisk
7355
+ broccoli
7356
+ broken
7357
+ bronze
7358
+ broom
7359
+ brother
7360
+ brown
7361
+ brush
7362
+ bubble
7363
+ buddy
7364
+ budget
7365
+ buffalo
7366
+ build
7367
+ bulb
7368
+ bulk
7369
+ bullet
7370
+ bundle
7371
+ bunker
7372
+ burden
7373
+ burger
7374
+ burst
7375
+ bus
7376
+ business
7377
+ busy
7378
+ butter
7379
+ buyer
7380
+ buzz
7381
+ cabbage
7382
+ cabin
7383
+ cable
7384
+ cactus
7385
+ cage
7386
+ cake
7387
+ call
7388
+ calm
7389
+ camera
7390
+ camp
7391
+ can
7392
+ canal
7393
+ cancel
7394
+ candy
7395
+ cannon
7396
+ canoe
7397
+ canvas
7398
+ canyon
7399
+ capable
7400
+ capital
7401
+ captain
7402
+ car
7403
+ carbon
7404
+ card
7405
+ cargo
7406
+ carpet
7407
+ carry
7408
+ cart
7409
+ case
7410
+ cash
7411
+ casino
7412
+ castle
7413
+ casual
7414
+ cat
7415
+ catalog
7416
+ catch
7417
+ category
7418
+ cattle
7419
+ caught
7420
+ cause
7421
+ caution
7422
+ cave
7423
+ ceiling
7424
+ celery
7425
+ cement
7426
+ census
7427
+ century
7428
+ cereal
7429
+ certain
7430
+ chair
7431
+ chalk
7432
+ champion
7433
+ change
7434
+ chaos
7435
+ chapter
7436
+ charge
7437
+ chase
7438
+ chat
7439
+ cheap
7440
+ check
7441
+ cheese
7442
+ chef
7443
+ cherry
7444
+ chest
7445
+ chicken
7446
+ chief
7447
+ child
7448
+ chimney
7449
+ choice
7450
+ choose
7451
+ chronic
7452
+ chuckle
7453
+ chunk
7454
+ churn
7455
+ cigar
7456
+ cinnamon
7457
+ circle
7458
+ citizen
7459
+ city
7460
+ civil
7461
+ claim
7462
+ clap
7463
+ clarify
7464
+ claw
7465
+ clay
7466
+ clean
7467
+ clerk
7468
+ clever
7469
+ click
7470
+ client
7471
+ cliff
7472
+ climb
7473
+ clinic
7474
+ clip
7475
+ clock
7476
+ clog
7477
+ close
7478
+ cloth
7479
+ cloud
7480
+ clown
7481
+ club
7482
+ clump
7483
+ cluster
7484
+ clutch
7485
+ coach
7486
+ coast
7487
+ coconut
7488
+ code
7489
+ coffee
7490
+ coil
7491
+ coin
7492
+ collect
7493
+ color
7494
+ column
7495
+ combine
7496
+ come
7497
+ comfort
7498
+ comic
7499
+ common
7500
+ company
7501
+ concert
7502
+ conduct
7503
+ confirm
7504
+ congress
7505
+ connect
7506
+ consider
7507
+ control
7508
+ convince
7509
+ cook
7510
+ cool
7511
+ copper
7512
+ copy
7513
+ coral
7514
+ core
7515
+ corn
7516
+ correct
7517
+ cost
7518
+ cotton
7519
+ couch
7520
+ country
7521
+ couple
7522
+ course
7523
+ cousin
7524
+ cover
7525
+ coyote
7526
+ crack
7527
+ cradle
7528
+ craft
7529
+ cram
7530
+ crane
7531
+ crash
7532
+ crater
7533
+ crawl
7534
+ crazy
7535
+ cream
7536
+ credit
7537
+ creek
7538
+ crew
7539
+ cricket
7540
+ crime
7541
+ crisp
7542
+ critic
7543
+ crop
7544
+ cross
7545
+ crouch
7546
+ crowd
7547
+ crucial
7548
+ cruel
7549
+ cruise
7550
+ crumble
7551
+ crunch
7552
+ crush
7553
+ cry
7554
+ crystal
7555
+ cube
7556
+ culture
7557
+ cup
7558
+ cupboard
7559
+ curious
7560
+ current
7561
+ curtain
7562
+ curve
7563
+ cushion
7564
+ custom
7565
+ cute
7566
+ cycle
7567
+ dad
7568
+ damage
7569
+ damp
7570
+ dance
7571
+ danger
7572
+ daring
7573
+ dash
7574
+ daughter
7575
+ dawn
7576
+ day
7577
+ deal
7578
+ debate
7579
+ debris
7580
+ decade
7581
+ december
7582
+ decide
7583
+ decline
7584
+ decorate
7585
+ decrease
7586
+ deer
7587
+ defense
7588
+ define
7589
+ defy
7590
+ degree
7591
+ delay
7592
+ deliver
7593
+ demand
7594
+ demise
7595
+ denial
7596
+ dentist
7597
+ deny
7598
+ depart
7599
+ depend
7600
+ deposit
7601
+ depth
7602
+ deputy
7603
+ derive
7604
+ describe
7605
+ desert
7606
+ design
7607
+ desk
7608
+ despair
7609
+ destroy
7610
+ detail
7611
+ detect
7612
+ develop
7613
+ device
7614
+ devote
7615
+ diagram
7616
+ dial
7617
+ diamond
7618
+ diary
7619
+ dice
7620
+ diesel
7621
+ diet
7622
+ differ
7623
+ digital
7624
+ dignity
7625
+ dilemma
7626
+ dinner
7627
+ dinosaur
7628
+ direct
7629
+ dirt
7630
+ disagree
7631
+ discover
7632
+ disease
7633
+ dish
7634
+ dismiss
7635
+ disorder
7636
+ display
7637
+ distance
7638
+ divert
7639
+ divide
7640
+ divorce
7641
+ dizzy
7642
+ doctor
7643
+ document
7644
+ dog
7645
+ doll
7646
+ dolphin
7647
+ domain
7648
+ donate
7649
+ donkey
7650
+ donor
7651
+ door
7652
+ dose
7653
+ double
7654
+ dove
7655
+ draft
7656
+ dragon
7657
+ drama
7658
+ drastic
7659
+ draw
7660
+ dream
7661
+ dress
7662
+ drift
7663
+ drill
7664
+ drink
7665
+ drip
7666
+ drive
7667
+ drop
7668
+ drum
7669
+ dry
7670
+ duck
7671
+ dumb
7672
+ dune
7673
+ during
7674
+ dust
7675
+ dutch
7676
+ duty
7677
+ dwarf
7678
+ dynamic
7679
+ eager
7680
+ eagle
7681
+ early
7682
+ earn
7683
+ earth
7684
+ easily
7685
+ east
7686
+ easy
7687
+ echo
7688
+ ecology
7689
+ economy
7690
+ edge
7691
+ edit
7692
+ educate
7693
+ effort
7694
+ egg
7695
+ eight
7696
+ either
7697
+ elbow
7698
+ elder
7699
+ electric
7700
+ elegant
7701
+ element
7702
+ elephant
7703
+ elevator
7704
+ elite
7705
+ else
7706
+ embark
7707
+ embody
7708
+ embrace
7709
+ emerge
7710
+ emotion
7711
+ employ
7712
+ empower
7713
+ empty
7714
+ enable
7715
+ enact
7716
+ end
7717
+ endless
7718
+ endorse
7719
+ enemy
7720
+ energy
7721
+ enforce
7722
+ engage
7723
+ engine
7724
+ enhance
7725
+ enjoy
7726
+ enlist
7727
+ enough
7728
+ enrich
7729
+ enroll
7730
+ ensure
7731
+ enter
7732
+ entire
7733
+ entry
7734
+ envelope
7735
+ episode
7736
+ equal
7737
+ equip
7738
+ era
7739
+ erase
7740
+ erode
7741
+ erosion
7742
+ error
7743
+ erupt
7744
+ escape
7745
+ essay
7746
+ essence
7747
+ estate
7748
+ eternal
7749
+ ethics
7750
+ evidence
7751
+ evil
7752
+ evoke
7753
+ evolve
7754
+ exact
7755
+ example
7756
+ excess
7757
+ exchange
7758
+ excite
7759
+ exclude
7760
+ excuse
7761
+ execute
7762
+ exercise
7763
+ exhaust
7764
+ exhibit
7765
+ exile
7766
+ exist
7767
+ exit
7768
+ exotic
7769
+ expand
7770
+ expect
7771
+ expire
7772
+ explain
7773
+ expose
7774
+ express
7775
+ extend
7776
+ extra
7777
+ eye
7778
+ eyebrow
7779
+ fabric
7780
+ face
7781
+ faculty
7782
+ fade
7783
+ faint
7784
+ faith
7785
+ fall
7786
+ false
7787
+ fame
7788
+ family
7789
+ famous
7790
+ fan
7791
+ fancy
7792
+ fantasy
7793
+ farm
7794
+ fashion
7795
+ fat
7796
+ fatal
7797
+ father
7798
+ fatigue
7799
+ fault
7800
+ favorite
7801
+ feature
7802
+ february
7803
+ federal
7804
+ fee
7805
+ feed
7806
+ feel
7807
+ female
7808
+ fence
7809
+ festival
7810
+ fetch
7811
+ fever
7812
+ few
7813
+ fiber
7814
+ fiction
7815
+ field
7816
+ figure
7817
+ file
7818
+ film
7819
+ filter
7820
+ final
7821
+ find
7822
+ fine
7823
+ finger
7824
+ finish
7825
+ fire
7826
+ firm
7827
+ first
7828
+ fiscal
7829
+ fish
7830
+ fit
7831
+ fitness
7832
+ fix
7833
+ flag
7834
+ flame
7835
+ flash
7836
+ flat
7837
+ flavor
7838
+ flee
7839
+ flight
7840
+ flip
7841
+ float
7842
+ flock
7843
+ floor
7844
+ flower
7845
+ fluid
7846
+ flush
7847
+ fly
7848
+ foam
7849
+ focus
7850
+ fog
7851
+ foil
7852
+ fold
7853
+ follow
7854
+ food
7855
+ foot
7856
+ force
7857
+ forest
7858
+ forget
7859
+ fork
7860
+ fortune
7861
+ forum
7862
+ forward
7863
+ fossil
7864
+ foster
7865
+ found
7866
+ fox
7867
+ fragile
7868
+ frame
7869
+ frequent
7870
+ fresh
7871
+ friend
7872
+ fringe
7873
+ frog
7874
+ front
7875
+ frost
7876
+ frown
7877
+ frozen
7878
+ fruit
7879
+ fuel
7880
+ fun
7881
+ funny
7882
+ furnace
7883
+ fury
7884
+ future
7885
+ gadget
7886
+ gain
7887
+ galaxy
7888
+ gallery
7889
+ game
7890
+ gap
7891
+ garage
7892
+ garbage
7893
+ garden
7894
+ garlic
7895
+ garment
7896
+ gas
7897
+ gasp
7898
+ gate
7899
+ gather
7900
+ gauge
7901
+ gaze
7902
+ general
7903
+ genius
7904
+ genre
7905
+ gentle
7906
+ genuine
7907
+ gesture
7908
+ ghost
7909
+ giant
7910
+ gift
7911
+ giggle
7912
+ ginger
7913
+ giraffe
7914
+ girl
7915
+ give
7916
+ glad
7917
+ glance
7918
+ glare
7919
+ glass
7920
+ glide
7921
+ glimpse
7922
+ globe
7923
+ gloom
7924
+ glory
7925
+ glove
7926
+ glow
7927
+ glue
7928
+ goat
7929
+ goddess
7930
+ gold
7931
+ good
7932
+ goose
7933
+ gorilla
7934
+ gospel
7935
+ gossip
7936
+ govern
7937
+ gown
7938
+ grab
7939
+ grace
7940
+ grain
7941
+ grant
7942
+ grape
7943
+ grass
7944
+ gravity
7945
+ great
7946
+ green
7947
+ grid
7948
+ grief
7949
+ grit
7950
+ grocery
7951
+ group
7952
+ grow
7953
+ grunt
7954
+ guard
7955
+ guess
7956
+ guide
7957
+ guilt
7958
+ guitar
7959
+ gun
7960
+ gym
7961
+ habit
7962
+ hair
7963
+ half
7964
+ hammer
7965
+ hamster
7966
+ hand
7967
+ happy
7968
+ harbor
7969
+ hard
7970
+ harsh
7971
+ harvest
7972
+ hat
7973
+ have
7974
+ hawk
7975
+ hazard
7976
+ head
7977
+ health
7978
+ heart
7979
+ heavy
7980
+ hedgehog
7981
+ height
7982
+ hello
7983
+ helmet
7984
+ help
7985
+ hen
7986
+ hero
7987
+ hidden
7988
+ high
7989
+ hill
7990
+ hint
7991
+ hip
7992
+ hire
7993
+ history
7994
+ hobby
7995
+ hockey
7996
+ hold
7997
+ hole
7998
+ holiday
7999
+ hollow
8000
+ home
8001
+ honey
8002
+ hood
8003
+ hope
8004
+ horn
8005
+ horror
8006
+ horse
8007
+ hospital
8008
+ host
8009
+ hotel
8010
+ hour
8011
+ hover
8012
+ hub
8013
+ huge
8014
+ human
8015
+ humble
8016
+ humor
8017
+ hundred
8018
+ hungry
8019
+ hunt
8020
+ hurdle
8021
+ hurry
8022
+ hurt
8023
+ husband
8024
+ hybrid
8025
+ ice
8026
+ icon
8027
+ idea
8028
+ identify
8029
+ idle
8030
+ ignore
8031
+ ill
8032
+ illegal
8033
+ illness
8034
+ image
8035
+ imitate
8036
+ immense
8037
+ immune
8038
+ impact
8039
+ impose
8040
+ improve
8041
+ impulse
8042
+ inch
8043
+ include
8044
+ income
8045
+ increase
8046
+ index
8047
+ indicate
8048
+ indoor
8049
+ industry
8050
+ infant
8051
+ inflict
8052
+ inform
8053
+ inhale
8054
+ inherit
8055
+ initial
8056
+ inject
8057
+ injury
8058
+ inmate
8059
+ inner
8060
+ innocent
8061
+ input
8062
+ inquiry
8063
+ insane
8064
+ insect
8065
+ inside
8066
+ inspire
8067
+ install
8068
+ intact
8069
+ interest
8070
+ into
8071
+ invest
8072
+ invite
8073
+ involve
8074
+ iron
8075
+ island
8076
+ isolate
8077
+ issue
8078
+ item
8079
+ ivory
8080
+ jacket
8081
+ jaguar
8082
+ jar
8083
+ jazz
8084
+ jealous
8085
+ jeans
8086
+ jelly
8087
+ jewel
8088
+ job
8089
+ join
8090
+ joke
8091
+ journey
8092
+ joy
8093
+ judge
8094
+ juice
8095
+ jump
8096
+ jungle
8097
+ junior
8098
+ junk
8099
+ just
8100
+ kangaroo
8101
+ keen
8102
+ keep
8103
+ ketchup
8104
+ key
8105
+ kick
8106
+ kid
8107
+ kidney
8108
+ kind
8109
+ kingdom
8110
+ kiss
8111
+ kit
8112
+ kitchen
8113
+ kite
8114
+ kitten
8115
+ kiwi
8116
+ knee
8117
+ knife
8118
+ knock
8119
+ know
8120
+ lab
8121
+ label
8122
+ labor
8123
+ ladder
8124
+ lady
8125
+ lake
8126
+ lamp
8127
+ language
8128
+ laptop
8129
+ large
8130
+ later
8131
+ latin
8132
+ laugh
8133
+ laundry
8134
+ lava
8135
+ law
8136
+ lawn
8137
+ lawsuit
8138
+ layer
8139
+ lazy
8140
+ leader
8141
+ leaf
8142
+ learn
8143
+ leave
8144
+ lecture
8145
+ left
8146
+ leg
8147
+ legal
8148
+ legend
8149
+ leisure
8150
+ lemon
8151
+ lend
8152
+ length
8153
+ lens
8154
+ leopard
8155
+ lesson
8156
+ letter
8157
+ level
8158
+ liar
8159
+ liberty
8160
+ library
8161
+ license
8162
+ life
8163
+ lift
8164
+ light
8165
+ like
8166
+ limb
8167
+ limit
8168
+ link
8169
+ lion
8170
+ liquid
8171
+ list
8172
+ little
8173
+ live
8174
+ lizard
8175
+ load
8176
+ loan
8177
+ lobster
8178
+ local
8179
+ lock
8180
+ logic
8181
+ lonely
8182
+ long
8183
+ loop
8184
+ lottery
8185
+ loud
8186
+ lounge
8187
+ love
8188
+ loyal
8189
+ lucky
8190
+ luggage
8191
+ lumber
8192
+ lunar
8193
+ lunch
8194
+ luxury
8195
+ lyrics
8196
+ machine
8197
+ mad
8198
+ magic
8199
+ magnet
8200
+ maid
8201
+ mail
8202
+ main
8203
+ major
8204
+ make
8205
+ mammal
8206
+ man
8207
+ manage
8208
+ mandate
8209
+ mango
8210
+ mansion
8211
+ manual
8212
+ maple
8213
+ marble
8214
+ march
8215
+ margin
8216
+ marine
8217
+ market
8218
+ marriage
8219
+ mask
8220
+ mass
8221
+ master
8222
+ match
8223
+ material
8224
+ math
8225
+ matrix
8226
+ matter
8227
+ maximum
8228
+ maze
8229
+ meadow
8230
+ mean
8231
+ measure
8232
+ meat
8233
+ mechanic
8234
+ medal
8235
+ media
8236
+ melody
8237
+ melt
8238
+ member
8239
+ memory
8240
+ mention
8241
+ menu
8242
+ mercy
8243
+ merge
8244
+ merit
8245
+ merry
8246
+ mesh
8247
+ message
8248
+ metal
8249
+ method
8250
+ middle
8251
+ midnight
8252
+ milk
8253
+ million
8254
+ mimic
8255
+ mind
8256
+ minimum
8257
+ minor
8258
+ minute
8259
+ miracle
8260
+ mirror
8261
+ misery
8262
+ miss
8263
+ mistake
8264
+ mix
8265
+ mixed
8266
+ mixture
8267
+ mobile
8268
+ model
8269
+ modify
8270
+ mom
8271
+ moment
8272
+ monitor
8273
+ monkey
8274
+ monster
8275
+ month
8276
+ moon
8277
+ moral
8278
+ more
8279
+ morning
8280
+ mosquito
8281
+ mother
8282
+ motion
8283
+ motor
8284
+ mountain
8285
+ mouse
8286
+ move
8287
+ movie
8288
+ much
8289
+ muffin
8290
+ mule
8291
+ multiply
8292
+ muscle
8293
+ museum
8294
+ mushroom
8295
+ music
8296
+ must
8297
+ mutual
8298
+ myself
8299
+ mystery
8300
+ myth
8301
+ naive
8302
+ name
8303
+ napkin
8304
+ narrow
8305
+ nasty
8306
+ nation
8307
+ nature
8308
+ near
8309
+ neck
8310
+ need
8311
+ negative
8312
+ neglect
8313
+ neither
8314
+ nephew
8315
+ nerve
8316
+ nest
8317
+ net
8318
+ network
8319
+ neutral
8320
+ never
8321
+ news
8322
+ next
8323
+ nice
8324
+ night
8325
+ noble
8326
+ noise
8327
+ nominee
8328
+ noodle
8329
+ normal
8330
+ north
8331
+ nose
8332
+ notable
8333
+ note
8334
+ nothing
8335
+ notice
8336
+ novel
8337
+ now
8338
+ nuclear
8339
+ number
8340
+ nurse
8341
+ nut
8342
+ oak
8343
+ obey
8344
+ object
8345
+ oblige
8346
+ obscure
8347
+ observe
8348
+ obtain
8349
+ obvious
8350
+ occur
8351
+ ocean
8352
+ october
8353
+ odor
8354
+ off
8355
+ offer
8356
+ office
8357
+ often
8358
+ oil
8359
+ okay
8360
+ old
8361
+ olive
8362
+ olympic
8363
+ omit
8364
+ once
8365
+ one
8366
+ onion
8367
+ online
8368
+ only
8369
+ open
8370
+ opera
8371
+ opinion
8372
+ oppose
8373
+ option
8374
+ orange
8375
+ orbit
8376
+ orchard
8377
+ order
8378
+ ordinary
8379
+ organ
8380
+ orient
8381
+ original
8382
+ orphan
8383
+ ostrich
8384
+ other
8385
+ outdoor
8386
+ outer
8387
+ output
8388
+ outside
8389
+ oval
8390
+ oven
8391
+ over
8392
+ own
8393
+ owner
8394
+ oxygen
8395
+ oyster
8396
+ ozone
8397
+ pact
8398
+ paddle
8399
+ page
8400
+ pair
8401
+ palace
8402
+ palm
8403
+ panda
8404
+ panel
8405
+ panic
8406
+ panther
8407
+ paper
8408
+ parade
8409
+ parent
8410
+ park
8411
+ parrot
8412
+ party
8413
+ pass
8414
+ patch
8415
+ path
8416
+ patient
8417
+ patrol
8418
+ pattern
8419
+ pause
8420
+ pave
8421
+ payment
8422
+ peace
8423
+ peanut
8424
+ pear
8425
+ peasant
8426
+ pelican
8427
+ pen
8428
+ penalty
8429
+ pencil
8430
+ people
8431
+ pepper
8432
+ perfect
8433
+ permit
8434
+ person
8435
+ pet
8436
+ phone
8437
+ photo
8438
+ phrase
8439
+ physical
8440
+ piano
8441
+ picnic
8442
+ picture
8443
+ piece
8444
+ pig
8445
+ pigeon
8446
+ pill
8447
+ pilot
8448
+ pink
8449
+ pioneer
8450
+ pipe
8451
+ pistol
8452
+ pitch
8453
+ pizza
8454
+ place
8455
+ planet
8456
+ plastic
8457
+ plate
8458
+ play
8459
+ please
8460
+ pledge
8461
+ pluck
8462
+ plug
8463
+ plunge
8464
+ poem
8465
+ poet
8466
+ point
8467
+ polar
8468
+ pole
8469
+ police
8470
+ pond
8471
+ pony
8472
+ pool
8473
+ popular
8474
+ portion
8475
+ position
8476
+ possible
8477
+ post
8478
+ potato
8479
+ pottery
8480
+ poverty
8481
+ powder
8482
+ power
8483
+ practice
8484
+ praise
8485
+ predict
8486
+ prefer
8487
+ prepare
8488
+ present
8489
+ pretty
8490
+ prevent
8491
+ price
8492
+ pride
8493
+ primary
8494
+ print
8495
+ priority
8496
+ prison
8497
+ private
8498
+ prize
8499
+ problem
8500
+ process
8501
+ produce
8502
+ profit
8503
+ program
8504
+ project
8505
+ promote
8506
+ proof
8507
+ property
8508
+ prosper
8509
+ protect
8510
+ proud
8511
+ provide
8512
+ public
8513
+ pudding
8514
+ pull
8515
+ pulp
8516
+ pulse
8517
+ pumpkin
8518
+ punch
8519
+ pupil
8520
+ puppy
8521
+ purchase
8522
+ purity
8523
+ purpose
8524
+ purse
8525
+ push
8526
+ put
8527
+ puzzle
8528
+ pyramid
8529
+ quality
8530
+ quantum
8531
+ quarter
8532
+ question
8533
+ quick
8534
+ quit
8535
+ quiz
8536
+ quote
8537
+ rabbit
8538
+ raccoon
8539
+ race
8540
+ rack
8541
+ radar
8542
+ radio
8543
+ rail
8544
+ rain
8545
+ raise
8546
+ rally
8547
+ ramp
8548
+ ranch
8549
+ random
8550
+ range
8551
+ rapid
8552
+ rare
8553
+ rate
8554
+ rather
8555
+ raven
8556
+ raw
8557
+ razor
8558
+ ready
8559
+ real
8560
+ reason
8561
+ rebel
8562
+ rebuild
8563
+ recall
8564
+ receive
8565
+ recipe
8566
+ record
8567
+ recycle
8568
+ reduce
8569
+ reflect
8570
+ reform
8571
+ refuse
8572
+ region
8573
+ regret
8574
+ regular
8575
+ reject
8576
+ relax
8577
+ release
8578
+ relief
8579
+ rely
8580
+ remain
8581
+ remember
8582
+ remind
8583
+ remove
8584
+ render
8585
+ renew
8586
+ rent
8587
+ reopen
8588
+ repair
8589
+ repeat
8590
+ replace
8591
+ report
8592
+ require
8593
+ rescue
8594
+ resemble
8595
+ resist
8596
+ resource
8597
+ response
8598
+ result
8599
+ retire
8600
+ retreat
8601
+ return
8602
+ reunion
8603
+ reveal
8604
+ review
8605
+ reward
8606
+ rhythm
8607
+ rib
8608
+ ribbon
8609
+ rice
8610
+ rich
8611
+ ride
8612
+ ridge
8613
+ rifle
8614
+ right
8615
+ rigid
8616
+ ring
8617
+ riot
8618
+ ripple
8619
+ risk
8620
+ ritual
8621
+ rival
8622
+ river
8623
+ road
8624
+ roast
8625
+ robot
8626
+ robust
8627
+ rocket
8628
+ romance
8629
+ roof
8630
+ rookie
8631
+ room
8632
+ rose
8633
+ rotate
8634
+ rough
8635
+ round
8636
+ route
8637
+ royal
8638
+ rubber
8639
+ rude
8640
+ rug
8641
+ rule
8642
+ run
8643
+ runway
8644
+ rural
8645
+ sad
8646
+ saddle
8647
+ sadness
8648
+ safe
8649
+ sail
8650
+ salad
8651
+ salmon
8652
+ salon
8653
+ salt
8654
+ salute
8655
+ same
8656
+ sample
8657
+ sand
8658
+ satisfy
8659
+ satoshi
8660
+ sauce
8661
+ sausage
8662
+ save
8663
+ say
8664
+ scale
8665
+ scan
8666
+ scare
8667
+ scatter
8668
+ scene
8669
+ scheme
8670
+ school
8671
+ science
8672
+ scissors
8673
+ scorpion
8674
+ scout
8675
+ scrap
8676
+ screen
8677
+ script
8678
+ scrub
8679
+ sea
8680
+ search
8681
+ season
8682
+ seat
8683
+ second
8684
+ secret
8685
+ section
8686
+ security
8687
+ seed
8688
+ seek
8689
+ segment
8690
+ select
8691
+ sell
8692
+ seminar
8693
+ senior
8694
+ sense
8695
+ sentence
8696
+ series
8697
+ service
8698
+ session
8699
+ settle
8700
+ setup
8701
+ seven
8702
+ shadow
8703
+ shaft
8704
+ shallow
8705
+ share
8706
+ shed
8707
+ shell
8708
+ sheriff
8709
+ shield
8710
+ shift
8711
+ shine
8712
+ ship
8713
+ shiver
8714
+ shock
8715
+ shoe
8716
+ shoot
8717
+ shop
8718
+ short
8719
+ shoulder
8720
+ shove
8721
+ shrimp
8722
+ shrug
8723
+ shuffle
8724
+ shy
8725
+ sibling
8726
+ sick
8727
+ side
8728
+ siege
8729
+ sight
8730
+ sign
8731
+ silent
8732
+ silk
8733
+ silly
8734
+ silver
8735
+ similar
8736
+ simple
8737
+ since
8738
+ sing
8739
+ siren
8740
+ sister
8741
+ situate
8742
+ six
8743
+ size
8744
+ skate
8745
+ sketch
8746
+ ski
8747
+ skill
8748
+ skin
8749
+ skirt
8750
+ skull
8751
+ slab
8752
+ slam
8753
+ sleep
8754
+ slender
8755
+ slice
8756
+ slide
8757
+ slight
8758
+ slim
8759
+ slogan
8760
+ slot
8761
+ slow
8762
+ slush
8763
+ small
8764
+ smart
8765
+ smile
8766
+ smoke
8767
+ smooth
8768
+ snack
8769
+ snake
8770
+ snap
8771
+ sniff
8772
+ snow
8773
+ soap
8774
+ soccer
8775
+ social
8776
+ sock
8777
+ soda
8778
+ soft
8779
+ solar
8780
+ soldier
8781
+ solid
8782
+ solution
8783
+ solve
8784
+ someone
8785
+ song
8786
+ soon
8787
+ sorry
8788
+ sort
8789
+ soul
8790
+ sound
8791
+ soup
8792
+ source
8793
+ south
8794
+ space
8795
+ spare
8796
+ spatial
8797
+ spawn
8798
+ speak
8799
+ special
8800
+ speed
8801
+ spell
8802
+ spend
8803
+ sphere
8804
+ spice
8805
+ spider
8806
+ spike
8807
+ spin
8808
+ spirit
8809
+ split
8810
+ spoil
8811
+ sponsor
8812
+ spoon
8813
+ sport
8814
+ spot
8815
+ spray
8816
+ spread
8817
+ spring
8818
+ spy
8819
+ square
8820
+ squeeze
8821
+ squirrel
8822
+ stable
8823
+ stadium
8824
+ staff
8825
+ stage
8826
+ stairs
8827
+ stamp
8828
+ stand
8829
+ start
8830
+ state
8831
+ stay
8832
+ steak
8833
+ steel
8834
+ stem
8835
+ step
8836
+ stereo
8837
+ stick
8838
+ still
8839
+ sting
8840
+ stock
8841
+ stomach
8842
+ stone
8843
+ stool
8844
+ story
8845
+ stove
8846
+ strategy
8847
+ street
8848
+ strike
8849
+ strong
8850
+ struggle
8851
+ student
8852
+ stuff
8853
+ stumble
8854
+ style
8855
+ subject
8856
+ submit
8857
+ subway
8858
+ success
8859
+ such
8860
+ sudden
8861
+ suffer
8862
+ sugar
8863
+ suggest
8864
+ suit
8865
+ summer
8866
+ sun
8867
+ sunny
8868
+ sunset
8869
+ super
8870
+ supply
8871
+ supreme
8872
+ sure
8873
+ surface
8874
+ surge
8875
+ surprise
8876
+ surround
8877
+ survey
8878
+ suspect
8879
+ sustain
8880
+ swallow
8881
+ swamp
8882
+ swap
8883
+ swarm
8884
+ swear
8885
+ sweet
8886
+ swift
8887
+ swim
8888
+ swing
8889
+ switch
8890
+ sword
8891
+ symbol
8892
+ symptom
8893
+ syrup
8894
+ system
8895
+ table
8896
+ tackle
8897
+ tag
8898
+ tail
8899
+ talent
8900
+ talk
8901
+ tank
8902
+ tape
8903
+ target
8904
+ task
8905
+ taste
8906
+ tattoo
8907
+ taxi
8908
+ teach
8909
+ team
8910
+ tell
8911
+ ten
8912
+ tenant
8913
+ tennis
8914
+ tent
8915
+ term
8916
+ test
8917
+ text
8918
+ thank
8919
+ that
8920
+ theme
8921
+ then
8922
+ theory
8923
+ there
8924
+ they
8925
+ thing
8926
+ this
8927
+ thought
8928
+ three
8929
+ thrive
8930
+ throw
8931
+ thumb
8932
+ thunder
8933
+ ticket
8934
+ tide
8935
+ tiger
8936
+ tilt
8937
+ timber
8938
+ time
8939
+ tiny
8940
+ tip
8941
+ tired
8942
+ tissue
8943
+ title
8944
+ toast
8945
+ tobacco
8946
+ today
8947
+ toddler
8948
+ toe
8949
+ together
8950
+ toilet
8951
+ token
8952
+ tomato
8953
+ tomorrow
8954
+ tone
8955
+ tongue
8956
+ tonight
8957
+ tool
8958
+ tooth
8959
+ top
8960
+ topic
8961
+ topple
8962
+ torch
8963
+ tornado
8964
+ tortoise
8965
+ toss
8966
+ total
8967
+ tourist
8968
+ toward
8969
+ tower
8970
+ town
8971
+ toy
8972
+ track
8973
+ trade
8974
+ traffic
8975
+ tragic
8976
+ train
8977
+ transfer
8978
+ trap
8979
+ trash
8980
+ travel
8981
+ tray
8982
+ treat
8983
+ tree
8984
+ trend
8985
+ trial
8986
+ tribe
8987
+ trick
8988
+ trigger
8989
+ trim
8990
+ trip
8991
+ trophy
8992
+ trouble
8993
+ truck
8994
+ true
8995
+ truly
8996
+ trumpet
8997
+ trust
8998
+ truth
8999
+ try
9000
+ tube
9001
+ tuition
9002
+ tumble
9003
+ tuna
9004
+ tunnel
9005
+ turkey
9006
+ turn
9007
+ turtle
9008
+ twelve
9009
+ twenty
9010
+ twice
9011
+ twin
9012
+ twist
9013
+ two
9014
+ type
9015
+ typical
9016
+ ugly
9017
+ umbrella
9018
+ unable
9019
+ unaware
9020
+ uncle
9021
+ uncover
9022
+ under
9023
+ undo
9024
+ unfair
9025
+ unfold
9026
+ unhappy
9027
+ uniform
9028
+ unique
9029
+ unit
9030
+ universe
9031
+ unknown
9032
+ unlock
9033
+ until
9034
+ unusual
9035
+ unveil
9036
+ update
9037
+ upgrade
9038
+ uphold
9039
+ upon
9040
+ upper
9041
+ upset
9042
+ urban
9043
+ urge
9044
+ usage
9045
+ use
9046
+ used
9047
+ useful
9048
+ useless
9049
+ usual
9050
+ utility
9051
+ vacant
9052
+ vacuum
9053
+ vague
9054
+ valid
9055
+ valley
9056
+ valve
9057
+ van
9058
+ vanish
9059
+ vapor
9060
+ various
9061
+ vast
9062
+ vault
9063
+ vehicle
9064
+ velvet
9065
+ vendor
9066
+ venture
9067
+ venue
9068
+ verb
9069
+ verify
9070
+ version
9071
+ very
9072
+ vessel
9073
+ veteran
9074
+ viable
9075
+ vibrant
9076
+ vicious
9077
+ victory
9078
+ video
9079
+ view
9080
+ village
9081
+ vintage
9082
+ violin
9083
+ virtual
9084
+ virus
9085
+ visa
9086
+ visit
9087
+ visual
9088
+ vital
9089
+ vivid
9090
+ vocal
9091
+ voice
9092
+ void
9093
+ volcano
9094
+ volume
9095
+ vote
9096
+ voyage
9097
+ wage
9098
+ wagon
9099
+ wait
9100
+ walk
9101
+ wall
9102
+ walnut
9103
+ want
9104
+ warfare
9105
+ warm
9106
+ warrior
9107
+ wash
9108
+ wasp
9109
+ waste
9110
+ water
9111
+ wave
9112
+ way
9113
+ wealth
9114
+ weapon
9115
+ wear
9116
+ weasel
9117
+ weather
9118
+ web
9119
+ wedding
9120
+ weekend
9121
+ weird
9122
+ welcome
9123
+ west
9124
+ wet
9125
+ whale
9126
+ what
9127
+ wheat
9128
+ wheel
9129
+ when
9130
+ where
9131
+ whip
9132
+ whisper
9133
+ wide
9134
+ width
9135
+ wife
9136
+ wild
9137
+ will
9138
+ win
9139
+ window
9140
+ wine
9141
+ wing
9142
+ wink
9143
+ winner
9144
+ winter
9145
+ wire
9146
+ wisdom
9147
+ wise
9148
+ wish
9149
+ witness
9150
+ wolf
9151
+ woman
9152
+ wonder
9153
+ wood
9154
+ wool
9155
+ word
9156
+ work
9157
+ world
9158
+ worry
9159
+ worth
9160
+ wrap
9161
+ wreck
9162
+ wrestle
9163
+ wrist
9164
+ write
9165
+ wrong
9166
+ yard
9167
+ year
9168
+ yellow
9169
+ you
9170
+ young
9171
+ youth
9172
+ zebra
9173
+ zero
9174
+ zone
9175
+ zoo`.split("\n");
9176
+
9177
+ //#endregion
9178
+ //#region packages/provider/src/MnemonicKeyDerivation.ts
9179
+ /**
9180
+ * MnemonicKeyDerivation
9181
+ *
9182
+ * Pure, stateless functions for BIP-39 mnemonic-based Ed25519 identity
9183
+ * derivation and AES-256-GCM seed wrapping. No IndexedDB, no WebAuthn,
9184
+ * no DOM access — fully unit-testable.
9185
+ *
9186
+ * Derivation chain:
9187
+ * BIP-39 Mnemonic (+optional passphrase)
9188
+ * → PBKDF2-HMAC-SHA512 (2048 rounds, per BIP-39 spec)
9189
+ * → first 32 bytes as IKM
9190
+ * → HKDF-SHA256(salt="abracadabra-mnemonic-v1", info="abracadabra-identity-v1")
9191
+ * → Ed25519 seed (32 bytes)
9192
+ * → Ed25519 keypair + X25519 (Montgomery conversion)
9193
+ *
9194
+ * The HKDF salt differs from the passkey PRF path (which uses PRF_SALT),
9195
+ * providing domain separation: identical raw input bytes can never produce
9196
+ * the same Ed25519 seed across the two derivation methods.
9197
+ *
9198
+ * Dependencies: @scure/bip39, @noble/ed25519, @noble/hashes, @noble/curves
9199
+ */
9200
+ /** HKDF salt for mnemonic → Ed25519 seed derivation. */
9201
+ const MNEMONIC_HKDF_SALT = /* @__PURE__ */ new TextEncoder().encode("abracadabra-mnemonic-v1");
9202
+ /** HKDF info string — intentionally matches the passkey path's HKDF_INFO. */
9203
+ const MNEMONIC_HKDF_INFO = /* @__PURE__ */ new TextEncoder().encode("abracadabra-identity-v1");
9204
+ /** HKDF info string for deriving the AES-GCM seed-wrapping key from PRF output. */
9205
+ const SEED_WRAP_INFO = /* @__PURE__ */ new TextEncoder().encode("abracadabra-seed-wrap-v1");
9206
+ function toBase64url$1(bytes) {
9207
+ return btoa(String.fromCharCode(...bytes)).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
9208
+ }
9209
+ /**
9210
+ * Generate a new BIP-39 mnemonic phrase.
9211
+ * @param strength 128 for 12 words (default), 256 for 24 words.
9212
+ */
9213
+ function generateMnemonic(strength = 128) {
9214
+ return (0, _scure_bip39.generateMnemonic)(wordlist, strength);
9215
+ }
9216
+ /**
9217
+ * Validate a BIP-39 mnemonic (wordlist + checksum).
9218
+ */
9219
+ function validateMnemonic(mnemonic) {
9220
+ return (0, _scure_bip39.validateMnemonic)(mnemonic, wordlist);
9221
+ }
9222
+ /**
9223
+ * Derive a 32-byte Ed25519 seed from a BIP-39 mnemonic.
9224
+ *
9225
+ * Chain: mnemonic → PBKDF2-HMAC-SHA512 (2048 rounds) → first 32 bytes →
9226
+ * HKDF-SHA256(salt, info) → 32-byte seed.
9227
+ *
9228
+ * @param mnemonic Valid BIP-39 mnemonic (12 or 24 words).
9229
+ * @param passphrase Optional BIP-39 passphrase ("25th word").
9230
+ * @returns 32-byte Ed25519 seed. Caller MUST wipe after use: `seed.fill(0)`.
9231
+ */
9232
+ function mnemonicToEd25519Seed(mnemonic, passphrase) {
9233
+ const bip39Seed = (0, _scure_bip39.mnemonicToSeedSync)(mnemonic, passphrase ?? "");
9234
+ const seed = hkdf(sha256, bip39Seed.subarray(0, 32), MNEMONIC_HKDF_SALT, MNEMONIC_HKDF_INFO, 32);
9235
+ bip39Seed.fill(0);
9236
+ return seed;
9237
+ }
9238
+ /**
9239
+ * Derive the full Ed25519 + X25519 keypair from a BIP-39 mnemonic.
9240
+ *
9241
+ * @param mnemonic Valid BIP-39 mnemonic.
9242
+ * @param passphrase Optional BIP-39 passphrase.
9243
+ * @returns Keys and seed. Caller MUST wipe `seed` after use.
9244
+ */
9245
+ async function mnemonicToKeyPair(mnemonic, passphrase) {
9246
+ const seed = mnemonicToEd25519Seed(mnemonic, passphrase);
9247
+ const publicKey = await _noble_ed25519.getPublicKeyAsync(seed);
9248
+ const publicKeyB64 = toBase64url$1(publicKey);
9249
+ const x25519PublicKey = ed25519.utils.toMontgomery(publicKey);
9250
+ return {
9251
+ seed,
9252
+ publicKey,
9253
+ publicKeyB64,
9254
+ x25519PublicKey,
9255
+ x25519PublicKeyB64: toBase64url$1(x25519PublicKey)
9256
+ };
9257
+ }
9258
+ /**
9259
+ * Derive a 32-byte AES-256-GCM key from WebAuthn PRF output for seed wrapping.
9260
+ *
9261
+ * @param prfOutput Raw PRF output from WebAuthn assertion (32 bytes typical).
9262
+ * @param wrapSalt Random 32-byte salt, stored alongside the ciphertext.
9263
+ */
9264
+ function deriveSeedWrappingKey(prfOutput, wrapSalt) {
9265
+ return hkdf(sha256, new Uint8Array(prfOutput), wrapSalt, SEED_WRAP_INFO, 32);
9266
+ }
9267
+ /**
9268
+ * Encrypt an Ed25519 seed with AES-256-GCM.
9269
+ *
9270
+ * @param seed 32-byte Ed25519 seed to protect.
9271
+ * @param wrappingKeyBytes 32-byte AES key from `deriveSeedWrappingKey`.
9272
+ * @returns Ciphertext (48 bytes: 32 plaintext + 16 auth tag) and 12-byte IV.
9273
+ */
9274
+ async function wrapSeed(seed, wrappingKeyBytes) {
9275
+ const iv = crypto.getRandomValues(new Uint8Array(12));
9276
+ const key = await crypto.subtle.importKey("raw", wrappingKeyBytes, "AES-GCM", false, ["encrypt"]);
9277
+ return {
9278
+ ciphertext: await crypto.subtle.encrypt({
9279
+ name: "AES-GCM",
9280
+ iv
9281
+ }, key, seed),
9282
+ iv
9283
+ };
9284
+ }
9285
+ /**
9286
+ * Decrypt an Ed25519 seed from AES-256-GCM ciphertext.
9287
+ *
9288
+ * @param ciphertext Encrypted seed (48 bytes).
9289
+ * @param iv 12-byte GCM nonce.
9290
+ * @param wrappingKeyBytes 32-byte AES key from `deriveSeedWrappingKey`.
9291
+ * @returns 32-byte Ed25519 seed. Caller MUST wipe after use.
9292
+ * @throws If the auth tag is invalid (wrong key or tampered data).
9293
+ */
9294
+ async function unwrapSeed(ciphertext, iv, wrappingKeyBytes) {
9295
+ const key = await crypto.subtle.importKey("raw", wrappingKeyBytes, "AES-GCM", false, ["decrypt"]);
9296
+ const plaintext = await crypto.subtle.decrypt({
9297
+ name: "AES-GCM",
9298
+ iv
9299
+ }, key, ciphertext);
9300
+ return new Uint8Array(plaintext);
9301
+ }
9302
+
7123
9303
  //#endregion
7124
9304
  //#region packages/provider/src/CryptoIdentityKeystore.ts
7125
9305
  /**
7126
9306
  * CryptoIdentityKeystore
7127
9307
  *
7128
- * Per-user Ed25519 keypair derived deterministically from a synced WebAuthn
7129
- * passkey's PRF extension output. The same passkey on any device produces the
7130
- * same identity — no private key storage needed.
9308
+ * Ed25519 identity management with two derivation modes:
7131
9309
  *
7132
- * Derivation chain:
7133
- * Synced Passkey PRF(constant salt) → HKDF-SHA256 → Ed25519 seed → keypair
9310
+ * 1. **Passkey-only (legacy)**: PRF output → HKDF → Ed25519 seed.
9311
+ * The passkey IS the identity source.
7134
9312
  *
7135
- * IndexedDB is used only as a lightweight cache for the public key and
7136
- * credential ID. Loss of IndexedDB is non-catastrophic a passkey assertion
7137
- * re-derives everything.
9313
+ * 2. **Mnemonic-rooted**: BIP-39 mnemonic Ed25519 seed, encrypted by
9314
+ * passkey PRF for day-to-day convenience. The mnemonic IS the identity
9315
+ * source; the passkey is a convenience wrapper. Recovery via mnemonic
9316
+ * re-derives the exact same key.
7138
9317
  *
7139
- * Dependencies: @noble/ed25519, @noble/hashes (for HKDF), @noble/curves (for X25519)
9318
+ * Both modes coexist. IndexedDB records with `encryptedSeed` use mode 2;
9319
+ * records without it use mode 1 (backward compatible).
9320
+ *
9321
+ * Dependencies: @noble/ed25519, @noble/hashes, @noble/curves, @scure/bip39
7140
9322
  */
7141
9323
  /**
7142
9324
  * Fixed PRF eval salt. Must be constant across all devices so the same synced
@@ -7192,7 +9374,7 @@ const DB_NAME = "abracadabra:identity";
7192
9374
  const STORE_NAME = "identity";
7193
9375
  function openDb$4() {
7194
9376
  return new Promise((resolve, reject) => {
7195
- const req = indexedDB.open(DB_NAME, 2);
9377
+ const req = indexedDB.open(DB_NAME, 3);
7196
9378
  req.onupgradeneeded = () => {
7197
9379
  const db = req.result;
7198
9380
  if (!db.objectStoreNames.contains(STORE_NAME)) db.createObjectStore(STORE_NAME);
@@ -7464,6 +9646,169 @@ var CryptoIdentityKeystore = class {
7464
9646
  }
7465
9647
  }
7466
9648
  /**
9649
+ * Register a new identity rooted in a BIP-39 mnemonic. Optionally wraps the
9650
+ * derived seed with a passkey for biometric day-to-day access.
9651
+ *
9652
+ * @param username - Display name for the identity.
9653
+ * @param mnemonic - Valid BIP-39 mnemonic (12 or 24 words).
9654
+ * @param passphrase - Optional BIP-39 passphrase ("25th word").
9655
+ * @param rpId - WebAuthn relying party ID (omit to skip passkey wrapping).
9656
+ * @param rpName - WebAuthn relying party display name.
9657
+ * @returns Public keys and optional credential ID.
9658
+ */
9659
+ async registerWithMnemonic(username, mnemonic, passphrase, rpId, rpName) {
9660
+ const kp = await mnemonicToKeyPair(mnemonic, passphrase);
9661
+ try {
9662
+ if (rpId && rpName) {
9663
+ const credential = await navigator.credentials.create({ publicKey: {
9664
+ challenge: crypto.getRandomValues(new Uint8Array(32)),
9665
+ rp: {
9666
+ id: rpId,
9667
+ name: rpName
9668
+ },
9669
+ user: {
9670
+ id: new TextEncoder().encode(username),
9671
+ name: username,
9672
+ displayName: username
9673
+ },
9674
+ pubKeyCredParams: [{
9675
+ alg: -7,
9676
+ type: "public-key"
9677
+ }, {
9678
+ alg: -257,
9679
+ type: "public-key"
9680
+ }],
9681
+ authenticatorSelection: {
9682
+ residentKey: "required",
9683
+ requireResidentKey: true,
9684
+ userVerification: "required"
9685
+ },
9686
+ extensions: { prf: { eval: { first: PRF_SALT.buffer } } }
9687
+ } });
9688
+ if (!credential) throw new Error("WebAuthn credential creation cancelled");
9689
+ const prfOutput = extractPrfOutput(credential);
9690
+ const wrapSalt = crypto.getRandomValues(new Uint8Array(32));
9691
+ const wrapKey = deriveSeedWrappingKey(prfOutput, wrapSalt);
9692
+ const { ciphertext, iv } = await wrapSeed(kp.seed, wrapKey);
9693
+ wrapKey.fill(0);
9694
+ const credentialIdB64 = toBase64url(new Uint8Array(credential.rawId));
9695
+ const db = await openDb$4();
9696
+ await dbPut(db, credentialIdB64, {
9697
+ username,
9698
+ publicKey: kp.publicKeyB64,
9699
+ credentialId: credential.rawId,
9700
+ encryptedSeed: ciphertext,
9701
+ seedIv: iv,
9702
+ wrapSalt,
9703
+ authMethod: "mnemonic"
9704
+ });
9705
+ db.close();
9706
+ return {
9707
+ publicKey: kp.publicKeyB64,
9708
+ x25519PublicKey: kp.x25519PublicKeyB64,
9709
+ credentialId: credentialIdB64
9710
+ };
9711
+ }
9712
+ return {
9713
+ publicKey: kp.publicKeyB64,
9714
+ x25519PublicKey: kp.x25519PublicKeyB64
9715
+ };
9716
+ } finally {
9717
+ kp.seed.fill(0);
9718
+ }
9719
+ }
9720
+ /**
9721
+ * Wrap an existing mnemonic-derived seed with a new passkey. Use this when
9722
+ * a user logged in via mnemonic and wants to add biometric convenience.
9723
+ *
9724
+ * @param mnemonic - The user's BIP-39 mnemonic.
9725
+ * @param passphrase - Optional BIP-39 passphrase.
9726
+ * @param rpId - WebAuthn relying party ID.
9727
+ * @param rpName - WebAuthn relying party display name.
9728
+ * @returns The new credential ID.
9729
+ */
9730
+ async wrapSeedWithPasskey(mnemonic, passphrase, rpId, rpName) {
9731
+ const kp = await mnemonicToKeyPair(mnemonic, passphrase);
9732
+ try {
9733
+ const credential = await navigator.credentials.create({ publicKey: {
9734
+ challenge: crypto.getRandomValues(new Uint8Array(32)),
9735
+ rp: {
9736
+ id: rpId,
9737
+ name: rpName
9738
+ },
9739
+ user: {
9740
+ id: fromBase64url(kp.publicKeyB64),
9741
+ name: kp.publicKeyB64.slice(0, 16),
9742
+ displayName: kp.publicKeyB64.slice(0, 16)
9743
+ },
9744
+ pubKeyCredParams: [{
9745
+ alg: -7,
9746
+ type: "public-key"
9747
+ }, {
9748
+ alg: -257,
9749
+ type: "public-key"
9750
+ }],
9751
+ authenticatorSelection: {
9752
+ residentKey: "required",
9753
+ requireResidentKey: true,
9754
+ userVerification: "required"
9755
+ },
9756
+ extensions: { prf: { eval: { first: PRF_SALT.buffer } } }
9757
+ } });
9758
+ if (!credential) throw new Error("WebAuthn credential creation cancelled");
9759
+ const prfOutput = extractPrfOutput(credential);
9760
+ const wrapSalt = crypto.getRandomValues(new Uint8Array(32));
9761
+ const wrapKey = deriveSeedWrappingKey(prfOutput, wrapSalt);
9762
+ const { ciphertext, iv } = await wrapSeed(kp.seed, wrapKey);
9763
+ wrapKey.fill(0);
9764
+ const credentialIdB64 = toBase64url(new Uint8Array(credential.rawId));
9765
+ let username = "";
9766
+ try {
9767
+ const db = await openDb$4();
9768
+ const existing = (await dbGetAll(db)).find((e) => e.value.publicKey === kp.publicKeyB64);
9769
+ if (existing) username = existing.value.username;
9770
+ db.close();
9771
+ } catch {}
9772
+ const db = await openDb$4();
9773
+ await dbPut(db, credentialIdB64, {
9774
+ username,
9775
+ publicKey: kp.publicKeyB64,
9776
+ credentialId: credential.rawId,
9777
+ encryptedSeed: ciphertext,
9778
+ seedIv: iv,
9779
+ wrapSalt,
9780
+ authMethod: "mnemonic"
9781
+ });
9782
+ db.close();
9783
+ return { credentialId: credentialIdB64 };
9784
+ } finally {
9785
+ kp.seed.fill(0);
9786
+ }
9787
+ }
9788
+ /**
9789
+ * Sign a challenge directly with a provided seed. No WebAuthn prompt.
9790
+ * For ephemeral mnemonic sessions where the seed is held in memory.
9791
+ *
9792
+ * The caller manages the seed lifecycle (wiping on session end).
9793
+ */
9794
+ static async signWithSeed(challengeB64, seed) {
9795
+ const challengeBytes = fromBase64url(challengeB64);
9796
+ return toBase64url(await _noble_ed25519.signAsync(challengeBytes, seed));
9797
+ }
9798
+ /**
9799
+ * Stateless mnemonic sign: derive seed, sign, wipe. No IndexedDB, no WebAuthn.
9800
+ * Useful for CLI or one-shot operations.
9801
+ */
9802
+ static async signWithMnemonic(mnemonic, challengeB64, passphrase) {
9803
+ const seed = mnemonicToEd25519Seed(mnemonic, passphrase);
9804
+ try {
9805
+ const challengeBytes = fromBase64url(challengeB64);
9806
+ return toBase64url(await _noble_ed25519.signAsync(challengeBytes, seed));
9807
+ } finally {
9808
+ seed.fill(0);
9809
+ }
9810
+ }
9811
+ /**
7467
9812
  * Perform a WebAuthn assertion with PRF, derive the Ed25519 seed, and
7468
9813
  * update the IndexedDB cache. Returns the seed (caller MUST wipe it).
7469
9814
  */
@@ -7489,15 +9834,32 @@ var CryptoIdentityKeystore = class {
7489
9834
  extensions: { prf: { eval: { first: PRF_SALT.buffer } } }
7490
9835
  } });
7491
9836
  if (!assertion) throw new Error("WebAuthn assertion cancelled");
7492
- const seed = deriveEd25519Seed(extractPrfOutput(assertion));
7493
- const publicKeyB64 = toBase64url(await _noble_ed25519.getPublicKeyAsync(seed));
9837
+ const prfOutput = extractPrfOutput(assertion);
7494
9838
  const credentialIdB64 = toBase64url(new Uint8Array(assertion.rawId));
9839
+ let stored;
9840
+ try {
9841
+ const db = await openDb$4();
9842
+ stored = await dbGet(db, credentialIdB64);
9843
+ db.close();
9844
+ } catch {}
9845
+ let seed;
9846
+ if (stored?.encryptedSeed && stored.seedIv && stored.wrapSalt) {
9847
+ const wrapKey = deriveSeedWrappingKey(prfOutput, stored.wrapSalt);
9848
+ seed = await unwrapSeed(stored.encryptedSeed, stored.seedIv, wrapKey);
9849
+ wrapKey.fill(0);
9850
+ } else seed = deriveEd25519Seed(prfOutput);
9851
+ const publicKeyB64 = toBase64url(await _noble_ed25519.getPublicKeyAsync(seed));
7495
9852
  try {
7496
9853
  const db = await openDb$4();
9854
+ const existing = await dbGet(db, credentialIdB64);
7497
9855
  await dbPut(db, credentialIdB64, {
7498
- username: (await dbGet(db, credentialIdB64))?.username ?? "",
9856
+ username: existing?.username ?? "",
7499
9857
  publicKey: publicKeyB64,
7500
- credentialId: assertion.rawId
9858
+ credentialId: assertion.rawId,
9859
+ encryptedSeed: existing?.encryptedSeed,
9860
+ seedIv: existing?.seedIv,
9861
+ wrapSalt: existing?.wrapSalt,
9862
+ authMethod: existing?.authMethod
7501
9863
  });
7502
9864
  db.close();
7503
9865
  } catch {}
@@ -11712,12 +14074,20 @@ exports.WsReadyStates = WsReadyStates;
11712
14074
  exports.YjsDataChannel = YjsDataChannel;
11713
14075
  exports.attachUpdatedAtObserver = attachUpdatedAtObserver;
11714
14076
  exports.awarenessStatesToArray = awarenessStatesToArray;
14077
+ exports.bip39Wordlist = wordlist;
11715
14078
  exports.decryptField = decryptField;
11716
14079
  exports.deriveIdentityDocId = deriveIdentityDocId;
14080
+ exports.deriveSeedWrappingKey = deriveSeedWrappingKey;
11717
14081
  exports.encryptField = encryptField;
14082
+ exports.generateMnemonic = generateMnemonic;
11718
14083
  exports.makeEncryptedYMap = makeEncryptedYMap;
11719
14084
  exports.makeEncryptedYText = makeEncryptedYText;
14085
+ exports.mnemonicToEd25519Seed = mnemonicToEd25519Seed;
14086
+ exports.mnemonicToKeyPair = mnemonicToKeyPair;
11720
14087
  exports.readAuthMessage = readAuthMessage;
14088
+ exports.unwrapSeed = unwrapSeed;
14089
+ exports.validateMnemonic = validateMnemonic;
14090
+ exports.wrapSeed = wrapSeed;
11721
14091
  exports.writeAuthenticated = writeAuthenticated;
11722
14092
  exports.writeAuthentication = writeAuthentication;
11723
14093
  exports.writePermissionDenied = writePermissionDenied;