dragonroll/backend/node_modules/nanoid/async/random.rn.js

15 lines
364 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

var random
try {
random = require('expo-random')
} catch (e) {
throw new Error(
'React-Native does not have a built-in secure random generator. ' +
'Install `expo-random` locally or ' +
'if you dont need unpredictable IDs, you can use `nanoid/non-secure`.'
)
}
module.exports = function (bytes) {
return random.getRandomBytesAsync(bytes)
}