Skip to content

Commit 2936ae5

Browse files
committed
docs(readme): fix usage subheaders
convert subheaders from h5 to h3
1 parent 25051c4 commit 2936ae5

File tree

1 file changed

+73
-54
lines changed

1 file changed

+73
-54
lines changed

README.md

Lines changed: 73 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -14,29 +14,29 @@ KdbxWeb is a high-performance javascript library for reading/writing KeePass v2
1414
- [Compatibility](#compatibility)
1515
- [Kdbx4](#kdbx4)
1616
- [Usage](#usage)
17-
- [Loading](#loading)
18-
- [Saving](#saving)
19-
- [File info](#file-info)
20-
- [Changing credentials](#changing-credentials)
21-
- [Creation](#creation)
22-
- [Maintenance](#maintenance)
23-
- [Merge](#merge)
24-
- [Groups](#groups)
25-
- [Group creation](#group-creation)
26-
- [Group deletion](#group-deletion)
27-
- [Group move](#group-move)
28-
- [Recycle Bin](#recycle-bin)
29-
- [Recursive traverse](#recursive-traverse)
30-
- [Entries](#entries)
31-
- [Entry creation](#entry-creation)
32-
- [Entry modification](#entry-modification)
17+
- [Loading](#loading)
18+
- [Saving](#saving)
19+
- [File info](#file-info)
20+
- [Changing credentials](#changing-credentials)
21+
- [Creation](#creation)
22+
- [Maintenance](#maintenance)
23+
- [Merge](#merge)
24+
- [Groups](#groups)
25+
- [Group creation](#group-creation)
26+
- [Group deletion](#group-deletion)
27+
- [Group move](#group-move)
28+
- [Recycle Bin](#recycle-bin)
29+
- [Recursive traverse](#recursive-traverse)
30+
- [Entries](#entries)
31+
- [Entry creation](#entry-creation)
32+
- [Entry modification](#entry-modification)
3333
- [Entry deletion](#entry-deletion)
34-
- [Entry move](#entry-move)
35-
- [ProtectedValue](#protectedvalue)
36-
- [Errors](#errors)
37-
- [Consts](#consts)
38-
- [Random](#random)
39-
- [ByteUtils](#byteutils)
34+
- [Entry move](#entry-move)
35+
- [ProtectedValue](#protectedvalue)
36+
- [Errors](#errors)
37+
- [Consts](#consts)
38+
- [Random](#random)
39+
- [ByteUtils](#byteutils)
4040
- [Building](#building)
4141
- [3rd party libs](#3rd-party-libs)
4242
- [Tools](#tools)
@@ -53,6 +53,8 @@ KdbxWeb is a high-performance javascript library for reading/writing KeePass v2
5353

5454
## Features
5555

56+
kdbxweb offers the following feature sets:
57+
5658
- runs in browser or node.js
5759
- no native addons
5860
- fast encryption with WebCrypto
@@ -71,8 +73,13 @@ KdbxWeb is a high-performance javascript library for reading/writing KeePass v2
7173

7274
## Browser support
7375

74-
- modern browsers: Chrome, Firefox, Safari, Opera, Edge
75-
- node.js
76+
- All modern browsers
77+
- Chrome / Chromium
78+
- Firefox
79+
- Safari
80+
- Opera
81+
- Edge
82+
- NodeJS
7683

7784
<br />
7885

@@ -82,7 +89,7 @@ KdbxWeb is a high-performance javascript library for reading/writing KeePass v2
8289

8390
## Compatibility
8491

85-
Supported formats are Kdbx3 and Kdbx4, current KeePass file format. Old kdb files (for KeePass v1) are out of scope of this library.
92+
Supported formats are Kdbx3 and Kdbx4, current KeePass file format. Old kdb files (for KeePass v1) are out of scope of this library. We currently have no plans to support the older formats.
8693

8794
<br />
8895

@@ -105,7 +112,7 @@ kdbxweb.CryptoEngine.setArgon2Impl((password, salt,
105112

106113
You can find an implementation example in [tests](https://github.com/keeweb/kdbxweb/blob/master/test/test-support/argon2.ts).
107114

108-
It's not compiled into the library because there's no universal way to provide a fast implementation, so it's up to you, to choose the best one.
115+
It's not compiled into the library because there's no universal way to provide a fast implementation, so it's up to you to choose the best one.
109116

110117
<br />
111118

@@ -115,7 +122,11 @@ It's not compiled into the library because there's no universal way to provide a
115122

116123
## Usage
117124

118-
##### Loading
125+
This section gives usage examples on how you can implement kdbxweb into your project.
126+
127+
<br />
128+
129+
### Loading
119130

120131
```ts
121132
let credentials = new kdbxweb.Credentials(kdbxweb.ProtectedValue.fromString('demo'),
@@ -124,7 +135,7 @@ const db1 = await kdbxweb.Kdbx.load(dataAsArrayBuffer, credentials);
124135
const db2 = await kdbxweb.Kdbx.loadXml(dataAsString, credentials);
125136
```
126137

127-
##### Saving
138+
### Saving
128139

129140
```ts
130141
const dataAsArrayBuffer = await db.save();
@@ -138,7 +149,7 @@ const prettyPrintedXml = await db.saveXml(true);
138149

139150
<br />
140151

141-
##### File info
152+
### File info
142153

143154
```ts
144155
db.header
@@ -147,7 +158,7 @@ db.meta
147158

148159
See the corresponding type fields inside, they should be obvious.
149160

150-
##### Changing credentials
161+
### Changing credentials
151162

152163
```ts
153164
const db = await kdbxweb.Kdbx.load(data, credentials);
@@ -157,7 +168,7 @@ db.credentials.setKeyFile(randomKeyFile);
157168
await db.save();
158169
```
159170

160-
##### Creation
171+
### Creation
161172

162173
```ts
163174
let newDb = kdbxweb.Kdbx.create(credentials, 'My new db');
@@ -167,7 +178,7 @@ let entry = newDb.createEntry(group);
167178

168179
<br />
169180

170-
##### Maintenance
181+
### Maintenance
171182

172183
```ts
173184
db.cleanup({
@@ -188,11 +199,12 @@ db.setKdf(kdbxweb.Consts.KdfId.Aes);
188199

189200
<br />
190201

191-
##### Merge
202+
### Merge
192203

193204
Entries, groups and meta are consistent against merging in any direction with any state.
194205
Due to format limitations, p2p entry history merging and some non-critical fields in meta can produce phantom records or deletions,
195206
so correct entry history merging is supported only with one central replica. Items order is not guaranteed but the algorithm tries to preserve it.
207+
196208
```ts
197209
let db = await kdbxweb.Kdbx.load(data, credentials); // load local db
198210
// work with db
@@ -216,7 +228,7 @@ if (pushedOk) {
216228

217229
<br />
218230

219-
##### Groups
231+
### Groups
220232

221233
```ts
222234
let defaultGroup = db.getDefaultGroup();
@@ -226,7 +238,7 @@ let deepGroup = defaultGroup.groups[1].groups[2];
226238

227239
<br />
228240

229-
##### Group creation
241+
### Group creation
230242

231243
```ts
232244
let group = db.createGroup(db.getDefaultGroup(), 'New group');
@@ -235,15 +247,15 @@ let anotherGroup = db.createGroup(group, 'Subgroup');
235247

236248
<br />
237249

238-
##### Group deletion
250+
### Group deletion
239251

240252
```ts
241253
db.remove(group);
242254
```
243255

244256
<br />
245257

246-
##### Group move
258+
### Group move
247259

248260
```ts
249261
db.move(group, toGroup);
@@ -252,7 +264,7 @@ db.move(group, toGroup, atIndex);
252264

253265
<br />
254266

255-
##### Recycle Bin
267+
### Recycle Bin
256268

257269
```ts
258270
let recycleBin = db.getGroup(db.meta.recycleBinUuid);
@@ -263,7 +275,7 @@ if (!recycleBin) {
263275

264276
<br />
265277

266-
##### Recursive traverse
278+
### Recursive traverse
267279

268280
```ts
269281
for (const entry of group.allEntries()) { /* ... */ }
@@ -273,7 +285,7 @@ for (const entryOrGroup of group.allGroupsAndEntries()) { /* ... */ }
273285

274286
<br />
275287

276-
##### Entries
288+
### Entries
277289

278290
```ts
279291
let entry = db.getDefaultGroup().entries[0];
@@ -283,27 +295,34 @@ entry.fields.Pin = kdbxweb.ProtectedValue.fromString('4321');
283295

284296
<br />
285297

286-
##### Entry creation
298+
### Entry creation
287299

288300
```ts
289301
let entry = db.createEntry(group);
290302
```
291303

292304
<br />
293305

294-
##### Entry modification
306+
### Entry modification
295307

296308
```ts
297309
// push current state to history stack
298310
entry.pushHistory();
311+
299312
// change something
300313
entry.fgColor = '#ff0000';
314+
301315
// update entry modification and access time
302316
entry.times.update();
317+
303318
// remove states from entry history
304319
entry.removeHistory(index, count);
305320
```
306-
Important: don't modify history states directly, this will break merge.
321+
322+
<br />
323+
324+
> [!WARNING]
325+
> Do **not** modify history states directly; this will break merge.
307326
308327
<br />
309328

@@ -315,22 +334,24 @@ db.remove(entry);
315334

316335
<br />
317336

318-
##### Entry move
337+
### Entry move
319338

320339
```ts
321340
db.move(entry, toGroup);
322341
```
323342

324343
If you're moving an entry from another file, this is called _import_:
344+
325345
```ts
326346
db.importEntry(entry, toGroup, sourceFile);
327347
```
328348

329349
<br />
330350

331-
##### ProtectedValue
351+
### ProtectedValue
352+
353+
Used for passwords and custom fields, stored the value in memory XOR'ed
332354

333-
Used for passwords and custom fields, stored the value in memory XOR'ed
334355
```ts
335356
let value = new kdbxweb.ProtectedValue(xoredByted, saltBytes);
336357
let valueFromString = kdbxweb.ProtectedValue.fromString('str');
@@ -342,7 +363,7 @@ let includesSubString = value.includes('foo');
342363

343364
<br />
344365

345-
##### Errors
366+
### Errors
346367

347368
```ts
348369
try {
@@ -356,7 +377,7 @@ try {
356377

357378
<br />
358379

359-
##### Consts
380+
### Consts
360381

361382
[Consts definition](https://github.com/keeweb/kdbxweb/blob/master/lib/defs/consts.ts)
362383

@@ -368,15 +389,15 @@ kdbxweb.Consts.Icons // icons map
368389

369390
<br />
370391

371-
##### Random
392+
### Random
372393

373394
```ts
374395
let randomArray = kdbxweb.Crypto.random(/* desired length */ 100);
375396
```
376397

377398
<br />
378399

379-
##### ByteUtils
400+
### ByteUtils
380401

381402
```ts
382403
kdbxweb.ByteUtils.bytesToString(bytes);
@@ -474,7 +495,7 @@ npm run script:make-big-files
474495

475496
## See it in action
476497

477-
This library is used in [KeeWeb](https://app.keeweb.info)
498+
This library is used in **[KeeWeb](https://app.keeweb.info)**
478499

479500
<br />
480501

@@ -484,9 +505,7 @@ This library is used in [KeeWeb](https://app.keeweb.info)
484505

485506
## Extras
486507

487-
We also provide a template for [HexFiend](https://github.com/ridiculousfish/HexFiend)
488-
to explore the contents of KDBX files, you can find it
489-
[here](format).
508+
We also provide a template for **[HexFiend](https://github.com/ridiculousfish/HexFiend)** to explore the contents of KDBX files, you can find it **[here](format)**.
490509

491510
<br />
492511

0 commit comments

Comments
 (0)