detect
Recognizes a well-known credential format: the whole of token must look like one.
The check is by prefix, alphabet and length (GitHub, AWS, Slack, Stripe, Google, npm, JWT, and
the header of a PEM private key): no network call, so it says a string looks like a token, not
that it is valid, and it will miss formats it does not know. Use scan to
search a whole text.
Import
Section titled “Import”Cargo feature secret (enabled by default). To compile only this module:
or in Cargo.toml:
Signature
Section titled “Signature”Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
token | &str | The string to check, a single word without surrounding quotes. |
Returns
Section titled “Returns”Option<TokenKind> — The TokenKind, or None when the string matches no known format.
