Browse Source

add comment option

ameba23 2 years ago
parent
commit
22e6d5f7f2
2 changed files with 3 additions and 1 deletions
  1. 2
    1
      README.md
  2. 1
    0
      index.js

+ 2
- 1
README.md View File

@@ -36,8 +36,9 @@ paperKeys.createPdf('./key-backup.pdf', keys, (err) => {
36 36
 
37 37
 creates a pdf `outputFile`.
38 38
 - `keys` should be an array of objects of the form:
39
-  - `name` - a string describing the key.
39
+  - `name` - a string describing the key (may contain markdown formatting).
40 40
   - `data` - the key as a buffer or hex encoded string.
41
+  - `comment` - an optional comment string to include (may contain markdown formatting). 
41 42
 
42 43
 ### `removePdf (filePath)`
43 44
 Securely removes the given file.  Returns a promise.

+ 1
- 0
index.js View File

@@ -22,6 +22,7 @@ async function createPdf (outputFile, keys, callback) {
22 22
       {}
23 23
     )
24 24
     markdown += `## ${key.name}\n![qrcode](${filename})\n`
25
+    if (key.comment) markdown += `${key.comment}\n`
25 26
     markdown += `${bip39.entropyToMnemonic(key.data)}\n---\n`
26 27
     return filename
27 28
   }))