@@ -20,9 +20,12 @@ <h2>Headers</h2>
20
20
< label for ="auth "> Authorization Header:</ label >
21
21
< textarea name ="auth " placeholder ="Bearer abCDef... "> </ textarea >
22
22
< label for ="crypt "> Crypto-Key Header:</ label >
23
- < p > The public key expressed after "p256ecdsa=" can associate this feed with the dashboard." </ p >
23
+ < p > The public key expressed after "p256ecdsa=" can associate this feed with the dashboard.</ p >
24
24
< textarea name ="crypt " placeholder ="p256ecdsa=abCDef.. "> </ textarea >
25
25
< div class ="control ">
26
+ < label for ="publicKey "> Public Key:</ label >
27
+ < p > This is the public key you'd use for the Dashboard</ p >
28
+ < textarea name ="publicKey " placeholder ="abCDef... " readonly =true > </ textarea >
26
29
< button id ="check "> Check headers</ button >
27
30
</ div >
28
31
</ div >
@@ -61,9 +64,9 @@ <h3>Claims JSON object:</h3>
61
64
< h2 > Exported Keys</ h2 >
62
65
< b > Auto-generated keys:</ b >
63
66
< p > These are ASN.1 DER formatted version of the public and private keys used to generate
64
- the VAPID headers. These can be useful for languages that use DER for key import.</ p >
65
- < label for ="priv "> Private Key:</ label > < textarea name ="priv "> </ textarea >
66
- < label for ="pub "> Public Key:</ label > < textarea name ="pub "> </ textarea >
67
+ the VAPID headers. These can be useful for languages that use DER or PEM for key import.</ p >
68
+ < label for ="priv "> DER Private Key:</ label > < textarea name ="priv "> </ textarea >
69
+ < label for ="pub "> DER Public Key:</ label > < textarea name ="pub "> </ textarea >
67
70
</ div >
68
71
< div id ="err " class ="hidden section "> </ div >
69
72
</ div >
@@ -212,12 +215,16 @@ <h2>Exported Keys</h2>
212
215
. catch ( er => error ( er , "Public key export failed" ) ) ;
213
216
vapid . sign ( claims )
214
217
. then ( k => {
215
- let auth = document . getElementsByName ( "auth" ) [ 0 ]
218
+ let auth = document . getElementsByName ( "auth" ) [ 0 ] ;
216
219
auth . value = k . authorization ;
217
220
auth . classList . add ( 'updated' ) ;
218
- let crypt = document . getElementsByName ( "crypt" ) [ 0 ]
221
+ let crypt = document . getElementsByName ( "crypt" ) [ 0 ] ;
219
222
crypt . value = k [ "crypto-key" ] ;
220
223
crypt . classList . add ( 'updated' ) ;
224
+ let pk = document . getElementsByName ( "publicKey" ) [ 0 ] ;
225
+ // Public Key is the crypto key minus the 'p256ecdsa='
226
+ pk . value = k . publicKey ;
227
+ pk . classList . add ( 'updated' ) ;
221
228
} )
222
229
. catch ( err => error ( err , err_strs . enus . CLAIMS_FAIL ) ) ;
223
230
} ) ;
0 commit comments