I am using AWS Lambda with Node.js to insert items to my DynamoDB tables and need to generate unique ids for the items.
My biggest concern is with entropy in AWS Lambda underlying infrastructure, and risk of collisions with high number of ids per second.
I am using nanoid, but not sure if it meet this requirements. The code that I am using is this:
const nanoid = require('nanoid/generate');
const alphabet = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
const id = generate(nanoid, 10); //=> "6pe7PJzjWc"
How does nonoid generates randomness? Is it safe to use in AWS Lambda functions (high entropy and low change of collisions)? If not, what are the alternatives?
Aucun commentaire:
Enregistrer un commentaire