![]() ![]() New TokenGenerator( '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz+/') // Custom encoding (base64)Ġ123456789abcdef TokenGenerator.BASE36 : StringĠ123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ TokenGenerator.BASE58 : Stringġ23456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz TokenGenerator.BASE62 : StringĠ123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz TokenGenerator.BASE66 : StringĠ123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-._~ New TokenGenerator( 512, TokenGenerator.BASE62) New TokenGenerator(TokenGenerator.BASE36) One of the TokenGenerator.BASE# constants or a custom string of characters to use to encode the token. ![]() The size of the token to generate in bits. -> '圆GCX3aq9hIT8gjhvO96ObYj0W5HBVTsj64eqCuVc5X'ĪPI new TokenGenerator() ⇒ ObjectĬreates a new TokenGenerator instance that generates bitSize-bit tokens encoded using the characters in baseEncoding. Installation npm install uuid- token-generator -save Usage const TokenGenerator = require( 'uuid-token-generator') Ĭonst tokgen = new TokenGenerator() // Default is a 128-bit token encoded in base58Ĭonst tokgen2 = new TokenGenerator( 256, TokenGenerator.BASE62) It is less likely to produce colliding tokens. ![]() It has both a synchronous and asynchronous interface.You can specify the length of the token that you'd like to generate It has more flexible token generation options.This package is no longer being maintained because a better one exists- uid-generator-which is better for the following reasons: Great for generating things like API keys and compact UIDs. Generated tokens are strings that are guaranteed to always be the same length, depending on the bit-size specified for the token. Provides a class that generates random tokens with custom size and base-encoding using the RFC 4122 v4 UUID algorithm. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |