Skip to content

Commit 57916db

Browse files
authored
Doc: Add key hints and status badges to README (#126)
[ci skip]
1 parent 21c11d2 commit 57916db

File tree

1 file changed

+36
-4
lines changed

1 file changed

+36
-4
lines changed

README.md

+36-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# node-jose #
22

33
[![Greenkeeper badge](https://badges.greenkeeper.io/cisco/node-jose.svg)](https://greenkeeper.io/)
4+
[![Build Status](https://travis-ci.org/cisco/node-jose.svg?branch=master)](https://travis-ci.org/cisco/node-jose)
45

56
A JavaScript implementation of the JSON Object Signing and Encryption (JOSE) for current web browsers and node.js-based servers. This library implements (wherever possible) all algorithms, formats, and options in [JWS](https://tools.ietf.org/html/rfc7515 "Jones, M., J. Bradley and N. Sakimura, 'JSON Web Signature (JWS)' RFC 7515, May 2015"), [JWE](https://tools.ietf.org/html/rfc7516 "Jones, M. and J. Hildebrand 'JSON Web Encryption (JWE)', RFC 7516, May 2015"), [JWK](https://tools.ietf.org/html/rfc7517 "Jones, M., 'JSON Web Key (JWK)', RFC 7517, May 2015"), and [JWA](https://tools.ietf.org/html/rfc7518 "Jones, M., 'JSON Web Algorithms (JWA)', RFC 7518, May 2015") and uses native cryptographic support ([WebCrypto API](http://www.w3.org/TR/WebCryptoAPI/) or node.js' "[crypto](https://nodejs.org/api/crypto.html)" module) where feasible.
67

@@ -19,11 +20,15 @@ A JavaScript implementation of the JSON Object Signing and Encryption (JOSE) for
1920
- [Importing and Exporting a Single Key](#importing-and-exporting-a-single-key)
2021
- [Obtaining a Key's Thumbprint](#obtaining-a-keys-thumbprint)
2122
- [Signatures](#signatures)
23+
- [Keys Used for Signing and Verifying](#keys-used-for-signing-and-verifying)
2224
- [Signing Content](#signing-content)
2325
- [Verifying a JWS](#verifying-a-jws)
26+
- [Handling `crit` Header Members](#handling-crit-header-members)
2427
- [Encryption](#encryption)
28+
- [Keys Used for Encrypting and Decrypting](#keys-used-for-encrypting-and-decrypting)
2529
- [Encrypting Content](#encrypting-content)
2630
- [Decrypting a JWE](#decrypting-a-jwe)
31+
- [Handling `crit` Header Members](#handling-crit-header-members-1)
2732
- [Useful Utilities](#useful-utilities)
2833
- [Converting to Buffer](#converting-to-buffer)
2934
- [URI-Safe Base64](#uri-safe-base64)
@@ -48,7 +53,7 @@ Or to install a specific release:
4853
Alternatively, the latest unpublished code can be installed directly from the repository:
4954

5055
```
51-
npm install git+ssh://git@github.com:cisco/node-jose.git
56+
npm install git+https://github.com/cisco/node-jose.git
5257
```
5358

5459
## Basics ##
@@ -293,6 +298,19 @@ When importing or generating a key that does not have a "kid" defined, a
293298

294299
## Signatures ##
295300

301+
### Keys Used for Signing and Verifying ###
302+
303+
When signing content, the key is expected to meet one of the following:
304+
305+
1. A secret key (e.g, `"kty":"oct"`)
306+
2. The **private** key from a PKI (`"kty":"EC"` or `"kty":"RSA"`) key pair
307+
308+
When verifying content, the key is expected to meet one of the following:
309+
310+
1. A secret key (e.g, `"kty":"oct"`)
311+
2. The **public** key from a PKI (`"kty":"EC"` or `"kty":"RSA"`) key pair
312+
313+
296314
### Signing Content ###
297315

298316
At its simplest, to create a JWS:
@@ -418,7 +436,7 @@ The key can be embedded using either 'jwk' or 'x5c', and can be located in eithe
418436

419437
To accept 'crit' field members, add the `handlers` member to the options Object. The `handlers` member is itself an Object, where its member names are the `crit` header member, and the value is one of:
420438

421-
* `Boolean`: accepts (if `true`) -- or rejects (if `false`) -- the JWS if the member is present.
439+
* `Boolean`: accepts (if `true`) -- or rejects (if `false`) -- the JWS if the member is present.
422440
* `Function`: takes the JWE decrypt output (just prior to decrypting) and returns a Promise for the processing of the member.
423441
* `Object`: An object with the following `Function` members:
424442
* "prepare" -- takes the JWE decrypt output (just prior to decrypting) and returns a Promise for the processing of the member.
@@ -482,6 +500,20 @@ jose.JWS.createVerify(key, opts).
482500

483501
## Encryption ##
484502

503+
504+
### Keys Used for Encrypting and Decrypting ###
505+
506+
When encrypting content, the key is expected to meet one of the following:
507+
508+
1. A secret key (e.g, `"kty":"oct"`)
509+
2. The **public** key from a PKI (`"kty":"EC"` or `"kty":"RSA"`) key pair
510+
511+
When decrypting content, the key is expected to meet one of the following:
512+
513+
1. A secret key (e.g, `"kty":"oct"`)
514+
2. The **private** key from a PKI (`"kty":"EC"` or `"kty":"RSA"`) key pair
515+
516+
485517
### Encrypting Content ###
486518

487519
At its simplest, to create a JWE:
@@ -564,7 +596,7 @@ jose.JWE.createDecrypt(keystore).
564596
then(function(result) {
565597
// {result} is a Object with:
566598
// * header: the combined 'protected' and 'unprotected' header members
567-
// * protected: an array of the member names from the "protected" member
599+
// * protected: an array of the member names from the "protected" member
568600
// * key: Key used to decrypt
569601
// * payload: Buffer of the decrypted content
570602
// * plaintext: Buffer of the decrypted content (alternate)
@@ -585,7 +617,7 @@ jose.JWE.createDecrypt(key).
585617

586618
To accept 'crit' field members, add the `handlers` member to the options Object. The `handlers` member is itself an Object, where its member names are the `crit` header member, and the value is one of:
587619

588-
* `Boolean`: accepts (if `true`) -- or rejects (if `false`) -- the JWE if the member is present.
620+
* `Boolean`: accepts (if `true`) -- or rejects (if `false`) -- the JWE if the member is present.
589621
* `Function`: takes the JWE decrypt output (just prior to decrypting) and returns a Promise for the processing of the member.
590622
* `Object`: An object with the following `Function` members:
591623
* "prepare" -- takes the JWE decrypt output (just prior to decrypting) and returns a Promise for the processing of the member.

0 commit comments

Comments
 (0)