Skip to content
This repository has been archived by the owner on Jan 18, 2024. It is now read-only.

Commit

Permalink
fix: remove opt-in-google-play-signing (#2247)
Browse files Browse the repository at this point in the history
* fix: remove opt-in-google-play-signing

* update CHANGELOG.md
  • Loading branch information
wkozyra95 committed Jun 12, 2020
1 parent e106afa commit 9a44da0
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 344 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Expand Up @@ -6,6 +6,8 @@ This is the log of notable changes to Expo CLI and related packages.

### 🛠 Breaking changes

- Remove `opt-in-google-play-signing` command ([#2247](https://github.com/expo/expo-cli/pull/2247) by [@wkozyra95](https://github.com/wkozyra95)).

### 🎉 New features

### 🐛 Bug fixes
Expand Down
233 changes: 0 additions & 233 deletions packages/expo-cli/src/commands/google-play/AppSigningOptIn.ts

This file was deleted.

1 change: 0 additions & 1 deletion packages/expo-cli/src/commands/index.ts
Expand Up @@ -20,7 +20,6 @@ const COMMANDS = [
require('./ios'),
require('./login'),
require('./logout'),
require('./opt-into-google-play-signing'),
require('./prepare-detached-build'),
require('./publish-info'),
require('./publish-modify'),
Expand Down
17 changes: 0 additions & 17 deletions packages/expo-cli/src/commands/opt-into-google-play-signing.ts

This file was deleted.

93 changes: 0 additions & 93 deletions packages/xdl/src/credentials/AndroidCredentials.ts
Expand Up @@ -95,99 +95,6 @@ export async function exportCertBase64(
}
}

export async function exportPrivateKey(
{ keystorePath, keystorePassword, keyAlias, keyPassword }: KeystoreInfo,
encryptionKey: string,
outputPath: string
) {
let nodePty;
const ptyTmpDir = '/tmp/pty-tmp-install';
try {
// it's not very pretty solution, but we decided to use it because it's affecting only people using
// this command and if node-pty is supported on that system instalation process will be invisble for user.
nodePty = require('node-pty-prebuilt');
} catch (err) {
try {
log.info('Installing node-pty-prebuilt in a temporary directory');
await fs.mkdirp(ptyTmpDir);
await spawnAsync('npm', ['init', '--yes'], { cwd: ptyTmpDir });
await spawnAsync('npm', ['install', 'node-pty-prebuilt'], {
cwd: ptyTmpDir,
stdio: ['pipe', 1, 2],
});
nodePty = require(`${ptyTmpDir}/node_modules/node-pty-prebuilt`);
} catch (err) {
log.info(`Run ${chalk.cyan('npm -g install node-pty-prebuilt')} to install node pty`);
throw new Error('Package node-pty-prebuilt is required to use PEPK tool');
}
}
const ptySpawn = nodePty.spawn;
const encryptToolPath = path.join(UserSettings.dotExpoHomeDirectory(), 'android_tools_pepk.jar');
if (!fs.existsSync(encryptToolPath)) {
log.info(`Downloading PEPK tool from Google Play to ${encryptToolPath}`);
const downloadUrl =
'https://www.gstatic.com/play-apps-publisher-rapid/signing-tool/prod/pepk.jar';
const file = fs.createWriteStream(encryptToolPath);
const response = await axios({ url: downloadUrl, method: 'GET', responseType: 'stream' });
const bar = new ProgressBar(' downloading pepk tool [:bar] :rate/bps :percent :etas', {
complete: '=',
incomplete: ' ',
width: 40,
total: parseInt(response.headers['content-length'], 10),
});
response.data.pipe(file);
response.data.on('data', (chunk: any) => bar.tick(chunk.length));
await new Promise((resolve, reject) => {
file.on('finish', resolve);
file.on('error', reject);
});
}
try {
await new Promise((res, rej) => {
const child = ptySpawn(
javaExecutable,
[
'-jar',
encryptToolPath,
'--keystore',
keystorePath,
'--alias',
keyAlias,
'--output',
outputPath,
'--encryptionkey',
encryptionKey,
],
{
name: 'pepk tool',
cols: 80,
rows: 30,
cwd: process.cwd(),
env: process.env,
}
);
child.on('error', (err: Error) => {
log.error('error', err);
rej(err);
});
child.on('exit', (exitCode: number) => {
if (exitCode !== 0) {
rej(exitCode);
} else {
res();
}
});
child.write(keystorePassword + NEWLINE);
child.write(keyPassword + NEWLINE);
});
log.info(`Exported and encrypted private App Signing Key to file ${outputPath}`);
} catch (error) {
throw new Error(`PEPK tool failed with return code ${error}`);
} finally {
fs.remove(ptyTmpDir);
}
}

export async function logKeystoreHashes(keystoreInfo: KeystoreInfo, linePrefix: string = '') {
const { keystorePath } = keystoreInfo;
const certFile = `${keystorePath}.cer`;
Expand Down

0 comments on commit 9a44da0

Please sign in to comment.