Download and install updates without the help of electron-updater
This commit is contained in:
parent
82dc723432
commit
c8ea2e9463
32 changed files with 75974 additions and 518 deletions
45
ts/updater/generateKeyPair.ts
Normal file
45
ts/updater/generateKeyPair.ts
Normal file
|
@ -0,0 +1,45 @@
|
|||
import { getCliOptions, getPrintableError } from './common';
|
||||
import { keyPair } from './curve';
|
||||
import { writeHexToPath } from './signature';
|
||||
|
||||
/* tslint:disable:no-console */
|
||||
|
||||
const OPTIONS = [
|
||||
{
|
||||
names: ['help', 'h'],
|
||||
type: 'bool',
|
||||
help: 'Print this help and exit.',
|
||||
},
|
||||
{
|
||||
names: ['key', 'k'],
|
||||
type: 'string',
|
||||
help: 'Path where public key will go',
|
||||
default: 'public.key',
|
||||
},
|
||||
{
|
||||
names: ['private', 'p'],
|
||||
type: 'string',
|
||||
help: 'Path where private key will go',
|
||||
default: 'private.key',
|
||||
},
|
||||
];
|
||||
|
||||
type OptionsType = {
|
||||
key: string;
|
||||
private: string;
|
||||
};
|
||||
|
||||
const cliOptions = getCliOptions<OptionsType>(OPTIONS);
|
||||
go(cliOptions).catch(error => {
|
||||
console.error('Something went wrong!', getPrintableError(error));
|
||||
});
|
||||
|
||||
async function go(options: OptionsType) {
|
||||
const { key: publicKeyPath, private: privateKeyPath } = options;
|
||||
const { publicKey, privateKey } = keyPair();
|
||||
|
||||
await Promise.all([
|
||||
writeHexToPath(publicKeyPath, publicKey),
|
||||
writeHexToPath(privateKeyPath, privateKey),
|
||||
]);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue