Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
mrfelton committed Jan 11, 2019
0 parents commit 040bf63
Show file tree
Hide file tree
Showing 15 changed files with 6,992 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"env": {
"development": {
"sourceMaps": "inline",
"plugins": ["source-map-support"]
}
},
"presets": [
["env", {
"targets": {
"node": "6.0"
}
}]
],
"plugins": ["add-module-exports"]
}
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Editor configuration, see http://editorconfig.org
root = true

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

[*.md]
max_line_length = off
trim_trailing_whitespace = false
5 changes: 5 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package.json
package-lock.json
.git
node_modules
coverage
11 changes: 11 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"extends": ["prettier"],
"parserOptions": {
"ecmaVersion": 2017,
"sourceType": "module"
},
"env": {
"es6": true,
"node": true
}
}
73 changes: 73 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# next.js build output
.next

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless

# Vendor binaries
/vendor

# Transpiled code
/dist
7 changes: 7 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package.json
package-lock.json
.git
.eslintrc
.babelrc
node_modules
coverage
15 changes: 15 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"bracketSpacing": true,
"printWidth": 120,
"semi": false,
"singleQuote": true,
"trailingComma": "all",
"overrides": [
{
"files": [".prettierrc"],
"options": {
"parser": "json"
}
}
]
}
7 changes: 7 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
language: node_js
node_js:
- node
- lts/*
os:
- linux
- osx
88 changes: 88 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# lndconnect

[![](https://img.shields.io/badge/project-LND-blue.svg?style=flat-square)](https://github.com/lightningnetwork/lnd)
[![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme)
[![Dependency Status](https://david-dm.org/LN-Zap/lndconnect.svg?style=flat-square)](https://david-dm.org/LN-Zap/lndconnect)
[![Build Status](https://travis-ci.org/LN-Zap/lndconnect.svg?branch=master)](https://travis-ci.org/LN-Zap/lndconnect)

> Generate and parse lndconnect uris https://github.com/LN-Zap/lndconnect ⚡️
This package provides utilities for generating and parsing lndconnect uris.

For more information take a look at the [specification of the uri format](https://github.com/LN-Zap/lndconnect/blob/master/lnd_connect_uri.md).

## Table of Contents

- [Install](#install)
- [Usage](#usage)
- [Maintainers](#maintainers)
- [Contribute](#contribute)
- [License](#license)

## Install

```
npm install lndconnect --save
```

## Usage

**encodeCert(certPath<string>):**

```javascript
const certPath = path.join(__dirname, 'tls.cert')
const cert = await encodeCert(certPath)
expect(cert).toEqual('MIICuDCCAl...')
```

**encodeMacaroon(macaroonPath<string>):**

```javascript
const macaroonPath = path.join(__dirname, 'admin.macaroon')
const macaroon = await encodeMacaroon(macaroonPath)
expect(macaroon).toEqual('macaroon=AgEDbG5kAr...')
```

**encode({ host<string>, cert<string>, macaroon<string> }):**

```javascript
const connectionString = encode({
host: '1.2.3.4:10009',
cert: 'MIICuDCCAl...',
macaroon: 'AgEDbG5kAr...',
})

expect(connectionString).toEqual('lndconnect://1.2.3.4:10009?cert=MIICuDCCAl...&macaroon=AgEDbG5kAr...')
```

**decode({ host<string>, cert<string>, macaroon<string> }):**

```javascript
const { host, cert, macaroon } decode('lndconnect://1.2.3.4:10009?cert=MIICuDCCAl...&macaroon=AgEDbG5kAr...')

expect(host).toEqual('1.2.3.4:10009')
expect(cert).toEqual('cert=MIICuDCCAl...')
expect(macaroon).toEqual('macaroon=AgEDbG5kAr...')
```

### Testing

Run the tests suite:

```bash
npm test
```

## Maintainers

[@Tom Kirkpatrick (mrfelton)](https://github.com/mrfelton).

## Contribute

Feel free to dive in! [Open an issue](https://github.com/LN-Zap/lndconnect/issues/new) or submit PRs.

lndconnect follows the [Contributor Covenant](http://contributor-covenant.org/version/1/3/0/) Code of Conduct.

## License

[MIT](LICENSE) © Tom Kirkpatrick
Loading

0 comments on commit 040bf63

Please sign in to comment.