13 lines
203 B
JavaScript
13 lines
203 B
JavaScript
'use strict';
|
|
|
|
const crypto = require('crypto');
|
|
|
|
let id = null;
|
|
|
|
module.exports.genId = () => {
|
|
if (!id) {
|
|
id = crypto.randomBytes(20);
|
|
Buffer.from('-AT0001-').copy(id, 0);
|
|
}
|
|
return id;
|
|
}; |