No description, website, or topics provided.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
app
js
project
.gitignore
.travis.yml
LICENSE
README.md
build.sbt
index.html
karma.conf.js
package.json
run-browser-tests.sh
sonatype.sbt
test.html

README.md

Scala.js Build Status #Cryptotpyrc

This ScalaJS cross compiled RSA / Crypto library.

Supported

  1. RSA Key generation / import / export
  2. RSA Signing and Verifying

Usage

Add this to your build.sbt "pl.setblack" %%% "cryptotpyrc" % "0.4"

val rsa = new UniCrypto.rsa
val generatedKeyPair = rsa.generateKeys()
...
generatedKeyPair.flatMap(
           keyPairGeneration => {
             val publicKeyJwk:Future[String] = keyPairGeneration.get.pub.export

             val privKeyPKCS8:Future[String] = keyPairGeneration.get.priv.export
             ...
           }
       )
...
val signature:Future[String] = rsa.sign(privKey, "mymessage" )
..
val verified:Future[Boolean] = rsa.verify(publKey, singature, "mymessage")

Features

  1. Uses Strings in API - makes it easy - not fast
  2. Uses JVM (java.security) and browser (SubtleCrypto) native libraries (may not work on NodeJS)
  3. Uses Future(s) in API (because of JavaScript) - crazy
  4. Same keys and signatures will work on both JVM and V8 ( You can sign on JVM and verify in browser or vice versa).
  5. It supports only RSA as for now

Testing

  1. sbt test runs only JVM part of tests
  2. Rhine/ Node just does not work (SubtleCrypto...)
  3. To test in browser run sbt appJS/test:fastOptJS and then open provided test.html. (There are still issues with scalatest async tests, though.)