Skip to content

Commit dd6111d

Browse files
authored
feat: expose custom bundles (#21)
1 parent 335147b commit dd6111d

File tree

8 files changed

+39
-40
lines changed

8 files changed

+39
-40
lines changed

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,17 @@ Using **AWS SSL Profiles** with custom `ssl` options:
110110
}
111111
```
112112

113+
### Custom bundles
114+
115+
```js
116+
const { proxyBundle } = require('aws-ssl-profiles');
117+
118+
{
119+
// ...
120+
ssl: proxyBundle,
121+
}
122+
```
123+
113124
---
114125

115126
## License

src/index.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1-
import { Profiles } from './@types/profiles.js';
1+
import type { Profiles } from './@types/profiles.js';
22
import { defaults } from './profiles/ca/defaults.js';
3-
import { proxy } from './profiles/ca/proxy.js';
3+
import { proxies } from './profiles/ca/proxies.js';
4+
5+
export const proxyBundle: Profiles = {
6+
ca: proxies,
7+
};
48

59
const profiles: Profiles = {
6-
ca: [...defaults, ...proxy],
10+
ca: [...defaults, ...proxies],
711
};
812

913
// eslint-disable-next-line import/no-default-export

src/profiles/ca/defaults.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { CA } from '../../@types/profiles.js';
1+
import type { CA } from '../../@types/profiles.js';
22

33
/**
44
* CA Certificates for **Amazon RDS** (2024)

src/profiles/ca/proxy.ts renamed to src/profiles/ca/proxies.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import { CA } from '../../@types/profiles.js';
1+
import type { CA } from '../../@types/profiles.js';
22

33
/**
44
* CA Certificates for **Amazon RDS Proxy** (2024)
55
*
66
* - https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/rds-proxy.howitworks.html#rds-proxy-security.tls
77
* - https://www.amazontrust.com/repository/
88
*/
9-
export const proxy: CA = [
9+
export const proxies: CA = [
1010
'-----BEGIN CERTIFICATE-----\n' +
1111
'MIIDQTCCAimgAwIBAgITBmyfz5m/jAo54vB4ikPmljZbyjANBgkqhkiG9w0BAQsF\n' +
1212
'ADA5MQswCQYDVQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6\n' +

test/unit/defaults.test.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
import { describe, assert } from 'poku';
22
import { defaults } from '../../src/profiles/ca/defaults.js';
33

4-
describe('Testing default profiles', {
5-
pad: true,
6-
background: false,
7-
});
4+
describe('Testing default profiles');
85

96
assert(Array.isArray(defaults), 'Ensure profiles type');
107
assert(

test/unit/profiles.test.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
import { describe, assert } from 'poku';
22
import profiles from '../../src/index.js';
33

4-
describe('Testing Profiles Final Bundle Structure', {
5-
pad: true,
6-
background: false,
7-
});
4+
describe('Testing Profiles Final Bundle Structure');
85

96
assert.strictEqual(typeof profiles, 'object', 'Ensure profiles type');
107
assert(Array.isArray(profiles.ca), 'Ensure profiles CA type');

test/unit/proxy.test.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
11
import { describe, assert } from 'poku';
2-
import { proxy } from '../../src/profiles/ca/proxy.js';
2+
import { proxies } from '../../src/profiles/ca/proxies.js';
33

4-
describe('Testing RDS Proxy profiles', {
5-
pad: true,
6-
background: false,
7-
});
4+
describe('Testing RDS Proxy profiles');
85

9-
assert(Array.isArray(proxy), 'Ensure profiles type');
6+
assert(Array.isArray(proxies), 'Ensure profiles type');
107
assert(
11-
proxy.every((item) => typeof item === 'string'),
8+
proxies.every((item) => typeof item === 'string'),
129
'Ensure all profiles items are strings'
1310
);
14-
assert.strictEqual(proxy.length, 5, 'Ensure profiles length');
11+
assert.strictEqual(proxies.length, 5, 'Ensure profiles length');
1512
assert.strictEqual(
16-
proxy[0],
13+
proxies[0],
1714
'-----BEGIN CERTIFICATE-----\n' +
1815
'MIIDQTCCAimgAwIBAgITBmyfz5m/jAo54vB4ikPmljZbyjANBgkqhkiG9w0BAQsF\n' +
1916
'ADA5MQswCQYDVQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6\n' +

test/unit/verify-certs.test.ts

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
import x509 from 'x509.js';
22
import { describe, assert } from 'poku';
33
import { defaults } from '../../src/profiles/ca/defaults.js';
4-
import { proxy } from '../../src/profiles/ca/proxy.js';
4+
import { proxies } from '../../src/profiles/ca/proxies.js';
55

6-
describe('Ensuring all certificates are valid and parsable', {
7-
pad: true,
8-
background: false,
9-
});
6+
describe('Ensuring all certificates are valid and parsable');
107

11-
defaults.forEach((cert, index) => {
8+
for (const [index, cert] of defaults.entries()) {
129
const parsedCert = x509.parseCert(cert);
1310
const expected = 'Amazon RDS';
1411

@@ -17,19 +14,15 @@ defaults.forEach((cert, index) => {
1714
expected,
1815
`Certificate at index ${index} from defaults`
1916
);
20-
});
17+
}
2118

22-
proxy.forEach((cert, index) => {
19+
for (const [index, cert] of proxies.entries()) {
2320
const parsedCert = x509.parseCert(cert);
24-
let expected = 'Amazon';
21+
const expected = /^(Amazon|Starfield Technologies, Inc\.)$/;
2522

26-
if (index === 4) {
27-
expected = 'Starfield Technologies, Inc.';
28-
}
29-
30-
assert.strictEqual(
31-
parsedCert.issuer.organizationName,
23+
assert.match(
24+
parsedCert.issuer.organizationName!,
3225
expected,
33-
`Certificate at index ${index} from proxy`
26+
`Certificate at index ${index} from proxies`
3427
);
35-
});
28+
}

0 commit comments

Comments
 (0)