UNPKG

98.3 kBTypeScriptView Raw
1export = RandomOrgClient;
2declare class RandomOrgClient {
3 static "__#5@#INTEGER_METHOD": string;
4 static "__#5@#INTEGER_SEQUENCE_METHOD": string;
5 static "__#5@#DECIMAL_FRACTION_METHOD": string;
6 static "__#5@#GAUSSIAN_METHOD": string;
7 static "__#5@#STRING_METHOD": string;
8 static "__#5@#UUID_METHOD": string;
9 static "__#5@#BLOB_METHOD": string;
10 static "__#5@#GET_USAGE_METHOD": string;
11 static "__#5@#SIGNED_INTEGER_METHOD": string;
12 static "__#5@#SIGNED_INTEGER_SEQUENCE_METHOD": string;
13 static "__#5@#SIGNED_DECIMAL_FRACTION_METHOD": string;
14 static "__#5@#SIGNED_GAUSSIAN_METHOD": string;
15 static "__#5@#SIGNED_STRING_METHOD": string;
16 static "__#5@#SIGNED_UUID_METHOD": string;
17 static "__#5@#SIGNED_BLOB_METHOD": string;
18 static "__#5@#GET_RESULT_METHOD": string;
19 static "__#5@#CREATE_TICKET_METHOD": string;
20 static "__#5@#LIST_TICKET_METHOD": string;
21 static "__#5@#GET_TICKET_METHOD": string;
22 static "__#5@#VERIFY_SIGNATURE_METHOD": string;
23 /** Blob format literal, base64 encoding (default). */
24 static BLOB_FORMAT_BASE64: string;
25 /** Blob format literal, hex encoding. */
26 static BLOB_FORMAT_HEX: string;
27 /** Default value for the replacement parameter (true). */
28 static DEFAULT_REPLACEMENT: boolean;
29 /** Default value for the base parameter (10). */
30 static DEFAULT_BASE: number;
31 /** Default value for the userData parameter (null). */
32 static DEFAULT_USER_DATA: any;
33 /** Default value for the ticketId parameter (null). */
34 static DEFAULT_TICKET_ID: any;
35 /** Default value for the pregeneratedRandomization parameter (null). */
36 static DEFAULT_PREGENERATED_RANDOMIZATION: any;
37 /** Default value for the licenseData parameter (null). */
38 static DEFAULT_LICENSE_DATA: any;
39 /** Size of a single UUID in bits. */
40 static UUID_SIZE: number;
41 /** Default value for the blockingTimeout parameter (1 day). */
42 static DEFAULT_BLOCKING_TIMEOUT: number;
43 /** Default value for the httpTimeout parameter (2 minutes). */
44 static DEFAULT_HTTP_TIMEOUT: number;
45 /** Maximum number of characters allowed in a signature verficiation URL. */
46 static MAX_URL_LENGTH: number;
47 static "__#5@#DEFAULT_DELAY": number;
48 static "__#5@#ALLOWANCE_STATE_REFRESH_SECONDS": number;
49 static "__#5@#keyIndexedInstances": {};
50 static "__#5@#ERROR_CODES": number[];
51 /**
52 * Constructor. Ensures only one instance of RandomOrgClient exists per API
53 * key. Creates a new instance if the supplied key isn't already known,
54 * otherwise returns the previously instantiated one.
55 * @constructor
56 * @param {string} apiKey API key of instance to create/find, obtained from
57 * RANDOM.ORG, see https://api.random.org/api-keys
58 * @param {{blockingTimeout?: number, httpTimeout?: number}} options An object
59 * which may contains any of the following optional parameters:
60 * @param {number} [options.blockingTimeout = 24 * 60 * 60 * 1000] Maximum
61 * time in milliseconds to wait before being allowed to send a request.
62 * Note this is a hint not a guarantee. The advisory delay from server
63 * must always be obeyed. Supply a value of -1 to allow blocking forever
64 * (default 24 * 60 * 60 * 1000, i.e., 1 day).
65 * @param {number} [options.httpTimeout = 120 * 1000] Maximum time in
66 * milliseconds to wait for the server response to a request (default
67 * 120*1000).
68 */
69 constructor(apiKey: string, options?: {
70 blockingTimeout?: number;
71 httpTimeout?: number;
72 });
73 /**
74 * Requests and returns an array of true random integers within a user-defined
75 * range from the server.
76 *
77 * See: https://api.random.org/json-rpc/4/basic#generateIntegers
78 * @param {number} n The number of random integers you need. Must be within
79 * the [1,1e4] range.
80 * @param {number} min The lower boundary for the range from which the random
81 * numbers will be picked. Must be within the [-1e9,1e9] range.
82 * @param {number} max The upper boundary for the range from which the random
83 * numbers will be picked. Must be within the [-1e9,1e9] range.
84 * @param {{replacement?: boolean, base?: number, pregeneratedRandomization?:
85 * Object}} options An object which may contains any of the following
86 * optional parameters:
87 * @param {boolean} [options.replacement=true] Specifies whether the random
88 * numbers should be picked with replacement. If true, the resulting numbers
89 * may contain duplicate values, otherwise the numbers will all be unique
90 * (default true).
91 * @param {number} [options.base=10] The base that will be used to display
92 * the numbers. Values allowed are 2, 8, 10 and 16 (default 10).
93 * @param {Object} [options.pregeneratedRandomization=null] A dictionary object
94 * which allows the client to specify that the random values should be
95 * generated from a pregenerated, historical randomization instead of a
96 * one-time on-the-fly randomization. There are three possible cases:
97 * * **null**: The standard way of calling for random values, i.e.true
98 * randomness is generated and discarded afterwards.
99 * * **date**: RANDOM.ORG uses historical true randomness generated on the
100 * corresponding date (past or present, format: { 'date', 'YYYY-MM-DD' }).
101 * * **id**: RANDOM.ORG uses historical true randomness derived from the
102 * corresponding identifier in a deterministic manner. Format: { 'id',
103 * 'PERSISTENT-IDENTIFIER' } where 'PERSISTENT-IDENTIFIER' is a string
104 * with length in the [1, 64] range.
105 * @returns {(Promise<number[]>|Promise<string[]>)} A Promise which, if
106 * resolved successfully, represents an array of true random integers.
107 * @throws {RandomOrgSendTimeoutError} Thrown when blocking timeout is exceeded
108 * before the request can be sent.
109 * @throws {RandomOrgKeyNotRunningError} Thrown when the API key has been
110 * stopped.
111 * @throws {RandomOrgInsufficientRequestsError} Thrown when the API key's server
112 * requests allowance has been exceeded.
113 * @throws {RandomOrgInsufficientBitsError} Thrown when the API key's server
114 * bits allowance has been exceeded.
115 * @throws {RandomOrgBadHTTPResponseError} Thrown when a HTTP 200 OK response
116 * is not received.
117 * @throws {RandomOrgRANDOMORGError} Thrown when the server returns a RANDOM.ORG
118 * Error.
119 * @throws {RandomOrgJSONRPCError} Thrown when the server returns a JSON-RPC Error.
120 * */
121 generateIntegers(n: number, min: number, max: number, options?: {
122 replacement?: boolean;
123 base?: number;
124 pregeneratedRandomization?: any;
125 }): (Promise<number[]> | Promise<string[]>);
126 /**
127 * Requests and returns an array of true random integer sequences within a
128 * user-defined range from the server.
129 *
130 * See: https://api.random.org/json-rpc/4/basic#generateIntegerSequences
131 * @param {number} n How many arrays of random integers you need. Must be
132 * within the [1,1e3] range.
133 * @param {(number|number[])} length The length of each array of random
134 * integers requested. For uniform sequences, length must be an integer
135 * in the [1, 1e4] range. For multiform sequences, length can be an array
136 * with n integers, each specifying the length of the sequence identified
137 * by its index. In this case, each value in length must be within the
138 * [1, 1e4] range and the total sum of all the lengths must be in the
139 * [1, 1e4] range.
140 * @param {(number|number[])} min The lower boundary for the range from which
141 * the random numbers will be picked. For uniform sequences, min must be
142 * an integer in the [-1e9, 1e9] range. For multiform sequences, min can
143 * be an array with n integers, each specifying the lower boundary of the
144 * sequence identified by its index. In this case, each value in min must
145 * be within the [-1e9, 1e9] range.
146 * @param {(number|number[])} max The upper boundary for the range from which
147 * the random numbers will be picked. For uniform sequences, max must be
148 * an integer in the [-1e9, 1e9] range. For multiform sequences, max can
149 * be an array with n integers, each specifying the upper boundary of the
150 * sequence identified by its index. In this case, each value in max must
151 * be within the [-1e9, 1e9] range.
152 * @param {{replacement?: boolean|boolean[], base?: number|number[],
153 * pregeneratedRandomization?: Object}} options An object which may contains
154 * any of the following optional parameters:
155 * @param {(boolean|boolean[])} [options.replacement=true] Specifies whether
156 * the random numbers should be picked with replacement. If true, the
157 * resulting numbers may contain duplicate values, otherwise the numbers
158 * will all be unique. For multiform sequences, replacement can be an array
159 * with n boolean values, each specifying whether the sequence identified
160 * by its index will be created with (true) or without (false) replacement
161 * (default true).
162 * @param {(number|number[])} [options.base=10] The base that will be used
163 * to display the numbers. Values allowed are 2, 8, 10 and 16. For multiform
164 * sequences, base can be an array with n integer values taken from the
165 * same set, each specifying the base that will be used to display the
166 * sequence identified by its index (default 10).
167 * @param {Object} [options.pregeneratedRandomization=null] A dictionary object
168 * which allows the client to specify that the random values should be
169 * generated from a pregenerated, historical randomization instead of a
170 * one-time on-the-fly randomization. There are three possible cases:
171 * * **null**: The standard way of calling for random values, i.e.true
172 * randomness is generated and discarded afterwards.
173 * * **date**: RANDOM.ORG uses historical true randomness generated on the
174 * corresponding date (past or present, format: { 'date', 'YYYY-MM-DD' }).
175 * * **id**: RANDOM.ORG uses historical true randomness derived from the
176 * corresponding identifier in a deterministic manner. Format: { 'id',
177 * 'PERSISTENT-IDENTIFIER' } where 'PERSISTENT-IDENTIFIER' is a string
178 * with length in the [1, 64] range.
179 * @returns {(Promise<number[][]>|Promise<string[][]>)} A Promise which, if
180 * resolved successfully, represents an array of true random integer
181 * sequences.
182 * @throws {RandomOrgSendTimeoutError} Thrown when blocking timeout is exceeded
183 * before the request can be sent.
184 * @throws {RandomOrgKeyNotRunningError} Thrown when the API key has been
185 * stopped.
186 * @throws {RandomOrgInsufficientRequestsError} Thrown when the API key's server
187 * requests allowance has been exceeded.
188 * @throws {RandomOrgInsufficientBitsError} Thrown when the API key's server
189 * bits allowance has been exceeded.
190 * @throws {RandomOrgBadHTTPResponseError} Thrown when a HTTP 200 OK response
191 * is not received.
192 * @throws {RandomOrgRANDOMORGError} Thrown when the server returns a RANDOM.ORG
193 * Error.
194 * @throws {RandomOrgJSONRPCError} Thrown when the server returns a JSON-RPC Error.
195 */
196 generateIntegerSequences(n: number, length: (number | number[]), min: (number | number[]), max: (number | number[]), options?: {
197 replacement?: boolean | boolean[];
198 base?: number | number[];
199 pregeneratedRandomization?: any;
200 }): (Promise<number[][]> | Promise<string[][]>);
201 /**
202 * Requests and returns a list (size n) of true random decimal fractions,
203 * from a uniform distribution across the [0,1] interval with a user-defined
204 * number of decimal places from the server.
205 *
206 * See: https://api.random.org/json-rpc/4/basic#generateDecimalFractions
207 * @param {number} n How many random decimal fractions you need. Must be
208 * within the [1,1e4] range.
209 * @param {number} decimalPlaces The number of decimal places to use. Must be
210 * within the [1,20] range.
211 * @param {{replacement?: boolean, pregeneratedRandomization?: Object}} options
212 * An object which may contains any of the following optional parameters:
213 * @param {boolean} [options.replacement=true] Specifies whether the random
214 * numbers should be picked with replacement. If true, the resulting numbers
215 * may contain duplicate values, otherwise the numbers will all be unique
216 * (default true).
217 * @param {Object} [options.pregeneratedRandomization=null] A dictionary object
218 * which allows the client to specify that the random values should be
219 * generated from a pregenerated, historical randomization instead of a
220 * one-time on-the-fly randomization. There are three possible cases:
221 * * **null**: The standard way of calling for random values, i.e.true
222 * randomness is generated and discarded afterwards.
223 * * **date**: RANDOM.ORG uses historical true randomness generated on the
224 * corresponding date (past or present, format: { 'date', 'YYYY-MM-DD' }).
225 * * **id**: RANDOM.ORG uses historical true randomness derived from the
226 * corresponding identifier in a deterministic manner. Format: { 'id',
227 * 'PERSISTENT-IDENTIFIER' } where 'PERSISTENT-IDENTIFIER' is a string
228 * with length in the [1, 64] range.
229 * @returns {Promise<number[]>} A Promise which, if resolved successfully,
230 * represents an array of true random decimal fractions.
231 * @throws {RandomOrgSendTimeoutError} Thrown when blocking timeout is exceeded
232 * before the request can be sent.
233 * @throws {RandomOrgKeyNotRunningError} Thrown when the API key has been
234 * stopped.
235 * @throws {RandomOrgInsufficientRequestsError} Thrown when the API key's server
236 * requests allowance has been exceeded.
237 * @throws {RandomOrgInsufficientBitsError} Thrown when the API key's server
238 * bits allowance has been exceeded.
239 * @throws {RandomOrgBadHTTPResponseError} Thrown when a HTTP 200 OK response
240 * is not received.
241 * @throws {RandomOrgRANDOMORGError} Thrown when the server returns a RANDOM.ORG
242 * Error.
243 * @throws {RandomOrgJSONRPCError} Thrown when the server returns a JSON-RPC Error.
244 */
245 generateDecimalFractions(n: number, decimalPlaces: number, options?: {
246 replacement?: boolean;
247 pregeneratedRandomization?: any;
248 }): Promise<number[]>;
249 /**
250 * Requests and returns a list (size n) of true random numbers from a
251 * Gaussian distribution (also known as a normal distribution).
252 *
253 * The form uses a Box-Muller Transform to generate the Gaussian distribution
254 * from uniformly distributed numbers.
255 * See: https://api.random.org/json-rpc/4/basic#generateGaussians
256 * @param {number} n How many random numbers you need. Must be within the
257 * [1,1e4] range.
258 * @param {number} mean The distribution's mean. Must be within the
259 * [-1e6,1e6] range.
260 * @param {number} standardDeviation The distribution's standard deviation.
261 * Must be within the [-1e6,1e6] range.
262 * @param {number} significantDigits The number of significant digits to use.
263 * Must be within the [2,20] range.
264 * @param {{pregeneratedRandomization?: Object}} options An object which may
265 * contains any of the following optional parameters:
266 * @param {Object} [options.pregeneratedRandomization=null] A dictionary object
267 * which allows the client to specify that the random values should be
268 * generated from a pregenerated, historical randomization instead of a
269 * one-time on-the-fly randomization. There are three possible cases:
270 * * **null**: The standard way of calling for random values, i.e.true
271 * randomness is generated and discarded afterwards.
272 * * **date**: RANDOM.ORG uses historical true randomness generated on the
273 * corresponding date (past or present, format: { 'date', 'YYYY-MM-DD' }).
274 * * **id**: RANDOM.ORG uses historical true randomness derived from the
275 * corresponding identifier in a deterministic manner. Format: { 'id',
276 * 'PERSISTENT-IDENTIFIER' } where 'PERSISTENT-IDENTIFIER' is a string
277 * with length in the [1, 64] range.
278 * @returns {Promise<number[]>} A Promise which, if resolved successfully,
279 * represents an array of true random numbers from a Gaussian distribution.
280 * @throws {RandomOrgSendTimeoutError} Thrown when blocking timeout is exceeded
281 * before the request can be sent.
282 * @throws {RandomOrgKeyNotRunningError} Thrown when the API key has been
283 * stopped.
284 * @throws {RandomOrgInsufficientRequestsError} Thrown when the API key's server
285 * requests allowance has been exceeded.
286 * @throws {RandomOrgInsufficientBitsError} Thrown when the API key's server
287 * bits allowance has been exceeded.
288 * @throws {RandomOrgBadHTTPResponseError} Thrown when a HTTP 200 OK response
289 * is not received.
290 * @throws {RandomOrgRANDOMORGError} Thrown when the server returns a RANDOM.ORG
291 * Error.
292 * @throws {RandomOrgJSONRPCError} Thrown when the server returns a JSON-RPC Error.
293 */
294 generateGaussians(n: number, mean: number, standardDeviation: number, significantDigits: number, options?: {
295 pregeneratedRandomization?: any;
296 }): Promise<number[]>;
297 /**
298 * Requests and returns a list (size n) of true random unicode strings from
299 * the server. See: https://api.random.org/json-rpc/4/basic#generateStrings
300 * @param {number} n How many random strings you need. Must be within the
301 * [1,1e4] range.
302 * @param {number} length The length of each string. Must be within the
303 * [1,20] range. All strings will be of the same length.
304 * @param {string} characters A string that contains the set of characters
305 * that are allowed to occur in the random strings. The maximum number
306 * of characters is 80.
307 * @param {{replacement?: boolean, pregeneratedRandomization?: Object}} options
308 * An object which may contains any of the following optional parameters:
309 * @param {boolean} [options.replacement=true] Specifies whether the random
310 * strings should be picked with replacement. If true, the resulting list
311 * of strings may contain duplicates, otherwise the strings will all be
312 * unique (default true).
313 * @param {Object} [options.pregeneratedRandomization=null] A dictionary object
314 * which allows the client to specify that the random values should be
315 * generated from a pregenerated, historical randomization instead of a
316 * one-time on-the-fly randomization. There are three possible cases:
317 * * **null**: The standard way of calling for random values, i.e.true
318 * randomness is generated and discarded afterwards.
319 * * **date**: RANDOM.ORG uses historical true randomness generated on the
320 * corresponding date (past or present, format: { 'date', 'YYYY-MM-DD' }).
321 * * **id**: RANDOM.ORG uses historical true randomness derived from the
322 * corresponding identifier in a deterministic manner. Format: { 'id',
323 * 'PERSISTENT-IDENTIFIER' } where 'PERSISTENT-IDENTIFIER' is a string
324 * with length in the [1, 64] range.
325 * @returns {Promise<string[]>} A Promise which, if resolved successfully,
326 * represents an array of true random strings.
327 * @throws {RandomOrgSendTimeoutError} Thrown when blocking timeout is exceeded
328 * before the request can be sent.
329 * @throws {RandomOrgKeyNotRunningError} Thrown when the API key has been
330 * stopped.
331 * @throws {RandomOrgInsufficientRequestsError} Thrown when the API key's server
332 * requests allowance has been exceeded.
333 * @throws {RandomOrgInsufficientBitsError} Thrown when the API key's server
334 * bits allowance has been exceeded.
335 * @throws {RandomOrgBadHTTPResponseError} Thrown when a HTTP 200 OK response
336 * is not received.
337 * @throws {RandomOrgRANDOMORGError} Thrown when the server returns a RANDOM.ORG
338 * Error.
339 * @throws {RandomOrgJSONRPCError} Thrown when the server returns a JSON-RPC Error.
340 */
341 generateStrings(n: number, length: number, characters: string, options?: {
342 replacement?: boolean;
343 pregeneratedRandomization?: any;
344 }): Promise<string[]>;
345 /**
346 * Requests and returns a list (size n) of version 4 true random Universally
347 * Unique IDentifiers (UUIDs) in accordance with section 4.4 of RFC 4122,
348 * from the server.
349 *
350 * See: https://api.random.org/json-rpc/4/basic#generateUUIDs
351 * @param {number} n How many random UUIDs you need. Must be within the
352 * [1,1e3] range.
353 * @param {{pregeneratedRandomization?: Object}} options An object which may
354 * contains any of the following optional parameters:
355 * @param {Object} [options.pregeneratedRandomization=null] A dictionary object
356 * which allows the client to specify that the random values should be
357 * generated from a pregenerated, historical randomization instead of a
358 * one-time on-the-fly randomization. There are three possible cases:
359 * * **null**: The standard way of calling for random values, i.e.true
360 * randomness is generated and discarded afterwards.
361 * * **date**: RANDOM.ORG uses historical true randomness generated on the
362 * corresponding date (past or present, format: { 'date', 'YYYY-MM-DD' }).
363 * * **id**: RANDOM.ORG uses historical true randomness derived from the
364 * corresponding identifier in a deterministic manner. Format: { 'id',
365 * 'PERSISTENT-IDENTIFIER' } where 'PERSISTENT-IDENTIFIER' is a string
366 * with length in the [1, 64] range.
367 * @returns {Promise<string[]>} A Promise which, if resolved successfully,
368 * represents an array of true random UUIDs.
369 * @throws {RandomOrgSendTimeoutError} Thrown when blocking timeout is exceeded
370 * before the request can be sent.
371 * @throws {RandomOrgKeyNotRunningError} Thrown when the API key has been
372 * stopped.
373 * @throws {RandomOrgInsufficientRequestsError} Thrown when the API key's server
374 * requests allowance has been exceeded.
375 * @throws {RandomOrgInsufficientBitsError} Thrown when the API key's server
376 * bits allowance has been exceeded.
377 * @throws {RandomOrgBadHTTPResponseError} Thrown when a HTTP 200 OK response
378 * is not received.
379 * @throws {RandomOrgRANDOMORGError} Thrown when the server returns a RANDOM.ORG
380 * Error.
381 * @throws {RandomOrgJSONRPCError} Thrown when the server returns a JSON-RPC Error.
382 */
383 generateUUIDs(n: number, options?: {
384 pregeneratedRandomization?: any;
385 }): Promise<string[]>;
386 /**
387 * Requests and returns a list (size n) of Binary Large OBjects (BLOBs)
388 * as unicode strings containing true random data from the server.
389 *
390 * See: https://api.random.org/json-rpc/4/basic#generateBlobs
391 * @param {number} n How many random blobs you need. Must be within the
392 * [1,100] range.
393 * @param {number} size The size of each blob, measured in bits. Must be
394 * within the [1,1048576] range and must be divisible by 8.
395 * @param {{format?: string, pregeneratedRandomization?: Object}} options
396 * An object which may contains any of the following optional parameters:
397 * @param {string} [options.format='base64'] Specifies the format in which
398 * the blobs will be returned. Values allowed are 'base64' and 'hex'
399 * (default 'base64').
400 * @param {Object} [options.pregeneratedRandomization=null] A dictionary object
401 * which allows the client to specify that the random values should be
402 * generated from a pregenerated, historical randomization instead of a
403 * one-time on-the-fly randomization. There are three possible cases:
404 * * **null**: The standard way of calling for random values, i.e.true
405 * randomness is generated and discarded afterwards.
406 * * **date**: RANDOM.ORG uses historical true randomness generated on the
407 * corresponding date (past or present, format: { 'date', 'YYYY-MM-DD' }).
408 * * **id**: RANDOM.ORG uses historical true randomness derived from the
409 * corresponding identifier in a deterministic manner. Format: { 'id',
410 * 'PERSISTENT-IDENTIFIER' } where 'PERSISTENT-IDENTIFIER' is a string
411 * with length in the [1, 64] range.
412 * @returns {Promise<number[]>} A Promise which, if resolved successfully,
413 * represents an array of true random blobs as strings.
414 * @see {@link RandomOrgClient#BLOB_FORMAT_BASE64} for 'base64' (default).
415 * @see {@link RandomOrgClient#BLOB_FORMAT_HEX} for 'hex'.
416 * @throws {RandomOrgSendTimeoutError} Thrown when blocking timeout is exceeded
417 * before the request can be sent.
418 * @throws {RandomOrgKeyNotRunningError} Thrown when the API key has been
419 * stopped.
420 * @throws {RandomOrgInsufficientRequestsError} Thrown when the API key's server
421 * requests allowance has been exceeded.
422 * @throws {RandomOrgInsufficientBitsError} Thrown when the API key's server
423 * bits allowance has been exceeded.
424 * @throws {RandomOrgBadHTTPResponseError} Thrown when a HTTP 200 OK response
425 * is not received.
426 * @throws {RandomOrgRANDOMORGError} Thrown when the server returns a RANDOM.ORG
427 * Error.
428 * @throws {RandomOrgJSONRPCError} Thrown when the server returns a JSON-RPC Error.
429 */
430 generateBlobs(n: number, size: number, options?: {
431 format?: string;
432 pregeneratedRandomization?: any;
433 }): Promise<number[]>;
434 /**
435 * Requests a list (size n) of true random integers within a user-defined
436 * range from the server.
437 *
438 * Returns a Promise which, if resolved successfully, respresents an object
439 * with the parsed integer list mapped to 'data', the original response mapped
440 * to 'random', and the response's signature mapped to 'signature'.
441 * See: https://api.random.org/json-rpc/4/signed#generateSignedIntegers
442 * @param {number} n How many random integers you need. Must be within the
443 * [1,1e4] range.
444 * @param {number} min The lower boundary for the range from which the
445 * random numbers will be picked. Must be within the [-1e9,1e9] range.
446 * @param {number} max The upper boundary for the range from which the
447 * random numbers will be picked. Must be within the [-1e9,1e9] range.
448 * @param {{replacement?: boolean, base?: number, pregeneratedRandomization?:
449 * Object, licenseData?: Object, userData?: Object|number|string, ticketId?:
450 * string}} options An object which may contains any of the following
451 * optional parameters:
452 * @param {boolean} [options.replacement=true] Specifies whether the random
453 * numbers should be picked with replacement. If true, the resulting numbers
454 * may contain duplicate values, otherwise the numbers will all be unique
455 * (default true).
456 * @param {number} [options.base=10] The base that will be used to display
457 * the numbers. Values allowed are 2, 8, 10 and 16 (default 10).
458 * @param {Object} [options.pregeneratedRandomization=null] A dictionary object
459 * which allows the client to specify that the random values should be
460 * generated from a pregenerated, historical randomization instead of a
461 * one-time on-the-fly randomization. There are three possible cases:
462 * * **null**: The standard way of calling for random values, i.e.true
463 * randomness is generated and discarded afterwards.
464 * * **date**: RANDOM.ORG uses historical true randomness generated on the
465 * corresponding date (past or present, format: { 'date', 'YYYY-MM-DD' }).
466 * * **id**: RANDOM.ORG uses historical true randomness derived from the
467 * corresponding identifier in a deterministic manner. Format: { 'id',
468 * 'PERSISTENT-IDENTIFIER' } where 'PERSISTENT-IDENTIFIER' is a string
469 * with length in the [1, 64] range.
470 * @param {Object} [options.licenseData=null] A dictionary object which allows
471 * the caller to include data of relevance to the license that is associated
472 * with the API Key. This is mandatory for API Keys with the license type
473 * 'Flexible Gambling' and follows the format { 'maxPayout': { 'currency':
474 * 'XTS', 'amount': 0.0 }}. This information is used in licensing
475 * requested random values and in billing. The currently supported
476 * currencies are: 'USD', 'EUR', 'GBP', 'BTC', 'ETH'. The most up-to-date
477 * information on the currencies can be found in the Signed API
478 * documentation, here: https://api.random.org/json-rpc/4/signed
479 * @param {(string|number|Object)} [options.userData=null] Object that will be
480 * included in unmodified form. Its maximum size in encoded (string) form is
481 * 1,000 characters (default null).
482 * @param {string} [options.ticketId=null] A string with ticket identifier obtained
483 * via the {@link RandomOrgClient#createTickets} method. Specifying a value
484 * for ticketId will cause RANDOM.ORG to record that the ticket was used
485 * to generate the requested random values. Each ticket can only be used
486 * once (default null).
487 * @returns {Promise<{data: number[]|string[], random: Object, signature: string}>}
488 * A Promise which, if resolved successfully, represents an object with the
489 * following structure:
490 * * **data**: array of true random integers
491 * * **random**: random field as returned from the server
492 * * **signature**: signature string
493 * @throws {RandomOrgSendTimeoutError} Thrown when blocking timeout is exceeded
494 * before the request can be sent.
495 * @throws {RandomOrgKeyNotRunningError} Thrown when the API key has been
496 * stopped.
497 * @throws {RandomOrgInsufficientRequestsError} Thrown when the API key's server
498 * requests allowance has been exceeded.
499 * @throws {RandomOrgInsufficientBitsError} Thrown when the API key's server
500 * bits allowance has been exceeded.
501 * @throws {RandomOrgBadHTTPResponseError} Thrown when a HTTP 200 OK response
502 * is not received.
503 * @throws {RandomOrgRANDOMORGError} Thrown when the server returns a RANDOM.ORG
504 * Error.
505 * @throws {RandomOrgJSONRPCError} Thrown when the server returns a JSON-RPC Error.
506 */
507 generateSignedIntegers(n: number, min: number, max: number, options?: {
508 replacement?: boolean;
509 base?: number;
510 pregeneratedRandomization?: any;
511 licenseData?: any;
512 userData?: any | number | string;
513 ticketId?: string;
514 }): Promise<{
515 data: number[] | string[];
516 random: any;
517 signature: string;
518 }>;
519 /**
520 * Requests and returns uniform or multiform sequences of true random integers
521 * within user-defined ranges from the server.
522 *
523 * Returns a Promise which, if resolved successfully, respresents an object
524 * with the parsed array of integer sequences mapped to 'data', the original
525 * response mapped to 'random', and the response's signature mapped to
526 * 'signature'.
527 * See: https://api.random.org/json-rpc/4/signed#generateIntegerSequences
528 * @param {number} n How many arrays of random integers you need. Must be
529 * within the [1,1e3] range.
530 * @param {(number|number[])} length The length of each array of random
531 * integers requested. For uniform sequences, length must be an integer
532 * in the [1, 1e4] range. For multiform sequences, length can be an array
533 * with n integers, each specifying the length of the sequence identified
534 * by its index. In this case, each value in length must be within the
535 * [1, 1e4] range and the total sum of all the lengths must be in the
536 * [1, 1e4] range.
537 * @param {(number|number[])} min The lower boundary for the range from which
538 * the random numbers will be picked. For uniform sequences, min must be
539 * an integer in the [-1e9, 1e9] range. For multiform sequences, min can
540 * be an array with n integers, each specifying the lower boundary of the
541 * sequence identified by its index. In this case, each value in min must
542 * be within the [-1e9, 1e9] range.
543 * @param {(number|number[])} max The upper boundary for the range from which
544 * the random numbers will be picked. For uniform sequences, max must be
545 * an integer in the [-1e9, 1e9] range. For multiform sequences, max can
546 * be an array with n integers, each specifying the upper boundary of the
547 * sequence identified by its index. In this case, each value in max must
548 * be within the [-1e9, 1e9] range.
549 * @param {{replacement?: boolean|boolean[], base?: number|number[],
550 * pregeneratedRandomization?: Object, licenseData?: Object, userData?:
551 * Object|number|string, ticketId?: string}} options An object which may
552 * contains any of the following optional parameters:
553 * @param {(boolean|boolean[])} [options.replacement=true] Specifies whether
554 * the random numbers should be picked with replacement. If true, the
555 * resulting numbers may contain duplicate values, otherwise the numbers
556 * will all be unique. For multiform sequences, replacement can be an array
557 * with n boolean values, each specifying whether the sequence identified by
558 * its index will be created with (true) or without (false) replacement
559 * (default true).
560 * @param {(number|number[])} [options.base=10] The base that will be used to
561 * display the numbers. Values allowed are 2, 8, 10 and 16. For multiform
562 * sequences, base can be an array with n integer values taken from the same
563 * set, each specifying the base that will be used to display the sequence
564 * identified by its index (default 10).
565 * @param {Object} [options.pregeneratedRandomization=null] A dictionary object
566 * which allows the client to specify that the random values should be
567 * generated from a pregenerated, historical randomization instead of a
568 * one-time on-the-fly randomization. There are three possible cases:
569 * * **null**: The standard way of calling for random values, i.e.true
570 * randomness is generated and discarded afterwards.
571 * * **date**: RANDOM.ORG uses historical true randomness generated on the
572 * corresponding date (past or present, format: { 'date', 'YYYY-MM-DD' }).
573 * * **id**: RANDOM.ORG uses historical true randomness derived from the
574 * corresponding identifier in a deterministic manner. Format: { 'id',
575 * 'PERSISTENT-IDENTIFIER' } where 'PERSISTENT-IDENTIFIER' is a string
576 * with length in the [1, 64] range.
577 * @param {Object} [options.licenseData=null] A dictionary object which allows
578 * the caller to include data of relevance to the license that is associated
579 * with the API Key. This is mandatory for API Keys with the license type
580 * 'Flexible Gambling' and follows the format { 'maxPayout': { 'currency':
581 * 'XTS', 'amount': 0.0 }}. This information is used in licensing
582 * requested random values and in billing. The currently supported
583 * currencies are: 'USD', 'EUR', 'GBP', 'BTC', 'ETH'. The most up-to-date
584 * information on the currencies can be found in the Signed API
585 * documentation, here: https://api.random.org/json-rpc/4/signed
586 * @param {(string|number|Object)} [options.userData=null] Object that will be
587 * included in unmodified form. Its maximum size in encoded (String) form
588 * is 1,000 characters (default null).
589 * @param {string} [options.ticketId=null] A string with ticket identifier
590 * obtained via the {@link RandomOrgClient#createTickets} method. Specifying
591 * a value for ticketId will cause RANDOM.ORG to record that the ticket was
592 * used to generate the requested random values. Each ticket can only be used
593 * once (default null).
594 * @returns {Promise<{data: number[][]|string[][], random: Object, signature: string}>}
595 * A Promise which, if resolved successfully, represents an object with the
596 * following structure:
597 * * **data**: array of true random integer sequences
598 * * **random**: random field as returned from the server
599 * * **signature**: signature string
600 * @throws {RandomOrgSendTimeoutError} Thrown when blocking timeout is exceeded
601 * before the request can be sent.
602 * @throws {RandomOrgKeyNotRunningError} Thrown when the API key has been
603 * stopped.
604 * @throws {RandomOrgInsufficientRequestsError} Thrown when the API key's server
605 * requests allowance has been exceeded.
606 * @throws {RandomOrgInsufficientBitsError} Thrown when the API key's server
607 * bits allowance has been exceeded.
608 * @throws {RandomOrgBadHTTPResponseError} Thrown when a HTTP 200 OK response
609 * is not received.
610 * @throws {RandomOrgRANDOMORGError} Thrown when the server returns a RANDOM.ORG
611 * Error.
612 * @throws {RandomOrgJSONRPCError} Thrown when the server returns a JSON-RPC Error.
613 */
614 generateSignedIntegerSequences(n: number, length: (number | number[]), min: (number | number[]), max: (number | number[]), options?: {
615 replacement?: boolean | boolean[];
616 base?: number | number[];
617 pregeneratedRandomization?: any;
618 licenseData?: any;
619 userData?: any | number | string;
620 ticketId?: string;
621 }): Promise<{
622 data: number[][] | string[][];
623 random: any;
624 signature: string;
625 }>;
626 /**
627 * Request a list (size n) of true random decimal fractions, from a uniform
628 * distribution across the [0,1] interval with a user-defined number of
629 * decimal places from the server.
630 *
631 * Returns a Promise which, if resolved successfully, respresents an object
632 * with the parsed decimal fractions mapped to 'data', the original response
633 * mapped to 'random', and the response's signature mapped to 'signature'. See:
634 * https://api.random.org/json-rpc/4/signed#generateSignedDecimalFractions
635 * @param {number} n How many random decimal fractions you need. Must be
636 * within the [1,1e4] range.
637 * @param {number} decimalPlaces The number of decimal places to use. Must
638 * be within the [1,20] range.
639 * @param {{replacement?: boolean, pregeneratedRandomization?: Object, licenseData?:
640 * Object, userData?: Object|number|string, ticketId?: string}} options An
641 * object which may contains any of the following optional parameters:
642 * @param {boolean} [options.replacement=true] Specifies whether the random
643 * numbers should be picked with replacement. If true, the resulting numbers
644 * may contain duplicate values, otherwise the numbers will all be unique
645 * (default true).
646 * @param {Object} [options.pregeneratedRandomization=null] A dictionary object
647 * which allows the client to specify that the random values should be
648 * generated from a pregenerated, historical randomization instead of a
649 * one-time on-the-fly randomization. There are three possible cases:
650 * * **null**: The standard way of calling for random values, i.e.true
651 * randomness is generated and discarded afterwards.
652 * * **date**: RANDOM.ORG uses historical true randomness generated on the
653 * corresponding date (past or present, format: { 'date', 'YYYY-MM-DD' }).
654 * * **id**: RANDOM.ORG uses historical true randomness derived from the
655 * corresponding identifier in a deterministic manner. Format: { 'id',
656 * 'PERSISTENT-IDENTIFIER' } where 'PERSISTENT-IDENTIFIER' is a string
657 * with length in the [1, 64] range.
658 * @param {Object} [options.licenseData=null] A dictionary object which allows
659 * the caller to include data of relevance to the license that is associated
660 * with the API Key. This is mandatory for API Keys with the license type
661 * 'Flexible Gambling' and follows the format { 'maxPayout': { 'currency':
662 * 'XTS', 'amount': 0.0 }}. This information is used in licensing
663 * requested random values and in billing. The currently supported
664 * currencies are: 'USD', 'EUR', 'GBP', 'BTC', 'ETH'. The most up-to-date
665 * information on the currencies can be found in the Signed API
666 * documentation, here: https://api.random.org/json-rpc/4/signed
667 * @param {(string|number|Object)} [options.userData=null] Object that will be
668 * included in unmodified form. Its maximum size in encoded (String) form
669 * is 1,000 characters (default null).
670 * @param {string} [options.ticketId=null] A string with ticket identifier
671 * obtained via the {@link RandomOrgClient#createTickets} method. Specifying
672 * a value for ticketId will cause RANDOM.ORG to record that the ticket was
673 * used to generate the requested random values. Each ticket can only be used
674 * once (default null).
675 * @returns {Promise<{data: number[], random: Object, signature: string}>} A
676 * Promise which, if resolved successfully, represents an object with the
677 * following structure:
678 * * **data**: array of true random decimal fractions
679 * * **random**: random field as returned from the server
680 * * **signature**: signature string
681 * @throws {RandomOrgSendTimeoutError} Thrown when blocking timeout is exceeded
682 * before the request can be sent.
683 * @throws {RandomOrgKeyNotRunningError} Thrown when the API key has been
684 * stopped.
685 * @throws {RandomOrgInsufficientRequestsError} Thrown when the API key's server
686 * requests allowance has been exceeded.
687 * @throws {RandomOrgInsufficientBitsError} Thrown when the API key's server
688 * bits allowance has been exceeded.
689 * @throws {RandomOrgBadHTTPResponseError} Thrown when a HTTP 200 OK response
690 * is not received.
691 * @throws {RandomOrgRANDOMORGError} Thrown when the server returns a RANDOM.ORG
692 * Error.
693 * @throws {RandomOrgJSONRPCError} Thrown when the server returns a JSON-RPC Error.
694 */
695 generateSignedDecimalFractions(n: number, decimalPlaces: number, options?: {
696 replacement?: boolean;
697 pregeneratedRandomization?: any;
698 licenseData?: any;
699 userData?: any | number | string;
700 ticketId?: string;
701 }): Promise<{
702 data: number[];
703 random: any;
704 signature: string;
705 }>;
706 /**
707 * Request a list (size n) of true random numbers from a Gaussian distribution
708 * (also known as a normal distribution).
709 *
710 * Returns a Promise which, if resolved successfully, respresents an object
711 * with the parsed numbers mapped to 'data', the original response mapped to
712 * 'random', and the response's signature mapped to 'signature'. See:
713 * https://api.random.org/json-rpc/4/signed#generateSignedGaussians
714 * @param {number} n How many random numbers you need. Must be within the
715 * [1,1e4] range.
716 * @param {number} mean The distribution's mean. Must be within the [-1e6,1e6]
717 * range.
718 * @param {number} standardDeviation The distribution's standard deviation.
719 * Must be within the [-1e6,1e6] range.
720 * @param {number} significantDigits The number of significant digits to use.
721 * Must be within the [2,20] range.
722 * @param {{pregeneratedRandomization?: Object, licenseData?: Object, userData?:
723 * Object|number|string, ticketId?: string}} options An object which may
724 * contains any of the following optional parameters:
725 * @param {Object} [options.pregeneratedRandomization=null] A dictionary object
726 * which allows the client to specify that the random values should be
727 * generated from a pregenerated, historical randomization instead of a
728 * one-time on-the-fly randomization. There are three possible cases:
729 * * **null**: The standard way of calling for random values, i.e.true
730 * randomness is generated and discarded afterwards.
731 * * **date**: RANDOM.ORG uses historical true randomness generated on the
732 * corresponding date (past or present, format: { 'date', 'YYYY-MM-DD' }).
733 * * **id**: RANDOM.ORG uses historical true randomness derived from the
734 * corresponding identifier in a deterministic manner. Format: { 'id',
735 * 'PERSISTENT-IDENTIFIER' } where 'PERSISTENT-IDENTIFIER' is a string
736 * with length in the [1, 64] range.
737 * @param {Object} [options.licenseData=null] A dictionary object which allows
738 * the caller to include data of relevance to the license that is associated
739 * with the API Key. This is mandatory for API Keys with the license type
740 * 'Flexible Gambling' and follows the format { 'maxPayout': { 'currency':
741 * 'XTS', 'amount': 0.0 }}. This information is used in licensing
742 * requested random values and in billing. The currently supported
743 * currencies are: 'USD', 'EUR', 'GBP', 'BTC', 'ETH'. The most up-to-date
744 * information on the currencies can be found in the Signed API
745 * documentation, here: https://api.random.org/json-rpc/4/signed
746 * @param {(string|number|Object)} [options.userData=null] Object that will be
747 * included in unmodified form. Its maximum size in encoded (String) form
748 * is 1,000 characters (default null).
749 * @param {string} [options.ticketId=null] A string with ticket identifier
750 * obtained via the {@link RandomOrgClient#createTickets} method. Specifying
751 * a value for ticketId will cause RANDOM.ORG to record that the ticket was
752 * used to generate the requested random values. Each ticket can only be used
753 * once (default null).
754 * @returns {Promise<{data: number[], random: Object, signature: string}>} A
755 * Promise which, if resolved successfully, represents an object with the
756 * following structure:
757 * * **data**: array of true random numbers from a Gaussian distribution
758 * * **random**: random field as returned from the server
759 * * **signature**: signature string
760 * @throws {RandomOrgSendTimeoutError} Thrown when blocking timeout is exceeded
761 * before the request can be sent.
762 * @throws {RandomOrgKeyNotRunningError} Thrown when the API key has been
763 * stopped.
764 * @throws {RandomOrgInsufficientRequestsError} Thrown when the API key's server
765 * requests allowance has been exceeded.
766 * @throws {RandomOrgInsufficientBitsError} Thrown when the API key's server
767 * bits allowance has been exceeded.
768 * @throws {RandomOrgBadHTTPResponseError} Thrown when a HTTP 200 OK response
769 * is not received.
770 * @throws {RandomOrgRANDOMORGError} Thrown when the server returns a RANDOM.ORG
771 * Error.
772 * @throws {RandomOrgJSONRPCError} Thrown when the server returns a JSON-RPC Error.
773 */
774 generateSignedGaussians(n: number, mean: number, standardDeviation: number, significantDigits: number, options?: {
775 pregeneratedRandomization?: any;
776 licenseData?: any;
777 userData?: any | number | string;
778 ticketId?: string;
779 }): Promise<{
780 data: number[];
781 random: any;
782 signature: string;
783 }>;
784 /**
785 * Request a list (size n) of true random strings from the server.
786 *
787 * Returns a Promise which, if resolved successfully, respresents an object
788 * with the parsed strings mapped to 'data', the original response mapped to
789 * 'random', and the response's signature mapped to 'signature'. See:
790 * https://api.random.org/json-rpc/4/signed#generateSignedStrings
791 * @param {number} n How many random strings you need. Must be within the
792 * [1,1e4] range.
793 * @param {number} length The length of each string. Must be within the [1,20]
794 * range. All strings will be of the same length.
795 * @param {string} characters A string that contains the set of characters
796 * that are allowed to occur in the random strings. The maximum number
797 * of characters is 80.
798 * @param {{replacement?: boolean, pregeneratedRandomization?: Object, licenseData?:
799 * Object, userData?: Object|number|string, ticketId?: string}} options An
800 * object which may contains any of the following optional parameters:
801 * @param {boolean} [options.replacement=null] Specifies whether the random
802 * strings should be picked with replacement. If true, the resulting list
803 * of strings may contain duplicates, otherwise the strings will all be
804 * unique (default true).
805 * @param {Object} [options.pregeneratedRandomization=null] A dictionary object
806 * which allows the client to specify that the random values should be
807 * generated from a pregenerated, historical randomization instead of a
808 * one-time on-the-fly randomization. There are three possible cases:
809 * * **null**: The standard way of calling for random values, i.e.true
810 * randomness is generated and discarded afterwards.
811 * * **date**: RANDOM.ORG uses historical true randomness generated on the
812 * corresponding date (past or present, format: { 'date', 'YYYY-MM-DD' }).
813 * * **id**: RANDOM.ORG uses historical true randomness derived from the
814 * corresponding identifier in a deterministic manner. Format: { 'id',
815 * 'PERSISTENT-IDENTIFIER' } where 'PERSISTENT-IDENTIFIER' is a string
816 * with length in the [1, 64] range.
817 * @param {Object} [options.licenseData=null] A dictionary object which allows
818 * the caller to include data of relevance to the license that is associated
819 * with the API Key. This is mandatory for API Keys with the license type
820 * 'Flexible Gambling' and follows the format { 'maxPayout': { 'currency':
821 * 'XTS', 'amount': 0.0 }}. This information is used in licensing
822 * requested random values and in billing. The currently supported
823 * currencies are: 'USD', 'EUR', 'GBP', 'BTC', 'ETH'. The most up-to-date
824 * information on the currencies can be found in the Signed API
825 * documentation, here: https://api.random.org/json-rpc/4/signed
826 * @param {(string|number|Object)} [options.userData=null] Object that will be
827 * included in unmodified form. Its maximum size in encoded (String) form
828 * is 1,000 characters (default null).
829 * @param {string} [options.ticketId=null] A string with ticket identifier
830 * obtained via the {@link RandomOrgClient#createTickets} method. Specifying
831 * a value for ticketId will cause RANDOM.ORG to record that the ticket was
832 * used to generate the requested random values. Each ticket can only be used
833 * once (default null).
834 * @returns {Promise<{data: string[], random: Object, signature: string}>} A
835 * Promise which, if resolved successfully, represents an object with the
836 * following structure:
837 * * **data**: array of true random strings
838 * * **random**: random field as returned from the server
839 * * **signature**: signature string
840 * @throws {RandomOrgSendTimeoutError} Thrown when blocking timeout is exceeded
841 * before the request can be sent.
842 * @throws {RandomOrgKeyNotRunningError} Thrown when the API key has been
843 * stopped.
844 * @throws {RandomOrgInsufficientRequestsError} Thrown when the API key's server
845 * requests allowance has been exceeded.
846 * @throws {RandomOrgInsufficientBitsError} Thrown when the API key's server
847 * bits allowance has been exceeded.
848 * @throws {RandomOrgBadHTTPResponseError} Thrown when a HTTP 200 OK response
849 * is not received.
850 * @throws {RandomOrgRANDOMORGError} Thrown when the server returns a RANDOM.ORG
851 * Error.
852 * @throws {RandomOrgJSONRPCError} Thrown when the server returns a JSON-RPC Error.
853 */
854 generateSignedStrings(n: number, length: number, characters: string, options?: {
855 replacement?: boolean;
856 pregeneratedRandomization?: any;
857 licenseData?: any;
858 userData?: any | number | string;
859 ticketId?: string;
860 }): Promise<{
861 data: string[];
862 random: any;
863 signature: string;
864 }>;
865 /**
866 * Request a list (size n) of version 4 true random Universally Unique
867 * IDentifiers (UUIDs) in accordance with section 4.4 of RFC 4122, from
868 * the server.
869 *
870 * Returns a Promise which, if resolved successfully, respresents an object
871 * with the parsed UUIDs mapped to 'data', the original response mapped to
872 * 'random', and the response's signature mapped to 'signature'. See:
873 * https://api.random.org/json-rpc/4/signed#generateSignedUUIDs
874 * @param {number} n How many random UUIDs you need. Must be within the
875 * [1,1e3] range.
876 * @param {{pregeneratedRandomization?: Object, licenseData?: Object, userData?:
877 * Object|string|number, ticketId?: string}} options An object which may
878 * contain any of the following optional parameters:
879 * @param {Object} [options.pregeneratedRandomization=null] A dictionary object
880 * which allows the client to specify that the random values should be
881 * generated from a pregenerated, historical randomization instead of a
882 * one-time on-the-fly randomization. There are three possible cases:
883 * * **null**: The standard way of calling for random values, i.e.true
884 * randomness is generated and discarded afterwards.
885 * * **date**: RANDOM.ORG uses historical true randomness generated on the
886 * corresponding date (past or present, format: { 'date', 'YYYY-MM-DD' }).
887 * * **id**: RANDOM.ORG uses historical true randomness derived from the
888 * corresponding identifier in a deterministic manner. Format: { 'id',
889 * 'PERSISTENT-IDENTIFIER' } where 'PERSISTENT-IDENTIFIER' is a string
890 * with length in the [1, 64] range.
891 * @param {Object} [options.licenseData=null] A dictionary object which allows
892 * the caller to include data of relevance to the license that is associated
893 * with the API Key. This is mandatory for API Keys with the license type
894 * 'Flexible Gambling' and follows the format { 'maxPayout': { 'currency':
895 * 'XTS', 'amount': 0.0 }}. This information is used in licensing
896 * requested random values and in billing. The currently supported
897 * currencies are: 'USD', 'EUR', 'GBP', 'BTC', 'ETH'. The most up-to-date
898 * information on the currencies can be found in the Signed API
899 * documentation, here: https://api.random.org/json-rpc/4/signed
900 * @param {(string|number|Object)} [options.userData=null] Object that will be
901 * included in unmodified form. Its maximum size in encoded (String) form
902 * is 1,000 characters (default null).
903 * @param {string} [options.ticketId=null] A string with ticket identifier
904 * obtained via the {@link RandomOrgClient#createTickets} method. Specifying
905 * a value for ticketId will cause RANDOM.ORG to record that the ticket was
906 * used to generate the requested random values. Each ticket can only be used
907 * once (default null).
908 * @returns {Promise<{data: string[], random: Object, signature: string}>} A
909 * Promise which, if resolved successfully, represents an object with the
910 * following structure:
911 * * **data**: array of true random UUIDs
912 * * **random**: random field as returned from the server
913 * * **signature**: signature string
914 * @throws {RandomOrgSendTimeoutError} Thrown when blocking timeout is exceeded
915 * before the request can be sent.
916 * @throws {RandomOrgKeyNotRunningError} Thrown when the API key has been
917 * stopped.
918 * @throws {RandomOrgInsufficientRequestsError} Thrown when the API key's server
919 * requests allowance has been exceeded.
920 * @throws {RandomOrgInsufficientBitsError} Thrown when the API key's server
921 * bits allowance has been exceeded.
922 * @throws {RandomOrgBadHTTPResponseError} Thrown when a HTTP 200 OK response
923 * is not received.
924 * @throws {RandomOrgRANDOMORGError} Thrown when the server returns a RANDOM.ORG
925 * Error.
926 * @throws {RandomOrgJSONRPCError} Thrown when the server returns a JSON-RPC Error.
927 */
928 generateSignedUUIDs(n: number, options?: {
929 pregeneratedRandomization?: any;
930 licenseData?: any;
931 userData?: any | string | number;
932 ticketId?: string;
933 }): Promise<{
934 data: string[];
935 random: any;
936 signature: string;
937 }>;
938 /**
939 * Request a list (size n) of Binary Large OBjects (BLOBs) containing true
940 * random data from the server.
941 *
942 * Returns a Promise which, if resolved successfully, respresents an object
943 * with the parsed BLOBs mapped to 'data', the original response mapped to
944 * 'random', and the response's signature mapped to 'signature'. See:
945 * https://api.random.org/json-rpc/4/signed#generateSignedBlobs
946 * @param {number} n How many random blobs you need. Must be within the
947 * [1,100] range.
948 * @param {number} size The size of each blob, measured in bits. Must be
949 * within the [1,1048576] range and must be divisible by 8.
950 * @param {{format?: string, pregeneratedRandomization?: Object, licenseData?:
951 * Object, userData?: Object|number|string, ticketId?: string}} options An
952 * object which may contain any of the following optional parameters:
953 * @param {string} [options.format='base64'] Specifies the format in which the
954 * blobs will be returned. Values allowed are 'base64' and 'hex' (default
955 * 'base64').
956 * @param {Object} [options.pregeneratedRandomization=null] A dictionary object
957 * which allows the client to specify that the random values should be
958 * generated from a pregenerated, historical randomization instead of a
959 * one-time on-the-fly randomization. There are three possible cases:
960 * * **null**: The standard way of calling for random values, i.e.true
961 * randomness is generated and discarded afterwards.
962 * * **date**: RANDOM.ORG uses historical true randomness generated on the
963 * corresponding date (past or present, format: { 'date', 'YYYY-MM-DD' }).
964 * * **id**: RANDOM.ORG uses historical true randomness derived from the
965 * corresponding identifier in a deterministic manner. Format: { 'id',
966 * 'PERSISTENT-IDENTIFIER' } where 'PERSISTENT-IDENTIFIER' is a string
967 * with length in the [1, 64] range.
968 * @param {Object} [options.licenseData=null] A dictionary object which allows
969 * the caller to include data of relevance to the license that is associated
970 * with the API Key. This is mandatory for API Keys with the license type
971 * 'Flexible Gambling' and follows the format { 'maxPayout': { 'currency':
972 * 'XTS', 'amount': 0.0 }}. This information is used in licensing
973 * requested random values and in billing. The currently supported
974 * currencies are: 'USD', 'EUR', 'GBP', 'BTC', 'ETH'. The most up-to-date
975 * information on the currencies can be found in the Signed API
976 * documentation, here: https://api.random.org/json-rpc/4/signed
977 * @param {(string|number|Object)} [options.userData=null] Object that will be
978 * included in unmodified form. Its maximum size in encoded (String) form is
979 * 1,000 characters (default null).
980 * @param {string} [options.ticketId=null] A string with ticket identifier
981 * obtained via the {@link RandomOrgClient#createTickets} method. Specifying
982 * a value for ticketId will cause RANDOM.ORG to record that the ticket was
983 * used to generate the requested random values. Each ticket can only be used
984 * once (default null).
985 * @returns {Promise<{data: string[], random: Object, signature: string}>} A
986 * Promise which, if resolved successfully, represents an object with the
987 * following structure:
988 * * **data**: array of true random blobs as strings
989 * * **random**: random field as returned from the server
990 * * **signature**: signature string
991 * @see {@link RandomOrgClient#BLOB_FORMAT_BASE64} for 'base64' (default).
992 * @see {@link RandomOrgClient#BLOB_FORMAT_HEX} for 'hex'.
993 * @throws {RandomOrgSendTimeoutError} Thrown when blocking timeout is exceeded
994 * before the request can be sent.
995 * @throws {RandomOrgKeyNotRunningError} Thrown when the API key has been
996 * stopped.
997 * @throws {RandomOrgInsufficientRequestsError} Thrown when the API key's server
998 * requests allowance has been exceeded.
999 * @throws {RandomOrgInsufficientBitsError} Thrown when the API key's server
1000 * bits allowance has been exceeded.
1001 * @throws {RandomOrgBadHTTPResponseError} Thrown when a HTTP 200 OK response
1002 * is not received.
1003 * @throws {RandomOrgRANDOMORGError} Thrown when the server returns a RANDOM.ORG
1004 * Error.
1005 * @throws {RandomOrgJSONRPCError} Thrown when the server returns a JSON-RPC Error.
1006 */
1007 generateSignedBlobs(n: number, size: number, options?: {
1008 format?: string;
1009 pregeneratedRandomization?: any;
1010 licenseData?: any;
1011 userData?: any | number | string;
1012 ticketId?: string;
1013 }): Promise<{
1014 data: string[];
1015 random: any;
1016 signature: string;
1017 }>;
1018 /**
1019 * Verifies the signature of a response previously received from one of the
1020 * methods in the Signed API with the server.
1021 *
1022 * This is used to examine the authenticity of numbers. Returns True on
1023 * verification success. See:
1024 * https://api.random.org/json-rpc/4/signed#verifySignature
1025 * @param {Object} random The random field from a response returned by RANDOM.ORG
1026 * through one of the Signed API methods.
1027 * @param {string} signature The signature field from the same response that
1028 * the random field originates from.
1029 * @returns {Promise<boolean>} A Promise which, if resolved successfully,
1030 * represents whether the result could be verified (true) or not (false).
1031 * @throws {RandomOrgSendTimeoutError} Thrown when blocking timeout is exceeded
1032 * before the request can be sent.
1033 * @throws {RandomOrgKeyNotRunningError} Thrown when the API key has been
1034 * stopped.
1035 * @throws {RandomOrgInsufficientRequestsError} Thrown when the API key's server
1036 * requests allowance has been exceeded.
1037 * @throws {RandomOrgInsufficientBitsError} Thrown when the API key's server
1038 * bits allowance has been exceeded.
1039 * @throws {RandomOrgBadHTTPResponseError} Thrown when a HTTP 200 OK response
1040 * is not received.
1041 * @throws {RandomOrgRANDOMORGError} Thrown when the server returns a RANDOM.ORG
1042 * Error.
1043 * @throws {RandomOrgJSONRPCError} Thrown when the server returns a JSON-RPC Error.
1044 */
1045 verifySignature(random: any, signature: string): Promise<boolean>;
1046 /**
1047 * Returns the (estimated) number of remaining true random bits available to
1048 * the client. If cached usage info is older than an hour, fresh info is
1049 * obtained from the server.
1050 * @returns {Promise<number>} A Promise which, if resolved successfully,
1051 * represents the number of bits remaining.
1052 * @throws {RandomOrgSendTimeoutError} Thrown when blocking timeout is exceeded
1053 * before the request can be sent.
1054 * @throws {RandomOrgKeyNotRunningError} Thrown when the API key has been
1055 * stopped.
1056 * @throws {RandomOrgInsufficientRequestsError} Thrown when the API key's server
1057 * requests allowance has been exceeded.
1058 * @throws {RandomOrgInsufficientBitsError} Thrown when the API key's server
1059 * bits allowance has been exceeded.
1060 * @throws {RandomOrgBadHTTPResponseError} Thrown when a HTTP 200 OK response
1061 * is not received.
1062 * @throws {RandomOrgRANDOMORGError} Thrown when the server returns a RANDOM.ORG
1063 * Error.
1064 * @throws {RandomOrgJSONRPCError} Thrown when the server returns a JSON-RPC Error.
1065 */
1066 getBitsLeft(): Promise<number>;
1067 /**
1068 * Returns the (estimated) number of remaining API requests available to the
1069 * client. If cached usage info is older than an hour, fresh info is
1070 * obtained from the server.
1071 * @returns {Promise<number>} A Promise which, if resolved successfully,
1072 * represents the number of requests remaining.
1073 * @throws {RandomOrgSendTimeoutError} Thrown when blocking timeout is exceeded
1074 * before the request can be sent.
1075 * @throws {RandomOrgKeyNotRunningError} Thrown when the API key has been
1076 * stopped.
1077 * @throws {RandomOrgInsufficientRequestsError} Thrown when the API key's server
1078 * requests allowance has been exceeded.
1079 * @throws {RandomOrgInsufficientBitsError} Thrown when the API key's server
1080 * bits allowance has been exceeded.
1081 * @throws {RandomOrgBadHTTPResponseError} Thrown when a HTTP 200 OK response
1082 * is not received.
1083 * @throws {RandomOrgRANDOMORGError} Thrown when the server returns a RANDOM.ORG
1084 * Error.
1085 * @throws {RandomOrgJSONRPCError} Thrown when the server returns a JSON-RPC Error.
1086 */
1087 getRequestsLeft(): Promise<number>;
1088 /**
1089 * Retrieves signed random values generated within the last 24h, using a
1090 * serial number.
1091 *
1092 * If the historical response was found, the response will contain the same
1093 * values that were returned by the method that was used to generate the values
1094 * initially. See: https://api.random.org/json-rpc/4/signed#getResult
1095 * @param {number} serialNumber An integer containing the serial number
1096 * associated with the response you wish to retrieve.
1097 * @returns {Promise<Object>} A Promise which, if resolved successfully,
1098 * represents an object with the following structure, identical to that
1099 * returned by the original request:
1100 * * **data**: array of true random values
1101 * * **random**: random field as returned from the server
1102 * * **signature**: signature string
1103 * @throws {RandomOrgSendTimeoutError} Thrown when blocking timeout is exceeded
1104 * before the request can be sent.
1105 * @throws {RandomOrgKeyNotRunningError} Thrown when the API key has been
1106 * stopped.
1107 * @throws {RandomOrgInsufficientRequestsError} Thrown when the API key's server
1108 * requests allowance has been exceeded.
1109 * @throws {RandomOrgInsufficientBitsError} Thrown when the API key's server
1110 * bits allowance has been exceeded.
1111 * @throws {RandomOrgBadHTTPResponseError} Thrown when a HTTP 200 OK response
1112 * is not received.
1113 * @throws {RandomOrgRANDOMORGError} Thrown when the server returns a RANDOM.ORG
1114 * Error.
1115 * @throws {RandomOrgJSONRPCError} Thrown when the server returns a JSON-RPC Error.
1116 */
1117 getResult(serialNumber: number): Promise<any>;
1118 /**
1119 * @typedef {Object} NewTicket A ticket as it is returned by the createTickets() method.
1120 * @property {string} ticketId A string value that uniquely identifies the ticket.
1121 * @property {string} creationTime A string containing the timestamp in ISO 8601
1122 * format at which the ticket was created.
1123 * @property {string} previousTicketId The previous ticket in the chain to which this
1124 * ticket belongs. Since a new chain only contains one ticket, previousTicketId will
1125 * be null.
1126 * @property {string} nextTicketId A string value that identifies the next ticket in
1127 * the chain. Since a new chain only contains one ticket, nextTicketId will be null.
1128 */
1129 /**
1130 * @typedef {Object} Ticket A ticket as it is returned by the listTickets() and
1131 * getTicket() methods.
1132 * @property {string} ticketId A string value that uniquely identifies the ticket.
1133 * @property {string} hashedApiKey The hashed API key for which the ticket is valid.
1134 * @property {boolean} showResult If false, getTicket() will return only the basic
1135 * ticket information. If true, the full random and signature objects from the
1136 * response that was used to satisfy the ticket is returned. For more information,
1137 * please see the documentation for getTicket.
1138 * @property {string} creationTime The timestamp in ISO 8601 format at which the ticket
1139 * was created.
1140 * @property {string} usedTime The timestamp in ISO 8601 format at which the ticket was
1141 * used. If the ticket has not been used yet, this value is null.
1142 * @property {number} serialNumber A numeric value indicating which serial number
1143 * (within the API key used to serve the ticket) was used for the ticket. If the
1144 * caller has the unhashed API key, they can use the serialNumber returned to obtain
1145 * the full result via the getResult method. If the ticket has not been used yet,
1146 * this value is null.
1147 * @property {string} expirationTime The timestamp in ISO 8601 format at which the ticket
1148 * expires. If the ticket has not been used yet, this value is null.
1149 * @property {string} previousTicketId The previous ticket in the chain to which this
1150 * ticket belongs. If the ticket is the first in its chain, then previousTicketId is
1151 * null.
1152 * @property {string} nextTicketId A string value that identifies the next
1153 * ticket in the chain.
1154 * @property {Object} [result] The same object that was returned by the method that was
1155 * originally used to generate the values.
1156 */
1157 /**
1158 * Creates n tickets to be used in signed value-generating methods.
1159 *
1160 * See: https://api.random.org/json-rpc/4/signed#createTickets
1161 * @param {number} n The number of tickets requested. This must be a number
1162 * in the [1, 50] range.
1163 * @param {boolean} showResult A boolean value that determines how much
1164 * information calls to {@link getTicket} will return.
1165 * * **false**: getTicket will return only the basic ticket information.
1166 * * **true**: the full random and signature objects from the response that
1167 * was used to satisfy the ticket is returned.
1168 * @returns {Promise<NewTicket[]>} A Promise which, if resolved successfully,
1169 * represents an array of ticket objects with the following structure:
1170 * * **ticketId**: A string value that uniquely identifies the ticket.
1171 * * **creationTime**: The time when the ticket was created (ISO 8601 format).
1172 * * **nextTicketId**: A string pointing to the next ticket in the chain.
1173 * This will be null, as the tickets returned from this method are the
1174 * first in their respective chains.
1175 * @throws {RandomOrgSendTimeoutError} Thrown when blocking timeout is exceeded
1176 * before the request can be sent.
1177 * @throws {RandomOrgKeyNotRunningError} Thrown when the API key has been
1178 * stopped.
1179 * @throws {RandomOrgInsufficientRequestsError} Thrown when the API key's server
1180 * requests allowance has been exceeded.
1181 * @throws {RandomOrgInsufficientBitsError} Thrown when the API key's server
1182 * bits allowance has been exceeded.
1183 * @throws {RandomOrgBadHTTPResponseError} Thrown when a HTTP 200 OK response
1184 * is not received.
1185 * @throws {RandomOrgRANDOMORGError} Thrown when the server returns a RANDOM.ORG
1186 * Error.
1187 * @throws {RandomOrgJSONRPCError} Thrown when the server returns a JSON-RPC Error.
1188 */
1189 createTickets(n: number, showResult: boolean): Promise<{
1190 /**
1191 * A string value that uniquely identifies the ticket.
1192 */
1193 ticketId: string;
1194 /**
1195 * A string containing the timestamp in ISO 8601
1196 * format at which the ticket was created.
1197 */
1198 creationTime: string;
1199 /**
1200 * The previous ticket in the chain to which this
1201 * ticket belongs. Since a new chain only contains one ticket, previousTicketId will
1202 * be null.
1203 */
1204 previousTicketId: string;
1205 /**
1206 * A string value that identifies the next ticket in
1207 * the chain. Since a new chain only contains one ticket, nextTicketId will be null.
1208 */
1209 nextTicketId: string;
1210 }[]>;
1211 /**
1212 * Obtains information about tickets linked with your API key.
1213 *
1214 * The maximum number of tickets that can be returned by this method is 2000.
1215 * See: https://api.random.org/json-rpc/4/signed#listTickets
1216 * @param {string} ticketType A string describing the type of tickets you want
1217 * to obtain information about. Possible values are 'singleton', 'head'
1218 * and 'tail'.
1219 * * **'singleton'** returns tickets that have no previous or next tickets.
1220 * * **'head'** returns tickets hat do not have a previous ticket but that do
1221 * have a next ticket.
1222 * * **'tail'** returns tickets that have a previous ticket but do not have a
1223 * next ticket.
1224 * @returns {Promise<Ticket[]>} A Promise which, if resolved successfully,
1225 * represents an array of ticket objects, as returned from the server.
1226 * **NOTE:** The objects returned from this method do not contain "result"
1227 * fields, even if tickets were created with "showResult" set to true.
1228 * @throws {RandomOrgSendTimeoutError} Thrown when blocking timeout is exceeded
1229 * before the request can be sent.
1230 * @throws {RandomOrgKeyNotRunningError} Thrown when the API key has been
1231 * stopped.
1232 * @throws {RandomOrgInsufficientRequestsError} Thrown when the API key's server
1233 * requests allowance has been exceeded.
1234 * @throws {RandomOrgInsufficientBitsError} Thrown when the API key's server
1235 * bits allowance has been exceeded.
1236 * @throws {RandomOrgBadHTTPResponseError} Thrown when a HTTP 200 OK response
1237 * is not received.
1238 * @throws {RandomOrgRANDOMORGError} Thrown when the server returns a RANDOM.ORG
1239 * Error.
1240 * @throws {RandomOrgJSONRPCError} Thrown when the server returns a JSON-RPC Error.
1241 */
1242 listTickets(ticketType: string): Promise<{
1243 /**
1244 * A string value that uniquely identifies the ticket.
1245 */
1246 ticketId: string;
1247 /**
1248 * The hashed API key for which the ticket is valid.
1249 */
1250 hashedApiKey: string;
1251 /**
1252 * If false, getTicket() will return only the basic
1253 * ticket information. If true, the full random and signature objects from the
1254 * response that was used to satisfy the ticket is returned. For more information,
1255 * please see the documentation for getTicket.
1256 */
1257 showResult: boolean;
1258 /**
1259 * The timestamp in ISO 8601 format at which the ticket
1260 * was created.
1261 */
1262 creationTime: string;
1263 /**
1264 * The timestamp in ISO 8601 format at which the ticket was
1265 * used. If the ticket has not been used yet, this value is null.
1266 */
1267 usedTime: string;
1268 /**
1269 * A numeric value indicating which serial number
1270 * (within the API key used to serve the ticket) was used for the ticket. If the
1271 * caller has the unhashed API key, they can use the serialNumber returned to obtain
1272 * the full result via the getResult method. If the ticket has not been used yet,
1273 * this value is null.
1274 */
1275 serialNumber: number;
1276 /**
1277 * The timestamp in ISO 8601 format at which the ticket
1278 * expires. If the ticket has not been used yet, this value is null.
1279 */
1280 expirationTime: string;
1281 /**
1282 * The previous ticket in the chain to which this
1283 * ticket belongs. If the ticket is the first in its chain, then previousTicketId is
1284 * null.
1285 */
1286 previousTicketId: string;
1287 /**
1288 * A string value that identifies the next
1289 * ticket in the chain.
1290 */
1291 nextTicketId: string;
1292 /**
1293 * The same object that was returned by the method that was
1294 * originally used to generate the values.
1295 */
1296 result?: any;
1297 }[]>;
1298 /**
1299 * Obtains information about a single ticket using the ticketId associated
1300 * with it.
1301 *
1302 * If the ticket has showResult set to true and has been used, this method
1303 * will return the values generated.
1304 * See: https://api.random.org/json-rpc/4/signed#getTicket
1305 * @param {string} ticketId A string containing a ticket identifier returned
1306 * by a prior call to the {@link createTickets} method.
1307 * @returns {Promise<Ticket>} A Promise which, if resolved successfully,
1308 * represents an object containing the following information:
1309 * * **ticketId**: A string value that uniquely identifies the ticket.
1310 * * **hashedApiKey**: The hashed API key for which the ticket is valid.
1311 * * **showResult**: If false, getTicket() will return only the basic
1312 * ticket information. If true, the full random and signature objects
1313 * from the response that was used to satisfy the ticket is returned.
1314 * For more information, please see the documentation for getTicket.
1315 * * **creationTime**: The timestamp in ISO 8601 format at which the ticket
1316 * was created.
1317 * * **usedTime** The timestamp in ISO 8601 format at which the ticket was
1318 * used. If the ticket has not been used yet, this value is null.
1319 * * **serialNumber**: A numeric value indicating which serial number (within
1320 * the API key used to serve the ticket) was used for the ticket. If the
1321 * caller has the unhashed API key, they can use the serialNumber returned
1322 * to obtain the full result via the getResult method. If the ticket has
1323 * not been used yet, this value is null.
1324 * * **expirationTime**: The timestamp in ISO 8601 format at which the ticket
1325 * expires. If the ticket has not been used yet, this value is null.
1326 * * **previousTicketId**: The previous ticket in the chain to which this ticket
1327 * belongs. If the ticket is the first in its chain, then previousTicketId is
1328 * null.
1329 * * **nextTicketId** A string value that identifies the next
1330 * ticket in the chain.
1331 *
1332 * If showResult was set to true when the ticket was created,
1333 * the following field will also be added:
1334 * * **result** The same object that was returned by the method that was originally
1335 * used to generate the values. This includes the random field which contains the
1336 * data property, and a signature field, required to verify the result.
1337 * @throws {RandomOrgSendTimeoutError} Thrown when blocking timeout is exceeded
1338 * before the request can be sent.
1339 * @throws {RandomOrgKeyNotRunningError} Thrown when the API key has been
1340 * stopped.
1341 * @throws {RandomOrgInsufficientRequestsError} Thrown when the API key's server
1342 * requests allowance has been exceeded.
1343 * @throws {RandomOrgInsufficientBitsError} Thrown when the API key's server
1344 * bits allowance has been exceeded.
1345 * @throws {RandomOrgBadHTTPResponseError} Thrown when a HTTP 200 OK response
1346 * is not received.
1347 * @throws {RandomOrgRANDOMORGError} Thrown when the server returns a RANDOM.ORG
1348 * Error.
1349 * @throws {RandomOrgJSONRPCError} Thrown when the server returns a JSON-RPC Error.
1350 */
1351 getTicket(ticketId: string): Promise<{
1352 /**
1353 * A string value that uniquely identifies the ticket.
1354 */
1355 ticketId: string;
1356 /**
1357 * The hashed API key for which the ticket is valid.
1358 */
1359 hashedApiKey: string;
1360 /**
1361 * If false, getTicket() will return only the basic
1362 * ticket information. If true, the full random and signature objects from the
1363 * response that was used to satisfy the ticket is returned. For more information,
1364 * please see the documentation for getTicket.
1365 */
1366 showResult: boolean;
1367 /**
1368 * The timestamp in ISO 8601 format at which the ticket
1369 * was created.
1370 */
1371 creationTime: string;
1372 /**
1373 * The timestamp in ISO 8601 format at which the ticket was
1374 * used. If the ticket has not been used yet, this value is null.
1375 */
1376 usedTime: string;
1377 /**
1378 * A numeric value indicating which serial number
1379 * (within the API key used to serve the ticket) was used for the ticket. If the
1380 * caller has the unhashed API key, they can use the serialNumber returned to obtain
1381 * the full result via the getResult method. If the ticket has not been used yet,
1382 * this value is null.
1383 */
1384 serialNumber: number;
1385 /**
1386 * The timestamp in ISO 8601 format at which the ticket
1387 * expires. If the ticket has not been used yet, this value is null.
1388 */
1389 expirationTime: string;
1390 /**
1391 * The previous ticket in the chain to which this
1392 * ticket belongs. If the ticket is the first in its chain, then previousTicketId is
1393 * null.
1394 */
1395 previousTicketId: string;
1396 /**
1397 * A string value that identifies the next
1398 * ticket in the chain.
1399 */
1400 nextTicketId: string;
1401 /**
1402 * The same object that was returned by the method that was
1403 * originally used to generate the values.
1404 */
1405 result?: any;
1406 }>;
1407 /**
1408 * Create the URL for the signature verification page of a response previously
1409 * received from one of the methods in the Signed API with the server. The
1410 * web-page accessible from this URL will contain the details of the response
1411 * used in this method, provided that the signature can be verified. This
1412 * URL is also shown under "Show Technical Details" when the online Signature
1413 * Verification Form is used to validate a signature. See:
1414 * https://api.random.org/signatures/form
1415 * @param {Object} random The random field from a response returned by
1416 * RANDOM.ORG through one of the Signed API methods.
1417 * @param {string} signature The signature field from the same response
1418 * that the random field originates from.
1419 * @returns {string} A string containing the signature verification URL.
1420 * @throws RandomOrgRANDOMORGError when the URL is too long (max. 2,046
1421 * characters).
1422 */
1423 createUrl(random: any, signature: string): string;
1424 /**
1425 * Create the HTML form for the signature verification page of a response
1426 * previously received from one of the methods in the Signed API with the
1427 * server. The web-page accessible from the "Validate" button created will
1428 * contain the details of the response used in this method, provided that
1429 * the signature can be verified. The same HTML form is also shown under
1430 * "Show Technical Details" when the online Signature Verification Form is
1431 * used to validate a signature. See: https://api.random.org/signatures/form
1432 * @param {Object} random The random field from a response returned by
1433 * RANDOM.ORG through one of the Signed API methods.
1434 * @param {string} signature The signature field from the same response
1435 * that the random field originates from.
1436 * @returns {string} A string containing the code for the HTML form.
1437 */
1438 createHtml(random: any, signature: string): string;
1439 /**
1440 * Gets a RandomOrgCache to obtain random integers.
1441 *
1442 * The RandomOrgCache can be polled for new results conforming to the output
1443 * format of the input request.
1444 * @param {number} n How many random integers you need. Must be within the
1445 * [1,1e4] range.
1446 * @param {number} min The lower boundary for the range from which the random
1447 * numbers will be picked. Must be within the [-1e9,1e9] range.
1448 * @param {number} max The upper boundary for the range from which the random
1449 * numbers will be picked. Must be within the [-1e9,1e9] range.
1450 * @param {{replacement?: boolean, base?: number, cacheSize?: number}} options
1451 * An object which may contain any of the following optional parameters:
1452 * @param {boolean} [options.replacement=true] Specifies whether the random
1453 * numbers should be picked with replacement. If true, the resulting numbers
1454 * may contain duplicate values, otherwise the numbers will all be unique
1455 * (default true).
1456 * @param {number} [options.base=10] The base that will be used to display the
1457 * numbers. Values allowed are 2, 8, 10 and 16 (default 10).
1458 * @param {number} [options.cacheSize=20] The number of result-sets for the
1459 * cache to try to maintain at any given time (default 20, minimum 2).
1460 * @returns {RandomOrgCache} An instance of the RandomOrgCache class which
1461 * can be polled for arrays of true random integers.
1462 */
1463 createIntegerCache(n: number, min: number, max: number, options?: {
1464 replacement?: boolean;
1465 base?: number;
1466 cacheSize?: number;
1467 }): RandomOrgCache;
1468 /**
1469 * Gets a RandomOrgCache to obtain random integer sequences.
1470 *
1471 * The RandomOrgCache can be polled for new results conforming to the output
1472 * format of the input request.
1473 * @param {number} n How many random integer sequences you need. Must be within
1474 * the [1,1e4] range.
1475 * @param {(number|number[])} length The length of each array of random
1476 * integers requested. For uniform sequences, length must be an integer
1477 * in the [1, 1e4] range. For multiform sequences, length can be an array
1478 * with n integers, each specifying the length of the sequence identified
1479 * by its index. In this case, each value in length must be within the
1480 * [1, 1e4] range and the total sum of all the lengths must be in the
1481 * [1, 1e4] range.
1482 * @param {(number|number[])} min The lower boundary for the range from which
1483 * the random numbers will be picked. For uniform sequences, min must be
1484 * an integer in the [-1e9, 1e9] range. For multiform sequences, min can
1485 * be an array with n integers, each specifying the lower boundary of the
1486 * sequence identified by its index. In this case, each value in min must
1487 * be within the [-1e9, 1e9] range.
1488 * @param {(number|number[])} max The upper boundary for the range from which
1489 * the random numbers will be picked. For uniform sequences, max must be
1490 * an integer in the [-1e9, 1e9] range. For multiform sequences, max can
1491 * be an array with n integers, each specifying the upper boundary of the
1492 * sequence identified by its index. In this case, each value in max must
1493 * be within the [-1e9, 1e9] range.
1494 * @param {{replacement?: boolean|boolean[], base?: number|number[],
1495 * cacheSize?: number}} options An object which may contain any of the
1496 * following optional parameters:
1497 * @param {boolean|boolean[]} replacement Specifies whether the random numbers
1498 * should be picked with replacement. If true, the resulting numbers may
1499 * contain duplicate values, otherwise the numbers will all be unique. For
1500 * multiform sequences, replacement can be an array with n boolean values,
1501 * each specifying whether the sequence identified by its index will be
1502 * created with (true) or without (false) replacement (default true).
1503 * @param {number|number[]} base The base that will be used to display the numbers.
1504 * Values allowed are 2, 8, 10 and 16. For multiform sequences, base can
1505 * be an array with n integer values taken from the same set, each
1506 * specifying the base that will be used to display the sequence identified
1507 * by its index (default 10).
1508 * @param {number} cacheSize The number of result-sets for the cache to try
1509 * to maintain at any given time (default 20, minimum 2).
1510 * @returns {RandomOrgCache} An instance of the RandomOrgCache class which
1511 * can be polled for arrays of true random integer sequences.
1512 */
1513 createIntegerSequenceCache(n: number, length: (number | number[]), min: (number | number[]), max: (number | number[]), options?: {
1514 replacement?: boolean | boolean[];
1515 base?: number | number[];
1516 cacheSize?: number;
1517 }): RandomOrgCache;
1518 /**
1519 * Gets a RandomOrgCache to obtain random decimal fractions.
1520 *
1521 * The RandomOrgCache can be polled for new results conforming to the output
1522 * format of the input request.
1523 * @param {number} n How many random decimal fractions you need. Must be
1524 * within the [1,1e4] range.
1525 * @param {number} decimalPlaces The number of decimal places to use. Must
1526 * be within the [1,20] range.
1527 * @param {{replacement?: boolean, cacheSize?: number}} options An object which
1528 * may contain any of the following optional parameters:
1529 * @param {boolean} [options.replacement=true] Specifies whether the random
1530 * numbers should be picked with replacement. If true, the resulting numbers
1531 * may contain duplicate values, otherwise the numbers will all be unique
1532 * (default true).
1533 * @param {number} [options.cacheSize=20] The number of result-sets for the cache
1534 * to try to maintain at any given time (default 20, minimum 2).
1535 * @returns {RandomOrgCache} An instance of the RandomOrgCache class which
1536 * can be polled for arrays of true random decimal fractions.
1537 */
1538 createDecimalFractionCache(n: number, decimalPlaces: number, options?: {
1539 replacement?: boolean;
1540 cacheSize?: number;
1541 }): RandomOrgCache;
1542 /**
1543 * Gets a RandomOrgCache to obtain random numbers from a Gaussian distribution.
1544 *
1545 * The RandomOrgCache can be polled for new results conforming to the output
1546 * format of the input request.
1547 * @param {number} n How many random numbers you need. Must be within the
1548 * [1,1e4] range.
1549 * @param {number} mean The distribution's mean. Must be within the
1550 * [-1e6,1e6] range.
1551 * @param {number} standardDeviation The distribution's standard deviation.
1552 * Must be within the [-1e6,1e6] range.
1553 * @param {number} significantDigits The number of significant digits to use.
1554 * Must be within the [2,20] range.
1555 * @param {{cacheSize?: number}} options An object which may contain the following
1556 * optional parameter:
1557 * @param {number} [options.cacheSize=20] The number of result-sets for the cache
1558 * to try to maintain at any given time (default 20, minimum 2).
1559 * @returns {RandomOrgCache} An instance of the RandomOrgCache class which
1560 * can be polled for arrays of true random numbers from a Gaussian
1561 * distribution.
1562 */
1563 createGaussianCache(n: number, mean: number, standardDeviation: number, significantDigits: number, options?: {
1564 cacheSize?: number;
1565 }): RandomOrgCache;
1566 /**
1567 * Gets a RandomOrgCache to obtain random strings.
1568 *
1569 * The RandomOrgCache can be polled for new results conforming to the output
1570 * format of the input request.
1571 * @param {number} n How many random strings you need. Must be within the
1572 * [1,1e4] range.
1573 * @param {number} length The length of each string. Must be within the [1,20]
1574 * range. All strings will be of the same length.
1575 * @param {string} characters A string that contains the set of characters
1576 * that are allowed to occur in the random strings. The maximum number
1577 * of characters is 80.
1578 * @param {{replacement?: boolean, cacheSize?: number}} options An object which
1579 * may contain any of the following optional parameters:
1580 * @param {boolean} [options.replacement=true] Specifies whether the random
1581 * strings should be picked with replacement. If true, the resulting list
1582 * of strings may contain duplicates, otherwise the strings will all be
1583 * unique (default true).
1584 * @param {number} [options.cacheSize=20] The number of result-sets for the
1585 * cache to try to maintain at any given time (default 20, minimum 2).
1586 * @returns {RandomOrgCache} An instance of the RandomOrgCache class which
1587 * can be polled for arrays of true random strings.
1588 */
1589 createStringCache(n: number, length: number, characters: string, options?: {
1590 replacement?: boolean;
1591 cacheSize?: number;
1592 }): RandomOrgCache;
1593 /**
1594 * Gets a RandomOrgCache to obtain UUIDs.
1595 *
1596 * The RandomOrgCache can be polled for new results conforming to the output
1597 * format of the input request.
1598 * @param {number} n How many random UUIDs you need. Must be within the
1599 * [1,1e3] range.
1600 * @param {{cacheSize?: number}} options An object which may contain the following
1601 * optional parameter:
1602 * @param {number} [options.cacheSize=10] The number of result-sets for the cache
1603 * to try to maintain at any given time (default 10, minimum 2).
1604 * @returns {RandomOrgCache} An instance of the RandomOrgCache class which
1605 * can be polled for arrays of true random UUIDs.
1606 */
1607 createUUIDCache(n: number, options?: {
1608 cacheSize?: number;
1609 }): RandomOrgCache;
1610 /**
1611 * Gets a RandomOrgCache to obtain random blobs.
1612 *
1613 * The RandomOrgCache can be polled for new results conforming to the output
1614 * format of the input request.
1615 * @param {number} n How many random blobs you need. n*(cacheSize/2) must be
1616 * within the [1,100] range.
1617 * @param {number} size The size of each blob, measured in bits. Must be
1618 * within the [1,1048576] range and must be divisible by 8.
1619 * @param {{format?: string, cacheSize?: number}} options An object which may
1620 * contain any of the following optional parameters:
1621 * @param {string} [options.format=base64] Specifies the format in which the
1622 * blobs will be returned. Values allowed are 'base64' and 'hex' (default
1623 * 'base64').
1624 * @param {number} [options.cacheSize=10] The number of result-sets for the cache
1625 * to try to maintain at any given time (default 10, minimum 2).
1626 * @returns {RandomOrgCache} An instance of the RandomOrgCache class which
1627 * can be polled for arrays of true random blobs as strings.
1628 * @see {@link RandomOrgClient#BLOB_FORMAT_BASE64} for 'base64' (default).
1629 * @see {@link RandomOrgClient#BLOB_FORMAT_HEX} for 'hex'.
1630 */
1631 createBlobCache(n: number, size: number, options?: {
1632 format?: string;
1633 cacheSize?: number;
1634 }): RandomOrgCache;
1635 #private;
1636}
1637import RandomOrgCache = require("./RandomOrgCache.js");