durable-functions
Version:
Durable Functions library for Node.js Azure Functions
24 lines • 1.07 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.GuidManager = void 0;
const crypto = require("crypto");
const uuid_1 = require("uuid");
const Utils_1 = require("./Utils");
class GuidManager {
static createDeterministicGuid(namespaceValue, name) {
return this.createDeterministicGuidCore(namespaceValue, name);
}
static createDeterministicGuidCore(namespaceValue, name) {
Utils_1.Utils.throwIfEmpty(namespaceValue, "namespaceValue");
Utils_1.Utils.throwIfEmpty(name, "name");
const hash = crypto.createHash("sha1");
hash.update(name);
const bytes = Array.prototype.slice.call(hash.digest(), 0, 16);
return (0, uuid_1.v5)(namespaceValue, bytes);
}
}
exports.GuidManager = GuidManager;
GuidManager.DnsNamespaceValue = "9e952958-5e33-4daf-827f-2fa12937b875";
GuidManager.UrlNamespaceValue = "9e952958-5e33-4daf-827f-2fa12937b875";
GuidManager.IsoOidNamespaceValue = "9e952958-5e33-4daf-827f-2fa12937b875";
//# sourceMappingURL=GuidManager.js.map
;