Skip to content
This repository was archived by the owner on Jul 30, 2024. It is now read-only.

Commit 9e9b996

Browse files
committed
Fix
1 parent 64a65d9 commit 9e9b996

File tree

2 files changed

+2
-17
lines changed

2 files changed

+2
-17
lines changed

app/nodejs-v12/src/test/scala/io/scalajs/nodejs/crypto/CryptoTest.scala

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -36,23 +36,6 @@ class CryptoTest extends AnyFunSpec with Matchers {
3636

3737
computedHash mustEqual expectedHash
3838
}
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-
}
5639
}
5740

5841
describe("Crypto module") {

app/nodejs-v16/src/main/scala/io/scalajs/nodejs/crypto/KeyObject.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@ import io.scalajs.nodejs.buffer.Buffer
44
import net.exoego.scalajs.types.util.Factory
55

66
import scala.scalajs.js
7+
import scala.scalajs.js.annotation.JSImport
78
import scala.scalajs.js.typedarray.{DataView, TypedArray}
89
import scala.scalajs.js.|
910

1011
@js.native
12+
@JSImport("crypto", "KeyObject")
1113
class KeyObject (`type_`: String, handle: js.Object) extends js.Object {
1214
def `export`(options: KeyObjectExportOptions): Buffer | String = js.native
1315
def `export`(): Buffer = js.native

0 commit comments

Comments
 (0)