share method
Creates a share token to share this repository with other devices.
By default the access mode of the token will be the same as the mode the repo is currently
opened in but it can be escalated with the local_secret
param or de-escalated with the
access_mode
param.
access_mode
: access mode of the token. Useful to de-escalate the access mode to below of what the repo is opened in.local_secret
: the local repo secret. If notNone
, the share token's access mode will be the same as what the secret provides. Useful to escalate the access mode to above of what the repo is opened in.
Implementation
Future<ShareToken> share({
required AccessMode accessMode,
LocalSecret? localSecret,
}) async {
final request = RequestRepositoryShare(
repo: handle,
accessMode: accessMode,
localSecret: localSecret,
);
final response = await client.invoke(request);
switch (response) {
case ResponseShareToken(value: final value): return value;
default: throw UnexpectedResponse();
}
}