Skip to content

Commit

Permalink
Update readme and index for new error and API
Browse files Browse the repository at this point in the history
  • Loading branch information
arekinath committed Apr 22, 2016
1 parent 72e5144 commit 6374f3e
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 9 deletions.
33 changes: 26 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ Usage

## Public keys

### `parseKey(data[, format = 'auto'[, name]])`
### `parseKey(data[, format = 'auto'[, options]])`

Parses a key from a given data format and returns a new `Key` object.

Expand All @@ -126,8 +126,12 @@ Parameters
- `rfc4253`: raw OpenSSH wire format
- `openssh`: new post-OpenSSH 6.5 internal format, produced by
`ssh-keygen -o`
- `name` -- Optional name for the key being parsed (eg. the filename that
was opened). Used to generate Error messages
- `options` -- Optional Object, extra options, with keys:
- `filename` -- Optional String, name for the key being parsed
(eg. the filename that was opened). Used to generate
Error messages
- `passphrase` -- Optional String, encryption passphrase used to decrypt an
encrypted PEM file

### `Key.isKey(obj)`

Expand Down Expand Up @@ -212,7 +216,7 @@ to call this function on other keys will yield an `Error`.

## Private keys

### `parsePrivateKey(data[, format = 'auto'[, name]])`
### `parsePrivateKey(data[, format = 'auto'[, options]])`

Parses a private key from a given data format and returns a new
`PrivateKey` object.
Expand All @@ -227,8 +231,12 @@ Parameters
`ssh-keygen -o`
- `pkcs1`, `pkcs8`: variants of `pem`
- `rfc4253`: raw OpenSSH wire format
- `name` -- Optional name for the key being parsed (eg. the filename that
was opened). Used to generate Error messages
- `options` -- Optional Object, extra options, with keys:
- `filename` -- Optional String, name for the key being parsed
(eg. the filename that was opened). Used to generate
Error messages
- `passphrase` -- Optional String, encryption passphrase used to decrypt an
encrypted PEM file

### `PrivateKey.isPrivateKey(obj)`

Expand Down Expand Up @@ -425,10 +433,21 @@ The key data given could not be parsed as a valid key.

Properties

- `keyName` -- `name` that was given to `Key#parse`
- `keyName` -- `filename` that was given to `Key#parse`
- `format` -- the `format` that was trying to parse the key
- `innerErr` -- the inner Error thrown by the format parser

### `KeyEncryptedError`

The key is encrypted with a symmetric key (ie, it is password protected). The
parsing operation would succeed if it was given the `passphrase` option.

Properties

- `keyName` -- `filename` that was given to `Key#parse`
- `format` -- the `format` that was trying to parse the key (currently can only
be `"pem"`)

Friends of sshpk
----------------

Expand Down
3 changes: 2 additions & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@ module.exports = {
FingerprintFormatError: errs.FingerprintFormatError,
InvalidAlgorithmError: errs.InvalidAlgorithmError,
KeyParseError: errs.KeyParseError,
SignatureParseError: errs.SignatureParseError
SignatureParseError: errs.SignatureParseError,
KeyEncryptedError: errs.KeyEncryptedError
};
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sshpk",
"version": "1.8.0",
"version": "1.8.1",
"description": "A library for finding and using SSH public keys",
"main": "lib/index.js",
"scripts": {
Expand Down

0 comments on commit 6374f3e

Please sign in to comment.