* Creates an instance of Crypto. * @param {!Window} win
(win)
| 21 | * @param {!Window} win |
| 22 | */ |
| 23 | constructor(win) { |
| 24 | /** @private {!Window} */ |
| 25 | this.win_ = win; |
| 26 | |
| 27 | let subtle = null; |
| 28 | let isLegacyWebkit = false; |
| 29 | if (win.crypto) { |
| 30 | if (win.crypto.subtle) { |
| 31 | subtle = win.crypto.subtle; |
| 32 | } else if (win.crypto.webkitSubtle) { |
| 33 | subtle = win.crypto.webkitSubtle; |
| 34 | isLegacyWebkit = true; |
| 35 | } |
| 36 | } |
| 37 | |
| 38 | /** @const {{name: string}} */ |
| 39 | this.pkcsAlgo = { |
| 40 | name: 'RSASSA-PKCS1-v1_5', |
| 41 | hash: {name: 'SHA-256'}, |
| 42 | }; |
| 43 | |
| 44 | /** @const {?webCrypto.SubtleCrypto} */ |
| 45 | this.subtle = subtle; |
| 46 | |
| 47 | /** @private @const {boolean} */ |
| 48 | this.isLegacyWebkit_ = isLegacyWebkit; |
| 49 | |
| 50 | /** @private {?Promise<!CryptoPolyfillDef>} */ |
| 51 | this.polyfillPromise_ = null; |
| 52 | } |
| 53 | |
| 54 | /** |
| 55 | * Returns the SHA-384 hash of the input string in a number array. |
nothing calls this directly
no outgoing calls
no test coverage detected