canary-kit 0.9.0 → 0.11.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/CANARY.md +38 -0
- package/NIP-CANARY.md +26 -0
- package/README.md +1 -1
- package/dist/counter.d.ts +1 -36
- package/dist/counter.d.ts.map +1 -1
- package/dist/counter.js +1 -61
- package/dist/counter.js.map +1 -1
- package/dist/crypto.d.ts +1 -110
- package/dist/crypto.d.ts.map +1 -1
- package/dist/crypto.js +2 -308
- package/dist/crypto.js.map +1 -1
- package/dist/encoding.d.ts +1 -55
- package/dist/encoding.d.ts.map +1 -1
- package/dist/encoding.js +1 -97
- package/dist/encoding.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -3
- package/dist/index.js.map +1 -1
- package/dist/nostr.d.ts +104 -88
- package/dist/nostr.d.ts.map +1 -1
- package/dist/nostr.js +123 -111
- package/dist/nostr.js.map +1 -1
- package/dist/sync.d.ts.map +1 -1
- package/dist/sync.js +13 -2
- package/dist/sync.js.map +1 -1
- package/dist/token.d.ts +4 -71
- package/dist/token.d.ts.map +1 -1
- package/dist/token.js +17 -111
- package/dist/token.js.map +1 -1
- package/dist/wordlist.d.ts +1 -27
- package/dist/wordlist.d.ts.map +1 -1
- package/dist/wordlist.js +1 -296
- package/dist/wordlist.js.map +1 -1
- package/llms-full.txt +1 -1
- package/llms.txt +1 -1
- package/package.json +3 -2
package/dist/token.js
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
* Prevents pathological iteration: at MAX_TOLERANCE=10, the collision
|
|
6
|
-
* avoidance window is ±20 counters (41 iterations) — well within reason.
|
|
7
|
-
*/
|
|
8
|
-
export const MAX_TOLERANCE = 10;
|
|
1
|
+
// Re-export generic functions from spoken-token
|
|
2
|
+
export { deriveTokenBytes, deriveToken, deriveDirectionalPair } from 'spoken-token';
|
|
3
|
+
export { MAX_TOLERANCE } from 'spoken-token';
|
|
4
|
+
import { hmacSha256, hexToBytes, concatBytes, timingSafeStringEqual, deriveToken as _deriveToken, encodeToken, DEFAULT_ENCODING, } from 'spoken-token';
|
|
9
5
|
const encoder = new TextEncoder();
|
|
10
6
|
function utf8(str) {
|
|
11
7
|
return encoder.encode(str);
|
|
@@ -33,59 +29,6 @@ function normaliseSecret(secret) {
|
|
|
33
29
|
}
|
|
34
30
|
return key;
|
|
35
31
|
}
|
|
36
|
-
/**
|
|
37
|
-
* CANARY-DERIVE: Derive raw token bytes from a shared secret, context, and counter.
|
|
38
|
-
*
|
|
39
|
-
* When `identity` is omitted, derives a group-wide token:
|
|
40
|
-
* HMAC-SHA256(secret, utf8(context) || counter_be32)
|
|
41
|
-
*
|
|
42
|
-
* When `identity` is provided, derives a per-member token:
|
|
43
|
-
* HMAC-SHA256(secret, utf8(context) || 0x00 || utf8(identity) || counter_be32)
|
|
44
|
-
*
|
|
45
|
-
* The null-byte separator prevents concatenation ambiguity between context and identity.
|
|
46
|
-
*
|
|
47
|
-
* @param secret - Shared secret (hex string or Uint8Array, minimum 16 bytes).
|
|
48
|
-
* @param context - Context string for domain separation (e.g. `'canary:group'`).
|
|
49
|
-
* @param counter - Time-based or usage counter (uint32).
|
|
50
|
-
* @param identity - Optional member pubkey for per-member tokens.
|
|
51
|
-
* @returns Raw 32-byte HMAC-SHA256 digest.
|
|
52
|
-
* @throws {RangeError} If secret is too short or counter is out of range.
|
|
53
|
-
* @throws {Error} If identity is provided but empty.
|
|
54
|
-
*/
|
|
55
|
-
export function deriveTokenBytes(secret, context, counter, identity) {
|
|
56
|
-
if (identity !== undefined && identity === '') {
|
|
57
|
-
throw new Error('identity must be non-empty when provided');
|
|
58
|
-
}
|
|
59
|
-
const key = normaliseSecret(secret);
|
|
60
|
-
const data = identity
|
|
61
|
-
? concatBytes(utf8(context), new Uint8Array([0x00]), utf8(identity), counterBe32(counter))
|
|
62
|
-
: concatBytes(utf8(context), counterBe32(counter));
|
|
63
|
-
return hmacSha256(key, data);
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* CANARY-DERIVE: Derive an encoded token string.
|
|
67
|
-
*
|
|
68
|
-
* When `identity` is provided, produces a per-member token unique to that member.
|
|
69
|
-
* When omitted, produces the group-wide token (backwards-compatible).
|
|
70
|
-
*
|
|
71
|
-
* @param secret - Shared secret (hex string or Uint8Array, minimum 16 bytes).
|
|
72
|
-
* @param context - Context string for domain separation (e.g. `'canary:group'`).
|
|
73
|
-
* @param counter - Time-based or usage counter (uint32).
|
|
74
|
-
* @param encoding - Output encoding format (default: single word from en-v1 wordlist).
|
|
75
|
-
* @param identity - Optional member pubkey for per-member tokens.
|
|
76
|
-
* @returns Encoded token string (word, PIN, or hex depending on encoding).
|
|
77
|
-
* @throws {RangeError} If secret is too short or counter is out of range.
|
|
78
|
-
*
|
|
79
|
-
* @example
|
|
80
|
-
* ```ts
|
|
81
|
-
* deriveToken(seedHex, 'canary:group', 42) // "falcon"
|
|
82
|
-
* deriveToken(seedHex, 'canary:group', 42, { format: 'pin', digits: 6 }) // "083721"
|
|
83
|
-
* ```
|
|
84
|
-
*/
|
|
85
|
-
export function deriveToken(secret, context, counter, encoding = DEFAULT_ENCODING, identity) {
|
|
86
|
-
const bytes = deriveTokenBytes(secret, context, counter, identity);
|
|
87
|
-
return encodeToken(bytes, encoding);
|
|
88
|
-
}
|
|
89
32
|
/**
|
|
90
33
|
* CANARY-DURESS: Derive raw duress token bytes for a specific identity.
|
|
91
34
|
*
|
|
@@ -115,8 +58,7 @@ export function deriveDuressTokenBytes(secret, context, identity, counter) {
|
|
|
115
58
|
* If the duress token collides with any normal verification token within
|
|
116
59
|
* ±(2 × maxTolerance) counter values (at the encoding level), re-derives with
|
|
117
60
|
* incrementing suffix bytes (0x01, 0x02, ..., 0xFF) until distinct.
|
|
118
|
-
* The 2× factor accounts for worst-case counter drift
|
|
119
|
-
* may each be off by maxTolerance in opposite directions.
|
|
61
|
+
* The 2× factor accounts for worst-case counter drift between deriver and verifier.
|
|
120
62
|
* If all 255 suffixes collide (astronomically unlikely), throws an error
|
|
121
63
|
* rather than failing open.
|
|
122
64
|
*
|
|
@@ -141,11 +83,13 @@ export function deriveDuressTokenBytes(secret, context, identity, counter) {
|
|
|
141
83
|
* @throws {Error} If collision avoidance fails after 255 retries.
|
|
142
84
|
*/
|
|
143
85
|
export function deriveDuressToken(secret, context, identity, counter, encoding = DEFAULT_ENCODING, maxTolerance, identities) {
|
|
86
|
+
// Import MAX_TOLERANCE value directly to avoid circular reference with the re-export
|
|
87
|
+
const MAX_TOLERANCE_VAL = 10;
|
|
144
88
|
if (!Number.isInteger(maxTolerance) || maxTolerance < 0) {
|
|
145
89
|
throw new RangeError('maxTolerance must be a non-negative integer');
|
|
146
90
|
}
|
|
147
|
-
if (maxTolerance >
|
|
148
|
-
throw new RangeError(`maxTolerance must be <= ${
|
|
91
|
+
if (maxTolerance > MAX_TOLERANCE_VAL) {
|
|
92
|
+
throw new RangeError(`maxTolerance must be <= ${MAX_TOLERANCE_VAL}, got ${maxTolerance}`);
|
|
149
93
|
}
|
|
150
94
|
// Collect normal tokens within ±(2 × maxTolerance) for cross-counter collision avoidance.
|
|
151
95
|
// The 2× window accounts for worst-case counter drift between deriver and verifier.
|
|
@@ -155,11 +99,11 @@ export function deriveDuressToken(secret, context, identity, counter, encoding =
|
|
|
155
99
|
const hi = Math.min(0xFFFFFFFF, counter + window);
|
|
156
100
|
for (let c = lo; c <= hi; c++) {
|
|
157
101
|
// Group-wide (anonymous) token
|
|
158
|
-
forbidden.add(
|
|
102
|
+
forbidden.add(_deriveToken(secret, context, c, encoding));
|
|
159
103
|
// Per-member tokens for all known identities
|
|
160
104
|
if (identities) {
|
|
161
105
|
for (const id of identities) {
|
|
162
|
-
forbidden.add(
|
|
106
|
+
forbidden.add(_deriveToken(secret, context, c, encoding, id));
|
|
163
107
|
}
|
|
164
108
|
}
|
|
165
109
|
}
|
|
@@ -211,13 +155,14 @@ export function deriveDuressToken(secret, context, identity, counter, encoding =
|
|
|
211
155
|
* ```
|
|
212
156
|
*/
|
|
213
157
|
export function verifyToken(secret, context, counter, input, identities, options) {
|
|
158
|
+
const MAX_TOLERANCE_VAL = 10;
|
|
214
159
|
const encoding = options?.encoding ?? DEFAULT_ENCODING;
|
|
215
160
|
const tolerance = options?.tolerance ?? 0;
|
|
216
161
|
if (!Number.isInteger(tolerance) || tolerance < 0) {
|
|
217
162
|
throw new RangeError('Tolerance must be a non-negative integer');
|
|
218
163
|
}
|
|
219
|
-
if (tolerance >
|
|
220
|
-
throw new RangeError(`Tolerance must be <= ${
|
|
164
|
+
if (tolerance > MAX_TOLERANCE_VAL) {
|
|
165
|
+
throw new RangeError(`Tolerance must be <= ${MAX_TOLERANCE_VAL}, got ${tolerance}`);
|
|
221
166
|
}
|
|
222
167
|
if (identities.length > MAX_MEMBERS) {
|
|
223
168
|
throw new RangeError(`identities array must not exceed ${MAX_MEMBERS} entries, got ${identities.length}`);
|
|
@@ -232,7 +177,7 @@ export function verifyToken(secret, context, counter, input, identities, options
|
|
|
232
177
|
// 1. Check per-member tokens at exact counter (each member has a unique word)
|
|
233
178
|
let exactMember = null;
|
|
234
179
|
for (const identity of identities) {
|
|
235
|
-
if (timingSafeStringEqual(normalised,
|
|
180
|
+
if (timingSafeStringEqual(normalised, _deriveToken(secret, context, counter, encoding, identity))) {
|
|
236
181
|
exactMember = identity;
|
|
237
182
|
}
|
|
238
183
|
}
|
|
@@ -254,7 +199,7 @@ export function verifyToken(secret, context, counter, input, identities, options
|
|
|
254
199
|
for (let c = lo; c <= hi; c++) {
|
|
255
200
|
if (c === counter)
|
|
256
201
|
continue; // already checked in step 1
|
|
257
|
-
if (timingSafeStringEqual(normalised,
|
|
202
|
+
if (timingSafeStringEqual(normalised, _deriveToken(secret, context, c, encoding, identity))) {
|
|
258
203
|
toleranceMember = identity;
|
|
259
204
|
}
|
|
260
205
|
}
|
|
@@ -262,7 +207,7 @@ export function verifyToken(secret, context, counter, input, identities, options
|
|
|
262
207
|
// 4. Also check group-wide token (backwards compat for anonymous verification)
|
|
263
208
|
let groupMatch = false;
|
|
264
209
|
for (let c = lo; c <= hi; c++) {
|
|
265
|
-
if (timingSafeStringEqual(normalised,
|
|
210
|
+
if (timingSafeStringEqual(normalised, _deriveToken(secret, context, c, encoding))) {
|
|
266
211
|
groupMatch = true;
|
|
267
212
|
}
|
|
268
213
|
}
|
|
@@ -302,43 +247,4 @@ export function deriveLivenessToken(secret, context, identity, counter) {
|
|
|
302
247
|
const data = concatBytes(utf8(context + ':alive'), new Uint8Array([0x00]), utf8(identity), counterBe32(counter));
|
|
303
248
|
return hmacSha256(key, data);
|
|
304
249
|
}
|
|
305
|
-
/**
|
|
306
|
-
* Derive a directional pair: two distinct tokens from the same secret,
|
|
307
|
-
* one per role. Each token uses context = `${namespace}\0${role}`.
|
|
308
|
-
*
|
|
309
|
-
* Neither token can be derived from the other without the shared secret.
|
|
310
|
-
* This prevents the "echo problem" where the second speaker could parrot
|
|
311
|
-
* the first.
|
|
312
|
-
*
|
|
313
|
-
* @param secret - Shared secret (hex string or Uint8Array).
|
|
314
|
-
* @param namespace - Namespace prefix (e.g. `'aviva'`, `'dispatch'`).
|
|
315
|
-
* @param roles - Exactly two role names (e.g. `['caller', 'agent']`).
|
|
316
|
-
* @param counter - Current counter value.
|
|
317
|
-
* @param encoding - Output encoding format (default: single word).
|
|
318
|
-
* @returns Object keyed by role name, each value is the role's token string.
|
|
319
|
-
* @throws {Error} If roles does not contain exactly 2 entries, or roles are identical.
|
|
320
|
-
*/
|
|
321
|
-
export function deriveDirectionalPair(secret, namespace, roles, counter, encoding = DEFAULT_ENCODING) {
|
|
322
|
-
if (!namespace) {
|
|
323
|
-
throw new Error('namespace must be a non-empty string');
|
|
324
|
-
}
|
|
325
|
-
if (namespace.includes('\0')) {
|
|
326
|
-
throw new Error('namespace must not contain null bytes');
|
|
327
|
-
}
|
|
328
|
-
if (!roles[0] || !roles[1]) {
|
|
329
|
-
throw new Error('Both roles must be non-empty strings');
|
|
330
|
-
}
|
|
331
|
-
if (roles[0].includes('\0') || roles[1].includes('\0')) {
|
|
332
|
-
throw new Error('Roles must not contain null bytes');
|
|
333
|
-
}
|
|
334
|
-
if (roles[0] === roles[1]) {
|
|
335
|
-
throw new Error(`Roles must be distinct, got ["${roles[0]}", "${roles[1]}"]`);
|
|
336
|
-
}
|
|
337
|
-
// Use null-byte separator to prevent concatenation ambiguity
|
|
338
|
-
// (e.g. namespace "a:b" + role "c" vs namespace "a" + role "b:c")
|
|
339
|
-
return {
|
|
340
|
-
[roles[0]]: deriveToken(secret, `${namespace}\0${roles[0]}`, counter, encoding),
|
|
341
|
-
[roles[1]]: deriveToken(secret, `${namespace}\0${roles[1]}`, counter, encoding),
|
|
342
|
-
};
|
|
343
|
-
}
|
|
344
250
|
//# sourceMappingURL=token.js.map
|
package/dist/token.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token.js","sourceRoot":"","sources":["../src/token.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"token.js","sourceRoot":"","sources":["../src/token.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,qBAAqB,EAAwB,MAAM,cAAc,CAAA;AACzG,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAE5C,OAAO,EACL,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,qBAAqB,EAC1D,WAAW,IAAI,YAAY,EAAE,WAAW,EACpB,gBAAgB,GACrC,MAAM,cAAc,CAAA;AAErB,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAA;AAEjC,SAAS,IAAI,CAAC,GAAW;IACvB,OAAO,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;AAC5B,CAAC;AAED,SAAS,WAAW,CAAC,OAAe;IAClC,IAAI,C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AAI,CAAA;QACnB,CAAC;IACH,CAAC;IAED,kFAAkF;IAClF,sEAAsE;IACtE,mFAAmF;IACnF,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,aAAa,EAAE,CAAA;IACpF,IAAI,WAAW;QAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC,WAAW,CAAC,EAAE,CAAA;IACtE,IAAI,eAAe;QAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC,eAAe,CAAC,EAAE,CAAA;IAC9E,IAAI,UAAU;QAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAA;IAC1C,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,CAAA;AAC9B,CAAC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,mBAAmB,CACjC,MAA2B,EAC3B,OAAe,EACf,QAAgB,EAChB,OAAe;IAEf,MAAM,GAAG,GAAG,eAAe,CAAC,MAAM,CAAC,CAAA;IACnC,MAAM,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC,OAAO,GAAG,QAAQ,CAAC,EAAE,IAAI,UAAU,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC,CAAA;IAChH,OAAO,UAAU,CAAC,GAAG,EAAE,IAAI,CAAC,CAAA;AAC9B,CAAC"}
|
package/dist/wordlist.d.ts
CHANGED
|
@@ -1,28 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
* Canary English wordlist (en-v1).
|
|
3
|
-
*
|
|
4
|
-
* 2048 words curated for spoken-word clarity. Based on BIP-39 English,
|
|
5
|
-
* filtered for verbal verification: no homophones, no phonetic
|
|
6
|
-
* near-collisions, no emotionally charged words. Backfilled with
|
|
7
|
-
* concrete, unambiguous supplementary words.
|
|
8
|
-
*
|
|
9
|
-
* All words are 3-8 characters, lowercase alphabetic only.
|
|
10
|
-
*/
|
|
11
|
-
export declare const WORDLIST: readonly string[];
|
|
12
|
-
export declare const WORDLIST_SIZE = 2048;
|
|
13
|
-
/**
|
|
14
|
-
* Return the word at the given index.
|
|
15
|
-
*
|
|
16
|
-
* @param index - Zero-based index into the wordlist (0-2047).
|
|
17
|
-
* @returns The word at the specified index.
|
|
18
|
-
* @throws {RangeError} If index is outside 0-2047.
|
|
19
|
-
*/
|
|
20
|
-
export declare function getWord(index: number): string;
|
|
21
|
-
/**
|
|
22
|
-
* Return the index of a word, or -1 if it is not in the wordlist.
|
|
23
|
-
*
|
|
24
|
-
* @param word - The word to look up (must match exactly, case-sensitive).
|
|
25
|
-
* @returns Zero-based index (0-2047) or -1 if not found.
|
|
26
|
-
*/
|
|
27
|
-
export declare function indexOf(word: string): number;
|
|
1
|
+
export { WORDLIST, WORDLIST_SIZE, getWord, indexOf } from 'spoken-token';
|
|
28
2
|
//# sourceMappingURL=wordlist.d.ts.map
|
package/dist/wordlist.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wordlist.d.ts","sourceRoot":"","sources":["../src/wordlist.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"wordlist.d.ts","sourceRoot":"","sources":["../src/wordlist.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA"}
|
package/dist/wordlist.js
CHANGED
|
@@ -1,297 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
* Canary English wordlist (en-v1).
|
|
3
|
-
*
|
|
4
|
-
* 2048 words curated for spoken-word clarity. Based on BIP-39 English,
|
|
5
|
-
* filtered for verbal verification: no homophones, no phonetic
|
|
6
|
-
* near-collisions, no emotionally charged words. Backfilled with
|
|
7
|
-
* concrete, unambiguous supplementary words.
|
|
8
|
-
*
|
|
9
|
-
* All words are 3-8 characters, lowercase alphabetic only.
|
|
10
|
-
*/
|
|
11
|
-
export const WORDLIST = [
|
|
12
|
-
'ability', 'able', 'about', 'above', 'absent', 'absorb', 'abstract', 'absurd',
|
|
13
|
-
'access', 'accident', 'account', 'accuse', 'achieve', 'acid', 'acorn', 'acoustic',
|
|
14
|
-
'acquire', 'across', 'act', 'action', 'actor', 'actress', 'actual', 'adapt',
|
|
15
|
-
'add', 'addict', 'address', 'adjust', 'admiral', 'admit', 'adult', 'advance',
|
|
16
|
-
'advice', 'aerobic', 'affair', 'afford', 'afraid', 'again', 'age', 'agent',
|
|
17
|
-
'agree', 'ahead', 'aim', 'air', 'airport', 'aisle', 'alarm', 'album',
|
|
18
|
-
'alcohol', 'alert', 'alien', 'all', 'alley', 'allow', 'almost', 'alone',
|
|
19
|
-
'alpha', 'alpine', 'already', 'also', 'always', 'amateur', 'amazing', 'amber',
|
|
20
|
-
'among', 'amount', 'amused', 'analyst', 'anchor', 'ancient', 'anger', 'angle',
|
|
21
|
-
'animal', 'ankle', 'announce', 'annual', 'another', 'answer', 'antenna', 'antique',
|
|
22
|
-
'anvil', 'anxiety', 'any', 'apart', 'apology', 'appear', 'apple', 'approve',
|
|
23
|
-
'april', 'apron', 'arch', 'arctic', 'area', 'arena', 'argue', 'arm',
|
|
24
|
-
'armed', 'armor', 'army', 'around', 'arrange', 'arrive', 'arrow', 'art',
|
|
25
|
-
'artefact', 'artist', 'artwork', 'ask', 'aspect', 'asset', 'assist', 'assume',
|
|
26
|
-
'asthma', 'athlete', 'atom', 'attack', 'attend', 'attitude', 'attract', 'auction',
|
|
27
|
-
'audit', 'august', 'aunt', 'author', 'auto', 'autumn', 'average', 'avocado',
|
|
28
|
-
'avoid', 'awake', 'aware', 'away', 'awesome', 'awful', 'awkward', 'axis',
|
|
29
|
-
'baby', 'bachelor', 'bacon', 'badge', 'badger', 'bag', 'bakery', 'balance',
|
|
30
|
-
'balcony', 'ball', 'balm', 'bamboo', 'banana', 'banjo', 'banner', 'bar',
|
|
31
|
-
'barely', 'bargain', 'barrel', 'base', 'basic', 'basil', 'basket', 'battle',
|
|
32
|
-
'beach', 'beacon', 'bean', 'beauty', 'because', 'become', 'beef', 'beetle',
|
|
33
|
-
'before', 'begin', 'behave', 'behind', 'belfry', 'believe', 'below', 'belt',
|
|
34
|
-
'bench', 'benefit', 'berry', 'best', 'better', 'between', 'beyond', 'bicycle',
|
|
35
|
-
'bid', 'bike', 'bind', 'biology', 'birch', 'bird', 'birth', 'bishop',
|
|
36
|
-
'bitter', 'black', 'blame', 'blanket', 'bleak', 'bless', 'bloom', 'blossom',
|
|
37
|
-
'blouse', 'blue', 'blur', 'blush', 'board', 'boat', 'bobcat', 'body',
|
|
38
|
-
'boil', 'bone', 'bonfire', 'bonus', 'book', 'boost', 'border', 'boring',
|
|
39
|
-
'borrow', 'boss', 'bottom', 'bounce', 'bouquet', 'box', 'boy', 'bracket',
|
|
40
|
-
'brain', 'branch', 'brand', 'brass', 'brave', 'bread', 'breaker', 'breeze',
|
|
41
|
-
'brick', 'bridge', 'brief', 'bright', 'bring', 'brisk', 'broccoli', 'bronze',
|
|
42
|
-
'brook', 'broom', 'brother', 'brown', 'brush', 'bubble', 'buckle', 'buddy',
|
|
43
|
-
'budget', 'buffalo', 'bugle', 'build', 'bulb', 'bulk', 'bumble', 'bundle',
|
|
44
|
-
'bunker', 'burger', 'burrow', 'burst', 'bus', 'bushel', 'business', 'busy',
|
|
45
|
-
'butter', 'buyer', 'buzz', 'cabbage', 'cabin', 'cable', 'cactus', 'cage',
|
|
46
|
-
'cairn', 'cake', 'call', 'calm', 'camel', 'camera', 'camp', 'can',
|
|
47
|
-
'canal', 'cancel', 'candy', 'canoe', 'canopy', 'canvas', 'canyon', 'capable',
|
|
48
|
-
'cape', 'capital', 'captain', 'car', 'caravan', 'carbon', 'card', 'cargo',
|
|
49
|
-
'carpet', 'carry', 'cart', 'case', 'cash', 'casino', 'castle', 'casual',
|
|
50
|
-
'cat', 'catalog', 'catch', 'category', 'cattle', 'caught', 'cause', 'caution',
|
|
51
|
-
'cave', 'cedar', 'ceiling', 'celery', 'cellar', 'cement', 'census', 'century',
|
|
52
|
-
'cereal', 'certain', 'chair', 'chalk', 'champion', 'change', 'chapter', 'charge',
|
|
53
|
-
'charter', 'chase', 'chat', 'cheap', 'check', 'cheese', 'chef', 'cherry',
|
|
54
|
-
'chest', 'chestnut', 'chicken', 'chief', 'child', 'chimney', 'choice', 'choose',
|
|
55
|
-
'chuckle', 'chunk', 'churn', 'cider', 'cigar', 'cinnamon', 'circle', 'citizen',
|
|
56
|
-
'city', 'civil', 'claim', 'clam', 'clap', 'clarify', 'claw', 'clay',
|
|
57
|
-
'clean', 'clerk', 'clever', 'click', 'client', 'cliff', 'climb', 'clinic',
|
|
58
|
-
'clip', 'cloak', 'clock', 'clog', 'close', 'cloth', 'cloud', 'clown',
|
|
59
|
-
'club', 'clump', 'cluster', 'clutch', 'coach', 'coast', 'cobalt', 'cocoa',
|
|
60
|
-
'coconut', 'code', 'codex', 'coffee', 'coil', 'coin', 'collect', 'color',
|
|
61
|
-
'column', 'combine', 'come', 'comet', 'comfort', 'comic', 'common', 'company',
|
|
62
|
-
'concert', 'condor', 'conduct', 'confirm', 'congress', 'connect', 'consider', 'consul',
|
|
63
|
-
'control', 'convince', 'cook', 'cool', 'copper', 'copy', 'coral', 'core',
|
|
64
|
-
'cork', 'corn', 'cornet', 'correct', 'cosmos', 'cost', 'cotton', 'couch',
|
|
65
|
-
'cougar', 'country', 'couple', 'course', 'cousin', 'cover', 'coyote', 'crack',
|
|
66
|
-
'cradle', 'craft', 'cram', 'crane', 'crater', 'crawl', 'cream', 'credit',
|
|
67
|
-
'creek', 'crew', 'cricket', 'crisp', 'critic', 'croft', 'crop', 'cross',
|
|
68
|
-
'crouch', 'crowd', 'crown', 'crucial', 'cruise', 'crumble', 'crunch', 'cry',
|
|
69
|
-
'crystal', 'cube', 'culture', 'cup', 'cupboard', 'curious', 'current', 'curtain',
|
|
70
|
-
'curve', 'cushion', 'custom', 'cute', 'cycle', 'cypress', 'dad', 'dagger',
|
|
71
|
-
'dahlia', 'damp', 'damsel', 'dance', 'danger', 'dapple', 'daring', 'dash',
|
|
72
|
-
'daughter', 'dawn', 'day', 'deal', 'debate', 'decade', 'december', 'decide',
|
|
73
|
-
'decline', 'decorate', 'decrease', 'defense', 'define', 'defy', 'degree', 'delay',
|
|
74
|
-
'deliver', 'delta', 'demand', 'demise', 'denial', 'denim', 'dentist', 'depart',
|
|
75
|
-
'depend', 'deposit', 'depot', 'depth', 'deputy', 'derive', 'describe', 'desert',
|
|
76
|
-
'design', 'desk', 'detail', 'detect', 'develop', 'device', 'devote', 'diagram',
|
|
77
|
-
'dial', 'diamond', 'diary', 'dice', 'diesel', 'diet', 'differ', 'digital',
|
|
78
|
-
'dignity', 'dilemma', 'dinner', 'dinosaur', 'direct', 'dirt', 'disagree', 'discover',
|
|
79
|
-
'dish', 'display', 'distance', 'divert', 'divide', 'divorce', 'dizzy', 'doctor',
|
|
80
|
-
'document', 'dog', 'doll', 'dolphin', 'domain', 'donate', 'donkey', 'donor',
|
|
81
|
-
'door', 'dorsal', 'double', 'dove', 'draft', 'drafter', 'dragon', 'drake',
|
|
82
|
-
'drama', 'drastic', 'draw', 'dream', 'dress', 'drift', 'drifter', 'drill',
|
|
83
|
-
'drink', 'drive', 'drop', 'droplet', 'drum', 'drummer', 'dry', 'duck',
|
|
84
|
-
'dulcet', 'dune', 'dungeon', 'during', 'dusk', 'dust', 'dutch', 'duty',
|
|
85
|
-
'dwarf', 'dynamic', 'eager', 'eagle', 'early', 'earn', 'earth', 'easily',
|
|
86
|
-
'east', 'easy', 'echo', 'ecology', 'economy', 'edge', 'edgeway', 'edit',
|
|
87
|
-
'educate', 'effort', 'egg', 'eight', 'either', 'elbow', 'elder', 'electric',
|
|
88
|
-
'elegant', 'element', 'elephant', 'elevator', 'elite', 'elm', 'else', 'embark',
|
|
89
|
-
'ember', 'embody', 'embrace', 'emerald', 'emerge', 'emotion', 'employ', 'empower',
|
|
90
|
-
'empty', 'enable', 'enact', 'end', 'endless', 'endorse', 'enemy', 'energy',
|
|
91
|
-
'enforce', 'engage', 'engine', 'enhance', 'enjoy', 'enlist', 'enough', 'enrich',
|
|
92
|
-
'enroll', 'ensign', 'ensure', 'enter', 'entire', 'entry', 'envelope', 'episode',
|
|
93
|
-
'epoch', 'equal', 'equip', 'era', 'erase', 'erode', 'erosion', 'error',
|
|
94
|
-
'escape', 'essay', 'essence', 'estate', 'estuary', 'eternal', 'ether', 'ethics',
|
|
95
|
-
'everest', 'evidence', 'evil', 'evolve', 'exact', 'example', 'exchange', 'excite',
|
|
96
|
-
'exclude', 'excuse', 'execute', 'exercise', 'exhaust', 'exhibit', 'exist', 'exit',
|
|
97
|
-
'exotic', 'expand', 'expect', 'explain', 'express', 'extend', 'extra', 'eye',
|
|
98
|
-
'eyebrow', 'fabric', 'face', 'faculty', 'fade', 'faint', 'faith', 'falcon',
|
|
99
|
-
'fall', 'fallow', 'false', 'fame', 'family', 'famous', 'fancy', 'fantasy',
|
|
100
|
-
'farm', 'fashion', 'fat', 'father', 'fathom', 'fatigue', 'favorite', 'feature',
|
|
101
|
-
'february', 'federal', 'fee', 'feed', 'feel', 'female', 'fence', 'fennel',
|
|
102
|
-
'fern', 'festival', 'fetch', 'fever', 'fiber', 'fiction', 'fiddle', 'field',
|
|
103
|
-
'figure', 'file', 'film', 'filter', 'final', 'finch', 'find', 'finger',
|
|
104
|
-
'finish', 'fire', 'firm', 'first', 'fiscal', 'fish', 'fit', 'fitness',
|
|
105
|
-
'fix', 'fjord', 'flag', 'flagon', 'flame', 'flannel', 'flash', 'flat',
|
|
106
|
-
'flavor', 'flicker', 'flight', 'flint', 'flip', 'float', 'flock', 'floor',
|
|
107
|
-
'floret', 'fluid', 'flush', 'flutter', 'fly', 'foal', 'foam', 'focus',
|
|
108
|
-
'fog', 'foil', 'fold', 'follow', 'food', 'foot', 'force', 'forest',
|
|
109
|
-
'forge', 'forget', 'fork', 'fortune', 'forum', 'forward', 'fossil', 'foster',
|
|
110
|
-
'found', 'foundry', 'fox', 'foxglove', 'fragile', 'frame', 'frequent', 'fresco',
|
|
111
|
-
'fresh', 'friend', 'fringe', 'frog', 'front', 'frost', 'frown', 'frozen',
|
|
112
|
-
'fruit', 'fuel', 'fun', 'funny', 'furnace', 'furrow', 'future', 'gadget',
|
|
113
|
-
'gain', 'galaxy', 'gallery', 'galley', 'game', 'gap', 'garage', 'garbage',
|
|
114
|
-
'garden', 'garland', 'garlic', 'garment', 'garnet', 'gas', 'gasp', 'gate',
|
|
115
|
-
'gather', 'gauge', 'gaze', 'gazelle', 'general', 'genius', 'genre', 'gentle',
|
|
116
|
-
'genuine', 'gesture', 'geyser', 'giant', 'gibbon', 'gift', 'giggle', 'ginger',
|
|
117
|
-
'giraffe', 'girl', 'give', 'glacier', 'glad', 'glance', 'glare', 'glass',
|
|
118
|
-
'glen', 'glide', 'glimpse', 'globe', 'gloom', 'glory', 'glove', 'glow',
|
|
119
|
-
'glue', 'goat', 'goblet', 'goddess', 'gold', 'golden', 'good', 'goose',
|
|
120
|
-
'gopher', 'gorge', 'gorilla', 'gospel', 'gossip', 'govern', 'gown', 'grab',
|
|
121
|
-
'grace', 'grain', 'granite', 'grant', 'grape', 'grass', 'gravity', 'great',
|
|
122
|
-
'green', 'grid', 'grocery', 'group', 'grow', 'grunt', 'guard', 'guess',
|
|
123
|
-
'guide', 'guilt', 'guitar', 'guppy', 'gust', 'gym', 'habit', 'half',
|
|
124
|
-
'hamlet', 'hammer', 'hammock', 'hamster', 'hand', 'happy', 'harbor', 'hard',
|
|
125
|
-
'harness', 'harvest', 'hat', 'have', 'hawk', 'hawthorn', 'head', 'health',
|
|
126
|
-
'heart', 'hearth', 'heavy', 'hedgehog', 'height', 'hello', 'helmet', 'help',
|
|
127
|
-
'hen', 'herald', 'hermit', 'hero', 'heron', 'hickory', 'hidden', 'high',
|
|
128
|
-
'hill', 'hint', 'hip', 'hire', 'history', 'hobby', 'hockey', 'hold',
|
|
129
|
-
'hole', 'holiday', 'hollow', 'home', 'homeward', 'honey', 'hood', 'hope',
|
|
130
|
-
'horizon', 'horn', 'hornet', 'horse', 'hospital', 'host', 'hotel', 'hour',
|
|
131
|
-
'hover', 'howler', 'hub', 'huge', 'human', 'humble', 'humor', 'hundred',
|
|
132
|
-
'hungry', 'hunt', 'hunter', 'hurdle', 'hurry', 'husband', 'hybrid', 'ice',
|
|
133
|
-
'icon', 'idea', 'identify', 'idle', 'igloo', 'ignore', 'ill', 'image',
|
|
134
|
-
'imitate', 'immune', 'impact', 'improve', 'inch', 'include', 'income', 'increase',
|
|
135
|
-
'index', 'indicate', 'indigo', 'indoor', 'industry', 'infant', 'inflict', 'inform',
|
|
136
|
-
'inhale', 'inherit', 'initial', 'inject', 'inkwell', 'inlet', 'inmate', 'inner',
|
|
137
|
-
'innocent', 'input', 'inquiry', 'insect', 'inside', 'inspire', 'install', 'intact',
|
|
138
|
-
'interest', 'into', 'invest', 'invite', 'involve', 'inward', 'iris', 'iron',
|
|
139
|
-
'island', 'issue', 'item', 'ivory', 'jacket', 'jade', 'jaguar', 'jar',
|
|
140
|
-
'jasmine', 'javelin', 'jazz', 'jeans', 'jelly', 'jersey', 'jewel', 'job',
|
|
141
|
-
'join', 'joke', 'jostle', 'journal', 'journey', 'joy', 'jubilee', 'judge',
|
|
142
|
-
'juice', 'jumble', 'jump', 'junco', 'jungle', 'junior', 'juniper', 'just',
|
|
143
|
-
'kangaroo', 'kayak', 'keen', 'keep', 'keeper', 'kelp', 'kennel', 'kernel',
|
|
144
|
-
'kestrel', 'ketchup', 'kettle', 'key', 'kick', 'kid', 'kidney', 'kind',
|
|
145
|
-
'kindle', 'kingdom', 'kinglet', 'kipper', 'kiss', 'kit', 'kitchen', 'kite',
|
|
146
|
-
'kitten', 'kiwi', 'knapsack', 'knee', 'knife', 'knock', 'lab', 'label',
|
|
147
|
-
'labor', 'ladder', 'lady', 'lake', 'lamp', 'language', 'lantern', 'lapis',
|
|
148
|
-
'laptop', 'larch', 'large', 'later', 'latin', 'laugh', 'laundry', 'laurel',
|
|
149
|
-
'lava', 'lavender', 'law', 'lawn', 'layer', 'lazy', 'leader', 'leaf',
|
|
150
|
-
'learn', 'leave', 'lecture', 'left', 'leg', 'legal', 'legend', 'leisure',
|
|
151
|
-
'lemon', 'lend', 'length', 'lens', 'leopard', 'lesson', 'letter', 'level',
|
|
152
|
-
'liar', 'liberty', 'library', 'license', 'lichen', 'life', 'lift', 'light',
|
|
153
|
-
'like', 'limit', 'linden', 'link', 'linnet', 'lion', 'liquid', 'list',
|
|
154
|
-
'little', 'live', 'lizard', 'llama', 'load', 'loan', 'lobster', 'local',
|
|
155
|
-
'lock', 'locust', 'lodge', 'logic', 'long', 'loom', 'loop', 'lottery',
|
|
156
|
-
'lotus', 'loud', 'lounge', 'love', 'loyal', 'lucky', 'luggage', 'lumber',
|
|
157
|
-
'lumen', 'lunar', 'lunch', 'luxury', 'machine', 'mackerel', 'magic', 'magnet',
|
|
158
|
-
'main', 'major', 'make', 'mammal', 'man', 'manage', 'mandate', 'mango',
|
|
159
|
-
'mansion', 'mantis', 'manual', 'maple', 'marble', 'march', 'margin', 'marine',
|
|
160
|
-
'market', 'marriage', 'marsh', 'marten', 'mask', 'masonry', 'mass', 'master',
|
|
161
|
-
'match', 'material', 'math', 'matrix', 'matter', 'maximum', 'maze', 'meadow',
|
|
162
|
-
'mean', 'measure', 'mechanic', 'medal', 'media', 'melody', 'melt', 'member',
|
|
163
|
-
'memory', 'mention', 'menu', 'mercy', 'merge', 'merit', 'merlin', 'merry',
|
|
164
|
-
'mesa', 'mesh', 'message', 'metal', 'method', 'micron', 'middle', 'midnight',
|
|
165
|
-
'milk', 'millet', 'million', 'mimic', 'mind', 'minimum', 'minnow', 'minor',
|
|
166
|
-
'minute', 'miracle', 'mirage', 'mirror', 'miss', 'mistake', 'mix', 'mixed',
|
|
167
|
-
'mixture', 'moat', 'mobile', 'model', 'modify', 'mohawk', 'mom', 'moment',
|
|
168
|
-
'monarch', 'mongrel', 'monitor', 'monkey', 'month', 'moon', 'moose', 'moral',
|
|
169
|
-
'more', 'morning', 'mortar', 'mosaic', 'mosquito', 'mother', 'motion', 'motor',
|
|
170
|
-
'mountain', 'mouse', 'move', 'movie', 'much', 'muffin', 'mullet', 'multiply',
|
|
171
|
-
'muscle', 'museum', 'mushroom', 'music', 'muslin', 'mussel', 'must', 'mustang',
|
|
172
|
-
'mutual', 'myrtle', 'myself', 'mystery', 'myth', 'naive', 'name', 'napkin',
|
|
173
|
-
'narrow', 'narwhal', 'nation', 'nature', 'near', 'neck', 'nectar', 'need',
|
|
174
|
-
'negative', 'neither', 'nephew', 'nest', 'nester', 'net', 'nettle', 'network',
|
|
175
|
-
'neutral', 'never', 'news', 'newt', 'next', 'nice', 'nimble', 'noble',
|
|
176
|
-
'noggin', 'noise', 'nomad', 'nominee', 'noodle', 'normal', 'north', 'nose',
|
|
177
|
-
'notable', 'note', 'nothing', 'notice', 'novel', 'now', 'nuclear', 'number',
|
|
178
|
-
'nurse', 'nut', 'nutmeg', 'oak', 'oakmoss', 'oasis', 'obey', 'object',
|
|
179
|
-
'oblige', 'observe', 'obsidian', 'obtain', 'ocean', 'octave', 'october', 'odor',
|
|
180
|
-
'off', 'offer', 'office', 'often', 'oil', 'okay', 'old', 'olive',
|
|
181
|
-
'olympic', 'omit', 'once', 'onion', 'online', 'only', 'onyx', 'opal',
|
|
182
|
-
'open', 'opera', 'opinion', 'oppose', 'option', 'orange', 'orbit', 'orchard',
|
|
183
|
-
'orchid', 'order', 'ordinary', 'organ', 'orient', 'original', 'oriole', 'orphan',
|
|
184
|
-
'osprey', 'ostrich', 'other', 'otter', 'outdoor', 'outer', 'outpost', 'output',
|
|
185
|
-
'outside', 'oval', 'oven', 'over', 'own', 'owner', 'oxygen', 'oyster',
|
|
186
|
-
'ozone', 'pact', 'paddle', 'page', 'pagoda', 'palace', 'palm', 'panda',
|
|
187
|
-
'panel', 'panther', 'paper', 'parade', 'parent', 'park', 'parrot', 'party',
|
|
188
|
-
'pass', 'patch', 'path', 'patient', 'patrol', 'pattern', 'pause', 'pave',
|
|
189
|
-
'payment', 'peanut', 'peasant', 'pelican', 'pen', 'pencil', 'people', 'pepper',
|
|
190
|
-
'perfect', 'permit', 'person', 'phone', 'photo', 'phrase', 'physical', 'piano',
|
|
191
|
-
'picnic', 'picture', 'pigeon', 'pill', 'pilot', 'pink', 'pioneer', 'pipe',
|
|
192
|
-
'pitch', 'pizza', 'place', 'planet', 'plastic', 'plate', 'play', 'please',
|
|
193
|
-
'pledge', 'pluck', 'plug', 'poem', 'poet', 'point', 'polar', 'pole',
|
|
194
|
-
'police', 'pond', 'pony', 'pool', 'popular', 'portion', 'position', 'possible',
|
|
195
|
-
'post', 'potato', 'pottery', 'powder', 'power', 'practice', 'praise', 'predict',
|
|
196
|
-
'prefer', 'prepare', 'present', 'pretty', 'prevent', 'price', 'pride', 'primary',
|
|
197
|
-
'print', 'priority', 'private', 'prize', 'process', 'produce', 'profit', 'program',
|
|
198
|
-
'project', 'promote', 'proof', 'property', 'prosper', 'protect', 'proud', 'provide',
|
|
199
|
-
'public', 'pudding', 'pull', 'pulp', 'pulse', 'pumpkin', 'puppy', 'purchase',
|
|
200
|
-
'purity', 'purpose', 'purse', 'push', 'put', 'puzzle', 'pyramid', 'quality',
|
|
201
|
-
'quantum', 'quarter', 'question', 'quick', 'quiz', 'quote', 'rabbit', 'race',
|
|
202
|
-
'rack', 'radar', 'radio', 'rail', 'rain', 'raise', 'rally', 'ramp',
|
|
203
|
-
'ranch', 'random', 'range', 'rapid', 'rare', 'rate', 'rather', 'raven',
|
|
204
|
-
'raw', 'razor', 'ready', 'real', 'reason', 'rebuild', 'recall', 'receive',
|
|
205
|
-
'recipe', 'record', 'recycle', 'reduce', 'reflect', 'reform', 'refuse', 'region',
|
|
206
|
-
'regular', 'relax', 'release', 'relief', 'rely', 'remain', 'remember', 'remove',
|
|
207
|
-
'render', 'renew', 'rent', 'reopen', 'repair', 'repeat', 'replace', 'report',
|
|
208
|
-
'require', 'rescue', 'resource', 'response', 'result', 'retire', 'retreat', 'return',
|
|
209
|
-
'reunion', 'reveal', 'review', 'reward', 'rhythm', 'rib', 'ribbon', 'rice',
|
|
210
|
-
'rich', 'ride', 'ridge', 'rifle', 'ring', 'ripple', 'risk', 'ritual',
|
|
211
|
-
'rival', 'river', 'road', 'roast', 'robot', 'robust', 'rocket', 'romance',
|
|
212
|
-
'roof', 'rookie', 'room', 'rose', 'rotate', 'round', 'route', 'royal',
|
|
213
|
-
'rubber', 'rug', 'rule', 'run', 'runway', 'rural', 'saddle', 'sadness',
|
|
214
|
-
'safe', 'salad', 'salmon', 'salon', 'salt', 'salute', 'same', 'sample',
|
|
215
|
-
'sand', 'satisfy', 'satoshi', 'sauce', 'sausage', 'save', 'say', 'scale',
|
|
216
|
-
'scan', 'school', 'science', 'scorpion', 'scout', 'screen', 'script', 'scrub',
|
|
217
|
-
'search', 'season', 'seat', 'second', 'secret', 'section', 'security', 'seed',
|
|
218
|
-
'seek', 'segment', 'select', 'sell', 'seminar', 'senior', 'sense', 'sentence',
|
|
219
|
-
'service', 'session', 'settle', 'setup', 'seven', 'shadow', 'shallow', 'share',
|
|
220
|
-
'shed', 'shell', 'sheriff', 'shield', 'shift', 'shine', 'shoe', 'shoot',
|
|
221
|
-
'shop', 'short', 'shoulder', 'shove', 'shrimp', 'shuffle', 'shy', 'sibling',
|
|
222
|
-
'sick', 'side', 'sight', 'sign', 'silent', 'silk', 'silly', 'silver',
|
|
223
|
-
'similar', 'simple', 'since', 'sister', 'situate', 'six', 'size', 'skate',
|
|
224
|
-
'sketch', 'ski', 'skill', 'skin', 'skirt', 'slab', 'slam', 'sleep',
|
|
225
|
-
'slice', 'slide', 'slight', 'slim', 'small', 'smart', 'smile', 'smooth',
|
|
226
|
-
'snack', 'snake', 'snow', 'soap', 'soccer', 'social', 'sock', 'soda',
|
|
227
|
-
'soft', 'solar', 'soldier', 'solid', 'solution', 'solve', 'someone', 'song',
|
|
228
|
-
'soon', 'sort', 'soul', 'sound', 'soup', 'source', 'south', 'space',
|
|
229
|
-
'spare', 'spatial', 'speak', 'special', 'speed', 'spell', 'spend', 'sphere',
|
|
230
|
-
'spice', 'spider', 'spike', 'spin', 'spirit', 'spoil', 'sponsor', 'spoon',
|
|
231
|
-
'sport', 'spot', 'spray', 'spread', 'spring', 'spy', 'square', 'squirrel',
|
|
232
|
-
'stable', 'stadium', 'staff', 'stage', 'stairs', 'stamp', 'stand', 'start',
|
|
233
|
-
'state', 'stay', 'steak', 'stem', 'step', 'stereo', 'stick', 'still',
|
|
234
|
-
'stock', 'stomach', 'stone', 'stool', 'story', 'stove', 'strategy', 'street',
|
|
235
|
-
'strong', 'student', 'style', 'subject', 'submit', 'subway', 'success', 'such',
|
|
236
|
-
'sudden', 'sugar', 'suggest', 'suit', 'summer', 'sunny', 'sunset', 'super',
|
|
237
|
-
'supply', 'supreme', 'sure', 'surface', 'surge', 'surprise', 'surround', 'survey',
|
|
238
|
-
'sustain', 'swap', 'swarm', 'sweet', 'swift', 'swim', 'swing', 'switch',
|
|
239
|
-
'sword', 'symbol', 'syrup', 'system', 'table', 'tackle', 'tag', 'talent',
|
|
240
|
-
'talk', 'tape', 'task', 'taste', 'taxi', 'teach', 'team', 'tell',
|
|
241
|
-
'tennis', 'term', 'test', 'text', 'thank', 'theme', 'then', 'theory',
|
|
242
|
-
'they', 'this', 'thought', 'thrive', 'throw', 'thumb', 'thunder', 'ticket',
|
|
243
|
-
'tide', 'tiger', 'tilt', 'timber', 'time', 'tiny', 'tip', 'tired',
|
|
244
|
-
'tissue', 'title', 'toast', 'today', 'toddler', 'together', 'toilet', 'token',
|
|
245
|
-
'tomato', 'tomorrow', 'tone', 'tonight', 'tool', 'tooth', 'top', 'topic',
|
|
246
|
-
'topple', 'torch', 'tortoise', 'toss', 'total', 'tourist', 'tower', 'town',
|
|
247
|
-
'toy', 'track', 'trade', 'traffic', 'train', 'transfer', 'trap', 'travel',
|
|
248
|
-
'tray', 'treat', 'trend', 'tribe', 'trick', 'trigger', 'trim', 'trip',
|
|
249
|
-
'trophy', 'truck', 'true', 'trumpet', 'truth', 'try', 'tuition', 'tunnel',
|
|
250
|
-
'turkey', 'turn', 'turtle', 'twelve', 'twenty', 'twice', 'twin', 'twist',
|
|
251
|
-
'two', 'type', 'typical', 'umbrella', 'unable', 'unaware', 'uncle', 'uncover',
|
|
252
|
-
'under', 'undo', 'unfair', 'unfold', 'uniform', 'unique', 'unit', 'universe',
|
|
253
|
-
'unknown', 'unlock', 'until', 'unusual', 'update', 'upgrade', 'uphold', 'upon',
|
|
254
|
-
'upper', 'upset', 'urban', 'urge', 'usage', 'use', 'used', 'useful',
|
|
255
|
-
'useless', 'usual', 'utility', 'vague', 'valid', 'valley', 'valve', 'vapor',
|
|
256
|
-
'various', 'vast', 'vehicle', 'velvet', 'vendor', 'venue', 'verb', 'verify',
|
|
257
|
-
'version', 'very', 'vessel', 'veteran', 'viable', 'vibrant', 'vicious', 'victory',
|
|
258
|
-
'video', 'village', 'vintage', 'violin', 'virtual', 'visa', 'visit', 'visual',
|
|
259
|
-
'vital', 'vivid', 'vocal', 'voice', 'volcano', 'vote', 'voyage', 'wagon',
|
|
260
|
-
'walk', 'wall', 'walnut', 'want', 'warm', 'warrior', 'wash', 'wasp',
|
|
261
|
-
'water', 'wave', 'way', 'wealth', 'weasel', 'web', 'wedding', 'weekend',
|
|
262
|
-
'welcome', 'west', 'wet', 'whale', 'what', 'wheat', 'wheel', 'when',
|
|
263
|
-
'whip', 'whisper', 'wide', 'width', 'wife', 'wild', 'will', 'win',
|
|
264
|
-
'window', 'wine', 'wing', 'wink', 'winner', 'winter', 'wire', 'wisdom',
|
|
265
|
-
'wise', 'wish', 'witness', 'wolf', 'woman', 'wonder', 'wool', 'word',
|
|
266
|
-
'work', 'world', 'worry', 'worth', 'wreck', 'wrestle', 'yard', 'year',
|
|
267
|
-
'yellow', 'you', 'young', 'youth', 'zebra', 'zero', 'zone', 'zoo',
|
|
268
|
-
];
|
|
269
|
-
export const WORDLIST_SIZE = 2048;
|
|
270
|
-
/** O(1) reverse lookup — built once at module load. */
|
|
271
|
-
const indexMap = new Map();
|
|
272
|
-
for (let i = 0; i < WORDLIST.length; i++) {
|
|
273
|
-
indexMap.set(WORDLIST[i], i);
|
|
274
|
-
}
|
|
275
|
-
/**
|
|
276
|
-
* Return the word at the given index.
|
|
277
|
-
*
|
|
278
|
-
* @param index - Zero-based index into the wordlist (0-2047).
|
|
279
|
-
* @returns The word at the specified index.
|
|
280
|
-
* @throws {RangeError} If index is outside 0-2047.
|
|
281
|
-
*/
|
|
282
|
-
export function getWord(index) {
|
|
283
|
-
if (index < 0 || index >= WORDLIST_SIZE) {
|
|
284
|
-
throw new RangeError(`Wordlist index out of range: ${index} (must be 0-${WORDLIST_SIZE - 1})`);
|
|
285
|
-
}
|
|
286
|
-
return WORDLIST[index];
|
|
287
|
-
}
|
|
288
|
-
/**
|
|
289
|
-
* Return the index of a word, or -1 if it is not in the wordlist.
|
|
290
|
-
*
|
|
291
|
-
* @param word - The word to look up (must match exactly, case-sensitive).
|
|
292
|
-
* @returns Zero-based index (0-2047) or -1 if not found.
|
|
293
|
-
*/
|
|
294
|
-
export function indexOf(word) {
|
|
295
|
-
return indexMap.get(word) ?? -1;
|
|
296
|
-
}
|
|
1
|
+
export { WORDLIST, WORDLIST_SIZE, getWord, indexOf } from 'spoken-token';
|
|
297
2
|
//# sourceMappingURL=wordlist.js.map
|