| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent bb051c5 commit 8ed4587
7 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -5,7 +5,6 @@ const { | |||
| 5 | 5 | ArrayBufferPrototypeSlice, | |
| 6 | 6 | ArrayFrom, | |
| 7 | 7 | ArrayPrototypePush, | |
| 8 | - PromiseReject, | ||
| 9 | 8 | SafeSet, | |
| 10 | 9 | TypedArrayPrototypeSlice, | |
| 11 | 10 | } = primordials; | |
@@ -144,7 +143,7 @@ function asyncAesKwCipher(mode, key, data) { | |||
| 144 | 143 | getVariant('AES-KW', key[kAlgorithm].length))); | |
| 145 | 144 | } | |
| 146 | 145 | ||
| 147 | - function asyncAesGcmCipher(mode, key, data, algorithm) { | ||
| 146 | + async function asyncAesGcmCipher(mode, key, data, algorithm) { | ||
| 148 | 147 | const { tagLength = 128 } = algorithm; | |
| 149 | 148 | ||
| 150 | 149 | const tagByteLength = tagLength / 8; | |
@@ -160,9 +159,9 @@ function asyncAesGcmCipher(mode, key, data, algorithm) { | |||
| 160 | 159 | // > If *plaintext* has a length less than *tagLength* bits, then `throw` | |
| 161 | 160 | // > an `OperationError`. | |
| 162 | 161 | if (tagByteLength > tag.byteLength) { | |
| 163 | - return PromiseReject(lazyDOMException( | ||
| 162 | + throw lazyDOMException( | ||
| 164 | 163 | 'The provided data is too small.', | |
| 165 | - 'OperationError')); | ||
| 164 | + 'OperationError'); | ||
| 166 | 165 | } | |
| 167 | 166 | ||
| 168 | 167 | data = slice(data, 0, -tagByteLength); | |
@@ -184,7 +183,7 @@ function asyncAesGcmCipher(mode, key, data, algorithm) { | |||
| 184 | 183 | algorithm.additionalData)); | |
| 185 | 184 | } | |
| 186 | 185 | ||
| 187 | - function asyncAesOcbCipher(mode, key, data, algorithm) { | ||
| 186 | + async function asyncAesOcbCipher(mode, key, data, algorithm) { | ||
| 188 | 187 | const { tagLength = 128 } = algorithm; | |
| 189 | 188 | ||
| 190 | 189 | const tagByteLength = tagLength / 8; | |
@@ -197,9 +196,9 @@ function asyncAesOcbCipher(mode, key, data, algorithm) { | |||
| 197 | 196 | ||
| 198 | 197 | // Similar to GCM, OCB requires the tag to be present for decryption | |
| 199 | 198 | if (tagByteLength > tag.byteLength) { | |
| 200 | - return PromiseReject(lazyDOMException( | ||
| 199 | + throw lazyDOMException( | ||
| 201 | 200 | 'The provided data is too small.', | |
| 202 | - 'OperationError')); | ||
| 201 | + 'OperationError'); | ||
| 203 | 202 | } | |
| 204 | 203 | ||
| 205 | 204 | data = slice(data, 0, -tagByteLength); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -343,7 +343,7 @@ function cfrgImportKey( | |||
| 343 | 343 | extractable); | |
| 344 | 344 | } | |
| 345 | 345 | ||
| 346 | - function eddsaSignVerify(key, data, algorithm, signature) { | ||
| 346 | + async function eddsaSignVerify(key, data, algorithm, signature) { | ||
| 347 | 347 | const mode = signature === undefined ? kSignJobModeSign : kSignJobModeVerify; | |
| 348 | 348 | const type = mode === kSignJobModeSign ? 'private' : 'public'; | |
| 349 | 349 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4,7 +4,6 @@ const { | |||
| 4 | 4 | ArrayBufferIsView, | |
| 5 | 5 | ArrayBufferPrototypeSlice, | |
| 6 | 6 | ArrayFrom, | |
| 7 | - PromiseReject, | ||
| 8 | 7 | SafeSet, | |
| 9 | 8 | TypedArrayPrototypeSlice, | |
| 10 | 9 | } = primordials; | |
@@ -47,17 +46,17 @@ function validateKeyLength(length) { | |||
| 47 | 46 | throw lazyDOMException('Invalid key length', 'DataError'); | |
| 48 | 47 | } | |
| 49 | 48 | ||
| 50 | - function c20pCipher(mode, key, data, algorithm) { | ||
| 49 | + async function c20pCipher(mode, key, data, algorithm) { | ||
| 51 | 50 | let tag; | |
| 52 | 51 | switch (mode) { | |
| 53 | 52 | case kWebCryptoCipherDecrypt: { | |
| 54 | 53 | const slice = ArrayBufferIsView(data) ? | |
| 55 | 54 | TypedArrayPrototypeSlice : ArrayBufferPrototypeSlice; | |
| 56 | 55 | ||
| 57 | 56 | if (data.byteLength < 16) { | |
| 58 | - return PromiseReject(lazyDOMException( | ||
| 57 | + throw lazyDOMException( | ||
| 59 | 58 | 'The provided data is too small.', | |
| 60 | - 'OperationError')); | ||
| 59 | + 'OperationError'); | ||
| 61 | 60 | } | |
| 62 | 61 | ||
| 63 | 62 | tag = slice(data, -16); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -284,7 +284,7 @@ function ecImportKey( | |||
| 284 | 284 | extractable); | |
| 285 | 285 | } | |
| 286 | 286 | ||
| 287 | - function ecdsaSignVerify(key, data, { name, hash }, signature) { | ||
| 287 | + async function ecdsaSignVerify(key, data, { name, hash }, signature) { | ||
| 288 | 288 | const mode = signature === undefined ? kSignJobModeSign : kSignJobModeVerify; | |
| 289 | 289 | const type = mode === kSignJobModeSign ? 'private' : 'public'; | |
| 290 | 290 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -287,7 +287,7 @@ function mlDsaImportKey( | |||
| 287 | 287 | extractable); | |
| 288 | 288 | } | |
| 289 | 289 | ||
| 290 | - function mlDsaSignVerify(key, data, algorithm, signature) { | ||
| 290 | + async function mlDsaSignVerify(key, data, algorithm, signature) { | ||
| 291 | 291 | const mode = signature === undefined ? kSignJobModeSign : kSignJobModeVerify; | |
| 292 | 292 | const type = mode === kSignJobModeSign ? 'private' : 'public'; | |
| 293 | 293 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -93,7 +93,7 @@ function validateRsaOaepAlgorithm(algorithm) { | |||
| 93 | 93 | } | |
| 94 | 94 | } | |
| 95 | 95 | ||
| 96 | - function rsaOaepCipher(mode, key, data, algorithm) { | ||
| 96 | + async function rsaOaepCipher(mode, key, data, algorithm) { | ||
| 97 | 97 | validateRsaOaepAlgorithm(algorithm); | |
| 98 | 98 | ||
| 99 | 99 | const type = mode === kWebCryptoCipherEncrypt ? 'public' : 'private'; | |
@@ -330,7 +330,7 @@ function rsaImportKey( | |||
| 330 | 330 | }, keyUsages, extractable); | |
| 331 | 331 | } | |
| 332 | 332 | ||
| 333 | - function rsaSignVerify(key, data, { saltLength }, signature) { | ||
| 333 | + async function rsaSignVerify(key, data, { saltLength }, signature) { | ||
| 334 | 334 | const mode = signature === undefined ? kSignJobModeSign : kSignJobModeVerify; | |
| 335 | 335 | const type = mode === kSignJobModeSign ? 'private' : 'public'; | |
| 336 | 336 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1022,7 +1022,7 @@ async function unwrapKey( | |||
| 1022 | 1022 | ); | |
| 1023 | 1023 | } | |
| 1024 | 1024 | ||
| 1025 | - function signVerify(algorithm, key, data, signature) { | ||
| 1025 | + async function signVerify(algorithm, key, data, signature) { | ||
| 1026 | 1026 | let usage = 'sign'; | |
| 1027 | 1027 | if (signature !== undefined) { | |
| 1028 | 1028 | usage = 'verify'; | |
| Back | FazBrowse Home | New Git URL |
0 commit comments