holosphere 2.0.0-alpha4 → 2.0.0-alpha5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/holosphere.cjs +1 -1
- package/dist/esm/holosphere.js +1 -1
- package/dist/{index-CBitK71M.cjs → index-BG8FStkt.cjs} +2 -2
- package/dist/{index-CBitK71M.cjs.map → index-BG8FStkt.cjs.map} +1 -1
- package/dist/{index-CV0eOogK.js → index-Bbey4GkP.js} +502 -56
- package/dist/index-Bbey4GkP.js.map +1 -0
- package/dist/{index-Cz-PLCUR.js → index-Cp3xctq8.js} +2 -2
- package/dist/{index-Cz-PLCUR.js.map → index-Cp3xctq8.js.map} +1 -1
- package/dist/index-hfVGRwSr.cjs +5 -0
- package/dist/index-hfVGRwSr.cjs.map +1 -0
- package/dist/{indexeddb-storage-CRsZyB2f.cjs → indexeddb-storage-BD70pN7q.cjs} +2 -2
- package/dist/{indexeddb-storage-CRsZyB2f.cjs.map → indexeddb-storage-BD70pN7q.cjs.map} +1 -1
- package/dist/{indexeddb-storage-DZaGlY_a.js → indexeddb-storage-Bjg84U5R.js} +2 -2
- package/dist/{indexeddb-storage-DZaGlY_a.js.map → indexeddb-storage-Bjg84U5R.js.map} +1 -1
- package/dist/{memory-storage-BkUi6sZG.js → memory-storage-CD0XFayE.js} +2 -2
- package/dist/{memory-storage-BkUi6sZG.js.map → memory-storage-CD0XFayE.js.map} +1 -1
- package/dist/{memory-storage-C0DuUsdY.cjs → memory-storage-DmMyJtOo.cjs} +2 -2
- package/dist/{memory-storage-C0DuUsdY.cjs.map → memory-storage-DmMyJtOo.cjs.map} +1 -1
- package/dist/{secp256k1-DN4FVXcv.js → secp256k1-69sS9O-P.js} +2 -2
- package/dist/{secp256k1-DN4FVXcv.js.map → secp256k1-69sS9O-P.js.map} +1 -1
- package/dist/{secp256k1-0kPdAVkK.cjs → secp256k1-TcN6vWGh.cjs} +2 -2
- package/dist/{secp256k1-0kPdAVkK.cjs.map → secp256k1-TcN6vWGh.cjs.map} +1 -1
- package/package.json +1 -1
- package/src/storage/nostr-async.js +149 -14
- package/src/storage/nostr-client.js +569 -46
- package/dist/index-BB_vVJgv.cjs +0 -5
- package/dist/index-BB_vVJgv.cjs.map +0 -1
- package/dist/index-CV0eOogK.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-hfVGRwSr.cjs");class e extends t.Hash{constructor(e,r){super(),this.finished=!1,this.destroyed=!1,t.ahash(e);const n=t.toBytes(r);if(this.iHash=e.create(),"function"!=typeof this.iHash.update)throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const o=this.blockLen,i=new Uint8Array(o);i.set(n.length>o?e.create().update(n).digest():n);for(let t=0;t<i.length;t++)i[t]^=54;this.iHash.update(i),this.oHash=e.create();for(let t=0;t<i.length;t++)i[t]^=106;this.oHash.update(i),t.clean(i)}update(e){return t.aexists(this),this.iHash.update(e),this}digestInto(e){t.aexists(this),t.abytes(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:e,iHash:r,finished:n,destroyed:o,blockLen:i,outputLen:s}=this;return t.finished=n,t.destroyed=o,t.blockLen=i,t.outputLen=s,t.oHash=e._cloneInto(t.oHash),t.iHash=r._cloneInto(t.iHash),t}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const r=(t,r,n)=>new e(t,r).update(n).digest();r.create=(t,r)=>new e(t,r);
|
|
2
2
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
3
3
|
const n=BigInt(0),o=BigInt(1);function i(t,e=""){if("boolean"!=typeof t){throw new Error((e&&`"${e}"`)+"expected boolean, got type="+typeof t)}return t}function s(e,r,n=""){const o=t.isBytes(e),i=e?.length,s=void 0!==r;if(!o||s&&i!==r){throw new Error((n&&`"${n}" `)+"expected Uint8Array"+(s?` of length ${r}`:"")+", got "+(o?`length=${i}`:"type="+typeof e))}return e}function c(t){const e=t.toString(16);return 1&e.length?"0"+e:e}function a(t){if("string"!=typeof t)throw new Error("hex string expected, got "+typeof t);return""===t?n:BigInt("0x"+t)}function f(e){return a(t.bytesToHex(e))}function u(e){return t.abytes(e),a(t.bytesToHex(Uint8Array.from(e).reverse()))}function d(e,r){return t.hexToBytes(e.toString(16).padStart(2*r,"0"))}function l(t,e){return d(t,e).reverse()}function h(e,r,n){let o;if("string"==typeof r)try{o=t.hexToBytes(r)}catch(i){throw new Error(e+" must be hex string or Uint8Array, cause: "+i)}else{if(!t.isBytes(r))throw new Error(e+" must be hex string or Uint8Array");o=Uint8Array.from(r)}return o.length,o}const w=t=>"bigint"==typeof t&&n<=t;function y(t,e,r,n){if(!function(t,e,r){return w(t)&&w(e)&&w(r)&&e<=t&&t<r}(e,r,n))throw new Error("expected valid "+t+": "+r+" <= n < "+n+", got "+e)}function g(t){let e;for(e=0;t>n;t>>=o,e+=1);return e}const p=t=>(o<<BigInt(t))-o;function m(t,e,r={}){if(!t||"object"!=typeof t)throw new Error("expected valid options object");function n(e,r,n){const o=t[e];if(n&&void 0===o)return;const i=typeof o;if(i!==r||null===o)throw new Error(`param "${e}" is invalid: expected ${r}, got ${i}`)}Object.entries(e).forEach(([t,e])=>n(t,e,!1)),Object.entries(r).forEach(([t,e])=>n(t,e,!0))}function b(t){const e=new WeakMap;return(r,...n)=>{const o=e.get(r);if(void 0!==o)return o;const i=t(r,...n);return e.set(r,i),i}}
|
|
4
4
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const E=BigInt(0),B=BigInt(1),v=BigInt(2),x=BigInt(3),O=BigInt(4),R=BigInt(5),S=BigInt(7),I=BigInt(8),N=BigInt(9),q=BigInt(16);function A(t,e){const r=t%e;return r>=E?r:e+r}function F(t,e,r){let n=t;for(;e-- >E;)n*=n,n%=r;return n}function Z(t,e){if(t===E)throw new Error("invert: expected non-zero number");if(e<=E)throw new Error("invert: expected positive modulus, got "+e);let r=A(t,e),n=e,o=E,i=B;for(;r!==E;){const t=n%r,e=o-i*(n/r);n=r,r=t,o=i,i=e}if(n!==B)throw new Error("invert: does not exist");return A(o,e)}function H(t,e,r){if(!t.eql(t.sqr(e),r))throw new Error("Cannot find square root")}function U(t,e){const r=(t.ORDER+B)/O,n=t.pow(e,r);return H(t,n,e),n}function V(t,e){const r=(t.ORDER-R)/I,n=t.mul(e,v),o=t.pow(n,r),i=t.mul(e,o),s=t.mul(t.mul(i,v),o),c=t.mul(i,t.sub(s,t.ONE));return H(t,c,e),c}function T(t){if(t<x)throw new Error("sqrt is not defined for small field");let e=t-B,r=0;for(;e%v===E;)e/=v,r++;let n=v;const o=j(t);for(;1===L(o,n);)if(n++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(1===r)return U;let i=o.pow(n,e);const s=(e+B)/v;return function(t,n){if(t.is0(n))return n;if(1!==L(t,n))throw new Error("Cannot find square root");let o=r,c=t.mul(t.ONE,i),a=t.pow(n,e),f=t.pow(n,s);for(;!t.eql(a,t.ONE);){if(t.is0(a))return t.ZERO;let e=1,r=t.sqr(a);for(;!t.eql(r,t.ONE);)if(e++,r=t.sqr(r),e===o)throw new Error("Cannot find square root");const n=B<<BigInt(o-e-1),i=t.pow(c,n);o=e,c=t.sqr(i),a=t.mul(a,c),f=t.mul(f,i)}return f}}function k(t){return t%O===x?U:t%I===R?V:t%q===N?function(t){const e=j(t),r=T(t),n=r(e,e.neg(e.ONE)),o=r(e,n),i=r(e,e.neg(n)),s=(t+S)/q;return(t,e)=>{let r=t.pow(e,s),c=t.mul(r,n);const a=t.mul(r,o),f=t.mul(r,i),u=t.eql(t.sqr(c),e),d=t.eql(t.sqr(a),e);r=t.cmov(r,c,u),c=t.cmov(f,a,d);const l=t.eql(t.sqr(c),e),h=t.cmov(r,c,l);return H(t,h,e),h}}(t):T(t)}const P=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function K(t,e,r=!1){const n=new Array(e.length).fill(r?t.ZERO:void 0),o=e.reduce((e,r,o)=>t.is0(r)?e:(n[o]=e,t.mul(e,r)),t.ONE),i=t.inv(o);return e.reduceRight((e,r,o)=>t.is0(r)?e:(n[o]=t.mul(e,n[o]),t.mul(e,r)),i),n}function L(t,e){const r=(t.ORDER-B)/v,n=t.pow(e,r),o=t.eql(n,t.ONE),i=t.eql(n,t.ZERO),s=t.eql(n,t.neg(t.ONE));if(!o&&!i&&!s)throw new Error("invalid Legendre symbol result");return o?1:i?0:-1}function C(e,r){void 0!==r&&t.anumber(r);const n=void 0!==r?r:e.toString(2).length;return{nBitLength:n,nByteLength:Math.ceil(n/8)}}function j(t,e,r=!1,n={}){if(t<=E)throw new Error("invalid field: expected ORDER > 0, got "+t);let o,i,s,c=!1;if("object"==typeof e&&null!=e){if(n.sqrt||r)throw new Error("cannot specify opts in two arguments");const t=e;t.BITS&&(o=t.BITS),t.sqrt&&(i=t.sqrt),"boolean"==typeof t.isLE&&(r=t.isLE),"boolean"==typeof t.modFromBytes&&(c=t.modFromBytes),s=t.allowedLengths}else"number"==typeof e&&(o=e),n.sqrt&&(i=n.sqrt);const{nBitLength:a,nByteLength:h}=C(t,o);if(h>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let w;const y=Object.freeze({ORDER:t,isLE:r,BITS:a,BYTES:h,MASK:p(a),ZERO:E,ONE:B,allowedLengths:s,create:e=>A(e,t),isValid:e=>{if("bigint"!=typeof e)throw new Error("invalid field element: expected bigint, got "+typeof e);return E<=e&&e<t},is0:t=>t===E,isValidNot0:t=>!y.is0(t)&&y.isValid(t),isOdd:t=>(t&B)===B,neg:e=>A(-e,t),eql:(t,e)=>t===e,sqr:e=>A(e*e,t),add:(e,r)=>A(e+r,t),sub:(e,r)=>A(e-r,t),mul:(e,r)=>A(e*r,t),pow:(t,e)=>function(t,e,r){if(r<E)throw new Error("invalid exponent, negatives unsupported");if(r===E)return t.ONE;if(r===B)return e;let n=t.ONE,o=e;for(;r>E;)r&B&&(n=t.mul(n,o)),o=t.sqr(o),r>>=B;return n}(y,t,e),div:(e,r)=>A(e*Z(r,t),t),sqrN:t=>t*t,addN:(t,e)=>t+e,subN:(t,e)=>t-e,mulN:(t,e)=>t*e,inv:e=>Z(e,t),sqrt:i||(e=>(w||(w=k(t)),w(y,e))),toBytes:t=>r?l(t,h):d(t,h),fromBytes:(e,n=!0)=>{if(s){if(!s.includes(e.length)||e.length>h)throw new Error("Field.fromBytes: expected "+s+" bytes, got "+e.length);const t=new Uint8Array(h);t.set(e,r?0:t.length-e.length),e=t}if(e.length!==h)throw new Error("Field.fromBytes: expected "+h+" bytes, got "+e.length);let o=r?u(e):f(e);if(c&&(o=A(o,t)),!n&&!y.isValid(o))throw new Error("invalid field element: outside of range 0..ORDER");return o},invertBatch:t=>K(y,t),cmov:(t,e,r)=>r?e:t});return Object.freeze(y)}function D(t){if("bigint"!=typeof t)throw new Error("field order must be bigint");const e=t.toString(2).length;return Math.ceil(e/8)}function Y(t){const e=D(t);return e+Math.ceil(e/2)}
|
|
@@ -9,4 +9,4 @@ const it=(t,e)=>(t+(t>=0?e:-e)/lt)/e;function st(t){if(!["compact","recovered","
|
|
|
9
9
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
10
10
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
11
11
|
const xt={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")},Ot={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),basises:[[BigInt("0x3086d221a7d46bcde86c90e49284eb15"),-BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),BigInt("0x3086d221a7d46bcde86c90e49284eb15")]]},Rt=BigInt(2);const St=j(xt.p,{sqrt:function(t){const e=xt.p,r=BigInt(3),n=BigInt(6),o=BigInt(11),i=BigInt(22),s=BigInt(23),c=BigInt(44),a=BigInt(88),f=t*t*t%e,u=f*f*t%e,d=F(u,r,e)*u%e,l=F(d,r,e)*u%e,h=F(l,Rt,e)*f%e,w=F(h,o,e)*h%e,y=F(w,i,e)*w%e,g=F(y,c,e)*y%e,p=F(g,a,e)*g%e,m=F(p,c,e)*y%e,b=F(m,r,e)*u%e,E=F(b,s,e)*w%e,B=F(E,n,e)*f%e,v=F(B,Rt,e);if(!St.eql(St.sqr(v),t))throw new Error("Cannot find square root");return v}}),It=function(t,e){const r=e=>vt({...t,hash:e});return{...r(e),create:r}}({...xt,Fp:St,lowS:!0,endo:Ot},t.sha256);exports.secp256k1=It;
|
|
12
|
-
//# sourceMappingURL=secp256k1-
|
|
12
|
+
//# sourceMappingURL=secp256k1-TcN6vWGh.cjs.map
|