Skip to Content
This project is in active development. Features and behaviors may change without notice.

extractUserWithVerify

Type: extractUserWithVerify(content?: string): Promise<APIResult<string>>

extractUserWithVerify() decrypts an encrypted token and verifies its HMAC to ensure it hasn’t been tampered with. This method should be used when security is a priority.

TypeScript
const = await .().(token);

Parameters

OptionTypeDescription
contentstringEncrypted token

Return Value

  • Promise<APIResult<string>>: On success, returns an object containing the username. On failure, returns an object with error information.

Example Usage

TypeScript
const = "encrypted-token-example"; const = await .().(); if (.) { .("Username:", .); } else { .("Error:", ., .); }

Notes

  • Always use this method for secure operations.
  • HMAC verification ensures the integrity and trustworthiness of the token.
Last updated on