Skip to content
This repository has been archived by the owner on Jan 7, 2023. It is now read-only.

Commit

Permalink
!feat: rebuild in deno
Browse files Browse the repository at this point in the history
  • Loading branch information
Marvin Heilemann committed Jun 17, 2020
1 parent 6251a8f commit 06b6a42
Show file tree
Hide file tree
Showing 28 changed files with 693 additions and 2,325 deletions.
16 changes: 16 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# EditorConfig is awesome: https://EditorConfig.org

root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 2

[Makefile]
indent_style = tab

[*.json]
insert_final_newline = false
17 changes: 0 additions & 17 deletions .eslintrc.json

This file was deleted.

4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
node_modules/
test/_out
certs
test
4 changes: 0 additions & 4 deletions .npmignore

This file was deleted.

8 changes: 0 additions & 8 deletions .prettierrc

This file was deleted.

4 changes: 4 additions & 0 deletions .prettierrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
trailingComma: none
singleQuote: true
printWidth: 100
semi: false
8 changes: 0 additions & 8 deletions .vscode/settings.json

This file was deleted.

99 changes: 0 additions & 99 deletions MAN

This file was deleted.

8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.PHONY: run test bundle

run:
deno run --allow-read --allow-write --allow-run cli.ts --debug --config fixtures/valid.toml

test:
deno test --allow-read --allow-write --allow-run \
config_test.ts
174 changes: 64 additions & 110 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,128 +1,82 @@
# OpenSSL Web Development
<h1 align="center">
<img width="340" src="https://upload.wikimedia.org/wikipedia/commons/a/a1/OpenSSL_logo.png" />
<br><br><p><b>WebSSL – OpenSSL for web and mobile development</b></p>
</h1>

[![npm](https://img.shields.io/npm/v/openssl-web-development.svg?style=for-the-badge)](https://www.npmjs.com/package/openssl-web-development)
Simply create [OpenSSL](https://de.wikipedia.org/wiki/OpenSSL) certificates for your local
web or mobile development that just work!

Simply create [OpenSSL][1] certificates for your local development that just
work!
## Installation

- [Install](#install)
- [How to use](#how-to-use)
- [Command Line](#command-line)
- [Programmatically](#programmatically)
- [Options](#options)
- [Example](#example)
> Requires [Deno](https://deno.land/)
## Install

- Globally: `npm install -g openssl-web-development`
- Locally: `npm install --save-dev openssl-web-development`

## How to use
```shell
deno install --allow-read --allow-write --allow-run --name webssl https://deno.land/x/webssl/cli.ts
```

> We recommend to create a new keychain `development` where you save all
> certificates that has something todo with projects you are currently
> developing.
| Flag | Explanation |
| --------------- | --------------------------------- |
| `--allow-read` | To read written certificate parts |
| `--allow-write` | To write certificate parts |
| `--allow-run` | To run the `openssl` command |

### Command Line
## Usage

```shell
Simply create OpenSSL certificates for your local development

Usage
$ webssl [flags] <out_dir>

Arguments
<out_dir> Where to save all files (default: /Current/Folder)*

Path can be absolute (starting with a slash) or relative. Relative path
will be resolved with the folder you are executing this script from.

Options
--filename, -f The name of the file which gets generated (default: ssl)
--addToKeychain, -a Add your generated key file to Keychain (default: false)
--removeOld, -r Remove your old key from Keychain (default: false)
--keychain, -k Select a keychain (default: login)
--config, -c Path to config file or false to disable (default: ./)
--dns DNS entries split by a comma. (default: null)

--commonName, -CN OpenSSL `commonName` subject entry*
--countryName, -C OpenSSL `countryName` subject entry*
--stateOrProvinceName, -ST OpenSSL `stateOrProvinceName` subject entry*
--localityName, -L OpenSSL `localityName` subject entry*
--organizationName, -O OpenSSL `organizationName` subject entry*
--organizationalUnit, -OU OpenSSL `organizationalUnit` subject entry
--emailAddress OpenSSL `emailAddress` subject entry

Examples
$ webssl \
--addToKeychain \
--keychain development \
--dns some.net,test.de \
--commonName Test \
/Users/Hi/Downloads

* this is required unless you do not have it in a config file
webssl [options] <destination>
webssl --filename dev_cert
```

> ⚠️ If you enable to add your certificate to macOS Keychain it will be
> automatically set to `allow all`.
> The default destination is `certs`. To override it just prepend a
> path (relative or absolute) to the command but make sure it is not following any option flag.
> **Tip:** use a readable name for `commonName` (e.g. _my-project_), so it will
> be easier to find in you macOS Keychain. The URL to your website will be
> handled via the `cdn` option.
### Options

### Programmatically
| Option | Description | Default |
| ------------ | ------------------------------- | ------------- |
| `--help` | prints this help message | / |
| `--debug` | print some debuggin information | / |
| `--config` | path to a custom config toml | `webssl.toml` |
| `--filename` | the generated files filename | dev |

See [cli.js](./cli.js)
### Config

```js
const WebSSL = require('openssl-web-development')
const options = {}
The configuration is written in toml. [Read more about toml](https://github.com/toml-lang/toml)

const webssl = new WebSSL(options)
webssl.generate()
```
Example `webssl.toml` file:

```toml
filename="dev"
destination="certs"

## Options

You can also save any parameters to an configuration file. We use cosmiconfig to
parse them but our search places differ a bit. Here is a list what we search
for:

- openssl.config.js
- openssl.ini
- .openssl
- .openssl.yaml
- webssl.config.js
- webssl.ini
- .webssl
- .webssl.yaml
- package.json

> If you going to use a configuration file, all CLI options will be ignored!
### Example

Here is an example `openssl.ini`:

```ini
filename=openssl
keychain=development
outDir=certs
sslDir=/etc/apache2/ssl

[dns]
openssl.lcl
open-ssl.lcl
openssl.net

[openssl]
commonName=openssl-website
countryName=DE
stateOrProvinceName=Hessen
localityName=Frankfurt am Main
organizationName=WebSSL
organizationalUnit=Development
domains = [
"example.dev",
"api.example.dev"
]

commonName = "com.github.webssl"
countryName = "DE"
stateOrProvinceName = "Germany"
localityName = "Frankfurt am Main"
organizationName = "WebSSL"
organizationalUnitName = "Development"
emailAddress = "[email protected]"
```

[1]: https://de.wikipedia.org/wiki/OpenSSL
## Tips

If you work on a Mac, I recommend you to create a new keychain called `development` where you save all certificates that are unsafe.

## Todo

- [ ] write more tests
- [ ] add to deno `x` third-party modules list
- [ ] create single executable
- [ ] curl shell script to add single executable to users bin
- [ ] make it available in:
- [ ] npm
- [ ] brew

---

#### This is not affiliated with OpenSSL. OpenSSL and the above logo is a registered trademark owned by OpenSSL Software Foundation.
Loading

0 comments on commit 06b6a42

Please sign in to comment.