Add nonce generation to o11y login frontend

What does this MR do and why?

This adds helper functions to generate nonces to verify data passed between the iframe hosted react app and the vue component hosting the iframe. It is broken out from Log a user into the O11y service react app (!197536 - merged) to help with review complexity.

Duo generated summary

This code adds a new utility for generating secure random numbers and nonces (unique identifiers) for the observability feature. The main functionality includes two functions: one that creates cryptographically secure random hex strings of any specified length, and another that generates standard 16-byte nonces. Both functions include proper error handling to ensure they only work when the browser's secure random number generator is available, and they validate input parameters to prevent misuse. The code also adds appropriate error messages that can be translated into different languages, and includes comprehensive tests to verify the functions work correctly, generate unique values each time, produce properly formatted output, and handle error cases gracefully.

References

Update login process to use observability_group_o11y_setting table

Screenshots or screen recordings

No UI changes. See final functionality screen recording

How to set up and validate locally

See final functionality testing

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Dakota Dux

Merge request reports

Loading