@textile/threads-id
Advanced tools
Comparing version 0.1.2 to 0.1.3
/// <reference types="node" /> | ||
import { name as Name } from 'multibase'; | ||
/** | ||
* Variant denotes Thread variant. Currently only two variants are supported. | ||
*/ | ||
export declare enum Variant { | ||
Raw = 85, | ||
AccessControlled = 112 | ||
} | ||
/** | ||
* ThreadID represents a self-describing Thread identifier. | ||
* It is formed by a Version, a Variant, and a random number of a given length. | ||
*/ | ||
declare class ThreadID { | ||
export declare class ThreadID { | ||
readonly buf: Buffer; | ||
constructor(buf: Uint8Array); | ||
/** | ||
* Versions. Currently only V1 is supported. | ||
*/ | ||
static V1: number; | ||
static Variant: typeof Variant; | ||
/** | ||
* fromRandom creates a new random ID object. | ||
@@ -15,3 +27,3 @@ * @param variant The Thread variant to use. @see Variant | ||
*/ | ||
static fromRandom(variant?: ThreadID.Variant, size?: number): ThreadID; | ||
static fromRandom(variant?: Variant, size?: number): ThreadID; | ||
/** | ||
@@ -70,15 +82,1 @@ * fromString parses an ID-encoded string and returns an ID object. | ||
} | ||
declare namespace ThreadID { | ||
/** | ||
* Versions. Currently only V1 is supported. | ||
*/ | ||
const V1 = 1; | ||
/** | ||
* Variant denotes Thread variant. Currently only two variants are supported. | ||
*/ | ||
enum Variant { | ||
Raw = 85, | ||
AccessControlled = 112 | ||
} | ||
} | ||
export { ThreadID }; |
@@ -6,3 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ThreadID = void 0; | ||
exports.ThreadID = exports.Variant = void 0; | ||
const varint_1 = require("varint"); | ||
@@ -12,2 +12,10 @@ const sync_randombytes_1 = __importDefault(require("@consento/sync-randombytes")); | ||
/** | ||
* Variant denotes Thread variant. Currently only two variants are supported. | ||
*/ | ||
var Variant; | ||
(function (Variant) { | ||
Variant[Variant["Raw"] = 85] = "Raw"; | ||
Variant[Variant["AccessControlled"] = 112] = "AccessControlled"; | ||
})(Variant = exports.Variant || (exports.Variant = {})); | ||
/** | ||
* ThreadID represents a self-describing Thread identifier. | ||
@@ -140,18 +148,7 @@ * It is formed by a Version, a Variant, and a random number of a given length. | ||
exports.ThreadID = ThreadID; | ||
// eslint-disable-next-line @typescript-eslint/no-namespace | ||
(function (ThreadID) { | ||
/** | ||
* Versions. Currently only V1 is supported. | ||
*/ | ||
ThreadID.V1 = 0x01; | ||
/** | ||
* Variant denotes Thread variant. Currently only two variants are supported. | ||
*/ | ||
let Variant; | ||
(function (Variant) { | ||
Variant[Variant["Raw"] = 85] = "Raw"; | ||
Variant[Variant["AccessControlled"] = 112] = "AccessControlled"; | ||
})(Variant = ThreadID.Variant || (ThreadID.Variant = {})); | ||
})(ThreadID || (ThreadID = {})); | ||
exports.ThreadID = ThreadID; | ||
/** | ||
* Versions. Currently only V1 is supported. | ||
*/ | ||
ThreadID.V1 = 0x01; | ||
ThreadID.Variant = Variant; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
var threads=function(e){function t(t){for(var n,u,a=t[0],c=t[1],s=t[2],l=0,d=[];l<a.length;l++)u=a[l],Object.prototype.hasOwnProperty.call(o,u)&&o[u]&&d.push(o[u][0]),o[u]=0;for(n in c)Object.prototype.hasOwnProperty.call(c,n)&&(e[n]=c[n]);for(f&&f(t);d.length;)d.shift()();return i.push.apply(i,s||[]),r()}function r(){for(var e,t=0;t<i.length;t++){for(var r=i[t],n=!0,a=1;a<r.length;a++){var c=r[a];0!==o[c]&&(n=!1)}n&&(i.splice(t--,1),e=u(u.s=r[0]))}return e}var n={},o={0:0},i=[];function u(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,u),r.l=!0,r.exports}u.m=e,u.c=n,u.d=function(e,t,r){u.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},u.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},u.t=function(e,t){if(1&t&&(e=u(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(u.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)u.d(r,n,function(t){return e[t]}.bind(null,n));return r},u.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return u.d(t,"a",t),t},u.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},u.p="";var a=window.webpackJsonpthreads=window.webpackJsonpthreads||[],c=a.push.bind(a);a.push=t,a=a.slice();for(var s=0;s<a.length;s++)t(a[s]);var f=c;return i.push([2,1]),r()}({15:function(e,t){},2:function(e,t,r){"use strict";(function(e){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ThreadID=void 0;const o=r(6),i=n(r(10)),u=n(r(16));class a{constructor(t){this.buf=e.from(t)}static fromRandom(t=a.Variant.Raw,r=32){const n=e.concat([e.from(o.encode(a.V1)),e.from(o.encode(t)),i.default(e.alloc(r))]);return new a(n)}static fromString(t){if(t.length<2)throw new Error("id too short");const r=u.default.decode(e.from(t));return a.fromBytes(r)}static fromBytes(t){let r=e.from(t);const n=o.decode(r);if(1!=n)throw new Error(`expected 1 as the id version number, got: ${n}.`);r=r.slice(o.decode.bytes,r.length);if(!(o.decode(r)in a.Variant))throw new Error("invalid variant.");if(r.slice(o.decode.bytes,r.length).length<16)throw new Error("random component too small.");return new a(e.from(t))}static getEncoding(e){if(e.length<2)throw new Error("Too Short");const t=u.default.isEncoded(e);if(!1===t)throw new Error("Invalid Encoding");return t}isDefined(){return this.buf.length>0}toBytes(){return e.from(this.buf)}equals(e){return this.buf.equals(e.buf)}version(){return o.decode(this.buf)}variant(){let t=e.from(this.buf);return o.decode(t),t=t.slice(o.decode.bytes),o.decode(t)}toString(e="base32"){switch(this.version()){case a.V1:return u.default.encode(e,this.buf).toString();default:throw new Error("unknown ID version.")}}}t.ThreadID=a,function(e){let t;e.V1=1,function(e){e[e.Raw=85]="Raw",e[e.AccessControlled=112]="AccessControlled"}(t=e.Variant||(e.Variant={}))}(a||(a={})),t.ThreadID=a}).call(this,r(0).Buffer)}}); | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly90aHJlYWRzL21haW4uanMiXSwibmFtZXMiOlsidGhyZWFkcyIsIm1vZHVsZXMiLCJ3ZWJwYWNrSnNvbnBDYWxsYmFjayIsImRhdGEiLCJtb2R1bGVJZCIsImNodW5rSWQiLCJjaHVua0lkcyIsIm1vcmVNb2R1bGVzIiwiZXhlY3V0ZU1vZHVsZXMiLCJpIiwicmVzb2x2ZXMiLCJsZW5ndGgiLCJPYmplY3QiLCJwcm90b3R5cGUiLCJoYXNPd25Qcm9wZXJ0eSIsImNhbGwiLCJpbnN0YWxsZWRDaHVua3MiLCJwdXNoIiwicGFyZW50SnNvbnBGdW5jdGlvbiIsInNoaWZ0IiwiZGVmZXJyZWRNb2R1bGVzIiwiYXBwbHkiLCJjaGVja0RlZmVycmVkTW9kdWxlcyIsInJlc3VsdCIsImRlZmVycmVkTW9kdWxlIiwiZnVsZmlsbGVkIiwiaiIsImRlcElkIiwic3BsaWNlIiwiX193ZWJwYWNrX3JlcXVpcmVfXyIsInMiLCJpbnN0YWxsZWRNb2R1bGVzIiwiMCIsImV4cG9ydHMiLCJtb2R1bGUiLCJsIiwibSIsImMiLCJkIiwibmFtZSIsImdldHRlciIsIm8iLCJkZWZpbmVQcm9wZXJ0eSIsImVudW1lcmFibGUiLCJnZXQiLCJyIiwiU3ltYm9sIiwidG9TdHJpbmdUYWciLCJ2YWx1ZSIsInQiLCJtb2RlIiwiX19lc01vZHVsZSIsIm5zIiwiY3JlYXRlIiwia2V5IiwiYmluZCIsIm4iLCJvYmplY3QiLCJwcm9wZXJ0eSIsInAiLCJqc29ucEFycmF5Iiwid2luZG93Iiwib2xkSnNvbnBGdW5jdG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FTaUIsT0FBT3JCLEtBQUtRLEtBS2hDRCxVQUNJLElBQUlnQixFQUFPekIsRUFBT1csS0FBS1QsS0FBS1EsS0FHNUIsT0FGQUosRUFBU2lCLE9BQU9FLEdBQ2hCQSxFQUFPQSxFQUFLNUIsTUFBTVMsRUFBU2lCLE9BQU9QLE9BQzNCVixFQUFTaUIsT0FBT0UsR0FNM0JoQixTQUFTcUIsRUFBTyxVQUNaLE9BQVE1QixLQUFLd0IsV0FDVCxLQUFLckIsRUFBU2MsR0FDVixPQUFPWCxFQUFZSixRQUFRYyxPQUFPWSxFQUFNNUIsS0FBS1EsS0FBS3FCLFdBQ3RELFFBQ0ksTUFBTSxJQUFJVCxNQUFNLHlCQUloQ3ZELEVBQVFzQyxTQUFXQSxFQUVuQixTQUFXQSxHQVFQLElBQUlRLEVBSkpSLEVBQVNjLEdBQUssRUFLZCxTQUFXTixHQUNQQSxFQUFRQSxFQUFhLElBQUksSUFBTSxNQUMvQkEsRUFBUUEsRUFBMEIsaUJBQUksS0FBTyxtQkFGakQsQ0FHR0EsRUFBVVIsRUFBU1EsVUFBWVIsRUFBU1EsUUFBVSxLQVp6RCxDQWFHUixJQUFhQSxFQUFXLEtBQzNCdEMsRUFBUXNDLFNBQVdBLElBRVV4RCxLQUFLcUQsS0FBTXZDLEVBQW9CLEdBQUdxQyIsImZpbGUiOiIuL21haW4uanMiLCJzb3VyY2VSb290IjoiIn0= | ||
var threads=function(e){function t(t){for(var n,a,u=t[0],c=t[1],s=t[2],l=0,d=[];l<u.length;l++)a=u[l],Object.prototype.hasOwnProperty.call(o,a)&&o[a]&&d.push(o[a][0]),o[a]=0;for(n in c)Object.prototype.hasOwnProperty.call(c,n)&&(e[n]=c[n]);for(f&&f(t);d.length;)d.shift()();return i.push.apply(i,s||[]),r()}function r(){for(var e,t=0;t<i.length;t++){for(var r=i[t],n=!0,u=1;u<r.length;u++){var c=r[u];0!==o[c]&&(n=!1)}n&&(i.splice(t--,1),e=a(a.s=r[0]))}return e}var n={},o={0:0},i=[];function a(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,a),r.l=!0,r.exports}a.m=e,a.c=n,a.d=function(e,t,r){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,t){if(1&t&&(e=a(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(a.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)a.d(r,n,function(t){return e[t]}.bind(null,n));return r},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="";var u=window.webpackJsonpthreads=window.webpackJsonpthreads||[],c=u.push.bind(u);u.push=t,u=u.slice();for(var s=0;s<u.length;s++)t(u[s]);var f=c;return i.push([2,1]),r()}({15:function(e,t){},2:function(e,t,r){"use strict";(function(e){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ThreadID=t.Variant=void 0;const o=r(6),i=n(r(10)),a=n(r(16));var u;!function(e){e[e.Raw=85]="Raw",e[e.AccessControlled=112]="AccessControlled"}(u=t.Variant||(t.Variant={}));let c=(()=>{class t{constructor(t){this.buf=e.from(t)}static fromRandom(r=t.Variant.Raw,n=32){const a=e.concat([e.from(o.encode(t.V1)),e.from(o.encode(r)),i.default(e.alloc(n))]);return new t(a)}static fromString(r){if(r.length<2)throw new Error("id too short");const n=a.default.decode(e.from(r));return t.fromBytes(n)}static fromBytes(r){let n=e.from(r);const i=o.decode(n);if(1!=i)throw new Error(`expected 1 as the id version number, got: ${i}.`);n=n.slice(o.decode.bytes,n.length);if(!(o.decode(n)in t.Variant))throw new Error("invalid variant.");if(n.slice(o.decode.bytes,n.length).length<16)throw new Error("random component too small.");return new t(e.from(r))}static getEncoding(e){if(e.length<2)throw new Error("Too Short");const t=a.default.isEncoded(e);if(!1===t)throw new Error("Invalid Encoding");return t}isDefined(){return this.buf.length>0}toBytes(){return e.from(this.buf)}equals(e){return this.buf.equals(e.buf)}version(){return o.decode(this.buf)}variant(){let t=e.from(this.buf);return o.decode(t),t=t.slice(o.decode.bytes),o.decode(t)}toString(e="base32"){switch(this.version()){case t.V1:return a.default.encode(e,this.buf).toString();default:throw new Error("unknown ID version.")}}}return t.V1=1,t.Variant=u,t})();t.ThreadID=c}).call(this,r(0).Buffer)}}); | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly90aHJlYWRzL21haW4uanMiXSwibmFtZXMiOlsidGhyZWFkcyIsIm1vZHVsZXMiLCJ3ZWJwYWNrSnNvbnBDYWxsYmFjayIsImRhdGEiLCJtb2R1bGVJZCIsImNodW5rSWQiLCJjaHVua0lkcyIsIm1vcmVNb2R1bGVzIiwiZXhlY3V0ZU1vZHVsZXMiLCJpIiwicmVzb2x2ZXMiLCJsZW5ndGgiLCJPYmplY3QiLCJwcm90b3R5cGUiLCJoYXNPd25Qcm9wZXJ0eSIsImNhbGwiLCJpbnN0YWxsZWRDaHVua3MiLCJwdXNoIiwicGFyZW50SnNvbnBGdW5jdGlvbiIsInNoaWZ0IiwiZGVmZXJyZWRNb2R1bGVzIiwiYXBwbHkiLCJjaGVja0RlZmVycmVkTW9kdWxlcyIsInJlc3VsdCIsImRlZmVycmVkTW9kdWxlIiwiZnVsZmlsbGVkIiwiaiIsImRlcElkIiwic3BsaWNlIiwiX193ZWJwYWNrX3JlcXVpcmVfXyIsInMiLCJpbnN0YWxsZWRNb2R1bGVzIiwiMCIsImV4cG9ydHMiLCJtb2R1bGUiLCJsIiwibSIsImMiL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cmNlUm9vdCI6IiJ9 |
{ | ||
"name": "@textile/threads-id", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"main": "dist/index", | ||
@@ -37,3 +37,3 @@ "types": "dist/index", | ||
}, | ||
"gitHead": "7237c11faa3ebb2a90a05502a2e314b155b14ad0" | ||
"gitHead": "70e27fb5f7552b987a646c5415ab684275982041" | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
136681
383