You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+36-3Lines changed: 36 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,9 +24,42 @@ The brains behind Cloverleaf
24
24
## siteData
25
25
**Returns**: <code>object</code> - Data for preset sites
26
26
27
+
Schema (How the JSON is structured):
28
+
29
+
```json
30
+
"App Name": {
31
+
"alias": "Real app", // Makes passwords as if this was the app name
32
+
"minLength": 4, // The minimum length of a password allowed on this preset (inclusive)
33
+
"maxLength": 512, // The maximum length of a password allowed on this preset (inclusive)
34
+
"chars": "abc123", // The password will be made out of a random selection of these characters.
35
+
"deprecated": false, // Used to hide presets
36
+
"regex": "^(?!.*(.)\\1{2,}).+", // A regex the password must match. This one disallows repetitions of 3 or more of the same character
37
+
"requirements": ["cap", "low", "num", "special"], // Passwords must have at least one of these character types
38
+
}
39
+
```
40
+
41
+
The only requirements for a valid preset is an alias or minimum length, the rest is optional.
42
+
27
43
28
44
# Contributing
29
45
30
-
`
31
-
pnpm i
32
-
`
46
+
## Creating a new preset
47
+
Making a new preset is pretty easy. All data for presets is kept in [sites.json](/data/sites.json). There's a json schema that describes what is needed but the tl;dr is this:
48
+
49
+
Add a new key in the JSON object (in alphabetical order) with the name of the site/app you're making a preset for.
50
+
51
+
### Working out a site's restrictions
52
+
#### Character restrictions
53
+
A good first test is pasting this in and seeing if it's upset about any characters:
If it is then you need to work out which it doesn't like. This can take a long time but can be sped up if you use a kind of binary search and half the string until you can pinpoint what is causing an issue.
58
+
59
+
#### Length restrictions
60
+
You also then need to work out if there are any minimum and maximum lengths. The first is easily discovered by attempting to use just "a" or something like that. For the maximum length I generally try a string that's over 512 characters (the default max for cloverleaf passwords).
61
+
62
+
#### Other restrictions
63
+
Some sites have basic restrictions such as "must have a special character" or "must use a number and a capital". For these we use the "requirements" key and an array or required character types ("cap", "low", "num" and "special")
64
+
65
+
Some websites disallow repeated characters (EG. `aaa`) or common phrases like `qwerty`, `abc` or `123`. If a site has these restrictions you will need to add a regex.
0 commit comments