-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove Dead Files
- Loading branch information
Universal Web
committed
May 29, 2023
1 parent
ca8b9be
commit 04fd4db
Showing
29 changed files
with
89 additions
and
191 deletions.
There are no files selected for viewing
Empty file.
Empty file.
Empty file.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,41 @@ | ||
import { write } from '#file'; | ||
import { encode } from 'msgpackr'; | ||
import { resolve } from 'path'; | ||
export async function saveCertificate(certificate, directory, certificateName = 'profile') { | ||
const savePath = resolve(`${directory}/${certificateName}.cert`); | ||
import { resolve, normalize } from 'path'; | ||
export async function saveCertificate(config) { | ||
const { | ||
certificate, | ||
savePath, | ||
certificateName | ||
} = config; | ||
const savePathRoot = `${resolve(`${savePath}`)}/${certificateName}`; | ||
const publicCertificate = certificate.certificate; | ||
const encodedCertificate = encode(certificate); | ||
await write(savePath, encodedCertificate); | ||
console.log(savePath, `${encodedCertificate.length} bytes`); | ||
await write(`${savePathRoot}-Public.cert`, publicCertificate); | ||
await write(`${savePathRoot}.cert`, encodedCertificate); | ||
} | ||
export async function saveProfile(config) { | ||
const { | ||
savePath, | ||
certificateName, | ||
profile, | ||
profile: { | ||
ephemeral: ephemeralCertificate, | ||
master: masterCertificate | ||
} | ||
} = config; | ||
console.log(config); | ||
const ephemeral = { | ||
certificate: ephemeralCertificate, | ||
savePath, | ||
certificateName: `${certificateName}Ephemeral` | ||
}; | ||
await saveCertificate(ephemeral); | ||
const master = { | ||
certificate: masterCertificate, | ||
savePath, | ||
certificateName: `${certificateName}Master` | ||
}; | ||
await saveCertificate(master); | ||
const savePathRoot = `${resolve(`${savePath}`)}/${certificateName}-Profile.cert`; | ||
await write(savePathRoot, encode(profile)); | ||
} |
Oops, something went wrong.