summaryrefslogtreecommitdiff
path: root/chromium/components/autofill/core/browser/password_generator.h
blob: 4ff870f942de335ddc90ce791b24af131492d241 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_PASSWORD_GENERATOR_H_
#define COMPONENTS_AUTOFILL_CORE_BROWSER_PASSWORD_GENERATOR_H_

#include "base/strings/string16.h"

namespace autofill {

class PasswordRequirementsSpec;

extern const uint32_t kDefaultPasswordLength;

// Returns a password that follows the |spec| as well as possible. If this is
// impossible, a password that nearly meets the requirements can be returned.
// In this case the user is asked to fix the password themselves.
//
// If |spec| is empty, a password of length |kDefaultPasswordLength| is
// generated that contains
// - at least 1 lower case latin character
// - at least 1 upper case latin character
// - at least 1 number (digit)
// - no symbols
base::string16 GeneratePassword(const PasswordRequirementsSpec& spec);

}  // namespace autofill

#endif  // COMPONENTS_AUTOFILL_CORE_BROWSER_PASSWORD_GENERATOR_H_