UNPKG

403 BJavaScriptView Raw
1// @flow
2import type {HTTPSOptions} from '@parcel/types';
3import type {FileSystem} from '@parcel/fs';
4
5export default async function getCertificate(
6 fs: FileSystem,
7 options: HTTPSOptions
8) {
9 try {
10 let cert = await fs.readFile(options.cert);
11 let key = await fs.readFile(options.key);
12
13 return {key, cert};
14 } catch (err) {
15 throw new Error('Certificate and/or key not found');
16 }
17}