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