Skip to content

openpgp v5 #225

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions app-config-cli/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ export const cli = yargs
}

process.stdout.write(`\nYour app-config key was set up in ${keyDirs.keychain}\n\n`);
process.stdout.write(initialized.publicKeyArmored);
process.stdout.write(initialized.publicKey);
process.stdout.write('\n');
},
),
Expand Down Expand Up @@ -676,10 +676,10 @@ export const cli = yargs
async () => {
logger.info('Creating a new trusted CI encryption key');

const { privateKeyArmored, publicKeyArmored } = await initializeKeys(false);
await trustTeamMember(await loadKey(publicKeyArmored), await loadPrivateKeyLazy());
const { privateKey, publicKey } = await initializeKeys(false);
await trustTeamMember(await loadKey(publicKey), await loadPrivateKeyLazy());

process.stdout.write(`\n${publicKeyArmored}\n\n${privateKeyArmored}\n\n`);
process.stdout.write(`\n${publicKey}\n\n${privateKey}\n\n`);

process.stdout.write(
stripIndents`
Expand Down Expand Up @@ -716,7 +716,7 @@ export const cli = yargs
const privateKey = await loadPrivateKeyLazy();
await trustTeamMember(key, privateKey);

logger.info(`Trusted ${key.getUserIds().join(', ')}`);
logger.info(`Trusted ${key.getUserIDs().join(', ')}`);
},
),
)
Expand Down
4 changes: 2 additions & 2 deletions app-config-encryption/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,16 @@
"@app-config/settings": "^2.8.7",
"@app-config/utils": "^2.8.7",
"@lcdev/ws-rpc": "0.4",
"@types/openpgp": "4",
"common-tags": "1",
"fs-extra": "7",
"openpgp": "^4.3.0",
"openpgp": "^5.9.0",
"selfsigned": "2",
"text-encoding-utf-8": "1",
"ws": "^7.4.6"
},
"devDependencies": {
"@app-config/test-utils": "^2.8.7",
"@openpgp/web-stream-tools": "^0.0.13",
"get-port": "5"
},
"prettier": "@lcdev/prettier",
Expand Down
30 changes: 15 additions & 15 deletions app-config-encryption/src/encryption.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,24 @@ import {

describe('User Keys', () => {
it('initialize keys without passphrase', async () => {
const { privateKeyArmored, publicKeyArmored } = await initializeKeysManually({
const { privateKey, publicKey } = await initializeKeysManually({
name: 'Tester',
email: '[email protected]',
});

await loadPublicKey(publicKeyArmored);
await loadPrivateKey(privateKeyArmored);
await loadPublicKey(publicKey);
await loadPrivateKey(privateKey);
});

it('initialize keys with passphrase', async () => {
const { privateKeyArmored, publicKeyArmored } = await initializeKeysManually({
const { privateKey, publicKey } = await initializeKeysManually({
name: 'Tester',
email: '[email protected]',
passphrase: 'Secret!',
});

await loadPublicKey(publicKeyArmored);
await expect(loadPrivateKey(privateKeyArmored)).rejects.toBeInstanceOf(SecretsRequireTTYError);
await loadPublicKey(publicKey);
await expect(loadPrivateKey(privateKey)).rejects.toBeInstanceOf(SecretsRequireTTYError);
});

it('initializes keys with a passphrase from stdin', async () => {
Expand All @@ -52,21 +52,21 @@ describe('User Keys', () => {
.then(() => send('$ecure!'))
.catch(() => {});

const { privateKeyArmored, publicKeyArmored } = await initializeKeys();
const { privateKey, publicKey } = await initializeKeys();

await loadPublicKey(publicKeyArmored);
await loadPublicKey(publicKey);

send('$ecure!').catch(() => {});

await loadPrivateKey(privateKeyArmored);
await loadPrivateKey(privateKey);
});
});

it('initializes keys into a directory', async () => {
await withTempFiles({}, async (inDir) => {
const keys = {
privateKeyArmored: 'privateKeyArmored',
publicKeyArmored: 'publicKeyArmored',
privateKey: 'privateKeyArmored',
publicKey: 'publicKeyArmored',
revocationCertificate: 'revocationCertificate',
};

Expand Down Expand Up @@ -103,7 +103,7 @@ describe('User Keys', () => {
});

const createKey = async () => {
const { privateKeyArmored } = await initializeKeysManually({
const { privateKey: privateKeyArmored } = await initializeKeysManually({
name: 'Tester',
email: '[email protected]',
});
Expand Down Expand Up @@ -230,7 +230,7 @@ describe('E2E Encrypted Repo', () => {
};

expect(await initializeLocalKeys(keys, dirs)).toEqual({
publicKeyArmored: keys.publicKeyArmored,
publicKeyArmored: keys.publicKey,
});

const publicKey = await loadPublicKey();
Expand All @@ -254,8 +254,8 @@ describe('E2E Encrypted Repo', () => {
email: '[email protected]',
});

const teammatePublicKey = await loadPublicKey(teammateKeys.publicKeyArmored);
const teammatePrivateKey = await loadPrivateKey(teammateKeys.privateKeyArmored);
const teammatePublicKey = await loadPublicKey(teammateKeys.publicKey);
const teammatePrivateKey = await loadPrivateKey(teammateKeys.privateKey);

await trustTeamMember(teammatePublicKey, privateKey);

Expand Down
Loading