Skip to content

Instantly share code, notes, and snippets.

@eerohele
Last active January 11, 2019 07:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eerohele/d48aa512a17833966a991eade321b18f to your computer and use it in GitHub Desktop.
Save eerohele/d48aa512a17833966a991eade321b18f to your computer and use it in GitHub Desktop.
shadow-cljs & mkcert

Using mkcert to generate a trusted certificate for ClojureScript development with shadow-cljs

NOTE: These instructions are a work in progress. Don't trust them yet.

Prerequisites

  1. Create a certificate authority and install it into the system, browser, and Java trust stores.

    # For mkcert to install the certificate into the Java trust store, $JAVA_HOME must be set.
    #
    # If you use jenv, running mkcert -install with jenv exec ensures that it is.
    #
    # If you don't use jenv, you have to make sure $JAVA_HOME points to your Java installation directory
    # and run `mkcert -install` instead.
    $ jenv exec mkcert -install
  2. Generate a certificate for localhost using the certificate authority mkcert created.

    $ mkcert localhost
  3. Convert the certificate into the PKCS #12 format.

    $ openssl pkcs12 -export -inkey localhost-key.pem -in localhost.pem -name localhost -out $TMPDIR/localhost.p12 -password pass:shadow-cljs
  4. Import the PKCS #12 certificate into a Java KeyStore.

    $ mkdir -p ssl
    $ keytool -importkeystore -srckeystore $TMPDIR/localhost.p12 -srcstoretype pkcs12 -destkeystore ssl/keystore.jks -storepass shadow-cljs -srcstorepass shadow-cljs
  5. Follow the instructions in the shadow-cljs manual to enable SSL for the shadow-cljs development server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment