@connextar/house 0.12.0 → 0.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +419 -0
- package/dist/auth/index.d.ts +3 -1
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/auth/index.js +3 -1
- package/dist/auth/index.js.map +1 -1
- package/dist/auth/second-factor-index.d.ts +7 -0
- package/dist/auth/second-factor-index.d.ts.map +1 -0
- package/dist/auth/second-factor-index.js +7 -0
- package/dist/auth/second-factor-index.js.map +1 -0
- package/dist/auth/second-factor-next.d.ts +39 -0
- package/dist/auth/second-factor-next.d.ts.map +1 -0
- package/dist/auth/second-factor-next.js +131 -0
- package/dist/auth/second-factor-next.js.map +1 -0
- package/dist/auth/second-factor-routes.d.ts +29 -0
- package/dist/auth/second-factor-routes.d.ts.map +1 -0
- package/dist/auth/second-factor-routes.js +35 -0
- package/dist/auth/second-factor-routes.js.map +1 -0
- package/dist/auth/second-factor.d.ts +117 -0
- package/dist/auth/second-factor.d.ts.map +1 -0
- package/dist/auth/second-factor.js +127 -0
- package/dist/auth/second-factor.js.map +1 -0
- package/dist/auth/two-factor-policy.d.ts +30 -1
- package/dist/auth/two-factor-policy.d.ts.map +1 -1
- package/dist/auth/two-factor-policy.js +39 -1
- package/dist/auth/two-factor-policy.js.map +1 -1
- package/dist/password/common.d.ts +2 -0
- package/dist/password/common.d.ts.map +1 -0
- package/dist/password/common.js +58 -0
- package/dist/password/common.js.map +1 -0
- package/dist/password/estimate-index.d.ts +10 -0
- package/dist/password/estimate-index.d.ts.map +1 -0
- package/dist/password/estimate-index.js +10 -0
- package/dist/password/estimate-index.js.map +1 -0
- package/dist/password/estimate.d.ts +65 -0
- package/dist/password/estimate.d.ts.map +1 -0
- package/dist/password/estimate.js +612 -0
- package/dist/password/estimate.js.map +1 -0
- package/dist/password/index.d.ts +22 -0
- package/dist/password/index.d.ts.map +1 -0
- package/dist/password/index.js +22 -0
- package/dist/password/index.js.map +1 -0
- package/dist/password/password-input.d.ts +55 -0
- package/dist/password/password-input.d.ts.map +1 -0
- package/dist/password/password-input.js +54 -0
- package/dist/password/password-input.js.map +1 -0
- package/dist/password/password-strength.d.ts +62 -0
- package/dist/password/password-strength.d.ts.map +1 -0
- package/dist/password/password-strength.js +79 -0
- package/dist/password/password-strength.js.map +1 -0
- package/dist/password/reveal.d.ts +56 -0
- package/dist/password/reveal.d.ts.map +1 -0
- package/dist/password/reveal.js +109 -0
- package/dist/password/reveal.js.map +1 -0
- package/package.json +19 -1
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The words people build passwords out of, most guessed first.
|
|
3
|
+
*
|
|
4
|
+
* The head is the top of the leaked-password lists every attacker starts with;
|
|
5
|
+
* the tail is the words those passwords are made of — pets, teams, seasons,
|
|
6
|
+
* months, feelings, keyboard rows — so "Sunshine2024!" is read as a common word
|
|
7
|
+
* dressed up rather than as twelve unknown characters. Kept to a few kilobytes
|
|
8
|
+
* on purpose: a full frequency list is what makes zxcvbn several hundred
|
|
9
|
+
* kilobytes, and the patterns (sequences, repeats, keyboard walks, dates) do
|
|
10
|
+
* most of the work a list would.
|
|
11
|
+
*
|
|
12
|
+
* A word's rank is its position, and its rank is roughly how many guesses an
|
|
13
|
+
* attacker spends before trying it. Lower case, three letters or more.
|
|
14
|
+
*/
|
|
15
|
+
const WORDS = `
|
|
16
|
+
password 123456 123456789 12345678 12345 qwerty 1234567 111111 1234567890 123123
|
|
17
|
+
abc123 1234 password1 iloveyou 000000 qwerty123 dragon monkey letmein 654321
|
|
18
|
+
football baseball welcome admin login master sunshine princess shadow superman
|
|
19
|
+
starwars trustno1 passw0rd whatever qazwsx michael charlie freedom hello secret
|
|
20
|
+
ashley bailey jordan jennifer hunter thomas batman soccer hockey killer george
|
|
21
|
+
andrew michelle jessica pepper daniel access mustang ginger joshua cheese amanda
|
|
22
|
+
summer love buster tigger robert matthew yankees dallas austin thunder taylor
|
|
23
|
+
harley hannah heather maggie orange computer internet flower silver golden
|
|
24
|
+
cookie chelsea arsenal liverpool manchester united london england google
|
|
25
|
+
apple banana chocolate coffee purple yellow blue green black white red pink
|
|
26
|
+
winter spring autumn january february march april june july august september
|
|
27
|
+
october november december monday tuesday wednesday thursday friday saturday
|
|
28
|
+
sunday family friends forever angel angels baby babygirl lovely loveme lover
|
|
29
|
+
pass pass123 password123 admin123 root toor test test123 guest user default
|
|
30
|
+
changeme temp temporary qwertyuiop asdfgh asdfghjkl zxcvbn zxcvbnm azerty
|
|
31
|
+
qwertz 1q2w3e4r 1qaz2wsx zaq12wsx q1w2e3r4 abcdef abcd1234 aaaaaa 121212
|
|
32
|
+
112233 123321 666666 696969 777777 888888 999999 987654321 159753 147258
|
|
33
|
+
myspace facebook twitter instagram linkedin microsoft windows samsung iphone
|
|
34
|
+
nintendo pokemon minecraft fortnite matrix hello123 welcome1 letmein1 football1
|
|
35
|
+
princess1 monkey1 dragon1 sunshine1 iloveyou1 qwerty1 charlie1 lovely1 secret1
|
|
36
|
+
tiger lion bear wolf eagle falcon dolphin horse puppy kitty kitten doggie
|
|
37
|
+
snoopy scooter buddy lucky oliver jack harry sophie emily olivia jacob william
|
|
38
|
+
james john david richard joseph charles mark paul steven kevin brian edward
|
|
39
|
+
mary patricia linda barbara elizabeth susan margaret sarah karen nancy lisa
|
|
40
|
+
anna maria laura helen emma grace chloe lucy ella mia amelia isla ava lily
|
|
41
|
+
alexander benjamin samuel henry oscar leo noah arthur alfie theo archie freddie
|
|
42
|
+
jesus christ god heaven blessed faith hope peace happy smile sweet honey sugar
|
|
43
|
+
magic dream star stars moon sun sky ocean river mountain forest fire water
|
|
44
|
+
earth storm rain snow ice money cash rich gold diamond king queen prince
|
|
45
|
+
princesa boss legend ninja pirate zombie monster devil demon ghost hunter1
|
|
46
|
+
music guitar piano rock metal jazz dance party fun cool awesome super power
|
|
47
|
+
player gamer game games soccer1 rugby cricket tennis golf boxing racing
|
|
48
|
+
chicken pizza burger pasta cherry lemon mango peach strawberry
|
|
49
|
+
college school student teacher doctor nurse office company business work
|
|
50
|
+
home house garden city country world england1 scotland wales ireland
|
|
51
|
+
britain america canada australia france germany spain italy india china japan
|
|
52
|
+
spurs everton leeds celtic rangers chelsea1 barcelona madrid juventus
|
|
53
|
+
batman1 spiderman ironman wonder marvel hulk thor loki yoda jedi sith vader
|
|
54
|
+
secret123 mypassword yourpassword nopassword letme letmein123 iloveu
|
|
55
|
+
sexy hottie babe darling sweetheart kiss hugs cuddles
|
|
56
|
+
`;
|
|
57
|
+
export const COMMON_WORDS = [...new Set(WORDS.trim().split(/\s+/))];
|
|
58
|
+
//# sourceMappingURL=common.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/password/common.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,MAAM,KAAK,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyCb,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAsB,CAAC,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@connextar/house/password/estimate` — the strength estimator alone, for the
|
|
3
|
+
* server.
|
|
4
|
+
*
|
|
5
|
+
* It imports nothing at all, so a route handler that refuses the weakest
|
|
6
|
+
* passwords with the same judgement the meter showed pulls in neither React nor
|
|
7
|
+
* an icon set. `src/password/entry-points.test.ts` holds it to that.
|
|
8
|
+
*/
|
|
9
|
+
export { estimatePasswordStrength, MAX_ANALYSED_LENGTH, PASSWORD_STRENGTH_MESSAGES, type EstimatePasswordStrengthOptions, type PasswordScore, type PasswordStrengthEstimate, type PasswordStrengthMessages, type PasswordWeakness, } from "./estimate.js";
|
|
10
|
+
//# sourceMappingURL=estimate-index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"estimate-index.d.ts","sourceRoot":"","sources":["../../src/password/estimate-index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EACL,wBAAwB,EACxB,mBAAmB,EACnB,0BAA0B,EAC1B,KAAK,+BAA+B,EACpC,KAAK,aAAa,EAClB,KAAK,wBAAwB,EAC7B,KAAK,wBAAwB,EAC7B,KAAK,gBAAgB,GACtB,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@connextar/house/password/estimate` — the strength estimator alone, for the
|
|
3
|
+
* server.
|
|
4
|
+
*
|
|
5
|
+
* It imports nothing at all, so a route handler that refuses the weakest
|
|
6
|
+
* passwords with the same judgement the meter showed pulls in neither React nor
|
|
7
|
+
* an icon set. `src/password/entry-points.test.ts` holds it to that.
|
|
8
|
+
*/
|
|
9
|
+
export { estimatePasswordStrength, MAX_ANALYSED_LENGTH, PASSWORD_STRENGTH_MESSAGES, } from "./estimate.js";
|
|
10
|
+
//# sourceMappingURL=estimate-index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"estimate-index.js","sourceRoot":"","sources":["../../src/password/estimate-index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EACL,wBAAwB,EACxB,mBAAmB,EACnB,0BAA0B,GAM3B,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
export type PasswordScore = 0 | 1 | 2 | 3 | 4;
|
|
2
|
+
/** The main reason a password scored low, when there is one worth naming. */
|
|
3
|
+
export type PasswordWeakness = "user-input" | "common" | "common-decorated" | "keyboard" | "repeat" | "sequence" | "date" | "short";
|
|
4
|
+
export interface PasswordStrengthMessages {
|
|
5
|
+
/** What each score is called, from 0 to 4. */
|
|
6
|
+
labels: readonly [string, string, string, string, string];
|
|
7
|
+
/** The sentence for a low score (0–2) with a reason that can be named. */
|
|
8
|
+
weakness: Record<PasswordWeakness, string>;
|
|
9
|
+
/** Score 0–1 with no single reason. */
|
|
10
|
+
weak: string;
|
|
11
|
+
/** Score 2 with no single reason. */
|
|
12
|
+
fair: string;
|
|
13
|
+
strong: string;
|
|
14
|
+
veryStrong: string;
|
|
15
|
+
/** Shown instead of the score's sentence while the password is shorter than the app's `minLength`. */
|
|
16
|
+
tooShort: (minLength: number) => string;
|
|
17
|
+
}
|
|
18
|
+
export declare const PASSWORD_STRENGTH_MESSAGES: PasswordStrengthMessages;
|
|
19
|
+
export interface EstimatePasswordStrengthOptions {
|
|
20
|
+
/**
|
|
21
|
+
* Things this person's password should not be built from: their email, name,
|
|
22
|
+
* username, organisation, the app's name. Matched in pieces, so
|
|
23
|
+
* "amir@connextar.com" also penalises "amir" and "connextar".
|
|
24
|
+
*/
|
|
25
|
+
userInputs?: ReadonlyArray<string | null | undefined>;
|
|
26
|
+
/**
|
|
27
|
+
* The app's own minimum length. While the password is shorter, the sentence
|
|
28
|
+
* says so instead of describing the score — the score itself is unchanged.
|
|
29
|
+
*/
|
|
30
|
+
minLength?: number;
|
|
31
|
+
messages?: Partial<PasswordStrengthMessages>;
|
|
32
|
+
}
|
|
33
|
+
export interface PasswordStrengthEstimate {
|
|
34
|
+
score: PasswordScore;
|
|
35
|
+
/** `labels[score]`, or "" for an empty password. */
|
|
36
|
+
label: string;
|
|
37
|
+
/** One plain sentence, or "" for an empty password. */
|
|
38
|
+
sentence: string;
|
|
39
|
+
/** Why it scored low, when the score is 2 or less and one reason stands out. */
|
|
40
|
+
weakness: PasswordWeakness | null;
|
|
41
|
+
/** Shorter than `minLength`, when one was given. */
|
|
42
|
+
belowMinLength: boolean;
|
|
43
|
+
/** log10 of the estimated number of guesses. */
|
|
44
|
+
guessesLog10: number;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Only the first 100 characters are analysed. Past that the estimate is already
|
|
48
|
+
* as high as it goes for anything but a repeat, and the search is cubic in
|
|
49
|
+
* length, so a pasted essay must not stall a keystroke.
|
|
50
|
+
*/
|
|
51
|
+
export declare const MAX_ANALYSED_LENGTH = 100;
|
|
52
|
+
/**
|
|
53
|
+
* Estimate how guessable `password` is.
|
|
54
|
+
*
|
|
55
|
+
* ```ts
|
|
56
|
+
* estimatePasswordStrength("Password1!").score; // 1 — "A common word with capitals, numbers or symbols added…"
|
|
57
|
+
* estimatePasswordStrength("amir-connextar-2026", { userInputs: ["amir@connextar.com"] }).weakness; // "user-input"
|
|
58
|
+
* ```
|
|
59
|
+
*
|
|
60
|
+
* On the server, the same call lets an app refuse what the meter calls very weak
|
|
61
|
+
* — `if (estimate.score < 2) …` — with the sentence as the error message. Whether
|
|
62
|
+
* to do that is the app's decision; nothing here refuses anything.
|
|
63
|
+
*/
|
|
64
|
+
export declare function estimatePasswordStrength(password: string, options?: EstimatePasswordStrengthOptions): PasswordStrengthEstimate;
|
|
65
|
+
//# sourceMappingURL=estimate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"estimate.d.ts","sourceRoot":"","sources":["../../src/password/estimate.ts"],"names":[],"mappings":"AAyBA,MAAM,MAAM,aAAa,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAE9C,6EAA6E;AAC7E,MAAM,MAAM,gBAAgB,GAC1B,YAAY,GAAG,QAAQ,GAAG,kBAAkB,GAAG,UAAU,GAAG,QAAQ,GAAG,UAAU,GAAG,MAAM,GAAG,OAAO,CAAC;AAEvG,MAAM,WAAW,wBAAwB;IACvC,8CAA8C;IAC9C,MAAM,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1D,0EAA0E;IAC1E,QAAQ,EAAE,MAAM,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC;IAC3C,uCAAuC;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,qCAAqC;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,sGAAsG;IACtG,QAAQ,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,CAAC;CACzC;AAED,eAAO,MAAM,0BAA0B,EAAE,wBAkBxC,CAAC;AAEF,MAAM,WAAW,+BAA+B;IAC9C;;;;OAIG;IACH,UAAU,CAAC,EAAE,aAAa,CAAC,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC,CAAC;IACtD;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC,wBAAwB,CAAC,CAAC;CAC9C;AAED,MAAM,WAAW,wBAAwB;IACvC,KAAK,EAAE,aAAa,CAAC;IACrB,oDAAoD;IACpD,KAAK,EAAE,MAAM,CAAC;IACd,uDAAuD;IACvD,QAAQ,EAAE,MAAM,CAAC;IACjB,gFAAgF;IAChF,QAAQ,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAClC,oDAAoD;IACpD,cAAc,EAAE,OAAO,CAAC;IACxB,gDAAgD;IAChD,YAAY,EAAE,MAAM,CAAC;CACtB;AAED;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,MAAM,CAAC;AAwjBvC;;;;;;;;;;;GAWG;AACH,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE,+BAAoC,GAC5C,wBAAwB,CA+B1B"}
|