This repository was archived by the owner on Jul 30, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +2
-17
lines changed
nodejs-v12/src/test/scala/io/scalajs/nodejs/crypto
nodejs-v16/src/main/scala/io/scalajs/nodejs/crypto Expand file tree Collapse file tree 2 files changed +2
-17
lines changed Original file line number Diff line number Diff line change @@ -36,23 +36,6 @@ class CryptoTest extends AnyFunSpec with Matchers {
36
36
37
37
computedHash mustEqual expectedHash
38
38
}
39
-
40
- it(" should be able to encrypt and decrypt text from a private key (AES-256-ctr)" ) {
41
- val alg = " aes-256-ctr"
42
- val key = " this-is-a-private-key"
43
- val stringToEncrypt = " text-to-encrypt"
44
-
45
- val cipher = Crypto .createCipher(alg, key)
46
- val encrypted = cipher.update(stringToEncrypt, " utf8" , " base64" )
47
- val finalEncryptedValue = encrypted + cipher.`final`(" base64" )
48
-
49
- val decipher = Crypto .createDecipher(alg, key)
50
- val decrypted = decipher.update(finalEncryptedValue, " base64" , " utf8" )
51
- val finalDecryptedValue = decrypted + decipher.`final`(" utf8" )
52
-
53
- finalEncryptedValue mustNot equal(stringToEncrypt)
54
- finalDecryptedValue must equal(stringToEncrypt)
55
- }
56
39
}
57
40
58
41
describe(" Crypto module" ) {
Original file line number Diff line number Diff line change @@ -4,10 +4,12 @@ import io.scalajs.nodejs.buffer.Buffer
4
4
import net .exoego .scalajs .types .util .Factory
5
5
6
6
import scala .scalajs .js
7
+ import scala .scalajs .js .annotation .JSImport
7
8
import scala .scalajs .js .typedarray .{DataView , TypedArray }
8
9
import scala .scalajs .js .|
9
10
10
11
@ js.native
12
+ @ JSImport (" crypto" , " KeyObject" )
11
13
class KeyObject (`type_` : String , handle : js.Object ) extends js.Object {
12
14
def `export` (options : KeyObjectExportOptions ): Buffer | String = js.native
13
15
def `export` (): Buffer = js.native
You can’t perform that action at this time.
0 commit comments