1
0
mirror of https://github.com/bitwarden/browser.git synced 2025-03-13 13:49:37 +01:00
bitwarden-browser/libs/common/src/tools/generator/username/options/constants.ts

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

113 lines
2.9 KiB
TypeScript
Raw Normal View History

import { ForwarderMetadata } from "./forwarder-options";
import { UsernameGeneratorOptions } from "./generator-options";
/** Metadata about an email forwarding service.
* @remarks This is used to populate the forwarder selection list
* and to identify forwarding services in error messages.
*/
export const Forwarders = Object.freeze({
/** For https://addy.io/ */
AddyIo: Object.freeze({
id: "anonaddy",
name: "Addy.io",
validForSelfHosted: true,
} as ForwarderMetadata),
/** For https://duckduckgo.com/email/ */
DuckDuckGo: Object.freeze({
id: "duckduckgo",
name: "DuckDuckGo",
validForSelfHosted: false,
} as ForwarderMetadata),
/** For https://www.fastmail.com. */
Fastmail: Object.freeze({
id: "fastmail",
name: "Fastmail",
validForSelfHosted: true,
} as ForwarderMetadata),
/** For https://relay.firefox.com/ */
FirefoxRelay: Object.freeze({
id: "firefoxrelay",
name: "Firefox Relay",
validForSelfHosted: false,
} as ForwarderMetadata),
/** For https://forwardemail.net/ */
ForwardEmail: Object.freeze({
id: "forwardemail",
name: "Forward Email",
validForSelfHosted: true,
} as ForwarderMetadata),
/** For https://simplelogin.io/ */
SimpleLogin: Object.freeze({
id: "simplelogin",
name: "SimpleLogin",
validForSelfHosted: true,
} as ForwarderMetadata),
});
/** Padding values used to prevent leaking the length of the encrypted options. */
export const SecretPadding = Object.freeze({
/** The length to pad out encrypted members. This should be at least as long
* as the JSON content for the longest JSON payload being encrypted.
*/
length: 512,
/** The character to use for padding. */
character: "0",
/** A regular expression for detecting invalid padding. When the character
* changes, this should be updated to include the new padding pattern.
*/
hasInvalidPadding: /[^0]/,
});
/** Default options for username generation. */
// freeze all the things to prevent mutation
export const DefaultOptions: UsernameGeneratorOptions = Object.freeze({
type: "word",
website: "",
word: Object.freeze({
capitalize: true,
includeNumber: true,
}),
subaddress: Object.freeze({
algorithm: "random",
email: "",
}),
catchall: Object.freeze({
algorithm: "random",
domain: "",
}),
forwarders: Object.freeze({
service: Forwarders.Fastmail.id,
fastMail: Object.freeze({
domain: "",
prefix: "",
token: "",
}),
addyIo: Object.freeze({
baseUrl: "https://app.addy.io",
domain: "",
token: "",
}),
forwardEmail: Object.freeze({
token: "",
domain: "",
}),
simpleLogin: Object.freeze({
baseUrl: "https://app.simplelogin.io",
token: "",
}),
duckDuckGo: Object.freeze({
token: "",
}),
firefoxRelay: Object.freeze({
token: "",
}),
}),
});