getTokens method

Future<List<Token>> getTokens()

Returns the available Tokens. In a regular user's session the list will always contain the user's token with id "user". If a system-wide TPM token is available, the returned list will also contain the system-wide token with id "system". The system-wide token will be the same for all sessions on this device (device in the sense of e.g. a Chromebook).

Implementation

Future<List<Token>> getTokens() {
  var $completer = Completer<List<Token>>();
  $js.chrome.enterprise.platformKeys.getTokens((JSArray tokens) {
    if (checkRuntimeLastError($completer)) {
      $completer.complete(tokens.toDart
          .cast<$js.Token>()
          .map((e) => Token.fromJS(e))
          .toList());
    }
  }.toJS);
  return $completer.future;
}