orphanWarning static method
Pure — the no-orphan / self-match decision, no I/O. Null means "print
nothing": either no cli:<hostname> key exists at all, or the one
that does is the very key just pasted, so nothing is orphaned.
Implementation
static String? orphanWarning({
required Map<String, dynamic>? existingKey,
required String pastedRawKey,
}) {
if (existingKey == null) return null;
final pastedPrefix = pastedRawKey.length >= 16
? pastedRawKey.substring(0, 16)
: pastedRawKey;
if (existingKey['prefix'] == pastedPrefix) return null;
return orphanWarningMessage(
keyName: existingKey['name'] as String,
prefix: existingKey['prefix'] as String,
);
}