{"id":13994611,"url":"https://github.com/1Password/password-rules-parser","last_synced_at":"2025-07-22T19:32:59.611Z","repository":{"id":52427926,"uuid":"309716551","full_name":"1Password/password-rules-parser","owner":"1Password","description":"Rust parser for the passwordrules attribute","archived":false,"fork":false,"pushed_at":"2021-10-07T14:56:31.000Z","size":50,"stargazers_count":66,"open_issues_count":2,"forks_count":9,"subscribers_count":8,"default_branch":"main","last_synced_at":"2024-11-23T11:23:47.039Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/1Password.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-11-03T14:44:53.000Z","updated_at":"2024-11-04T23:57:11.000Z","dependencies_parsed_at":"2022-08-18T06:36:28.828Z","dependency_job_id":null,"html_url":"https://github.com/1Password/password-rules-parser","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1Password%2Fpassword-rules-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1Password%2Fpassword-rules-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1Password%2Fpassword-rules-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1Password%2Fpassword-rules-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/1Password","download_url":"https://codeload.github.com/1Password/password-rules-parser/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227166819,"owners_count":17740986,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-09T14:02:59.206Z","updated_at":"2024-11-29T16:31:37.177Z","avatar_url":"https://github.com/1Password.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"# password-rules-parser\n\n[![crate documentation](https://docs.rs/password-rules-parser/badge.svg)](https://docs.rs/password-rules-parser)\n[![Crates.io version](https://img.shields.io/crates/v/password-rules-parser.svg)](https://crates.io/crates/password-rules-parser)\n[![Crates.io downloads](https://img.shields.io/crates/d/password-rules-parser.svg)](https://crates.io/crates/password-rules-parser)\n[![dependency status](https://deps.rs/repo/github/1Password/password-rules-parser/status.svg)](https://deps.rs/repo/github/1Password/password-rules-parser)\n![CI](https://github.com/1Password/password-rules-parser/workflows/CI/badge.svg)\n\nRust parser for the HTML [`passwordrules` attribute](https://github.com/whatwg/html/issues/3518), a proposal for an HTML attribute that allows services to specify their password requirements in a machine-readable format.\n\nThis spec is primarily being backed by Apple, and their tools and docs can be found [here](https://developer.apple.com/password-rules/).\n\nSee this crate's documentation for our own primer.\n\n## Example\n\nThis example can be run via `cargo run --example parse`.\n\n```rust\nuse password_rules_parser::{parse_password_rules, CharacterClass};\n\nlet password_rules = \"minlength: 8; maxlength: 32; required: lower, upper; required: digit; allowed: [-_./\\\\@$*\u0026!#];\";\nlet parsed_rules =\n    parse_password_rules(password_rules, true).expect(\"failed to parse password rules\");\n\nassert_eq!(parsed_rules.min_length.unwrap(), 8);\nassert_eq!(parsed_rules.max_length.unwrap(), 32);\n// This password rule does not place a restriction on consecutive characters\nassert!(parsed_rules.max_consecutive.is_none());\nassert_eq!(\n    parsed_rules.allowed,\n    vec![CharacterClass::Custom(vec![\n        '!', '#', '$', '\u0026', '*', '-', '.', '/', '@', '\\\\', '_',\n    ])]\n);\nassert_eq!(\n    parsed_rules.required,\n    vec![\n        vec![CharacterClass::Upper, CharacterClass::Lower],\n        vec![CharacterClass::Digit]\n    ]\n);\n\n// The above information can be used to make informed decisions about what password\n// to generate for use with a specific service\n```\n\nYou can try parsing arbitrary rules with this tool via `cargo run --example cli`.\n\n## MSRV\n\nThe Minimum Supported Rust Version is currently 1.46.0. This will be bumped to the latest stable version of Rust when needed.\n\n## Credits\n\nMade with ❤️ by the [1Password](https://1password.com/) team, with appreciation for the wonderful [nom](https://github.com/Geal/nom) parsing library.\n\n#### License\n\n\u003csup\u003e\nLicensed under either of \u003ca href=\"LICENSE-APACHE\"\u003eApache License, Version\n2.0\u003c/a\u003e or \u003ca href=\"LICENSE-MIT\"\u003eMIT license\u003c/a\u003e at your option.\n\u003c/sup\u003e\n\n\u003cbr\u003e\n\n\u003csub\u003e\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in this crate by you, as defined in the Apache-2.0 license, shall\nbe dual licensed as above, without any additional terms or conditions.\n\u003c/sub\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F1Password%2Fpassword-rules-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F1Password%2Fpassword-rules-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F1Password%2Fpassword-rules-parser/lists"}