Add config for objectId size (#3950)
* Add objectId config property, default to 10 * Update Config constructor * Add test for backwards compatibility when changing objectId size
This commit is contained in:
committed by
Natan Rolnik
parent
bd6816c14c
commit
51d2dd92cb
@@ -35,9 +35,8 @@ export function randomString(size: number): string {
|
||||
}
|
||||
|
||||
// Returns a new random alphanumeric string suitable for object ID.
|
||||
export function newObjectId(): string {
|
||||
//TODO: increase length to better protect against collisions.
|
||||
return randomString(10);
|
||||
export function newObjectId(size: number = 10): string {
|
||||
return randomString(size);
|
||||
}
|
||||
|
||||
// Returns a new random hex string suitable for secure tokens.
|
||||
|
||||
Reference in New Issue
Block a user