Giter Site home page Giter Site logo

puid's People

Contributors

bitdeli-chef avatar pid avatar tsdtsdtsd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

puid's Issues

Using a salt key to ensure even more uniqueness

Hi

You're asking for feedback about the "counter" part of the uid. So here's one :)
Maybe you could use a user-defined salt string in some config file and bake it into the counter part or the whole thing. What do you think ?

puid on client site (brainstorming task)

Change epoch default value

The default value for the epoch value until v0.4.x is "1999-07-02 03:00:00 pm", there was a foul, because the timezone isn't set, so it differ from the local timezone on the machine it was generated. I fix/change this in version v0.5.x to "1999-06-07 03:00:00 pm GMT". The new datetime is before the old one, so it won't break IDs generated with earlier versions of puid.

The possibility that a ID with v0.4 will collide, is only possible if

  • your hosts in the distributed environment are in different timezones
  • and only if a ID is generated in the same nanosecond (+hours the timezone differs)
  • and the same random counter will occur
  • and you miss to set a different node id.

So, there isn't really a chance for a collision ;-)

But it should be fixed ;-)
Please update to v0.5.x

Error "Cannot read property '0' of undefined" when call generate

var Puid = require('puid');
var puid = new Puid(false);
var schema = mongoose.Schema({
    _id:{
        type: String,
        default: puid.generate,
    },
});
------
//Got below error when try to use the mongoose model
TypeError: Cannot read property '0' of undefined
    at model.generate (C:\Workspace\Ioko\Node\yiiep\node_modules\puid\lib\puid.js:64:18)

bower

Is it possible to see this in bower? Thinking of using it client-side.

uuid module

Not sure if you are aware, but there is a uuid module:
https://github.com/shtylman/node-uuid

Which generates uuids based on the RFC. This is more standard and doesn't involve having to make a custom scheme. I would recommend using it :)

PUID vs. UUID?

I'm confused as you do not state anything about the relationships of PUIDs to UUIDs and from your PUID description I also do not see what benefit PUIDs provide over UUIDs. Can you please add some description about the relationships between PUIDs and UUIDs to your project, because UUIDs are standardized since a decade and seem to solve the same problem as PUIDs, hence it is vital to easily understand what different problem PUIDs seem to solve or why they solve the same problem better. Thanks.

nonce

This looks neato. ๐Ÿ‘ I have bit of a random question...

How appropriate might it be, to use a puid as a nonce in an HMAC protocol exchange?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.