Skip to content

Commit c336ebe

Browse files
committed
upd importKey api
1 parent dabbb75 commit c336ebe

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

js/vapid.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,15 @@ class VapidCore {
135135
};
136136

137137
return webCrypto.importKey('jwk', jwk, 'ECDSA', true, ["verify"])
138+
.catch(err => {
139+
if (err instanceof TypeError && /namedCurve/.test(err.stack))
140+
return webCrypto.importKey('jwk', jwk, {
141+
name: "ECDSA",
142+
namedCurve: "P-256"
143+
}, true, ["verify"])
144+
.then(k => this._public_key = k)
145+
throw err
146+
})
138147
.then(k => this._public_key = k)
139148
}
140149

0 commit comments

Comments
 (0)