Serializable
, Comparable<Identifier>
, net.minidev.json.JSONAware
@Immutable public final class Nonce extends Identifier
Example generation of a nonce with eight random mixed-case alphanumeric characters:
Nonce nonce = new Nonce(8);
Related specifications:
DEFAULT_BYTE_LENGTH, secureRandom
Constructor | Description |
---|---|
Nonce() |
Creates a new nonce with a randomly generated 256-bit (32-byte)
value, Base64URL-encoded.
|
Nonce(int byteLength) |
Creates a new nonce with a randomly generated value of the specified
byte length, Base64URL-encoded.
|
Nonce(String value) |
Creates a new nonce with the specified value.
|
Modifier and Type | Method | Description |
---|---|---|
boolean |
equals(Object object) |
|
static Nonce |
parse(String s) |
Parses a nonce from the specified string.
|
compareTo, getValue, hashCode, toJSONString, toString
public Nonce(String value)
value
- The nonce value. Must not be null
or empty
string.public Nonce(int byteLength)
byteLength
- The byte length of the value to generate. Must be
greater than one.public Nonce()
public boolean equals(Object object)
equals
in class Identifier
Copyright © 2019 Connect2id Ltd.. All rights reserved.