claim static method
Takes the service over with the master password (claim): the service
cannot prove itself here, so the caller warns the user first. Answers
the connection and the new admin key.
Implementation
static Future<(TomSecretsAdminClient, Uint8List)> claim(
TomSecretsRuntime runtime, {
required String password,
List<int>? keyFile,
Map<String, Object?> client = const {'name': 'tsm'},
}) async {
final admin = await _open(runtime);
await admin._next(); // the challenge, unanswerable without the key
admin._send({
'op': 'claim',
'password': password,
'keyFile': ?(keyFile == null ? null : base64.encode(keyFile)),
'client': client,
});
final answer = await admin._next();
admin._throwIfError(answer);
admin._listen();
return (admin, base64.decode(answer['adminKey']! as String));
}