extractUserUnsafe
Type: extractUserUnsafe(content?: string): APIResult<string>
extractUserUnsafe()
returns the decrypted username from an encrypted token, but does not perform HMAC-based tamper detection.
TypeScript
const = .().("encrypted-token");
if (.) {
.(.); // Username is displayed
}
Overview
- Internally uses
decrypt()
to decrypt the token. - No integrity check (HMAC verification) is performed.
- For secure usage, use
extractUserWithVerify()
instead.
Parameters
Option | Type | Description |
---|---|---|
content | string | The encrypted token |
Return Value
APIResult<string>
: Returns the decrypted username.
Example Usage
TypeScript
const = "encrypted-token";
const = .().();
if (.) {
.("Username:", .);
} else {
.("Failure:", .);
}
Notes
- This method may accept tampered tokens as valid.
- Use
extractUserWithVerify()
for untrusted data. - Marked as
@deprecated
in the documentation and may be removed in future versions.
Last updated on