(data)
| 800 | |
| 801 | // Parse wrapped JWK bytes according to WebCrypto's "parse a JWK" procedure. |
| 802 | function parseJwk(data) { |
| 803 | let key; |
| 804 | try { |
| 805 | // WebCrypto parses JWKs in a fresh global. Detach parsed JSON values |
| 806 | // from user-mutated prototypes before WebIDL dictionary conversion. |
| 807 | // Wrapped JWKs may be produced outside WebCrypto, so parse using the |
| 808 | // spec-required UTF-8. |
| 809 | const json = decodeUTF8(data, false, true); |
| 810 | const result = JSONParse(json); |
| 811 | detachFromUserPrototypes(result); |
| 812 | key = webidl.converters.JsonWebKey(result); |
| 813 | } catch (err) { |
| 814 | throw lazyDOMException( |
| 815 | 'Invalid wrapped JWK key', |
| 816 | { name: 'DataError', cause: err }); |
| 817 | } |
| 818 | |
| 819 | if (key.kty === undefined) { |
| 820 | throw lazyDOMException( |
| 821 | 'Invalid wrapped JWK key', |
| 822 | 'DataError'); |
| 823 | } |
| 824 | |
| 825 | return key; |
| 826 | } |
| 827 | |
| 828 | function aliasKeyFormat(format, alias) { |
| 829 | return format === alias ? 'raw' : format; |
no test coverage detected
searching dependent graphs…