vertx / io.vertx.reactivex.ext.auth / VertxContextPRNG

VertxContextPRNG

open class VertxContextPRNG

A secure non blocking random number generator isolated to the current context. The PRNG is bound to the vert.x context and setup to close when the context shuts down.

When applicable, use of VertxContextPRNG rather than create new PRNG objects is helpful to keep the system entropy usage to the minimum avoiding potential blocking across the application.

The use of VertxContextPRNG is particularly appropriate when multiple handlers use random numbers.

NOTE: This class has been automatically generated from the io.vertx.ext.auth.VertxContextPRNG non RX-ified interface using Vert.x codegen.

Constructors

<init>

VertxContextPRNG(delegate: VertxContextPRNG)

Properties

__TYPE_ARG

static val __TYPE_ARG: TypeArg<VertxContextPRNG>

Functions

current

open static fun current(): VertxContextPRNG

Get or create a secure non blocking random number generator using the current vert.x context. If there is no current context (i.e.: not running on the eventloop) then a java.lang.IllegalStateException is thrown.

open static fun current(vertx: Vertx): VertxContextPRNG

Get or create a secure non blocking random number generator using the current vert.x instance. Since the context might be different this method will attempt to use the current context first if available and then fall back to create a new instance of the PRNG.

equals

open fun equals(other: Any?): Boolean

getDelegate

open fun getDelegate(): VertxContextPRNG

hashCode

open fun hashCode(): Int

newInstance

open static fun newInstance(arg: VertxContextPRNG): VertxContextPRNG

nextInt

open fun nextInt(): Int

Returns a secure random int

nextString

open fun nextString(length: Int): String

Returns a Base64 mime encoded String of random data with the given length. The length parameter refers to the length of the String before the encoding step.

toString

open fun toString(): String