urbit/pkg/interface/webterm/constants.ts
tomholford 1a50957950 ux: session ID input validation
When creating a new session, validate that it meets the following conditions:

 - must start with an alphabetical
 - can be composed of alphanumerics with hyphens
 - can be length 1 or longer
 - cannot begin or end with a hyphen
2022-03-03 16:58:48 -06:00

12 lines
311 B
TypeScript

export const DEFAULT_SESSION = '';
/**
* Session ID validity:
*
* - must start with an alphabetical
* - can be composed of alphanumerics with hyphens
* - can be length 1 or longer
* - cannot begin or end with a hyphen
*/
export const SESSION_ID_REGEX = /(^[a-z]{1}[a-z\d\-]*[a-z\d]{1}$)|(^[a-z]{1}$)/;