Files
Shade/packages/shade-cli/src/commands/rotate.ts

30 lines
908 B
TypeScript
Raw Normal View History

import { createShade } from '@shade/sdk';
import { loadConfig } from '../config.js';
export async function rotateCommand(opts: { identity?: boolean } = {}): Promise<void> {
const config = loadConfig();
const shade = await createShade({
prekeyServer: config.prekeyServer,
storage: config.storage,
address: config.address,
autoReplenish: false,
});
try {
if (opts.identity) {
console.log('⚠ Rotating IDENTITY — peers will need to verify the new fingerprint');
const oldFp = await shade.fingerprint;
await shade.rotate();
const newFp = await shade.fingerprint;
console.log(` Old: ${oldFp}`);
console.log(` New: ${newFp}`);
} else {
console.log('Rotating signed prekey...');
await shade.getManager().rotateSignedPreKey();
console.log('✓ Signed prekey rotated');
}
} finally {
await shade.shutdown();
}
}