fix(devices): keep the existing device name on re-pair and re-login
A dedupe-keyed client re-mint (QR rescan, password/passkey re-login) replaces
the stored record, which also reset the operator-visible name to the app's
hardcoded default ('OpenChamber Mobile'). The app-reported name is now only a
fallback: an explicit pairing label wins, otherwise the replaced record's
label is kept, and the default applies only to a first-ever pairing.
This commit is contained in:
@@ -83,6 +83,23 @@ describe('remote client auth runtime', () => {
|
||||
}
|
||||
});
|
||||
|
||||
it('keeps the replaced record label on a dedupe re-mint without an explicit label', async () => {
|
||||
const { dir, runtime } = await createRuntime();
|
||||
try {
|
||||
await runtime.createClient({ label: 'Iryna iPhone', dedupeKey: 'mobile:device-1', fallbackLabel: 'OpenChamber Mobile' });
|
||||
const remint = await runtime.createClient({ dedupeKey: 'mobile:device-1', fallbackLabel: 'OpenChamber Mobile' });
|
||||
expect(remint.client.label).toBe('Iryna iPhone');
|
||||
|
||||
const renamed = await runtime.createClient({ label: 'Work phone', dedupeKey: 'mobile:device-1', fallbackLabel: 'OpenChamber Mobile' });
|
||||
expect(renamed.client.label).toBe('Work phone');
|
||||
|
||||
const fresh = await runtime.createClient({ dedupeKey: 'mobile:device-2', fallbackLabel: 'OpenChamber Mobile' });
|
||||
expect(fresh.client.label).toBe('OpenChamber Mobile');
|
||||
} finally {
|
||||
await fs.rm(dir, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
|
||||
it('keeps the token store private on disk', async () => {
|
||||
const { dir, runtime } = await createRuntime();
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user