chromium/chromeos/ash/services/nearby/public/mojom/quick_start_decoder_types.mojom

// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

module ash.quick_start.mojom;

struct BootstrapConfigurations {
  // Instance ID can be empty even with a valid BootstrapConfigurations.
  string instance_id;

  // Indicates whether the account in question is a supervised account
  // (Unicorn, Geller, etc.).
  bool is_supervised_account;

  // Email address for the account in question.
  string email;
};

enum WifiSecurityType {
  kPSK = 0,
  kWEP = 1,
  kEAP = 2,
  kOpen = 3,
  kOWE = 4,
  kSAE = 5,
};

struct UserVerificationMethod {
  bool use_source_lock_screen_prompt;
};

// These values are directly taken from Android, and reported back.
enum UserVerificationResult {
  kUserVerified = 0,
  kUserNotVerified = 1,
  kLSKFNotSet = 2,
};

struct UserVerificationResponse {
  UserVerificationResult result;
  bool is_first_user_verification;
};

struct UserVerificationRequested {
  bool is_awaiting_user_verification;
};

enum QuickStartDecoderError {
  kEmptyMessage = 0,
  kUnableToReadAsJSON = 1,
  kMessageDoesNotMatchSchema = 2,
  kUnexpectedMessageType = 3,
  kUnknownPayload = 4,
  kUnableToReadAsBase64 = 5,
};

struct WifiCredentials {
  string ssid;
  WifiSecurityType security_type;
  bool is_hidden;
  string? password;
};

struct FidoAssertionResponse {
  string email;
  string credential_id;

  // The following fields are passed directly to GAIA with
  // no further processing in Chromium. The raw byte values
  // will be opaque and will not be parsed within the
  // browser process.
  array<uint8> auth_data;
  array<uint8> signature;
};

struct NotifySourceOfUpdateResponse {
  bool ack_received;
};

union QuickStartMessage {
  BootstrapConfigurations bootstrap_configurations;
  WifiCredentials wifi_credentials;
  NotifySourceOfUpdateResponse notify_source_of_update_response;
  FidoAssertionResponse fido_assertion_response;
  UserVerificationRequested user_verification_requested;
  UserVerificationResponse user_verification_response;
  UserVerificationMethod user_verification_method;
};