Skip to content

Commit 497f582

Browse files
caitlin-tibbettsseebees
authored andcommitted
feat: example-node Readme.md update (#92)
Adding example-node Readme.md Cleaning up duplicate licensing language
1 parent 6050b9a commit 497f582

File tree

4 files changed

+25
-62
lines changed

4 files changed

+25
-62
lines changed

modules/example-node/Readme.md

+25-17
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,40 @@
11
# AWS Encryption SDK for Javascript Node.js examples
22

3-
This repository holds examples for encrypt and decrypt in Node.js.
4-
These examples are intended to work so you can experiment with functional code.
3+
This repository includes examples for encrypting and decrypting in Node.js. These are not for production use.
54

6-
# NOTE
7-
The CMK's in these examples *are only* for example. They *are public*.
8-
Replace these CMK's with your own.
5+
To run this example, you must have an AWS account with at least one AWS Key Management Service (AWS KMS) customer managed CMK.
6+
To encrypt, the CMK must have kms:GenerateDataKey permission.
7+
To decrypt, the CMK must have kms:Decrypt permission.
8+
The CMKs in these examples are only for *example*. *Replace these CMKs with your own*.
99

1010
## KMS Simple
1111

12-
This is the simples example.
13-
It encrypts and decrypts a simple string with KMS.
12+
This is an example of using the AWS Encryption SDK to encrypt and decrypt a simple string.
13+
For a more detailed explanation, see kms_simple.ts.
1414

1515
## KMS Stream
1616

17-
An example of encrypting a file stream with KMS.
17+
This is an example of using a KMS keyring to encrypt and decrypt a file stream.
18+
For a more detailed explanation, see kms_stream.ts.
1819

1920
## KMS Regional Discovery
2021

21-
KMS Keyrings can be put in `discovery` mode.
22-
This means that it will attempt to connect to any region.
23-
This is not always what you want.
24-
Perhapses for performance you want to limit attempts to a set of "close" regions.
25-
Perhapses for policy reason you want to exclude some regions.
22+
This is an example of using a KMS Regional Discovery Keyring that limits the AWS Encryption SDK to CMKs in a particular AWS Region(s).
23+
This is different from a KMS Discovery Keyring that doesn't specify any CMKs and will therefore use CMKs from any region available.
24+
For a more detailed explanation, see kms_regional_discovery.ts.
2625

2726
## RSA Simple
2827

29-
Sometimes you may want to use an RSA key to exchange secrets.
30-
This has some advantages, but comes with a heaved key management cost.
31-
If you can use KMS, the context guaranties are generally worth it.
32-
However, I still want to provide an example incase this fits your use case.
28+
This is an example of using a RSA key pair to encrypt and decrypt a simple string.
29+
This has some advantages for certain use cases, but we recommend that you use a keyring that protects your wrapping keys and performs cryptographic operations within a secure boundary. A KMS keyring uses AWS Key Management Service (AWS KMS) customer master keys (CMKs) that never leave AWS KMS unencrypted.
30+
For a more detailed explanation, see rsa_simple.ts.
31+
32+
## How to Use
33+
34+
To see these examples in action, run `npm test`.
35+
36+
## License
37+
38+
This SDK is distributed under the
39+
[Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0),
40+
see LICENSE.txt and NOTICE.txt for more information.

modules/example-node/src/kms_regional_discovery.ts

-15
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,6 @@
1313
* limitations under the License.
1414
*/
1515

16-
/*
17-
* Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
18-
*
19-
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use
20-
* this file except in compliance with the License. A copy of the License is
21-
* located at
22-
*
23-
* http://aws.amazon.com/apache2.0/
24-
*
25-
* or in the "license" file accompanying this file. This file is distributed on an
26-
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
27-
* implied. See the License for the specific language governing permissions and
28-
* limitations under the License.
29-
*/
30-
3116
import { KmsKeyringNode, limitRegions, excludeRegions, getKmsClient, decrypt } from '@aws-crypto/client-node'
3217

3318
export async function kmsRegionalDiscoveryLimitTest (ciphertext: string|Buffer) {

modules/example-node/src/kms_simple.ts

-15
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,6 @@
1313
* limitations under the License.
1414
*/
1515

16-
/*
17-
* Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
18-
*
19-
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use
20-
* this file except in compliance with the License. A copy of the License is
21-
* located at
22-
*
23-
* http://aws.amazon.com/apache2.0/
24-
*
25-
* or in the "license" file accompanying this file. This file is distributed on an
26-
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
27-
* implied. See the License for the specific language governing permissions and
28-
* limitations under the License.
29-
*/
30-
3116
import { KmsKeyringNode, encrypt, decrypt } from '@aws-crypto/client-node'
3217

3318
export async function kmsSimpleTest () {

modules/example-node/src/rsa_simple.ts

-15
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,6 @@
1313
* limitations under the License.
1414
*/
1515

16-
/*
17-
* Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
18-
*
19-
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use
20-
* this file except in compliance with the License. A copy of the License is
21-
* located at
22-
*
23-
* http://aws.amazon.com/apache2.0/
24-
*
25-
* or in the "license" file accompanying this file. This file is distributed on an
26-
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
27-
* implied. See the License for the specific language governing permissions and
28-
* limitations under the License.
29-
*/
30-
3116
import { RawRsaKeyringNode, encrypt, decrypt } from '@aws-crypto/client-node'
3217

3318
import { generateKeyPair } from 'crypto'

0 commit comments

Comments
 (0)