mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
21 lines
385 B
TypeScript
21 lines
385 B
TypeScript
|
|
import randomBytes = require('random-bytes');
|
||
|
|
|
||
|
|
// Callback-based signature.
|
||
|
|
randomBytes(16, (err, buff) => {
|
||
|
|
if (err) {
|
||
|
|
console.error(err);
|
||
|
|
} else {
|
||
|
|
console.log(buff);
|
||
|
|
}
|
||
|
|
});
|
||
|
|
|
||
|
|
// Promise-based signature.
|
||
|
|
randomBytes(32)
|
||
|
|
.then((buff) => {
|
||
|
|
console.log(buff);
|
||
|
|
});
|
||
|
|
|
||
|
|
// Synchronous signature.
|
||
|
|
const buff = randomBytes.sync(64);
|
||
|
|
console.log(buff);
|