@calimero-network/mero-js 19.4.0 → 19.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -39,6 +39,8 @@ __export(index_exports, {
39
39
  WebHttpClient: () => WebHttpClient,
40
40
  WsClient: () => WsClient,
41
41
  accountForRoot: () => accountForRoot,
42
+ accountRootFromPhrase: () => accountRootFromPhrase,
43
+ accountRootFromSecret: () => accountRootFromSecret,
42
44
  buildAuthLoginUrl: () => buildAuthLoginUrl,
43
45
  combineSignals: () => combineSignals,
44
46
  compareSemver: () => compareSemver,
@@ -63,6 +65,7 @@ __export(index_exports, {
63
65
  deviceCertPayload: () => deviceCertPayload,
64
66
  discoverLocalNodes: () => discoverLocalNodes,
65
67
  encodeSignedInvitation: () => encodeSignedInvitation,
68
+ generateAccountRoot: () => generateAccountRoot,
66
69
  generateSessionKey: () => generateSessionKey,
67
70
  hasCap: () => hasCap,
68
71
  intentHash: () => intentHash,
@@ -73,6 +76,7 @@ __export(index_exports, {
73
76
  nodeEndpoint: () => nodeEndpoint,
74
77
  parseAuthCallback: () => parseAuthCallback,
75
78
  probeNodeHealth: () => probeNodeHealth,
79
+ signAccountLink: () => signAccountLink,
76
80
  signDeviceCert: () => signDeviceCert,
77
81
  signLoginStatement: () => signLoginStatement,
78
82
  signMemberJoinOp: () => signMemberJoinOp,
@@ -1142,6 +1146,33 @@ var AdminApiClient = class {
1142
1146
  async listApplicationAliases() {
1143
1147
  return unwrap(await this.httpClient.get("/admin-api/alias/list/application"));
1144
1148
  }
1149
+ async createDeviceAlias(request) {
1150
+ return unwrap(
1151
+ await this.httpClient.post(
1152
+ "/admin-api/alias/create/device",
1153
+ { alias: request.alias, deviceId: request.deviceId }
1154
+ )
1155
+ );
1156
+ }
1157
+ async lookupDeviceAlias(name) {
1158
+ return unwrap(
1159
+ await this.httpClient.post(
1160
+ `/admin-api/alias/lookup/device/${encodeURIComponent(name)}`,
1161
+ {}
1162
+ )
1163
+ );
1164
+ }
1165
+ async deleteDeviceAlias(name) {
1166
+ return unwrap(
1167
+ await this.httpClient.post(
1168
+ `/admin-api/alias/delete/device/${encodeURIComponent(name)}`,
1169
+ {}
1170
+ )
1171
+ );
1172
+ }
1173
+ async listDeviceAliases() {
1174
+ return unwrap(await this.httpClient.get("/admin-api/alias/list/device"));
1175
+ }
1145
1176
  // ---- Namespace Management ----
1146
1177
  async listNamespaces() {
1147
1178
  return unwrap(await this.httpClient.get("/admin-api/namespaces"));
@@ -2373,6 +2404,2326 @@ var EphemeralClient = class {
2373
2404
  }
2374
2405
  };
2375
2406
 
2407
+ // src/crypto/internal.ts
2408
+ var PKCS8_ED25519_PREFIX = new Uint8Array([
2409
+ 48,
2410
+ 46,
2411
+ 2,
2412
+ 1,
2413
+ 0,
2414
+ 48,
2415
+ 5,
2416
+ 6,
2417
+ 3,
2418
+ 43,
2419
+ 101,
2420
+ 112,
2421
+ 4,
2422
+ 34,
2423
+ 4,
2424
+ 32
2425
+ ]);
2426
+ function u32le(value) {
2427
+ const out = new Uint8Array(4);
2428
+ new DataView(out.buffer).setUint32(0, value, true);
2429
+ return out;
2430
+ }
2431
+ function hex(bytes) {
2432
+ return Array.from(bytes, (b) => b.toString(16).padStart(2, "0")).join("");
2433
+ }
2434
+ function fromHex(value, label, expectedBytes) {
2435
+ const clean = value.trim();
2436
+ if (!/^[0-9a-fA-F]*$/.test(clean) || clean.length !== expectedBytes * 2) {
2437
+ throw new Error(
2438
+ `${label} must be ${expectedBytes * 2} hex characters, got ${clean.length}`
2439
+ );
2440
+ }
2441
+ const bytes = new Uint8Array(expectedBytes);
2442
+ for (let i = 0; i < expectedBytes; i += 1) {
2443
+ bytes[i] = Number.parseInt(clean.slice(i * 2, i * 2 + 2), 16);
2444
+ }
2445
+ return bytes;
2446
+ }
2447
+ function u64le(value) {
2448
+ const out = new Uint8Array(8);
2449
+ new DataView(out.buffer).setBigUint64(0, BigInt(value), true);
2450
+ return out;
2451
+ }
2452
+ function concat(...parts) {
2453
+ const out = new Uint8Array(parts.reduce((total, p) => total + p.length, 0));
2454
+ let offset = 0;
2455
+ for (const part of parts) {
2456
+ out.set(part, offset);
2457
+ offset += part.length;
2458
+ }
2459
+ return out;
2460
+ }
2461
+ async function domainHash(domain, parts) {
2462
+ const chunks = [u64le(domain.length), domain];
2463
+ for (const part of parts) {
2464
+ chunks.push(u64le(part.length), part);
2465
+ }
2466
+ return new Uint8Array(
2467
+ await crypto.subtle.digest("SHA-256", concat(...chunks))
2468
+ );
2469
+ }
2470
+ async function importSigningKey(secretHex) {
2471
+ const seed = fromHex(secretHex, "deviceSecret", 32);
2472
+ const pkcs8 = concat(PKCS8_ED25519_PREFIX, seed);
2473
+ try {
2474
+ return await crypto.subtle.importKey(
2475
+ "pkcs8",
2476
+ pkcs8,
2477
+ { name: "Ed25519" },
2478
+ false,
2479
+ ["sign"]
2480
+ );
2481
+ } catch (cause) {
2482
+ const detail = cause instanceof Error ? `: ${cause.message}` : "";
2483
+ throw new Error(
2484
+ "this runtime has no WebCrypto Ed25519, so a warrant cannot be signed here. Node 18.4+, Safari 17+, Firefox 129+ and Chrome 137+ have it; otherwise mint the warrant with `merod account warrant`" + detail
2485
+ );
2486
+ }
2487
+ }
2488
+ async function derivePublicKey(secretHex) {
2489
+ const seed = fromHex(secretHex, "deviceSecret", 32);
2490
+ const pkcs8 = concat(PKCS8_ED25519_PREFIX, seed);
2491
+ const key = await crypto.subtle.importKey(
2492
+ "pkcs8",
2493
+ pkcs8,
2494
+ { name: "Ed25519" },
2495
+ true,
2496
+ ["sign"]
2497
+ );
2498
+ const jwk = await crypto.subtle.exportKey("jwk", key);
2499
+ const raw = jwk.x;
2500
+ return Uint8Array.from(
2501
+ atob(raw.replace(/-/g, "+").replace(/_/g, "/")),
2502
+ (c) => c.charCodeAt(0)
2503
+ );
2504
+ }
2505
+
2506
+ // src/device-cert/device-cert.ts
2507
+ var CERT_DOMAIN = new TextEncoder().encode("calimero.device.cert.v1");
2508
+ var ACCOUNT_ID_DOMAIN = new TextEncoder().encode("calimero.account.genesis.v1");
2509
+ var DEVICE_ID_DOMAIN = new TextEncoder().encode("calimero.device.id.v1");
2510
+ var ACCOUNT_GENESIS_VERSION = 2;
2511
+ async function mintDeviceId(account, nonce) {
2512
+ if (nonce.length !== 16) {
2513
+ throw new Error(`nonce must be 16 bytes, got ${nonce.length}`);
2514
+ }
2515
+ const accountBytes = fromHex(account, "account", 32);
2516
+ return hex(await domainHash(DEVICE_ID_DOMAIN, [accountBytes, nonce]));
2517
+ }
2518
+ async function deviceCertPayload(input) {
2519
+ return domainHash(CERT_DOMAIN, [
2520
+ fromHex(input.account, "account", 32),
2521
+ fromHex(input.device, "device", 32),
2522
+ fromHex(input.signPublicKey, "signPublicKey", 32),
2523
+ fromHex(input.kemPublicKey, "kemPublicKey", 32),
2524
+ u32le(input.keyEpoch),
2525
+ u32le(input.deviceEpoch)
2526
+ ]);
2527
+ }
2528
+ function accountProofBytes(input) {
2529
+ return concat(
2530
+ new Uint8Array([ACCOUNT_GENESIS_VERSION]),
2531
+ input.rootPublicKey,
2532
+ u32le(0),
2533
+ fromHex(input.account, "account", 32),
2534
+ fromHex(input.device, "device", 32),
2535
+ fromHex(input.signPublicKey, "signPublicKey", 32),
2536
+ fromHex(input.kemPublicKey, "kemPublicKey", 32),
2537
+ u32le(input.keyEpoch),
2538
+ u32le(input.deviceEpoch),
2539
+ input.signature
2540
+ );
2541
+ }
2542
+ async function signDeviceCert(input) {
2543
+ const rootPublicKey = await derivePublicKey(input.rootSecret);
2544
+ const account = hex(
2545
+ await domainHash(ACCOUNT_ID_DOMAIN, [
2546
+ concat(new Uint8Array([ACCOUNT_GENESIS_VERSION]), rootPublicKey)
2547
+ ])
2548
+ );
2549
+ const keyEpoch = 0;
2550
+ const payload = await deviceCertPayload({
2551
+ account,
2552
+ device: input.device,
2553
+ signPublicKey: input.signPublicKey,
2554
+ kemPublicKey: input.kemPublicKey,
2555
+ keyEpoch,
2556
+ deviceEpoch: input.deviceEpoch
2557
+ });
2558
+ const key = await importSigningKey(input.rootSecret);
2559
+ const signature = new Uint8Array(
2560
+ await crypto.subtle.sign("Ed25519", key, payload)
2561
+ );
2562
+ const credential = accountProofBytes({
2563
+ rootPublicKey,
2564
+ account,
2565
+ device: input.device,
2566
+ signPublicKey: input.signPublicKey,
2567
+ kemPublicKey: input.kemPublicKey,
2568
+ keyEpoch,
2569
+ deviceEpoch: input.deviceEpoch,
2570
+ signature
2571
+ });
2572
+ return hex(credential);
2573
+ }
2574
+ async function accountForRoot(rootSecret) {
2575
+ const rootPublicKey = await derivePublicKey(rootSecret);
2576
+ return hex(
2577
+ await domainHash(ACCOUNT_ID_DOMAIN, [
2578
+ concat(new Uint8Array([ACCOUNT_GENESIS_VERSION]), rootPublicKey)
2579
+ ])
2580
+ );
2581
+ }
2582
+
2583
+ // src/account/wordlist.ts
2584
+ var ENGLISH_WORDLIST = [
2585
+ "abandon",
2586
+ "ability",
2587
+ "able",
2588
+ "about",
2589
+ "above",
2590
+ "absent",
2591
+ "absorb",
2592
+ "abstract",
2593
+ "absurd",
2594
+ "abuse",
2595
+ "access",
2596
+ "accident",
2597
+ "account",
2598
+ "accuse",
2599
+ "achieve",
2600
+ "acid",
2601
+ "acoustic",
2602
+ "acquire",
2603
+ "across",
2604
+ "act",
2605
+ "action",
2606
+ "actor",
2607
+ "actress",
2608
+ "actual",
2609
+ "adapt",
2610
+ "add",
2611
+ "addict",
2612
+ "address",
2613
+ "adjust",
2614
+ "admit",
2615
+ "adult",
2616
+ "advance",
2617
+ "advice",
2618
+ "aerobic",
2619
+ "affair",
2620
+ "afford",
2621
+ "afraid",
2622
+ "again",
2623
+ "age",
2624
+ "agent",
2625
+ "agree",
2626
+ "ahead",
2627
+ "aim",
2628
+ "air",
2629
+ "airport",
2630
+ "aisle",
2631
+ "alarm",
2632
+ "album",
2633
+ "alcohol",
2634
+ "alert",
2635
+ "alien",
2636
+ "all",
2637
+ "alley",
2638
+ "allow",
2639
+ "almost",
2640
+ "alone",
2641
+ "alpha",
2642
+ "already",
2643
+ "also",
2644
+ "alter",
2645
+ "always",
2646
+ "amateur",
2647
+ "amazing",
2648
+ "among",
2649
+ "amount",
2650
+ "amused",
2651
+ "analyst",
2652
+ "anchor",
2653
+ "ancient",
2654
+ "anger",
2655
+ "angle",
2656
+ "angry",
2657
+ "animal",
2658
+ "ankle",
2659
+ "announce",
2660
+ "annual",
2661
+ "another",
2662
+ "answer",
2663
+ "antenna",
2664
+ "antique",
2665
+ "anxiety",
2666
+ "any",
2667
+ "apart",
2668
+ "apology",
2669
+ "appear",
2670
+ "apple",
2671
+ "approve",
2672
+ "april",
2673
+ "arch",
2674
+ "arctic",
2675
+ "area",
2676
+ "arena",
2677
+ "argue",
2678
+ "arm",
2679
+ "armed",
2680
+ "armor",
2681
+ "army",
2682
+ "around",
2683
+ "arrange",
2684
+ "arrest",
2685
+ "arrive",
2686
+ "arrow",
2687
+ "art",
2688
+ "artefact",
2689
+ "artist",
2690
+ "artwork",
2691
+ "ask",
2692
+ "aspect",
2693
+ "assault",
2694
+ "asset",
2695
+ "assist",
2696
+ "assume",
2697
+ "asthma",
2698
+ "athlete",
2699
+ "atom",
2700
+ "attack",
2701
+ "attend",
2702
+ "attitude",
2703
+ "attract",
2704
+ "auction",
2705
+ "audit",
2706
+ "august",
2707
+ "aunt",
2708
+ "author",
2709
+ "auto",
2710
+ "autumn",
2711
+ "average",
2712
+ "avocado",
2713
+ "avoid",
2714
+ "awake",
2715
+ "aware",
2716
+ "away",
2717
+ "awesome",
2718
+ "awful",
2719
+ "awkward",
2720
+ "axis",
2721
+ "baby",
2722
+ "bachelor",
2723
+ "bacon",
2724
+ "badge",
2725
+ "bag",
2726
+ "balance",
2727
+ "balcony",
2728
+ "ball",
2729
+ "bamboo",
2730
+ "banana",
2731
+ "banner",
2732
+ "bar",
2733
+ "barely",
2734
+ "bargain",
2735
+ "barrel",
2736
+ "base",
2737
+ "basic",
2738
+ "basket",
2739
+ "battle",
2740
+ "beach",
2741
+ "bean",
2742
+ "beauty",
2743
+ "because",
2744
+ "become",
2745
+ "beef",
2746
+ "before",
2747
+ "begin",
2748
+ "behave",
2749
+ "behind",
2750
+ "believe",
2751
+ "below",
2752
+ "belt",
2753
+ "bench",
2754
+ "benefit",
2755
+ "best",
2756
+ "betray",
2757
+ "better",
2758
+ "between",
2759
+ "beyond",
2760
+ "bicycle",
2761
+ "bid",
2762
+ "bike",
2763
+ "bind",
2764
+ "biology",
2765
+ "bird",
2766
+ "birth",
2767
+ "bitter",
2768
+ "black",
2769
+ "blade",
2770
+ "blame",
2771
+ "blanket",
2772
+ "blast",
2773
+ "bleak",
2774
+ "bless",
2775
+ "blind",
2776
+ "blood",
2777
+ "blossom",
2778
+ "blouse",
2779
+ "blue",
2780
+ "blur",
2781
+ "blush",
2782
+ "board",
2783
+ "boat",
2784
+ "body",
2785
+ "boil",
2786
+ "bomb",
2787
+ "bone",
2788
+ "bonus",
2789
+ "book",
2790
+ "boost",
2791
+ "border",
2792
+ "boring",
2793
+ "borrow",
2794
+ "boss",
2795
+ "bottom",
2796
+ "bounce",
2797
+ "box",
2798
+ "boy",
2799
+ "bracket",
2800
+ "brain",
2801
+ "brand",
2802
+ "brass",
2803
+ "brave",
2804
+ "bread",
2805
+ "breeze",
2806
+ "brick",
2807
+ "bridge",
2808
+ "brief",
2809
+ "bright",
2810
+ "bring",
2811
+ "brisk",
2812
+ "broccoli",
2813
+ "broken",
2814
+ "bronze",
2815
+ "broom",
2816
+ "brother",
2817
+ "brown",
2818
+ "brush",
2819
+ "bubble",
2820
+ "buddy",
2821
+ "budget",
2822
+ "buffalo",
2823
+ "build",
2824
+ "bulb",
2825
+ "bulk",
2826
+ "bullet",
2827
+ "bundle",
2828
+ "bunker",
2829
+ "burden",
2830
+ "burger",
2831
+ "burst",
2832
+ "bus",
2833
+ "business",
2834
+ "busy",
2835
+ "butter",
2836
+ "buyer",
2837
+ "buzz",
2838
+ "cabbage",
2839
+ "cabin",
2840
+ "cable",
2841
+ "cactus",
2842
+ "cage",
2843
+ "cake",
2844
+ "call",
2845
+ "calm",
2846
+ "camera",
2847
+ "camp",
2848
+ "can",
2849
+ "canal",
2850
+ "cancel",
2851
+ "candy",
2852
+ "cannon",
2853
+ "canoe",
2854
+ "canvas",
2855
+ "canyon",
2856
+ "capable",
2857
+ "capital",
2858
+ "captain",
2859
+ "car",
2860
+ "carbon",
2861
+ "card",
2862
+ "cargo",
2863
+ "carpet",
2864
+ "carry",
2865
+ "cart",
2866
+ "case",
2867
+ "cash",
2868
+ "casino",
2869
+ "castle",
2870
+ "casual",
2871
+ "cat",
2872
+ "catalog",
2873
+ "catch",
2874
+ "category",
2875
+ "cattle",
2876
+ "caught",
2877
+ "cause",
2878
+ "caution",
2879
+ "cave",
2880
+ "ceiling",
2881
+ "celery",
2882
+ "cement",
2883
+ "census",
2884
+ "century",
2885
+ "cereal",
2886
+ "certain",
2887
+ "chair",
2888
+ "chalk",
2889
+ "champion",
2890
+ "change",
2891
+ "chaos",
2892
+ "chapter",
2893
+ "charge",
2894
+ "chase",
2895
+ "chat",
2896
+ "cheap",
2897
+ "check",
2898
+ "cheese",
2899
+ "chef",
2900
+ "cherry",
2901
+ "chest",
2902
+ "chicken",
2903
+ "chief",
2904
+ "child",
2905
+ "chimney",
2906
+ "choice",
2907
+ "choose",
2908
+ "chronic",
2909
+ "chuckle",
2910
+ "chunk",
2911
+ "churn",
2912
+ "cigar",
2913
+ "cinnamon",
2914
+ "circle",
2915
+ "citizen",
2916
+ "city",
2917
+ "civil",
2918
+ "claim",
2919
+ "clap",
2920
+ "clarify",
2921
+ "claw",
2922
+ "clay",
2923
+ "clean",
2924
+ "clerk",
2925
+ "clever",
2926
+ "click",
2927
+ "client",
2928
+ "cliff",
2929
+ "climb",
2930
+ "clinic",
2931
+ "clip",
2932
+ "clock",
2933
+ "clog",
2934
+ "close",
2935
+ "cloth",
2936
+ "cloud",
2937
+ "clown",
2938
+ "club",
2939
+ "clump",
2940
+ "cluster",
2941
+ "clutch",
2942
+ "coach",
2943
+ "coast",
2944
+ "coconut",
2945
+ "code",
2946
+ "coffee",
2947
+ "coil",
2948
+ "coin",
2949
+ "collect",
2950
+ "color",
2951
+ "column",
2952
+ "combine",
2953
+ "come",
2954
+ "comfort",
2955
+ "comic",
2956
+ "common",
2957
+ "company",
2958
+ "concert",
2959
+ "conduct",
2960
+ "confirm",
2961
+ "congress",
2962
+ "connect",
2963
+ "consider",
2964
+ "control",
2965
+ "convince",
2966
+ "cook",
2967
+ "cool",
2968
+ "copper",
2969
+ "copy",
2970
+ "coral",
2971
+ "core",
2972
+ "corn",
2973
+ "correct",
2974
+ "cost",
2975
+ "cotton",
2976
+ "couch",
2977
+ "country",
2978
+ "couple",
2979
+ "course",
2980
+ "cousin",
2981
+ "cover",
2982
+ "coyote",
2983
+ "crack",
2984
+ "cradle",
2985
+ "craft",
2986
+ "cram",
2987
+ "crane",
2988
+ "crash",
2989
+ "crater",
2990
+ "crawl",
2991
+ "crazy",
2992
+ "cream",
2993
+ "credit",
2994
+ "creek",
2995
+ "crew",
2996
+ "cricket",
2997
+ "crime",
2998
+ "crisp",
2999
+ "critic",
3000
+ "crop",
3001
+ "cross",
3002
+ "crouch",
3003
+ "crowd",
3004
+ "crucial",
3005
+ "cruel",
3006
+ "cruise",
3007
+ "crumble",
3008
+ "crunch",
3009
+ "crush",
3010
+ "cry",
3011
+ "crystal",
3012
+ "cube",
3013
+ "culture",
3014
+ "cup",
3015
+ "cupboard",
3016
+ "curious",
3017
+ "current",
3018
+ "curtain",
3019
+ "curve",
3020
+ "cushion",
3021
+ "custom",
3022
+ "cute",
3023
+ "cycle",
3024
+ "dad",
3025
+ "damage",
3026
+ "damp",
3027
+ "dance",
3028
+ "danger",
3029
+ "daring",
3030
+ "dash",
3031
+ "daughter",
3032
+ "dawn",
3033
+ "day",
3034
+ "deal",
3035
+ "debate",
3036
+ "debris",
3037
+ "decade",
3038
+ "december",
3039
+ "decide",
3040
+ "decline",
3041
+ "decorate",
3042
+ "decrease",
3043
+ "deer",
3044
+ "defense",
3045
+ "define",
3046
+ "defy",
3047
+ "degree",
3048
+ "delay",
3049
+ "deliver",
3050
+ "demand",
3051
+ "demise",
3052
+ "denial",
3053
+ "dentist",
3054
+ "deny",
3055
+ "depart",
3056
+ "depend",
3057
+ "deposit",
3058
+ "depth",
3059
+ "deputy",
3060
+ "derive",
3061
+ "describe",
3062
+ "desert",
3063
+ "design",
3064
+ "desk",
3065
+ "despair",
3066
+ "destroy",
3067
+ "detail",
3068
+ "detect",
3069
+ "develop",
3070
+ "device",
3071
+ "devote",
3072
+ "diagram",
3073
+ "dial",
3074
+ "diamond",
3075
+ "diary",
3076
+ "dice",
3077
+ "diesel",
3078
+ "diet",
3079
+ "differ",
3080
+ "digital",
3081
+ "dignity",
3082
+ "dilemma",
3083
+ "dinner",
3084
+ "dinosaur",
3085
+ "direct",
3086
+ "dirt",
3087
+ "disagree",
3088
+ "discover",
3089
+ "disease",
3090
+ "dish",
3091
+ "dismiss",
3092
+ "disorder",
3093
+ "display",
3094
+ "distance",
3095
+ "divert",
3096
+ "divide",
3097
+ "divorce",
3098
+ "dizzy",
3099
+ "doctor",
3100
+ "document",
3101
+ "dog",
3102
+ "doll",
3103
+ "dolphin",
3104
+ "domain",
3105
+ "donate",
3106
+ "donkey",
3107
+ "donor",
3108
+ "door",
3109
+ "dose",
3110
+ "double",
3111
+ "dove",
3112
+ "draft",
3113
+ "dragon",
3114
+ "drama",
3115
+ "drastic",
3116
+ "draw",
3117
+ "dream",
3118
+ "dress",
3119
+ "drift",
3120
+ "drill",
3121
+ "drink",
3122
+ "drip",
3123
+ "drive",
3124
+ "drop",
3125
+ "drum",
3126
+ "dry",
3127
+ "duck",
3128
+ "dumb",
3129
+ "dune",
3130
+ "during",
3131
+ "dust",
3132
+ "dutch",
3133
+ "duty",
3134
+ "dwarf",
3135
+ "dynamic",
3136
+ "eager",
3137
+ "eagle",
3138
+ "early",
3139
+ "earn",
3140
+ "earth",
3141
+ "easily",
3142
+ "east",
3143
+ "easy",
3144
+ "echo",
3145
+ "ecology",
3146
+ "economy",
3147
+ "edge",
3148
+ "edit",
3149
+ "educate",
3150
+ "effort",
3151
+ "egg",
3152
+ "eight",
3153
+ "either",
3154
+ "elbow",
3155
+ "elder",
3156
+ "electric",
3157
+ "elegant",
3158
+ "element",
3159
+ "elephant",
3160
+ "elevator",
3161
+ "elite",
3162
+ "else",
3163
+ "embark",
3164
+ "embody",
3165
+ "embrace",
3166
+ "emerge",
3167
+ "emotion",
3168
+ "employ",
3169
+ "empower",
3170
+ "empty",
3171
+ "enable",
3172
+ "enact",
3173
+ "end",
3174
+ "endless",
3175
+ "endorse",
3176
+ "enemy",
3177
+ "energy",
3178
+ "enforce",
3179
+ "engage",
3180
+ "engine",
3181
+ "enhance",
3182
+ "enjoy",
3183
+ "enlist",
3184
+ "enough",
3185
+ "enrich",
3186
+ "enroll",
3187
+ "ensure",
3188
+ "enter",
3189
+ "entire",
3190
+ "entry",
3191
+ "envelope",
3192
+ "episode",
3193
+ "equal",
3194
+ "equip",
3195
+ "era",
3196
+ "erase",
3197
+ "erode",
3198
+ "erosion",
3199
+ "error",
3200
+ "erupt",
3201
+ "escape",
3202
+ "essay",
3203
+ "essence",
3204
+ "estate",
3205
+ "eternal",
3206
+ "ethics",
3207
+ "evidence",
3208
+ "evil",
3209
+ "evoke",
3210
+ "evolve",
3211
+ "exact",
3212
+ "example",
3213
+ "excess",
3214
+ "exchange",
3215
+ "excite",
3216
+ "exclude",
3217
+ "excuse",
3218
+ "execute",
3219
+ "exercise",
3220
+ "exhaust",
3221
+ "exhibit",
3222
+ "exile",
3223
+ "exist",
3224
+ "exit",
3225
+ "exotic",
3226
+ "expand",
3227
+ "expect",
3228
+ "expire",
3229
+ "explain",
3230
+ "expose",
3231
+ "express",
3232
+ "extend",
3233
+ "extra",
3234
+ "eye",
3235
+ "eyebrow",
3236
+ "fabric",
3237
+ "face",
3238
+ "faculty",
3239
+ "fade",
3240
+ "faint",
3241
+ "faith",
3242
+ "fall",
3243
+ "false",
3244
+ "fame",
3245
+ "family",
3246
+ "famous",
3247
+ "fan",
3248
+ "fancy",
3249
+ "fantasy",
3250
+ "farm",
3251
+ "fashion",
3252
+ "fat",
3253
+ "fatal",
3254
+ "father",
3255
+ "fatigue",
3256
+ "fault",
3257
+ "favorite",
3258
+ "feature",
3259
+ "february",
3260
+ "federal",
3261
+ "fee",
3262
+ "feed",
3263
+ "feel",
3264
+ "female",
3265
+ "fence",
3266
+ "festival",
3267
+ "fetch",
3268
+ "fever",
3269
+ "few",
3270
+ "fiber",
3271
+ "fiction",
3272
+ "field",
3273
+ "figure",
3274
+ "file",
3275
+ "film",
3276
+ "filter",
3277
+ "final",
3278
+ "find",
3279
+ "fine",
3280
+ "finger",
3281
+ "finish",
3282
+ "fire",
3283
+ "firm",
3284
+ "first",
3285
+ "fiscal",
3286
+ "fish",
3287
+ "fit",
3288
+ "fitness",
3289
+ "fix",
3290
+ "flag",
3291
+ "flame",
3292
+ "flash",
3293
+ "flat",
3294
+ "flavor",
3295
+ "flee",
3296
+ "flight",
3297
+ "flip",
3298
+ "float",
3299
+ "flock",
3300
+ "floor",
3301
+ "flower",
3302
+ "fluid",
3303
+ "flush",
3304
+ "fly",
3305
+ "foam",
3306
+ "focus",
3307
+ "fog",
3308
+ "foil",
3309
+ "fold",
3310
+ "follow",
3311
+ "food",
3312
+ "foot",
3313
+ "force",
3314
+ "forest",
3315
+ "forget",
3316
+ "fork",
3317
+ "fortune",
3318
+ "forum",
3319
+ "forward",
3320
+ "fossil",
3321
+ "foster",
3322
+ "found",
3323
+ "fox",
3324
+ "fragile",
3325
+ "frame",
3326
+ "frequent",
3327
+ "fresh",
3328
+ "friend",
3329
+ "fringe",
3330
+ "frog",
3331
+ "front",
3332
+ "frost",
3333
+ "frown",
3334
+ "frozen",
3335
+ "fruit",
3336
+ "fuel",
3337
+ "fun",
3338
+ "funny",
3339
+ "furnace",
3340
+ "fury",
3341
+ "future",
3342
+ "gadget",
3343
+ "gain",
3344
+ "galaxy",
3345
+ "gallery",
3346
+ "game",
3347
+ "gap",
3348
+ "garage",
3349
+ "garbage",
3350
+ "garden",
3351
+ "garlic",
3352
+ "garment",
3353
+ "gas",
3354
+ "gasp",
3355
+ "gate",
3356
+ "gather",
3357
+ "gauge",
3358
+ "gaze",
3359
+ "general",
3360
+ "genius",
3361
+ "genre",
3362
+ "gentle",
3363
+ "genuine",
3364
+ "gesture",
3365
+ "ghost",
3366
+ "giant",
3367
+ "gift",
3368
+ "giggle",
3369
+ "ginger",
3370
+ "giraffe",
3371
+ "girl",
3372
+ "give",
3373
+ "glad",
3374
+ "glance",
3375
+ "glare",
3376
+ "glass",
3377
+ "glide",
3378
+ "glimpse",
3379
+ "globe",
3380
+ "gloom",
3381
+ "glory",
3382
+ "glove",
3383
+ "glow",
3384
+ "glue",
3385
+ "goat",
3386
+ "goddess",
3387
+ "gold",
3388
+ "good",
3389
+ "goose",
3390
+ "gorilla",
3391
+ "gospel",
3392
+ "gossip",
3393
+ "govern",
3394
+ "gown",
3395
+ "grab",
3396
+ "grace",
3397
+ "grain",
3398
+ "grant",
3399
+ "grape",
3400
+ "grass",
3401
+ "gravity",
3402
+ "great",
3403
+ "green",
3404
+ "grid",
3405
+ "grief",
3406
+ "grit",
3407
+ "grocery",
3408
+ "group",
3409
+ "grow",
3410
+ "grunt",
3411
+ "guard",
3412
+ "guess",
3413
+ "guide",
3414
+ "guilt",
3415
+ "guitar",
3416
+ "gun",
3417
+ "gym",
3418
+ "habit",
3419
+ "hair",
3420
+ "half",
3421
+ "hammer",
3422
+ "hamster",
3423
+ "hand",
3424
+ "happy",
3425
+ "harbor",
3426
+ "hard",
3427
+ "harsh",
3428
+ "harvest",
3429
+ "hat",
3430
+ "have",
3431
+ "hawk",
3432
+ "hazard",
3433
+ "head",
3434
+ "health",
3435
+ "heart",
3436
+ "heavy",
3437
+ "hedgehog",
3438
+ "height",
3439
+ "hello",
3440
+ "helmet",
3441
+ "help",
3442
+ "hen",
3443
+ "hero",
3444
+ "hidden",
3445
+ "high",
3446
+ "hill",
3447
+ "hint",
3448
+ "hip",
3449
+ "hire",
3450
+ "history",
3451
+ "hobby",
3452
+ "hockey",
3453
+ "hold",
3454
+ "hole",
3455
+ "holiday",
3456
+ "hollow",
3457
+ "home",
3458
+ "honey",
3459
+ "hood",
3460
+ "hope",
3461
+ "horn",
3462
+ "horror",
3463
+ "horse",
3464
+ "hospital",
3465
+ "host",
3466
+ "hotel",
3467
+ "hour",
3468
+ "hover",
3469
+ "hub",
3470
+ "huge",
3471
+ "human",
3472
+ "humble",
3473
+ "humor",
3474
+ "hundred",
3475
+ "hungry",
3476
+ "hunt",
3477
+ "hurdle",
3478
+ "hurry",
3479
+ "hurt",
3480
+ "husband",
3481
+ "hybrid",
3482
+ "ice",
3483
+ "icon",
3484
+ "idea",
3485
+ "identify",
3486
+ "idle",
3487
+ "ignore",
3488
+ "ill",
3489
+ "illegal",
3490
+ "illness",
3491
+ "image",
3492
+ "imitate",
3493
+ "immense",
3494
+ "immune",
3495
+ "impact",
3496
+ "impose",
3497
+ "improve",
3498
+ "impulse",
3499
+ "inch",
3500
+ "include",
3501
+ "income",
3502
+ "increase",
3503
+ "index",
3504
+ "indicate",
3505
+ "indoor",
3506
+ "industry",
3507
+ "infant",
3508
+ "inflict",
3509
+ "inform",
3510
+ "inhale",
3511
+ "inherit",
3512
+ "initial",
3513
+ "inject",
3514
+ "injury",
3515
+ "inmate",
3516
+ "inner",
3517
+ "innocent",
3518
+ "input",
3519
+ "inquiry",
3520
+ "insane",
3521
+ "insect",
3522
+ "inside",
3523
+ "inspire",
3524
+ "install",
3525
+ "intact",
3526
+ "interest",
3527
+ "into",
3528
+ "invest",
3529
+ "invite",
3530
+ "involve",
3531
+ "iron",
3532
+ "island",
3533
+ "isolate",
3534
+ "issue",
3535
+ "item",
3536
+ "ivory",
3537
+ "jacket",
3538
+ "jaguar",
3539
+ "jar",
3540
+ "jazz",
3541
+ "jealous",
3542
+ "jeans",
3543
+ "jelly",
3544
+ "jewel",
3545
+ "job",
3546
+ "join",
3547
+ "joke",
3548
+ "journey",
3549
+ "joy",
3550
+ "judge",
3551
+ "juice",
3552
+ "jump",
3553
+ "jungle",
3554
+ "junior",
3555
+ "junk",
3556
+ "just",
3557
+ "kangaroo",
3558
+ "keen",
3559
+ "keep",
3560
+ "ketchup",
3561
+ "key",
3562
+ "kick",
3563
+ "kid",
3564
+ "kidney",
3565
+ "kind",
3566
+ "kingdom",
3567
+ "kiss",
3568
+ "kit",
3569
+ "kitchen",
3570
+ "kite",
3571
+ "kitten",
3572
+ "kiwi",
3573
+ "knee",
3574
+ "knife",
3575
+ "knock",
3576
+ "know",
3577
+ "lab",
3578
+ "label",
3579
+ "labor",
3580
+ "ladder",
3581
+ "lady",
3582
+ "lake",
3583
+ "lamp",
3584
+ "language",
3585
+ "laptop",
3586
+ "large",
3587
+ "later",
3588
+ "latin",
3589
+ "laugh",
3590
+ "laundry",
3591
+ "lava",
3592
+ "law",
3593
+ "lawn",
3594
+ "lawsuit",
3595
+ "layer",
3596
+ "lazy",
3597
+ "leader",
3598
+ "leaf",
3599
+ "learn",
3600
+ "leave",
3601
+ "lecture",
3602
+ "left",
3603
+ "leg",
3604
+ "legal",
3605
+ "legend",
3606
+ "leisure",
3607
+ "lemon",
3608
+ "lend",
3609
+ "length",
3610
+ "lens",
3611
+ "leopard",
3612
+ "lesson",
3613
+ "letter",
3614
+ "level",
3615
+ "liar",
3616
+ "liberty",
3617
+ "library",
3618
+ "license",
3619
+ "life",
3620
+ "lift",
3621
+ "light",
3622
+ "like",
3623
+ "limb",
3624
+ "limit",
3625
+ "link",
3626
+ "lion",
3627
+ "liquid",
3628
+ "list",
3629
+ "little",
3630
+ "live",
3631
+ "lizard",
3632
+ "load",
3633
+ "loan",
3634
+ "lobster",
3635
+ "local",
3636
+ "lock",
3637
+ "logic",
3638
+ "lonely",
3639
+ "long",
3640
+ "loop",
3641
+ "lottery",
3642
+ "loud",
3643
+ "lounge",
3644
+ "love",
3645
+ "loyal",
3646
+ "lucky",
3647
+ "luggage",
3648
+ "lumber",
3649
+ "lunar",
3650
+ "lunch",
3651
+ "luxury",
3652
+ "lyrics",
3653
+ "machine",
3654
+ "mad",
3655
+ "magic",
3656
+ "magnet",
3657
+ "maid",
3658
+ "mail",
3659
+ "main",
3660
+ "major",
3661
+ "make",
3662
+ "mammal",
3663
+ "man",
3664
+ "manage",
3665
+ "mandate",
3666
+ "mango",
3667
+ "mansion",
3668
+ "manual",
3669
+ "maple",
3670
+ "marble",
3671
+ "march",
3672
+ "margin",
3673
+ "marine",
3674
+ "market",
3675
+ "marriage",
3676
+ "mask",
3677
+ "mass",
3678
+ "master",
3679
+ "match",
3680
+ "material",
3681
+ "math",
3682
+ "matrix",
3683
+ "matter",
3684
+ "maximum",
3685
+ "maze",
3686
+ "meadow",
3687
+ "mean",
3688
+ "measure",
3689
+ "meat",
3690
+ "mechanic",
3691
+ "medal",
3692
+ "media",
3693
+ "melody",
3694
+ "melt",
3695
+ "member",
3696
+ "memory",
3697
+ "mention",
3698
+ "menu",
3699
+ "mercy",
3700
+ "merge",
3701
+ "merit",
3702
+ "merry",
3703
+ "mesh",
3704
+ "message",
3705
+ "metal",
3706
+ "method",
3707
+ "middle",
3708
+ "midnight",
3709
+ "milk",
3710
+ "million",
3711
+ "mimic",
3712
+ "mind",
3713
+ "minimum",
3714
+ "minor",
3715
+ "minute",
3716
+ "miracle",
3717
+ "mirror",
3718
+ "misery",
3719
+ "miss",
3720
+ "mistake",
3721
+ "mix",
3722
+ "mixed",
3723
+ "mixture",
3724
+ "mobile",
3725
+ "model",
3726
+ "modify",
3727
+ "mom",
3728
+ "moment",
3729
+ "monitor",
3730
+ "monkey",
3731
+ "monster",
3732
+ "month",
3733
+ "moon",
3734
+ "moral",
3735
+ "more",
3736
+ "morning",
3737
+ "mosquito",
3738
+ "mother",
3739
+ "motion",
3740
+ "motor",
3741
+ "mountain",
3742
+ "mouse",
3743
+ "move",
3744
+ "movie",
3745
+ "much",
3746
+ "muffin",
3747
+ "mule",
3748
+ "multiply",
3749
+ "muscle",
3750
+ "museum",
3751
+ "mushroom",
3752
+ "music",
3753
+ "must",
3754
+ "mutual",
3755
+ "myself",
3756
+ "mystery",
3757
+ "myth",
3758
+ "naive",
3759
+ "name",
3760
+ "napkin",
3761
+ "narrow",
3762
+ "nasty",
3763
+ "nation",
3764
+ "nature",
3765
+ "near",
3766
+ "neck",
3767
+ "need",
3768
+ "negative",
3769
+ "neglect",
3770
+ "neither",
3771
+ "nephew",
3772
+ "nerve",
3773
+ "nest",
3774
+ "net",
3775
+ "network",
3776
+ "neutral",
3777
+ "never",
3778
+ "news",
3779
+ "next",
3780
+ "nice",
3781
+ "night",
3782
+ "noble",
3783
+ "noise",
3784
+ "nominee",
3785
+ "noodle",
3786
+ "normal",
3787
+ "north",
3788
+ "nose",
3789
+ "notable",
3790
+ "note",
3791
+ "nothing",
3792
+ "notice",
3793
+ "novel",
3794
+ "now",
3795
+ "nuclear",
3796
+ "number",
3797
+ "nurse",
3798
+ "nut",
3799
+ "oak",
3800
+ "obey",
3801
+ "object",
3802
+ "oblige",
3803
+ "obscure",
3804
+ "observe",
3805
+ "obtain",
3806
+ "obvious",
3807
+ "occur",
3808
+ "ocean",
3809
+ "october",
3810
+ "odor",
3811
+ "off",
3812
+ "offer",
3813
+ "office",
3814
+ "often",
3815
+ "oil",
3816
+ "okay",
3817
+ "old",
3818
+ "olive",
3819
+ "olympic",
3820
+ "omit",
3821
+ "once",
3822
+ "one",
3823
+ "onion",
3824
+ "online",
3825
+ "only",
3826
+ "open",
3827
+ "opera",
3828
+ "opinion",
3829
+ "oppose",
3830
+ "option",
3831
+ "orange",
3832
+ "orbit",
3833
+ "orchard",
3834
+ "order",
3835
+ "ordinary",
3836
+ "organ",
3837
+ "orient",
3838
+ "original",
3839
+ "orphan",
3840
+ "ostrich",
3841
+ "other",
3842
+ "outdoor",
3843
+ "outer",
3844
+ "output",
3845
+ "outside",
3846
+ "oval",
3847
+ "oven",
3848
+ "over",
3849
+ "own",
3850
+ "owner",
3851
+ "oxygen",
3852
+ "oyster",
3853
+ "ozone",
3854
+ "pact",
3855
+ "paddle",
3856
+ "page",
3857
+ "pair",
3858
+ "palace",
3859
+ "palm",
3860
+ "panda",
3861
+ "panel",
3862
+ "panic",
3863
+ "panther",
3864
+ "paper",
3865
+ "parade",
3866
+ "parent",
3867
+ "park",
3868
+ "parrot",
3869
+ "party",
3870
+ "pass",
3871
+ "patch",
3872
+ "path",
3873
+ "patient",
3874
+ "patrol",
3875
+ "pattern",
3876
+ "pause",
3877
+ "pave",
3878
+ "payment",
3879
+ "peace",
3880
+ "peanut",
3881
+ "pear",
3882
+ "peasant",
3883
+ "pelican",
3884
+ "pen",
3885
+ "penalty",
3886
+ "pencil",
3887
+ "people",
3888
+ "pepper",
3889
+ "perfect",
3890
+ "permit",
3891
+ "person",
3892
+ "pet",
3893
+ "phone",
3894
+ "photo",
3895
+ "phrase",
3896
+ "physical",
3897
+ "piano",
3898
+ "picnic",
3899
+ "picture",
3900
+ "piece",
3901
+ "pig",
3902
+ "pigeon",
3903
+ "pill",
3904
+ "pilot",
3905
+ "pink",
3906
+ "pioneer",
3907
+ "pipe",
3908
+ "pistol",
3909
+ "pitch",
3910
+ "pizza",
3911
+ "place",
3912
+ "planet",
3913
+ "plastic",
3914
+ "plate",
3915
+ "play",
3916
+ "please",
3917
+ "pledge",
3918
+ "pluck",
3919
+ "plug",
3920
+ "plunge",
3921
+ "poem",
3922
+ "poet",
3923
+ "point",
3924
+ "polar",
3925
+ "pole",
3926
+ "police",
3927
+ "pond",
3928
+ "pony",
3929
+ "pool",
3930
+ "popular",
3931
+ "portion",
3932
+ "position",
3933
+ "possible",
3934
+ "post",
3935
+ "potato",
3936
+ "pottery",
3937
+ "poverty",
3938
+ "powder",
3939
+ "power",
3940
+ "practice",
3941
+ "praise",
3942
+ "predict",
3943
+ "prefer",
3944
+ "prepare",
3945
+ "present",
3946
+ "pretty",
3947
+ "prevent",
3948
+ "price",
3949
+ "pride",
3950
+ "primary",
3951
+ "print",
3952
+ "priority",
3953
+ "prison",
3954
+ "private",
3955
+ "prize",
3956
+ "problem",
3957
+ "process",
3958
+ "produce",
3959
+ "profit",
3960
+ "program",
3961
+ "project",
3962
+ "promote",
3963
+ "proof",
3964
+ "property",
3965
+ "prosper",
3966
+ "protect",
3967
+ "proud",
3968
+ "provide",
3969
+ "public",
3970
+ "pudding",
3971
+ "pull",
3972
+ "pulp",
3973
+ "pulse",
3974
+ "pumpkin",
3975
+ "punch",
3976
+ "pupil",
3977
+ "puppy",
3978
+ "purchase",
3979
+ "purity",
3980
+ "purpose",
3981
+ "purse",
3982
+ "push",
3983
+ "put",
3984
+ "puzzle",
3985
+ "pyramid",
3986
+ "quality",
3987
+ "quantum",
3988
+ "quarter",
3989
+ "question",
3990
+ "quick",
3991
+ "quit",
3992
+ "quiz",
3993
+ "quote",
3994
+ "rabbit",
3995
+ "raccoon",
3996
+ "race",
3997
+ "rack",
3998
+ "radar",
3999
+ "radio",
4000
+ "rail",
4001
+ "rain",
4002
+ "raise",
4003
+ "rally",
4004
+ "ramp",
4005
+ "ranch",
4006
+ "random",
4007
+ "range",
4008
+ "rapid",
4009
+ "rare",
4010
+ "rate",
4011
+ "rather",
4012
+ "raven",
4013
+ "raw",
4014
+ "razor",
4015
+ "ready",
4016
+ "real",
4017
+ "reason",
4018
+ "rebel",
4019
+ "rebuild",
4020
+ "recall",
4021
+ "receive",
4022
+ "recipe",
4023
+ "record",
4024
+ "recycle",
4025
+ "reduce",
4026
+ "reflect",
4027
+ "reform",
4028
+ "refuse",
4029
+ "region",
4030
+ "regret",
4031
+ "regular",
4032
+ "reject",
4033
+ "relax",
4034
+ "release",
4035
+ "relief",
4036
+ "rely",
4037
+ "remain",
4038
+ "remember",
4039
+ "remind",
4040
+ "remove",
4041
+ "render",
4042
+ "renew",
4043
+ "rent",
4044
+ "reopen",
4045
+ "repair",
4046
+ "repeat",
4047
+ "replace",
4048
+ "report",
4049
+ "require",
4050
+ "rescue",
4051
+ "resemble",
4052
+ "resist",
4053
+ "resource",
4054
+ "response",
4055
+ "result",
4056
+ "retire",
4057
+ "retreat",
4058
+ "return",
4059
+ "reunion",
4060
+ "reveal",
4061
+ "review",
4062
+ "reward",
4063
+ "rhythm",
4064
+ "rib",
4065
+ "ribbon",
4066
+ "rice",
4067
+ "rich",
4068
+ "ride",
4069
+ "ridge",
4070
+ "rifle",
4071
+ "right",
4072
+ "rigid",
4073
+ "ring",
4074
+ "riot",
4075
+ "ripple",
4076
+ "risk",
4077
+ "ritual",
4078
+ "rival",
4079
+ "river",
4080
+ "road",
4081
+ "roast",
4082
+ "robot",
4083
+ "robust",
4084
+ "rocket",
4085
+ "romance",
4086
+ "roof",
4087
+ "rookie",
4088
+ "room",
4089
+ "rose",
4090
+ "rotate",
4091
+ "rough",
4092
+ "round",
4093
+ "route",
4094
+ "royal",
4095
+ "rubber",
4096
+ "rude",
4097
+ "rug",
4098
+ "rule",
4099
+ "run",
4100
+ "runway",
4101
+ "rural",
4102
+ "sad",
4103
+ "saddle",
4104
+ "sadness",
4105
+ "safe",
4106
+ "sail",
4107
+ "salad",
4108
+ "salmon",
4109
+ "salon",
4110
+ "salt",
4111
+ "salute",
4112
+ "same",
4113
+ "sample",
4114
+ "sand",
4115
+ "satisfy",
4116
+ "satoshi",
4117
+ "sauce",
4118
+ "sausage",
4119
+ "save",
4120
+ "say",
4121
+ "scale",
4122
+ "scan",
4123
+ "scare",
4124
+ "scatter",
4125
+ "scene",
4126
+ "scheme",
4127
+ "school",
4128
+ "science",
4129
+ "scissors",
4130
+ "scorpion",
4131
+ "scout",
4132
+ "scrap",
4133
+ "screen",
4134
+ "script",
4135
+ "scrub",
4136
+ "sea",
4137
+ "search",
4138
+ "season",
4139
+ "seat",
4140
+ "second",
4141
+ "secret",
4142
+ "section",
4143
+ "security",
4144
+ "seed",
4145
+ "seek",
4146
+ "segment",
4147
+ "select",
4148
+ "sell",
4149
+ "seminar",
4150
+ "senior",
4151
+ "sense",
4152
+ "sentence",
4153
+ "series",
4154
+ "service",
4155
+ "session",
4156
+ "settle",
4157
+ "setup",
4158
+ "seven",
4159
+ "shadow",
4160
+ "shaft",
4161
+ "shallow",
4162
+ "share",
4163
+ "shed",
4164
+ "shell",
4165
+ "sheriff",
4166
+ "shield",
4167
+ "shift",
4168
+ "shine",
4169
+ "ship",
4170
+ "shiver",
4171
+ "shock",
4172
+ "shoe",
4173
+ "shoot",
4174
+ "shop",
4175
+ "short",
4176
+ "shoulder",
4177
+ "shove",
4178
+ "shrimp",
4179
+ "shrug",
4180
+ "shuffle",
4181
+ "shy",
4182
+ "sibling",
4183
+ "sick",
4184
+ "side",
4185
+ "siege",
4186
+ "sight",
4187
+ "sign",
4188
+ "silent",
4189
+ "silk",
4190
+ "silly",
4191
+ "silver",
4192
+ "similar",
4193
+ "simple",
4194
+ "since",
4195
+ "sing",
4196
+ "siren",
4197
+ "sister",
4198
+ "situate",
4199
+ "six",
4200
+ "size",
4201
+ "skate",
4202
+ "sketch",
4203
+ "ski",
4204
+ "skill",
4205
+ "skin",
4206
+ "skirt",
4207
+ "skull",
4208
+ "slab",
4209
+ "slam",
4210
+ "sleep",
4211
+ "slender",
4212
+ "slice",
4213
+ "slide",
4214
+ "slight",
4215
+ "slim",
4216
+ "slogan",
4217
+ "slot",
4218
+ "slow",
4219
+ "slush",
4220
+ "small",
4221
+ "smart",
4222
+ "smile",
4223
+ "smoke",
4224
+ "smooth",
4225
+ "snack",
4226
+ "snake",
4227
+ "snap",
4228
+ "sniff",
4229
+ "snow",
4230
+ "soap",
4231
+ "soccer",
4232
+ "social",
4233
+ "sock",
4234
+ "soda",
4235
+ "soft",
4236
+ "solar",
4237
+ "soldier",
4238
+ "solid",
4239
+ "solution",
4240
+ "solve",
4241
+ "someone",
4242
+ "song",
4243
+ "soon",
4244
+ "sorry",
4245
+ "sort",
4246
+ "soul",
4247
+ "sound",
4248
+ "soup",
4249
+ "source",
4250
+ "south",
4251
+ "space",
4252
+ "spare",
4253
+ "spatial",
4254
+ "spawn",
4255
+ "speak",
4256
+ "special",
4257
+ "speed",
4258
+ "spell",
4259
+ "spend",
4260
+ "sphere",
4261
+ "spice",
4262
+ "spider",
4263
+ "spike",
4264
+ "spin",
4265
+ "spirit",
4266
+ "split",
4267
+ "spoil",
4268
+ "sponsor",
4269
+ "spoon",
4270
+ "sport",
4271
+ "spot",
4272
+ "spray",
4273
+ "spread",
4274
+ "spring",
4275
+ "spy",
4276
+ "square",
4277
+ "squeeze",
4278
+ "squirrel",
4279
+ "stable",
4280
+ "stadium",
4281
+ "staff",
4282
+ "stage",
4283
+ "stairs",
4284
+ "stamp",
4285
+ "stand",
4286
+ "start",
4287
+ "state",
4288
+ "stay",
4289
+ "steak",
4290
+ "steel",
4291
+ "stem",
4292
+ "step",
4293
+ "stereo",
4294
+ "stick",
4295
+ "still",
4296
+ "sting",
4297
+ "stock",
4298
+ "stomach",
4299
+ "stone",
4300
+ "stool",
4301
+ "story",
4302
+ "stove",
4303
+ "strategy",
4304
+ "street",
4305
+ "strike",
4306
+ "strong",
4307
+ "struggle",
4308
+ "student",
4309
+ "stuff",
4310
+ "stumble",
4311
+ "style",
4312
+ "subject",
4313
+ "submit",
4314
+ "subway",
4315
+ "success",
4316
+ "such",
4317
+ "sudden",
4318
+ "suffer",
4319
+ "sugar",
4320
+ "suggest",
4321
+ "suit",
4322
+ "summer",
4323
+ "sun",
4324
+ "sunny",
4325
+ "sunset",
4326
+ "super",
4327
+ "supply",
4328
+ "supreme",
4329
+ "sure",
4330
+ "surface",
4331
+ "surge",
4332
+ "surprise",
4333
+ "surround",
4334
+ "survey",
4335
+ "suspect",
4336
+ "sustain",
4337
+ "swallow",
4338
+ "swamp",
4339
+ "swap",
4340
+ "swarm",
4341
+ "swear",
4342
+ "sweet",
4343
+ "swift",
4344
+ "swim",
4345
+ "swing",
4346
+ "switch",
4347
+ "sword",
4348
+ "symbol",
4349
+ "symptom",
4350
+ "syrup",
4351
+ "system",
4352
+ "table",
4353
+ "tackle",
4354
+ "tag",
4355
+ "tail",
4356
+ "talent",
4357
+ "talk",
4358
+ "tank",
4359
+ "tape",
4360
+ "target",
4361
+ "task",
4362
+ "taste",
4363
+ "tattoo",
4364
+ "taxi",
4365
+ "teach",
4366
+ "team",
4367
+ "tell",
4368
+ "ten",
4369
+ "tenant",
4370
+ "tennis",
4371
+ "tent",
4372
+ "term",
4373
+ "test",
4374
+ "text",
4375
+ "thank",
4376
+ "that",
4377
+ "theme",
4378
+ "then",
4379
+ "theory",
4380
+ "there",
4381
+ "they",
4382
+ "thing",
4383
+ "this",
4384
+ "thought",
4385
+ "three",
4386
+ "thrive",
4387
+ "throw",
4388
+ "thumb",
4389
+ "thunder",
4390
+ "ticket",
4391
+ "tide",
4392
+ "tiger",
4393
+ "tilt",
4394
+ "timber",
4395
+ "time",
4396
+ "tiny",
4397
+ "tip",
4398
+ "tired",
4399
+ "tissue",
4400
+ "title",
4401
+ "toast",
4402
+ "tobacco",
4403
+ "today",
4404
+ "toddler",
4405
+ "toe",
4406
+ "together",
4407
+ "toilet",
4408
+ "token",
4409
+ "tomato",
4410
+ "tomorrow",
4411
+ "tone",
4412
+ "tongue",
4413
+ "tonight",
4414
+ "tool",
4415
+ "tooth",
4416
+ "top",
4417
+ "topic",
4418
+ "topple",
4419
+ "torch",
4420
+ "tornado",
4421
+ "tortoise",
4422
+ "toss",
4423
+ "total",
4424
+ "tourist",
4425
+ "toward",
4426
+ "tower",
4427
+ "town",
4428
+ "toy",
4429
+ "track",
4430
+ "trade",
4431
+ "traffic",
4432
+ "tragic",
4433
+ "train",
4434
+ "transfer",
4435
+ "trap",
4436
+ "trash",
4437
+ "travel",
4438
+ "tray",
4439
+ "treat",
4440
+ "tree",
4441
+ "trend",
4442
+ "trial",
4443
+ "tribe",
4444
+ "trick",
4445
+ "trigger",
4446
+ "trim",
4447
+ "trip",
4448
+ "trophy",
4449
+ "trouble",
4450
+ "truck",
4451
+ "true",
4452
+ "truly",
4453
+ "trumpet",
4454
+ "trust",
4455
+ "truth",
4456
+ "try",
4457
+ "tube",
4458
+ "tuition",
4459
+ "tumble",
4460
+ "tuna",
4461
+ "tunnel",
4462
+ "turkey",
4463
+ "turn",
4464
+ "turtle",
4465
+ "twelve",
4466
+ "twenty",
4467
+ "twice",
4468
+ "twin",
4469
+ "twist",
4470
+ "two",
4471
+ "type",
4472
+ "typical",
4473
+ "ugly",
4474
+ "umbrella",
4475
+ "unable",
4476
+ "unaware",
4477
+ "uncle",
4478
+ "uncover",
4479
+ "under",
4480
+ "undo",
4481
+ "unfair",
4482
+ "unfold",
4483
+ "unhappy",
4484
+ "uniform",
4485
+ "unique",
4486
+ "unit",
4487
+ "universe",
4488
+ "unknown",
4489
+ "unlock",
4490
+ "until",
4491
+ "unusual",
4492
+ "unveil",
4493
+ "update",
4494
+ "upgrade",
4495
+ "uphold",
4496
+ "upon",
4497
+ "upper",
4498
+ "upset",
4499
+ "urban",
4500
+ "urge",
4501
+ "usage",
4502
+ "use",
4503
+ "used",
4504
+ "useful",
4505
+ "useless",
4506
+ "usual",
4507
+ "utility",
4508
+ "vacant",
4509
+ "vacuum",
4510
+ "vague",
4511
+ "valid",
4512
+ "valley",
4513
+ "valve",
4514
+ "van",
4515
+ "vanish",
4516
+ "vapor",
4517
+ "various",
4518
+ "vast",
4519
+ "vault",
4520
+ "vehicle",
4521
+ "velvet",
4522
+ "vendor",
4523
+ "venture",
4524
+ "venue",
4525
+ "verb",
4526
+ "verify",
4527
+ "version",
4528
+ "very",
4529
+ "vessel",
4530
+ "veteran",
4531
+ "viable",
4532
+ "vibrant",
4533
+ "vicious",
4534
+ "victory",
4535
+ "video",
4536
+ "view",
4537
+ "village",
4538
+ "vintage",
4539
+ "violin",
4540
+ "virtual",
4541
+ "virus",
4542
+ "visa",
4543
+ "visit",
4544
+ "visual",
4545
+ "vital",
4546
+ "vivid",
4547
+ "vocal",
4548
+ "voice",
4549
+ "void",
4550
+ "volcano",
4551
+ "volume",
4552
+ "vote",
4553
+ "voyage",
4554
+ "wage",
4555
+ "wagon",
4556
+ "wait",
4557
+ "walk",
4558
+ "wall",
4559
+ "walnut",
4560
+ "want",
4561
+ "warfare",
4562
+ "warm",
4563
+ "warrior",
4564
+ "wash",
4565
+ "wasp",
4566
+ "waste",
4567
+ "water",
4568
+ "wave",
4569
+ "way",
4570
+ "wealth",
4571
+ "weapon",
4572
+ "wear",
4573
+ "weasel",
4574
+ "weather",
4575
+ "web",
4576
+ "wedding",
4577
+ "weekend",
4578
+ "weird",
4579
+ "welcome",
4580
+ "west",
4581
+ "wet",
4582
+ "whale",
4583
+ "what",
4584
+ "wheat",
4585
+ "wheel",
4586
+ "when",
4587
+ "where",
4588
+ "whip",
4589
+ "whisper",
4590
+ "wide",
4591
+ "width",
4592
+ "wife",
4593
+ "wild",
4594
+ "will",
4595
+ "win",
4596
+ "window",
4597
+ "wine",
4598
+ "wing",
4599
+ "wink",
4600
+ "winner",
4601
+ "winter",
4602
+ "wire",
4603
+ "wisdom",
4604
+ "wise",
4605
+ "wish",
4606
+ "witness",
4607
+ "wolf",
4608
+ "woman",
4609
+ "wonder",
4610
+ "wood",
4611
+ "wool",
4612
+ "word",
4613
+ "work",
4614
+ "world",
4615
+ "worry",
4616
+ "worth",
4617
+ "wrap",
4618
+ "wreck",
4619
+ "wrestle",
4620
+ "wrist",
4621
+ "write",
4622
+ "wrong",
4623
+ "yard",
4624
+ "year",
4625
+ "yellow",
4626
+ "you",
4627
+ "young",
4628
+ "youth",
4629
+ "zebra",
4630
+ "zero",
4631
+ "zone",
4632
+ "zoo"
4633
+ ];
4634
+
4635
+ // src/account/account.ts
4636
+ var ACCOUNT_LINK_DOMAIN = new TextEncoder().encode(
4637
+ "calimero.mdma.account-link.v1\0"
4638
+ );
4639
+ var ENTROPY_BITS = 256;
4640
+ var CHECKSUM_BITS = ENTROPY_BITS / 32;
4641
+ var PHRASE_WORDS = (ENTROPY_BITS + CHECKSUM_BITS) / 11;
4642
+ async function generateAccountRoot() {
4643
+ const entropy = crypto.getRandomValues(new Uint8Array(ENTROPY_BITS / 8));
4644
+ return withPhrase(hex(entropy), await encodePhrase(entropy));
4645
+ }
4646
+ async function accountRootFromPhrase(phrase) {
4647
+ const words = normalisePhrase(phrase);
4648
+ return withPhrase(hex(await decodePhrase(words)), words.join(" "));
4649
+ }
4650
+ async function accountRootFromSecret(secret) {
4651
+ fromHex(secret, "secret", 32);
4652
+ return {
4653
+ secret,
4654
+ publicKey: hex(await derivePublicKey(secret)),
4655
+ accountId: await accountForRoot(secret)
4656
+ };
4657
+ }
4658
+ async function signAccountLink(input) {
4659
+ if (!input.nonce) throw new Error("nonce is required to sign an account link");
4660
+ const key = await importSigningKey(input.rootSecret);
4661
+ const signature = new Uint8Array(
4662
+ await crypto.subtle.sign(
4663
+ "Ed25519",
4664
+ key,
4665
+ concat(ACCOUNT_LINK_DOMAIN, new TextEncoder().encode(input.nonce))
4666
+ )
4667
+ );
4668
+ return base64(signature);
4669
+ }
4670
+ async function withPhrase(secret, phrase) {
4671
+ return { ...await accountRootFromSecret(secret), phrase };
4672
+ }
4673
+ function normalisePhrase(phrase) {
4674
+ const words = phrase.normalize("NFKD").toLowerCase().trim().split(/\s+/);
4675
+ const count = words[0] === "" ? 0 : words.length;
4676
+ if (count !== PHRASE_WORDS) {
4677
+ throw new Error(
4678
+ `recovery phrase must be ${PHRASE_WORDS} words, got ${count}`
4679
+ );
4680
+ }
4681
+ return words;
4682
+ }
4683
+ async function encodePhrase(entropy) {
4684
+ const bits = bitsOf(entropy) + await checksumBits(entropy);
4685
+ const words = [];
4686
+ for (let i = 0; i < PHRASE_WORDS; i += 1) {
4687
+ const index = Number.parseInt(bits.slice(i * 11, i * 11 + 11), 2);
4688
+ words.push(ENGLISH_WORDLIST[index]);
4689
+ }
4690
+ return words.join(" ");
4691
+ }
4692
+ async function decodePhrase(words) {
4693
+ let bits = "";
4694
+ for (const word of words) {
4695
+ const index = ENGLISH_WORDLIST.indexOf(word);
4696
+ if (index < 0) {
4697
+ throw new Error(`"${word}" is not a word in the recovery phrase list`);
4698
+ }
4699
+ bits += index.toString(2).padStart(11, "0");
4700
+ }
4701
+ const entropy = new Uint8Array(ENTROPY_BITS / 8);
4702
+ for (let i = 0; i < entropy.length; i += 1) {
4703
+ entropy[i] = Number.parseInt(bits.slice(i * 8, i * 8 + 8), 2);
4704
+ }
4705
+ if (bits.slice(ENTROPY_BITS) !== await checksumBits(entropy)) {
4706
+ throw new Error(
4707
+ "recovery phrase checksum failed \u2014 check for a mistyped or transposed word"
4708
+ );
4709
+ }
4710
+ return entropy;
4711
+ }
4712
+ async function checksumBits(entropy) {
4713
+ const digest = new Uint8Array(await crypto.subtle.digest("SHA-256", entropy));
4714
+ return bitsOf(digest).slice(0, CHECKSUM_BITS);
4715
+ }
4716
+ function bitsOf(bytes) {
4717
+ let bits = "";
4718
+ for (const byte of bytes) bits += byte.toString(2).padStart(8, "0");
4719
+ return bits;
4720
+ }
4721
+ function base64(bytes) {
4722
+ let binary = "";
4723
+ for (const byte of bytes) binary += String.fromCharCode(byte);
4724
+ return btoa(binary);
4725
+ }
4726
+
2376
4727
  // src/cloud/cloud-client.ts
2377
4728
  var DEFAULT_CLOUD_BASE_URL = "https://cloud.calimero.network";
2378
4729
  var REFRESH_HEADER = "x-mdma-session-refresh";
@@ -2616,6 +4967,93 @@ var CloudClient = class {
2616
4967
  window.open(`${this.baseUrl}/disable-ha?${params.toString()}`);
2617
4968
  }
2618
4969
  /** Record a freshly-issued session and tell the app to persist it. */
4970
+ /**
4971
+ * Link a Calimero account to this cloud login, proving possession of its root.
4972
+ *
4973
+ * Two hops, folded into one call because they are useless apart: fetch a
4974
+ * single-use challenge, then sign it with the account root and post the proof.
4975
+ * The secret never leaves this process — only a signature over a nonce the
4976
+ * cloud minted does.
4977
+ *
4978
+ * This is the binding the cloud bills against. A relay does not need it to run
4979
+ * an intent; the cloud needs it to know whose plan a hosted node is spending,
4980
+ * and to sign that account back in later.
4981
+ *
4982
+ * @param rootSecret the account root's signing secret, 64 hex — from
4983
+ * {@link generateAccountRoot}, from a restored recovery phrase, or from a
4984
+ * desktop app or hardware key that already holds one.
4985
+ *
4986
+ * Idempotent for the same login. An account already linked to a *different*
4987
+ * cloud login is a `409`; a replayed or expired challenge is a `403`; and
4988
+ * exceeding the plan's account limit is a `402`.
4989
+ */
4990
+ async linkAccount(rootSecret) {
4991
+ const root = await accountRootFromSecret(rootSecret);
4992
+ const { nonce } = await this.getAccountLinkChallenge();
4993
+ return this.submitAccountLink({
4994
+ accountId: root.accountId,
4995
+ rootPublicKey: root.publicKey,
4996
+ nonce,
4997
+ signature: await signAccountLink({ rootSecret, nonce })
4998
+ });
4999
+ }
5000
+ /**
5001
+ * Mint a single-use challenge for an account root to sign.
5002
+ *
5003
+ * The split half of {@link linkAccount}, for the case that call cannot serve:
5004
+ * a root held by a desktop app, a hardware key or an air-gapped machine, which
5005
+ * signs without the secret ever reaching this process. Fetch the challenge
5006
+ * here, have the holder sign it, then hand the proof to
5007
+ * {@link submitAccountLink}.
5008
+ *
5009
+ * Bound to the signed-in login and short-lived, so it is not a standing
5010
+ * capability if it leaks — but it IS single-use, so a challenge fetched and
5011
+ * abandoned is spent.
5012
+ */
5013
+ async getAccountLinkChallenge() {
5014
+ const body = await this.request("GET", "/api/cloud/me/accounts/challenge");
5015
+ return { nonce: body.nonce, expiresAtMs: body.expires_at_ms ?? null };
5016
+ }
5017
+ /**
5018
+ * Post a proof assembled elsewhere. The other half of
5019
+ * {@link getAccountLinkChallenge}.
5020
+ *
5021
+ * `accountId` must be the account `rootPublicKey` names — the cloud refuses a
5022
+ * valid signature by a key that names a different account, or a caller could
5023
+ * prove one root and link somebody else's account. Derive both from the same
5024
+ * key rather than letting a user type either.
5025
+ */
5026
+ async submitAccountLink(proof) {
5027
+ const body = await this.request(
5028
+ "POST",
5029
+ "/api/cloud/me/accounts",
5030
+ {
5031
+ body: {
5032
+ account_id: proof.accountId,
5033
+ root_public_key: proof.rootPublicKey,
5034
+ nonce: proof.nonce,
5035
+ signature: proof.signature
5036
+ }
5037
+ }
5038
+ );
5039
+ return {
5040
+ accountId: String(body.account_id ?? proof.accountId),
5041
+ linkedAt: body.linked_at ?? null,
5042
+ alreadyLinked: body.already_linked === true
5043
+ };
5044
+ }
5045
+ /** The accounts linked to this login, and how many the plan allows. */
5046
+ async getMyAccounts() {
5047
+ const body = await this.request("GET", "/api/cloud/me/accounts");
5048
+ return {
5049
+ accounts: (body.accounts ?? []).map((row) => ({
5050
+ accountId: String(row.account_id ?? ""),
5051
+ linkedAt: row.linked_at ?? null,
5052
+ hasRecoveryEnvelope: row.has_recovery_envelope === true
5053
+ })),
5054
+ limit: body.limit ?? null
5055
+ };
5056
+ }
2619
5057
  adoptSession(body) {
2620
5058
  this.session = {
2621
5059
  sessionToken: body.session_token,
@@ -3095,105 +5533,6 @@ var LocalStorageTokenStore = class {
3095
5533
  }
3096
5534
  };
3097
5535
 
3098
- // src/crypto/internal.ts
3099
- var PKCS8_ED25519_PREFIX = new Uint8Array([
3100
- 48,
3101
- 46,
3102
- 2,
3103
- 1,
3104
- 0,
3105
- 48,
3106
- 5,
3107
- 6,
3108
- 3,
3109
- 43,
3110
- 101,
3111
- 112,
3112
- 4,
3113
- 34,
3114
- 4,
3115
- 32
3116
- ]);
3117
- function u32le(value) {
3118
- const out = new Uint8Array(4);
3119
- new DataView(out.buffer).setUint32(0, value, true);
3120
- return out;
3121
- }
3122
- function hex(bytes) {
3123
- return Array.from(bytes, (b) => b.toString(16).padStart(2, "0")).join("");
3124
- }
3125
- function fromHex(value, label, expectedBytes) {
3126
- const clean = value.trim();
3127
- if (!/^[0-9a-fA-F]*$/.test(clean) || clean.length !== expectedBytes * 2) {
3128
- throw new Error(
3129
- `${label} must be ${expectedBytes * 2} hex characters, got ${clean.length}`
3130
- );
3131
- }
3132
- const bytes = new Uint8Array(expectedBytes);
3133
- for (let i = 0; i < expectedBytes; i += 1) {
3134
- bytes[i] = Number.parseInt(clean.slice(i * 2, i * 2 + 2), 16);
3135
- }
3136
- return bytes;
3137
- }
3138
- function u64le(value) {
3139
- const out = new Uint8Array(8);
3140
- new DataView(out.buffer).setBigUint64(0, BigInt(value), true);
3141
- return out;
3142
- }
3143
- function concat(...parts) {
3144
- const out = new Uint8Array(parts.reduce((total, p) => total + p.length, 0));
3145
- let offset = 0;
3146
- for (const part of parts) {
3147
- out.set(part, offset);
3148
- offset += part.length;
3149
- }
3150
- return out;
3151
- }
3152
- async function domainHash(domain, parts) {
3153
- const chunks = [u64le(domain.length), domain];
3154
- for (const part of parts) {
3155
- chunks.push(u64le(part.length), part);
3156
- }
3157
- return new Uint8Array(
3158
- await crypto.subtle.digest("SHA-256", concat(...chunks))
3159
- );
3160
- }
3161
- async function importSigningKey(secretHex) {
3162
- const seed = fromHex(secretHex, "deviceSecret", 32);
3163
- const pkcs8 = concat(PKCS8_ED25519_PREFIX, seed);
3164
- try {
3165
- return await crypto.subtle.importKey(
3166
- "pkcs8",
3167
- pkcs8,
3168
- { name: "Ed25519" },
3169
- false,
3170
- ["sign"]
3171
- );
3172
- } catch (cause) {
3173
- const detail = cause instanceof Error ? `: ${cause.message}` : "";
3174
- throw new Error(
3175
- "this runtime has no WebCrypto Ed25519, so a warrant cannot be signed here. Node 18.4+, Safari 17+, Firefox 129+ and Chrome 137+ have it; otherwise mint the warrant with `merod account warrant`" + detail
3176
- );
3177
- }
3178
- }
3179
- async function derivePublicKey(secretHex) {
3180
- const seed = fromHex(secretHex, "deviceSecret", 32);
3181
- const pkcs8 = concat(PKCS8_ED25519_PREFIX, seed);
3182
- const key = await crypto.subtle.importKey(
3183
- "pkcs8",
3184
- pkcs8,
3185
- { name: "Ed25519" },
3186
- true,
3187
- ["sign"]
3188
- );
3189
- const jwk = await crypto.subtle.exportKey("jwk", key);
3190
- const raw = jwk.x;
3191
- return Uint8Array.from(
3192
- atob(raw.replace(/-/g, "+").replace(/_/g, "/")),
3193
- (c) => c.charCodeAt(0)
3194
- );
3195
- }
3196
-
3197
5536
  // src/warrant/warrant.ts
3198
5537
  var SIGN_DOMAIN = new TextEncoder().encode("calimero.warrant.v2");
3199
5538
  var INTENT_DOMAIN = new TextEncoder().encode("calimero.warrant.intent.v1");
@@ -3507,83 +5846,6 @@ async function defaultNonceSource(deviceSecret) {
3507
5846
  }
3508
5847
  }
3509
5848
 
3510
- // src/device-cert/device-cert.ts
3511
- var CERT_DOMAIN = new TextEncoder().encode("calimero.device.cert.v1");
3512
- var ACCOUNT_ID_DOMAIN = new TextEncoder().encode("calimero.account.genesis.v1");
3513
- var DEVICE_ID_DOMAIN = new TextEncoder().encode("calimero.device.id.v1");
3514
- var ACCOUNT_GENESIS_VERSION = 2;
3515
- async function mintDeviceId(account, nonce) {
3516
- if (nonce.length !== 16) {
3517
- throw new Error(`nonce must be 16 bytes, got ${nonce.length}`);
3518
- }
3519
- const accountBytes = fromHex(account, "account", 32);
3520
- return hex(await domainHash(DEVICE_ID_DOMAIN, [accountBytes, nonce]));
3521
- }
3522
- async function deviceCertPayload(input) {
3523
- return domainHash(CERT_DOMAIN, [
3524
- fromHex(input.account, "account", 32),
3525
- fromHex(input.device, "device", 32),
3526
- fromHex(input.signPublicKey, "signPublicKey", 32),
3527
- fromHex(input.kemPublicKey, "kemPublicKey", 32),
3528
- u32le(input.keyEpoch),
3529
- u32le(input.deviceEpoch)
3530
- ]);
3531
- }
3532
- function accountProofBytes(input) {
3533
- return concat(
3534
- new Uint8Array([ACCOUNT_GENESIS_VERSION]),
3535
- input.rootPublicKey,
3536
- u32le(0),
3537
- fromHex(input.account, "account", 32),
3538
- fromHex(input.device, "device", 32),
3539
- fromHex(input.signPublicKey, "signPublicKey", 32),
3540
- fromHex(input.kemPublicKey, "kemPublicKey", 32),
3541
- u32le(input.keyEpoch),
3542
- u32le(input.deviceEpoch),
3543
- input.signature
3544
- );
3545
- }
3546
- async function signDeviceCert(input) {
3547
- const rootPublicKey = await derivePublicKey(input.rootSecret);
3548
- const account = hex(
3549
- await domainHash(ACCOUNT_ID_DOMAIN, [
3550
- concat(new Uint8Array([ACCOUNT_GENESIS_VERSION]), rootPublicKey)
3551
- ])
3552
- );
3553
- const keyEpoch = 0;
3554
- const payload = await deviceCertPayload({
3555
- account,
3556
- device: input.device,
3557
- signPublicKey: input.signPublicKey,
3558
- kemPublicKey: input.kemPublicKey,
3559
- keyEpoch,
3560
- deviceEpoch: input.deviceEpoch
3561
- });
3562
- const key = await importSigningKey(input.rootSecret);
3563
- const signature = new Uint8Array(
3564
- await crypto.subtle.sign("Ed25519", key, payload)
3565
- );
3566
- const credential = accountProofBytes({
3567
- rootPublicKey,
3568
- account,
3569
- device: input.device,
3570
- signPublicKey: input.signPublicKey,
3571
- kemPublicKey: input.kemPublicKey,
3572
- keyEpoch,
3573
- deviceEpoch: input.deviceEpoch,
3574
- signature
3575
- });
3576
- return hex(credential);
3577
- }
3578
- async function accountForRoot(rootSecret) {
3579
- const rootPublicKey = await derivePublicKey(rootSecret);
3580
- return hex(
3581
- await domainHash(ACCOUNT_ID_DOMAIN, [
3582
- concat(new Uint8Array([ACCOUNT_GENESIS_VERSION]), rootPublicKey)
3583
- ])
3584
- );
3585
- }
3586
-
3587
5849
  // src/namespace-op/namespace-op.ts
3588
5850
  var SIGNED_NAMESPACE_OP_SCHEMA_VERSION = 8;
3589
5851
  var NAMESPACE_SIGN_DOMAIN = new TextEncoder().encode("calimero.namespace.v1");