@@ -37,19 +37,16 @@ <h1>VAPID verification</h1>
37
37
< div class ="description "> This is the content of the
38
38
< code > Authorization</ code > header included as part of the subscription
39
39
POST update.</ div >
40
- < textarea name ="auth " placeholder ="Bearer abCDef... "> </ textarea >
40
+ < textarea name ="auth " id ="auth " placeholder ="WebPush abCDef... "> </ textarea >
41
+ < div class ="v1 ">
41
42
< label for ="crypt "> Crypto-Key Header:</ label >
42
43
< div class ="description "> This is included
43
44
as part of the < code > Crypto-Key</ code > header, which is included
44
45
as part of the subscription POST update. < code > Crypto-Key</ code >
45
46
may contain more than one part. Each part should be separated by a
46
47
comma (",") (NOTE: For Draft-02, this header is not required)</ div >
47
48
< textarea name ="crypt " placeholder ="p256ecdsa=abCDef.. "> </ textarea >
48
- < div class ="control ">
49
- < label for ="publicKey "> Public Key:</ label >
50
- < div class ="description "> This is the VAPID key you would use when adding
51
- applications to your Dashboard.</ div >
52
- < div name ="publicKey " class ="value " > </ div >
49
+ </ div >
53
50
< button id ="check "> Check headers</ button >
54
51
</ div >
55
52
</ div >
@@ -82,14 +79,7 @@ <h1>VAPID verification</h1>
82
79
< button id ="gen "> Generate VAPID</ button >
83
80
</ div >
84
81
< h3 > Claims JSON object:</ h3 >
85
- < pre class ="brush: js line-numbers lanuage-js ">
86
- < code id ="raw_claims " > None</ code >
87
- </ pre >
88
- < div id ="ignored " class ="hidden ">
89
- < div class ="title "> The following were ignored.
90
- < div class ="items "> </ div >
91
- </ div >
92
- </ div >
82
+ < pre class ="brush: js line-numbers lanuage-js "> < code id ="raw_claims " > None</ code > </ pre >
93
83
</ div >
94
84
< div id ="keys " class ="section ">
95
85
< a name ="export "> < h2 > Exported Keys</ h2 > </ a >
@@ -127,6 +117,26 @@ <h3>Claims JSON object:</h3>
127
117
return new VapidToken02 ( ) ;
128
118
}
129
119
120
+ function vers_click ( e ) {
121
+ if ( document . getElementById ( 'version' ) . getElementsByTagName ( 'input' ) [ 0 ] . checked ) {
122
+ document . getElementById ( 'auth' ) . placeholder = "WebPush abCDef..." ;
123
+ for ( item of document . getElementsByClassName ( 'v2' ) ) {
124
+ item . classList . add ( 'hidden' )
125
+ }
126
+ for ( item of document . getElementsByClassName ( 'v1' ) ) {
127
+ item . classList . remove ( 'hidden' )
128
+ }
129
+ } else {
130
+ document . getElementById ( 'auth' ) . placeholder = "vapid t=abCDef..., k=aBcD..." ;
131
+ for ( item of document . getElementsByClassName ( 'v1' ) ) {
132
+ item . classList . add ( 'hidden' )
133
+ }
134
+ for ( item of document . getElementsByClassName ( 'v2' ) ) {
135
+ item . classList . remove ( 'hidden' )
136
+ }
137
+ }
138
+ }
139
+
130
140
function error ( ex = null , msg = null , clear = false ) {
131
141
let er = document . getElementById ( "err" ) ;
132
142
if ( clear ) {
@@ -142,6 +152,7 @@ <h3>Claims JSON object:</h3>
142
152
}
143
153
144
154
function success ( claims ) {
155
+ document . getElementById ( 'raw_claims' ) . innerHTML = JSON . stringify ( claims , null , 2 ) ;
145
156
for ( let n of [ "sub" , "exp" ] ) {
146
157
let item = document . getElementsByName ( n ) [ 0 ] ;
147
158
item . value = claims [ n ] ;
@@ -151,13 +162,6 @@ <h3>Claims JSON object:</h3>
151
162
let err = document . getElementById ( "err" ) ;
152
163
err . innerHTML = "" ;
153
164
err . classList . add ( "hidden" ) ;
154
- let extra = JSON . stringify ( claims , " " ) ;
155
- if ( extra . length > 2 ) {
156
- let ignored = document . getElementsById ( "ignored" ) ;
157
- ignored . getElementsByClassName ( "items" )
158
- . innerHTML = extra ;
159
- ignored . classList . remove ( "hidden" ) ;
160
- }
161
165
}
162
166
163
167
@@ -304,6 +308,8 @@ <h3>Claims JSON object:</h3>
304
308
}
305
309
}
306
310
311
+
312
+ document . getElementById ( "version" ) . addEventListener ( "click" , vers_click ) ;
307
313
document . getElementById ( "check" ) . addEventListener ( "click" , check ) ;
308
314
document . getElementById ( "gen" ) . addEventListener ( "click" , gen ) ;
309
315
document . getElementById ( 'vapid_exp' ) . value = parseInt ( Date . now ( ) * .001 ) + 86400 ;
0 commit comments