// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
syntax = "proto2";
option optimize_for = LITE_RUNTIME;
package autofill;
// Requirements for generating passwords.
message PasswordRequirementsSpec {
// A CharacterClass represents a type of characters (e.g. upper case,
// lower case, numbers, special symbols, ...).
//
// With min and max it is possible to specify the desired frequency:
// - Allowed: min = 0, max = MAX_INT32
// - Required: min = 1, max = MAX_INT32
// - Prohibited: min = 0, max = 0
//
// Note that character classes are meant to be handled independently of each
// other. Therefore, it is recommended not to set max > 0 for two overlapping
// character classes.
//
// It is also possible to express special rules like "at least two numbers"
// via min = 2, max = MAX_INT32, or "only numbers" by setting min = max = 0
// for all other character classes.
message CharacterClass {
// This is the pool of characters that make up the character set. For
// brevity, some defaults are assumed given the name/identity of the
// character class member (i.e., lower case vs upper case).
// Anything in UTF-8 is deemed acceptable here.
optional string character_set = 1;
// Minimum number of characters from this class.
optional uint32 min = 2;
// Maximum number of characters from this class.
optional uint32 max = 3;
}
// The priority of this specification.
//
// Autofill uses crowdsourcing to learn the requirements of passwords.
// It is possible to manually override the requirements for an entire domain
// or for a specific form. The priority field can be used to determine which
// specification wins. If multiple specificaitons are available, the one with
// the highest priority value wins. In that case all other specifications
// are discarded (i.e. completely overridden as if they were never there).
//
// Values:
// - 10 default for crowd sourced data.
// - 20 for hard-coded overrides by domain.
// - 30 for hard-coded overrides for a specific form.
optional uint32 priority = 1;
// A version number to allow older versions of Chrome to notice that they
// don't understand a new revision of the requirements spec.
optional uint32 spec_version = 2;
// Minimum and maximum length of generated passwords for a site. Note that
// these defaults may override the required minimum occurrences of character
// classes if the two contradict.
//
// Defaults may change over time.
optional uint32 min_length = 4;
optional uint32 max_length = 5;
// The following fields allow overriding requirements for specific character
// classes. If attributes of a CharacterClass are not set, the following
// defaults apply:
// All default character sets below are taken from 7-bit ASCII.
// Default: character_set = [a-z], min = 1, max = MAX_INT32
optional CharacterClass lower_case = 6;
// Default: character_set = [A-Z], min = 1, max = MAX_INT32
optional CharacterClass upper_case = 7;
// Alphabetic should not be used together with lower_case and upper_case.
// This is just an option for sites that don't differentiate the cases.
// If you wish to use alphabetic, you should set lower_case and upper_case
// to min = max = 0.
// Default: character_set = [a-zA-Z], min = 0, max = 0
optional CharacterClass alphabetic = 8;
// Default: character_set = [0-9], min = 1, max = MAX_INT32
optional CharacterClass numeric = 9;
// Default: character_set = some default that works often
// (e.g. [!@#$%^&*()_-+=]) but the default value may change over time!),
// min = 0, max = 0
optional CharacterClass symbols = 10;
}
// Response which contains what the server knows for a particular domain.
message DomainSuggestions {
// Requirements that the website places on new passwords.
optional PasswordRequirementsSpec password_requirements = 1;
}