1 | const api = require('./api');
|
2 |
|
3 | const global = typeof window !== 'undefined' ? window : self;
|
4 |
|
5 | module.exports = ({crdsUrl}) => api({
|
6 | random: () => {
|
7 | const array = new Uint32Array(1);
|
8 | crypto.getRandomValues(array);
|
9 | return Math.abs(array[0] / 0xFFFFFFFF);
|
10 | },
|
11 | fetch: global.fetch,
|
12 | Headers: global.Headers,
|
13 | encodeUtf8: s => new TextEncoder('utf-8').encode(s),
|
14 | crdsUrl: crdsUrl,
|
15 | });
|