aws-instance-identity-certificates
Version:
Public certificates for AWS Instance Identity Documents. Useful when publishing EC2 AMIs via the AWS Marketplace.
58 lines (38 loc) • 1.85 kB
Markdown
is an npm module that provides utilities for working with AWS instance identity documents and certificates. It helps in verifying the identity of EC2 instances and ensures secure communication between services.
The verification process is taken from the AWS documentation: [Verify the instance identity document for an Amazon EC2 instance](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/verify-iid.html#verify-signature)
The certificates are scraped from this [wonderfully user hostile format for supplying certificates](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/regions-certs.html)
To install the module, use npm:
```bash
npm install aws-instance-identity-certificates
```
Here is an example of how to use the module:
```javascript
const { verifyIdentityDocument } = require('aws-instance-identity-certificates');
const document = '...'; // Your instance identity document
const signature = '...'; // The corresponding signature
verifyIdentityDocument(document, signature)
.then(isValid => {
if (isValid) {
console.log('The identity document is valid.');
} else {
console.log('The identity document is invalid.');
}
})
.catch(error => {
console.error('Error verifying identity document:', error);
});
```
Verifies the given instance identity document and its signature.
- `document` (string): The instance identity document.
- `signature` (string): The signature of the document.
Returns a promise that resolves to a boolean indicating whether the document is valid.
Contributions are welcome! Please open an issue or submit a pull request.
This project is licensed under the MIT License.
`aws-instance-identity-certificates`