Giter VIP home page Giter VIP logo

objectid64's Introduction

Greetings! πŸ‘‹

I am...

  • 🧭 a Web Platform Engineer.
  • πŸ›’οΈ creator of Cisternaβ€”a SaaS Warehouse Management System (WMS) for bulk fluid storage facilities.
  • 🏫 and Scriptareβ€”an educational startup (in closed beta).
  • πŸ–‹οΈ infrequent writer on medium.
  • πŸ“š a voracious (audio)book consumer.
  • πŸ“§ reachable via [email protected].

Ukrainians, do not hesitate to contact me if you need help in my field of expertise or simply a brotherly soul to talk to.

objectid64's People

Contributors

goooseman avatar joonhocho avatar zandaqo avatar

Stargazers

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

Watchers

 avatar  avatar  avatar

objectid64's Issues

Just created a PR fixing a bug.

Current test seems not comprehensive enough.
Maybe add a test to create 100,000 random objectid and test encode/decode with them.

Does not work with Node.js Web Crypto and UUID

Maybe I'm doing something wrong but I can't get a UUID -> encrypt -> encode -> decode -> decrypt -> UUID flow working.

import crypto from 'crypto'
import {Encoder, Encrypter} from 'objectid64'

global.crypto = crypto.webcrypto

const encoder = new Encoder()

const key = await Encrypter.generateKey()
const encrypter = new Encrypter(key)

const uuid = crypto.randomUUID()
console.log(uuid) // 4874c42f-61e3-42c8-9a39-4007a81737e7

const binUuid = encoder.toBinUUID(uuid)
const encrypted = await encrypter.fromUUID(binUuid)
const encoded = encoder.fromBinUUID(encrypted)
console.log(encoded) // MxbKSQB-fuDtqUJayvuVCO

const decoded = encoder.toBinUUID(encoded)
const decrypted = await encrypter.toUUID(decoded)
const uuid2 = encoder.fromBinUUID(decrypted)
console.log(uuid2) // 4874c42f-61e3-42c8-9C3, uuid is not recovered in full

console.log(uuid === uuid2) // false

Node.js version: 16.17.1
objectid64 version: 3.2.1

not working with ES6

Hi Maga,

thanks for you great work! Unfortunately in some envs it is not possible to control the ES Version, so in my case i needed to comply with ES6. I have forked and adapted your lib (https://github.com/kaeferfreund/oid64) to work with ES6.

Maybe there is a way to incorporate my changes upstream to a version that is compatible with different ES versions?

No "exports" main defined in package.json

I get this error attempting to use this package with Node.js v18.14.0.

node:internal/modules/cjs/loader:544
      throw e;
      ^

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in /Users/joe/repos/fieldzoo/libs/database/node_modules/objectid64/package.json
    at new NodeError (node:internal/errors:399:5)
    at exportsNotFound (node:internal/modules/esm/resolve:361:10)
    at packageExportsResolve (node:internal/modules/esm/resolve:641:13)
    at resolveExports (node:internal/modules/cjs/loader:538:36)
    at Module._findPath (node:internal/modules/cjs/loader:607:31)
    at Module._resolveFilename (node:internal/modules/cjs/loader:1033:27)
    at Module._load (node:internal/modules/cjs/loader:893:27)
    at Module.require (node:internal/modules/cjs/loader:1113:19)
    at require (node:internal/modules/cjs/helpers:103:18)
    at Object.<anonymous> (/Users/joe/repos/fieldzoo/libs/database/dist/lib/id-encoder.js:27:33) {
  code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
}

This is the entire program:

import { Encoder } from "objectid64";
import { randomUUID } from "crypto";

export const idEncoder = new Encoder();

console.log(idEncoder.fromUUID(randomUUID()));

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.