@gurge/sdk-react-native 0.3.88 → 0.3.96

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.
@@ -1 +1 @@
1
- const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require(`../../../vendor/libsodium-wrappers/dist/modules/libsodium-wrappers.cjs`);let n=require(`ethers`);var r=e.__toESM(t.default),i=()=>r.default.crypto_box_SEALBYTES+r.default.crypto_secretbox_KEYBYTES,a=({nonce:e,sealedKeys:t,ciphertext:n})=>{let r=t.length,a=new Uint8Array(1+e.length+r*i()+n.length),o=0;return a[o]=r,o+=1,a.set(e,o),o+=e.length,t.forEach(e=>{a.set(e,o),o+=e.length}),a.set(n,o),a},o=(e,t)=>{let i=r.default.crypto_secretbox_keygen(),o=r.default.randombytes_buf(r.default.crypto_secretbox_NONCEBYTES),s=r.default.crypto_secretbox_easy(e,o,i);return a({nonce:o,sealedKeys:t.map(e=>r.default.crypto_box_seal(i,n.ethers.getBytes(e))),ciphertext:s})};exports.encryptSealedKeys=o,exports.pack=a;
1
+ const e=require("../../../_virtual/_rolldown/runtime.cjs");let t=require(`ethers`),n=require(`libsodium-wrappers`);n=e.__toESM(n);var r=()=>n.default.crypto_box_SEALBYTES+n.default.crypto_secretbox_KEYBYTES,i=({nonce:e,sealedKeys:t,ciphertext:n})=>{let i=t.length,a=new Uint8Array(1+e.length+i*r()+n.length),o=0;return a[o]=i,o+=1,a.set(e,o),o+=e.length,t.forEach(e=>{a.set(e,o),o+=e.length}),a.set(n,o),a},a=(e,r)=>{let a=n.default.crypto_secretbox_keygen(),o=n.default.randombytes_buf(n.default.crypto_secretbox_NONCEBYTES),s=n.default.crypto_secretbox_easy(e,o,a);return i({nonce:o,sealedKeys:r.map(e=>n.default.crypto_box_seal(a,t.ethers.getBytes(e))),ciphertext:s})};exports.encryptSealedKeys=a,exports.pack=i;
@@ -1,19 +1,18 @@
1
- import { __toESM as e } from "../../../_virtual/_rolldown/runtime.mjs";
2
- import { require_libsodium_wrappers as t } from "../../../vendor/libsodium-wrappers/dist/modules/libsodium-wrappers.mjs";
3
- import { ethers as n } from "ethers";
1
+ import { ethers as e } from "ethers";
2
+ import t from "libsodium-wrappers";
4
3
  //#region common/src/crypto/ecdh-sealed-keys.ts
5
- var r = /* @__PURE__ */ e(t()), i = () => r.default.crypto_box_SEALBYTES + r.default.crypto_secretbox_KEYBYTES, a = ({ nonce: e, sealedKeys: t, ciphertext: n }) => {
6
- let r = t.length, a = new Uint8Array(1 + e.length + r * i() + n.length), o = 0;
7
- return a[o] = r, o += 1, a.set(e, o), o += e.length, t.forEach((e) => {
4
+ var n = () => t.crypto_box_SEALBYTES + t.crypto_secretbox_KEYBYTES, r = ({ nonce: e, sealedKeys: t, ciphertext: r }) => {
5
+ let i = t.length, a = new Uint8Array(1 + e.length + i * n() + r.length), o = 0;
6
+ return a[o] = i, o += 1, a.set(e, o), o += e.length, t.forEach((e) => {
8
7
  a.set(e, o), o += e.length;
9
- }), a.set(n, o), a;
10
- }, o = (e, t) => {
11
- let i = r.default.crypto_secretbox_keygen(), o = r.default.randombytes_buf(r.default.crypto_secretbox_NONCEBYTES), s = r.default.crypto_secretbox_easy(e, o, i);
12
- return a({
8
+ }), a.set(r, o), a;
9
+ }, i = (n, i) => {
10
+ let a = t.crypto_secretbox_keygen(), o = t.randombytes_buf(t.crypto_secretbox_NONCEBYTES), s = t.crypto_secretbox_easy(n, o, a);
11
+ return r({
13
12
  nonce: o,
14
- sealedKeys: t.map((e) => r.default.crypto_box_seal(i, n.getBytes(e))),
13
+ sealedKeys: i.map((n) => t.crypto_box_seal(a, e.getBytes(n))),
15
14
  ciphertext: s
16
15
  });
17
16
  };
18
17
  //#endregion
19
- export { o as encryptSealedKeys, a as pack };
18
+ export { i as encryptSealedKeys, r as pack };
@@ -1 +1 @@
1
- require(`ethers`);
1
+ const e=require("../../../_virtual/_rolldown/runtime.cjs");require(`ethers`);let t=require(`libsodium-wrappers`);t=e.__toESM(t);
@@ -1 +1,2 @@
1
1
  import "ethers";
2
+ import "libsodium-wrappers";
@@ -1 +1 @@
1
- const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require(`./poseidon.cjs`),n=require(`../../../vendor/libsodium-wrappers/dist/modules/libsodium-wrappers.cjs`),r=require(`./babyJub.cjs`),i=require(`./eddsa.cjs`);let a=require(`buffer`),o=require(`process`);o=e.__toESM(o);var s=e.__toESM(n.default),c=async(e=!1)=>{(typeof window<`u`||typeof self<`u`)&&(typeof window<`u`&&(window.global=window),globalThis.Buffer=a.Buffer,globalThis.process=o.default),await Promise.all([s.default.ready,t.poseidonHolder.init(),r.jubHolder.init(),...e?[]:[i.eddsaHolder.init()]])};exports.preProcessing=c;
1
+ const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require(`./poseidon.cjs`),n=require(`./babyJub.cjs`),r=require(`./eddsa.cjs`);let i=require(`buffer`),a=require(`libsodium-wrappers`);a=e.__toESM(a);let o=require(`process`);o=e.__toESM(o);var s=async(e=!1)=>{(typeof window<`u`||typeof self<`u`)&&(typeof window<`u`&&(window.global=window),globalThis.Buffer=i.Buffer,globalThis.process=o.default),await Promise.all([a.default.ready,t.poseidonHolder.init(),n.jubHolder.init(),...e?[]:[r.eddsaHolder.init()]])};exports.preProcessing=s;
@@ -1,18 +1,17 @@
1
- import { __toESM as e } from "../../../_virtual/_rolldown/runtime.mjs";
2
- import { poseidonHolder as t } from "./poseidon.mjs";
3
- import { require_libsodium_wrappers as n } from "../../../vendor/libsodium-wrappers/dist/modules/libsodium-wrappers.mjs";
4
- import { jubHolder as r } from "./babyJub.mjs";
5
- import { eddsaHolder as i } from "./eddsa.mjs";
6
- import { Buffer as a } from "buffer";
7
- import o from "process";
1
+ import { poseidonHolder as e } from "./poseidon.mjs";
2
+ import { jubHolder as t } from "./babyJub.mjs";
3
+ import { eddsaHolder as n } from "./eddsa.mjs";
4
+ import { Buffer as r } from "buffer";
5
+ import i from "libsodium-wrappers";
6
+ import a from "process";
8
7
  //#region common/src/crypto/preProcessing.ts
9
- var s = /* @__PURE__ */ e(n()), c = async (e = !1) => {
10
- (typeof window < "u" || typeof self < "u") && (typeof window < "u" && (window.global = window), globalThis.Buffer = a, globalThis.process = o), await Promise.all([
11
- s.default.ready,
8
+ var o = async (o = !1) => {
9
+ (typeof window < "u" || typeof self < "u") && (typeof window < "u" && (window.global = window), globalThis.Buffer = r, globalThis.process = a), await Promise.all([
10
+ i.ready,
11
+ e.init(),
12
12
  t.init(),
13
- r.init(),
14
- ...e ? [] : [i.init()]
13
+ ...o ? [] : [n.init()]
15
14
  ]);
16
15
  };
17
16
  //#endregion
18
- export { c as preProcessing };
17
+ export { o as preProcessing };
@@ -1 +1 @@
1
- const e=require("../../../../_virtual/_rolldown/runtime.cjs"),t=require(`../../constants/protocol.constants.cjs`),n=require(`../../crypto/poseidon.cjs`),r=require(`../../../../vendor/libsodium-wrappers/dist/modules/libsodium-wrappers.cjs`),i=require(`../../crypto/babyJub.cjs`),a=require(`../../crypto/eddsa.cjs`),o=require(`../cacheDevices/AttachableMemoryCacheDevice.cjs`),s=require(`./keyUtils.cjs`);let c=require(`ethers`),l=require(`@solana/web3.js`),u=require(`bs58`);u=e.__toESM(u);let d=require(`tweetnacl`);d=e.__toESM(d);let f=require(`tronweb`);var p=e.__toESM(r.default),m=new o.AttachableMemoryCacheDevice,h=new o.AttachableMemoryCacheDevice,g=new o.AttachableMemoryCacheDevice,_=class{signature;nullifyingKey;PREFIX_FOR_SPENDING_PAIR=`1`;PREFIX_FOR_NULLIFYING_PAIR=`2`;constructor(e,t){this.signature=e,this.nullifyingKey=t}getSignature(){return this.requireSignature(),this.signature}setSignature(e){this.signature=e}requireSignature(){if(!this.signature)throw Error(`No signature provided`)}requireKeyMaterial(){if(!this.signature&&!this.nullifyingKey)throw Error(`No signature or private key provided`)}verifyTronMessage(e,t){return this.requireSignature(),t===f.Trx.verifyMessageV2(e,this.signature)}getShieldedPrivateKey=()=>(this.requireKeyMaterial(),this.nullifyingKey||=c.ethers.keccak256(this.signature),this.nullifyingKey);getShieldedPublicKey=()=>(this.requireKeyMaterial(),n.poseidonHash(this.getShieldedPrivateKey()));getSpendingKeyPair=()=>{this.requireSignature();let e=a.eddsaInstance(),t=i.babyJubInstance(),r=n.poseidonHash(this.PREFIX_FOR_SPENDING_PAIR,this.getSignature()),o=Buffer.from(c.ethers.getBytes(r)),s=e.prv2pub(o);return{privSpendingKey:r,pubSpendingBJJPoint:[BigInt(t.F.toString(s[0])),BigInt(t.F.toString(s[1]))]}};signEddsa=e=>{this.requireSignature();let t=i.babyJubInstance(),n=a.eddsaInstance(),r=Buffer.from(c.ethers.getBytes(this.getSpendingKeyPair().privSpendingKey)),o=t.F.e(e),s=n.signPoseidon(r,o);return{R8:[BigInt(t.F.toString(s.R8[0])),BigInt(t.F.toString(s.R8[1]))],S:BigInt(s.S)}};getShieldedPrivateKeyFromNonce=e=>{this.requireKeyMaterial();let t=n.poseidonHash(e,this.getShieldedPrivateKey(),this.getShieldedPublicKey());return c.ethers.keccak256(c.ethers.toUtf8Bytes(`hinkal-offchain-shielded-key:${t}`))};getClaimableSignatureFromNonce=e=>{this.requireKeyMaterial();let t=n.poseidonHash(e,this.getShieldedPrivateKey(),this.getShieldedPublicKey());return c.ethers.keccak256(c.ethers.toUtf8Bytes(`hinkal-claimable-utxo-signature:${t}`))};getDerivedEthereumAddress=()=>(this.requireKeyMaterial(),new c.ethers.Wallet(this.getShieldedPrivateKey()).address);getDerivedSolanaPublicKey=()=>(this.requireKeyMaterial(),l.Keypair.fromSeed(c.ethers.getBytes(this.getShieldedPrivateKey())).publicKey.toBase58());getNearIntentsAccountId=()=>{this.requireKeyMaterial();let e=l.Keypair.fromSeed(c.ethers.getBytes(this.getShieldedPrivateKey()));return c.ethers.hexlify(e.publicKey.toBytes()).slice(2)};getNearIntentsKeyPairString=()=>{this.requireKeyMaterial();let e=l.Keypair.fromSeed(c.ethers.getBytes(this.getShieldedPrivateKey()));return`ed25519:${u.default.encode(e.secretKey)}`};getSignerPrivateKeyFromNonce=e=>{this.requireKeyMaterial();let t=n.poseidonHash(e,this.getShieldedPrivateKey(),this.getShieldedPublicKey());return c.ethers.keccak256(c.ethers.toUtf8Bytes(t))};getSignerSolanaPrivateKeyFromNonce=e=>{let t=this.getSignerPrivateKeyFromNonce(e),n=c.ethers.getBytes(t),r=l.Keypair.fromSeed(n);return u.default.encode(r.secretKey)};verifyMessage(e){return this.requireSignature(),c.ethers.verifyMessage(e,this.signature)}verifySolanaMessage(e,t){this.requireSignature();let n=new TextEncoder().encode(e),r=c.ethers.getBytes(this.signature),i=new l.PublicKey(t).toBytes();return d.default.sign.detached.verify(n,r,i)}static getRandomizedStealthPairOld=h.attach((e,n)=>{let r=i.babyJubInstance(),a=e*(BigInt(n)%t.CIRCOM_P)%t.CIRCOM_P,o=r.mulPointEscalar(r.Base8,e),s=r.mulPointEscalar(r.Base8,a);return{H0:[BigInt(r.F.toString(o[0])),BigInt(r.F.toString(o[1]))],H1:[BigInt(r.F.toString(s[0])),BigInt(r.F.toString(s[1]))]}});static getRandomizedStealthPair=m.attach((e,n)=>{let r=i.babyJubInstance(),a=BigInt(n)%t.CIRCOM_P,o=r.mulPointEscalar(r.Base8,e),s=r.mulPointEscalar(o,a);return{H0:[BigInt(r.F.toString(o[0])),BigInt(r.F.toString(o[1]))],H1:[BigInt(r.F.toString(s[0])),BigInt(r.F.toString(s[1]))]}});static getStealthAddressCompressedPoints=(e,t)=>{let{H0:n,H1:r}=this.getRandomizedStealthPairOld(e,t),[i,a]=[n,r].map(e=>BigInt(e[1])+2n**255n*s.getCircomSign(e[0]));return{h0:i,h1:a}};static checkSignature=(e,t,n,r)=>{let{h0:i,h1:a}=this.getStealthAddressCompressedPoints(e,r);return t===i&&n===a};static getStealthAddress=g.attach((e,t)=>{let{H0:r,H1:i}=this.getRandomizedStealthPairOld(e,t);return n.poseidonHash(2n*s.getCircomSign(r[0])+s.getCircomSign(i[0]),r[1],i[1])});static getH1FromH0=(e,n)=>{let r=i.babyJubInstance(),a=BigInt(n)%t.CIRCOM_P,o=[r.F.e(e[0]),r.F.e(e[1])],s=r.mulPointEscalar(o,a);return[BigInt(r.F.toString(s[0])),BigInt(r.F.toString(s[1]))]};static verifyStealthPair=(e,t,n,r=!0)=>{let i=this.getH1FromH0(e,n);return r?i[1]===t[1]:i===t};static getStealthAddressNewStyle=(e,t,r)=>{if(r?.length!==2)throw Error(`Spending public key must be an array of 2 elements`);let i=this.getH1FromH0(e,t);return n.poseidonHash(2n*s.getCircomSign(e[0])+s.getCircomSign(i[0]),e[1],i[1],r[0],r[1],t)};static findCorrectRandomization(e,n){if(!n)throw Error(`No Private Shielded Key Provided`);let r=BigInt(n)%t.CIRCOM_P,i,a,o=0n;do i=e*10n**o%t.CIRCOM_P,a=i*r%t.CIRCOM_P,o+=1n;while(a>=2n**253n||i>=2n**253n);return i}static getH0FromRandomization=e=>{let t=i.babyJubInstance(),n=t.mulPointEscalar(t.Base8,e);return[BigInt(t.F.toString(n[0])),BigInt(t.F.toString(n[1]))]};static findH0(e,t){if(!t)return;let{H0:n}=this.getRandomizedStealthPair(e,t);return n}static getEncryptionKeyPair=e=>{let t=p.default.crypto_box_seed_keypair(c.ethers.getBytes(e));return{privateKey:c.ethers.hexlify(t.privateKey),publicKey:c.ethers.hexlify(t.publicKey)}};getAccessKey=()=>(this.requireKeyMaterial(),n.poseidonHash(this.getShieldedPrivateKey(),this.getShieldedPublicKey()));getBackendToken=()=>(this.requireKeyMaterial(),n.poseidonHash(this.getAccessKey(),this.getShieldedPublicKey()))};exports.UserKeys=_,exports.stealthAddressCacheDevice=g,exports.stealthPairCacheDevice=m,exports.stealthPairOldCacheDevice=h;
1
+ const e=require("../../../../_virtual/_rolldown/runtime.cjs"),t=require(`../../constants/protocol.constants.cjs`),n=require(`../../crypto/poseidon.cjs`),r=require(`../../crypto/babyJub.cjs`),i=require(`../../crypto/eddsa.cjs`),a=require(`../cacheDevices/AttachableMemoryCacheDevice.cjs`),o=require(`./keyUtils.cjs`);let s=require(`ethers`),c=require(`@solana/web3.js`),l=require(`bs58`);l=e.__toESM(l);let u=require(`libsodium-wrappers`);u=e.__toESM(u);let d=require(`tweetnacl`);d=e.__toESM(d);let f=require(`tronweb`);var p=new a.AttachableMemoryCacheDevice,m=new a.AttachableMemoryCacheDevice,h=new a.AttachableMemoryCacheDevice,g=class{signature;nullifyingKey;PREFIX_FOR_SPENDING_PAIR=`1`;PREFIX_FOR_NULLIFYING_PAIR=`2`;constructor(e,t){this.signature=e,this.nullifyingKey=t}getSignature(){return this.requireSignature(),this.signature}setSignature(e){this.signature=e}requireSignature(){if(!this.signature)throw Error(`No signature provided`)}requireKeyMaterial(){if(!this.signature&&!this.nullifyingKey)throw Error(`No signature or private key provided`)}verifyTronMessage(e,t){return this.requireSignature(),t===f.Trx.verifyMessageV2(e,this.signature)}getShieldedPrivateKey=()=>(this.requireKeyMaterial(),this.nullifyingKey||=s.ethers.keccak256(this.signature),this.nullifyingKey);getShieldedPublicKey=()=>(this.requireKeyMaterial(),n.poseidonHash(this.getShieldedPrivateKey()));getSpendingKeyPair=()=>{this.requireSignature();let e=i.eddsaInstance(),t=r.babyJubInstance(),a=n.poseidonHash(this.PREFIX_FOR_SPENDING_PAIR,this.getSignature()),o=Buffer.from(s.ethers.getBytes(a)),c=e.prv2pub(o);return{privSpendingKey:a,pubSpendingBJJPoint:[BigInt(t.F.toString(c[0])),BigInt(t.F.toString(c[1]))]}};signEddsa=e=>{this.requireSignature();let t=r.babyJubInstance(),n=i.eddsaInstance(),a=Buffer.from(s.ethers.getBytes(this.getSpendingKeyPair().privSpendingKey)),o=t.F.e(e),c=n.signPoseidon(a,o);return{R8:[BigInt(t.F.toString(c.R8[0])),BigInt(t.F.toString(c.R8[1]))],S:BigInt(c.S)}};getShieldedPrivateKeyFromNonce=e=>{this.requireKeyMaterial();let t=n.poseidonHash(e,this.getShieldedPrivateKey(),this.getShieldedPublicKey());return s.ethers.keccak256(s.ethers.toUtf8Bytes(`hinkal-offchain-shielded-key:${t}`))};getClaimableSignatureFromNonce=e=>{this.requireKeyMaterial();let t=n.poseidonHash(e,this.getShieldedPrivateKey(),this.getShieldedPublicKey());return s.ethers.keccak256(s.ethers.toUtf8Bytes(`hinkal-claimable-utxo-signature:${t}`))};getDerivedEthereumAddress=()=>(this.requireKeyMaterial(),new s.ethers.Wallet(this.getShieldedPrivateKey()).address);getDerivedSolanaPublicKey=()=>(this.requireKeyMaterial(),c.Keypair.fromSeed(s.ethers.getBytes(this.getShieldedPrivateKey())).publicKey.toBase58());getNearIntentsAccountId=()=>{this.requireKeyMaterial();let e=c.Keypair.fromSeed(s.ethers.getBytes(this.getShieldedPrivateKey()));return s.ethers.hexlify(e.publicKey.toBytes()).slice(2)};getNearIntentsKeyPairString=()=>{this.requireKeyMaterial();let e=c.Keypair.fromSeed(s.ethers.getBytes(this.getShieldedPrivateKey()));return`ed25519:${l.default.encode(e.secretKey)}`};getSignerPrivateKeyFromNonce=e=>{this.requireKeyMaterial();let t=n.poseidonHash(e,this.getShieldedPrivateKey(),this.getShieldedPublicKey());return s.ethers.keccak256(s.ethers.toUtf8Bytes(t))};getSignerSolanaPrivateKeyFromNonce=e=>{let t=this.getSignerPrivateKeyFromNonce(e),n=s.ethers.getBytes(t),r=c.Keypair.fromSeed(n);return l.default.encode(r.secretKey)};verifyMessage(e){return this.requireSignature(),s.ethers.verifyMessage(e,this.signature)}verifySolanaMessage(e,t){this.requireSignature();let n=new TextEncoder().encode(e),r=s.ethers.getBytes(this.signature),i=new c.PublicKey(t).toBytes();return d.default.sign.detached.verify(n,r,i)}static getRandomizedStealthPairOld=m.attach((e,n)=>{let i=r.babyJubInstance(),a=e*(BigInt(n)%t.CIRCOM_P)%t.CIRCOM_P,o=i.mulPointEscalar(i.Base8,e),s=i.mulPointEscalar(i.Base8,a);return{H0:[BigInt(i.F.toString(o[0])),BigInt(i.F.toString(o[1]))],H1:[BigInt(i.F.toString(s[0])),BigInt(i.F.toString(s[1]))]}});static getRandomizedStealthPair=p.attach((e,n)=>{let i=r.babyJubInstance(),a=BigInt(n)%t.CIRCOM_P,o=i.mulPointEscalar(i.Base8,e),s=i.mulPointEscalar(o,a);return{H0:[BigInt(i.F.toString(o[0])),BigInt(i.F.toString(o[1]))],H1:[BigInt(i.F.toString(s[0])),BigInt(i.F.toString(s[1]))]}});static getStealthAddressCompressedPoints=(e,t)=>{let{H0:n,H1:r}=this.getRandomizedStealthPairOld(e,t),[i,a]=[n,r].map(e=>BigInt(e[1])+2n**255n*o.getCircomSign(e[0]));return{h0:i,h1:a}};static checkSignature=(e,t,n,r)=>{let{h0:i,h1:a}=this.getStealthAddressCompressedPoints(e,r);return t===i&&n===a};static getStealthAddress=h.attach((e,t)=>{let{H0:r,H1:i}=this.getRandomizedStealthPairOld(e,t);return n.poseidonHash(2n*o.getCircomSign(r[0])+o.getCircomSign(i[0]),r[1],i[1])});static getH1FromH0=(e,n)=>{let i=r.babyJubInstance(),a=BigInt(n)%t.CIRCOM_P,o=[i.F.e(e[0]),i.F.e(e[1])],s=i.mulPointEscalar(o,a);return[BigInt(i.F.toString(s[0])),BigInt(i.F.toString(s[1]))]};static verifyStealthPair=(e,t,n,r=!0)=>{let i=this.getH1FromH0(e,n);return r?i[1]===t[1]:i===t};static getStealthAddressNewStyle=(e,t,r)=>{if(r?.length!==2)throw Error(`Spending public key must be an array of 2 elements`);let i=this.getH1FromH0(e,t);return n.poseidonHash(2n*o.getCircomSign(e[0])+o.getCircomSign(i[0]),e[1],i[1],r[0],r[1],t)};static findCorrectRandomization(e,n){if(!n)throw Error(`No Private Shielded Key Provided`);let r=BigInt(n)%t.CIRCOM_P,i,a,o=0n;do i=e*10n**o%t.CIRCOM_P,a=i*r%t.CIRCOM_P,o+=1n;while(a>=2n**253n||i>=2n**253n);return i}static getH0FromRandomization=e=>{let t=r.babyJubInstance(),n=t.mulPointEscalar(t.Base8,e);return[BigInt(t.F.toString(n[0])),BigInt(t.F.toString(n[1]))]};static findH0(e,t){if(!t)return;let{H0:n}=this.getRandomizedStealthPair(e,t);return n}static getEncryptionKeyPair=e=>{let t=u.default.crypto_box_seed_keypair(s.ethers.getBytes(e));return{privateKey:s.ethers.hexlify(t.privateKey),publicKey:s.ethers.hexlify(t.publicKey)}};getAccessKey=()=>(this.requireKeyMaterial(),n.poseidonHash(this.getShieldedPrivateKey(),this.getShieldedPublicKey()));getBackendToken=()=>(this.requireKeyMaterial(),n.poseidonHash(this.getAccessKey(),this.getShieldedPublicKey()))};exports.UserKeys=g,exports.stealthAddressCacheDevice=h,exports.stealthPairCacheDevice=p,exports.stealthPairOldCacheDevice=m;
@@ -1,18 +1,17 @@
1
- import { __toESM as e } from "../../../../_virtual/_rolldown/runtime.mjs";
2
- import { CIRCOM_P as t } from "../../constants/protocol.constants.mjs";
3
- import { poseidonHash as n } from "../../crypto/poseidon.mjs";
4
- import { require_libsodium_wrappers as r } from "../../../../vendor/libsodium-wrappers/dist/modules/libsodium-wrappers.mjs";
5
- import { babyJubInstance as i } from "../../crypto/babyJub.mjs";
6
- import { eddsaInstance as a } from "../../crypto/eddsa.mjs";
7
- import { AttachableMemoryCacheDevice as o } from "../cacheDevices/AttachableMemoryCacheDevice.mjs";
8
- import { getCircomSign as s } from "./keyUtils.mjs";
9
- import { ethers as c } from "ethers";
10
- import { Keypair as l, PublicKey as u } from "@solana/web3.js";
11
- import d from "bs58";
12
- import f from "tweetnacl";
13
- import { Trx as p } from "tronweb";
1
+ import { CIRCOM_P as e } from "../../constants/protocol.constants.mjs";
2
+ import { poseidonHash as t } from "../../crypto/poseidon.mjs";
3
+ import { babyJubInstance as n } from "../../crypto/babyJub.mjs";
4
+ import { eddsaInstance as r } from "../../crypto/eddsa.mjs";
5
+ import { AttachableMemoryCacheDevice as i } from "../cacheDevices/AttachableMemoryCacheDevice.mjs";
6
+ import { getCircomSign as a } from "./keyUtils.mjs";
7
+ import { ethers as o } from "ethers";
8
+ import { Keypair as s, PublicKey as c } from "@solana/web3.js";
9
+ import l from "bs58";
10
+ import u from "libsodium-wrappers";
11
+ import d from "tweetnacl";
12
+ import { Trx as f } from "tronweb";
14
13
  //#region common/src/data-structures/crypto-keys/keys.ts
15
- var m = /* @__PURE__ */ e(r()), h = new o(), g = new o(), _ = new o(), v = class {
14
+ var p = new i(), m = new i(), h = new i(), g = class {
16
15
  signature;
17
16
  nullifyingKey;
18
17
  PREFIX_FOR_SPENDING_PAIR = "1";
@@ -33,118 +32,118 @@ var m = /* @__PURE__ */ e(r()), h = new o(), g = new o(), _ = new o(), v = class
33
32
  if (!this.signature && !this.nullifyingKey) throw Error("No signature or private key provided");
34
33
  }
35
34
  verifyTronMessage(e, t) {
36
- return this.requireSignature(), t === p.verifyMessageV2(e, this.signature);
35
+ return this.requireSignature(), t === f.verifyMessageV2(e, this.signature);
37
36
  }
38
- getShieldedPrivateKey = () => (this.requireKeyMaterial(), this.nullifyingKey ||= c.keccak256(this.signature), this.nullifyingKey);
39
- getShieldedPublicKey = () => (this.requireKeyMaterial(), n(this.getShieldedPrivateKey()));
37
+ getShieldedPrivateKey = () => (this.requireKeyMaterial(), this.nullifyingKey ||= o.keccak256(this.signature), this.nullifyingKey);
38
+ getShieldedPublicKey = () => (this.requireKeyMaterial(), t(this.getShieldedPrivateKey()));
40
39
  getSpendingKeyPair = () => {
41
40
  this.requireSignature();
42
- let e = a(), t = i(), r = n(this.PREFIX_FOR_SPENDING_PAIR, this.getSignature()), o = Buffer.from(c.getBytes(r)), s = e.prv2pub(o);
41
+ let e = r(), i = n(), a = t(this.PREFIX_FOR_SPENDING_PAIR, this.getSignature()), s = Buffer.from(o.getBytes(a)), c = e.prv2pub(s);
43
42
  return {
44
- privSpendingKey: r,
45
- pubSpendingBJJPoint: [BigInt(t.F.toString(s[0])), BigInt(t.F.toString(s[1]))]
43
+ privSpendingKey: a,
44
+ pubSpendingBJJPoint: [BigInt(i.F.toString(c[0])), BigInt(i.F.toString(c[1]))]
46
45
  };
47
46
  };
48
47
  signEddsa = (e) => {
49
48
  this.requireSignature();
50
- let t = i(), n = a(), r = Buffer.from(c.getBytes(this.getSpendingKeyPair().privSpendingKey)), o = t.F.e(e), s = n.signPoseidon(r, o);
49
+ let t = n(), i = r(), a = Buffer.from(o.getBytes(this.getSpendingKeyPair().privSpendingKey)), s = t.F.e(e), c = i.signPoseidon(a, s);
51
50
  return {
52
- R8: [BigInt(t.F.toString(s.R8[0])), BigInt(t.F.toString(s.R8[1]))],
53
- S: BigInt(s.S)
51
+ R8: [BigInt(t.F.toString(c.R8[0])), BigInt(t.F.toString(c.R8[1]))],
52
+ S: BigInt(c.S)
54
53
  };
55
54
  };
56
55
  getShieldedPrivateKeyFromNonce = (e) => {
57
56
  this.requireKeyMaterial();
58
- let t = n(e, this.getShieldedPrivateKey(), this.getShieldedPublicKey());
59
- return c.keccak256(c.toUtf8Bytes(`hinkal-offchain-shielded-key:${t}`));
57
+ let n = t(e, this.getShieldedPrivateKey(), this.getShieldedPublicKey());
58
+ return o.keccak256(o.toUtf8Bytes(`hinkal-offchain-shielded-key:${n}`));
60
59
  };
61
60
  getClaimableSignatureFromNonce = (e) => {
62
61
  this.requireKeyMaterial();
63
- let t = n(e, this.getShieldedPrivateKey(), this.getShieldedPublicKey());
64
- return c.keccak256(c.toUtf8Bytes(`hinkal-claimable-utxo-signature:${t}`));
62
+ let n = t(e, this.getShieldedPrivateKey(), this.getShieldedPublicKey());
63
+ return o.keccak256(o.toUtf8Bytes(`hinkal-claimable-utxo-signature:${n}`));
65
64
  };
66
- getDerivedEthereumAddress = () => (this.requireKeyMaterial(), new c.Wallet(this.getShieldedPrivateKey()).address);
67
- getDerivedSolanaPublicKey = () => (this.requireKeyMaterial(), l.fromSeed(c.getBytes(this.getShieldedPrivateKey())).publicKey.toBase58());
65
+ getDerivedEthereumAddress = () => (this.requireKeyMaterial(), new o.Wallet(this.getShieldedPrivateKey()).address);
66
+ getDerivedSolanaPublicKey = () => (this.requireKeyMaterial(), s.fromSeed(o.getBytes(this.getShieldedPrivateKey())).publicKey.toBase58());
68
67
  getNearIntentsAccountId = () => {
69
68
  this.requireKeyMaterial();
70
- let e = l.fromSeed(c.getBytes(this.getShieldedPrivateKey()));
71
- return c.hexlify(e.publicKey.toBytes()).slice(2);
69
+ let e = s.fromSeed(o.getBytes(this.getShieldedPrivateKey()));
70
+ return o.hexlify(e.publicKey.toBytes()).slice(2);
72
71
  };
73
72
  getNearIntentsKeyPairString = () => {
74
73
  this.requireKeyMaterial();
75
- let e = l.fromSeed(c.getBytes(this.getShieldedPrivateKey()));
76
- return `ed25519:${d.encode(e.secretKey)}`;
74
+ let e = s.fromSeed(o.getBytes(this.getShieldedPrivateKey()));
75
+ return `ed25519:${l.encode(e.secretKey)}`;
77
76
  };
78
77
  getSignerPrivateKeyFromNonce = (e) => {
79
78
  this.requireKeyMaterial();
80
- let t = n(e, this.getShieldedPrivateKey(), this.getShieldedPublicKey());
81
- return c.keccak256(c.toUtf8Bytes(t));
79
+ let n = t(e, this.getShieldedPrivateKey(), this.getShieldedPublicKey());
80
+ return o.keccak256(o.toUtf8Bytes(n));
82
81
  };
83
82
  getSignerSolanaPrivateKeyFromNonce = (e) => {
84
- let t = this.getSignerPrivateKeyFromNonce(e), n = c.getBytes(t), r = l.fromSeed(n);
85
- return d.encode(r.secretKey);
83
+ let t = this.getSignerPrivateKeyFromNonce(e), n = o.getBytes(t), r = s.fromSeed(n);
84
+ return l.encode(r.secretKey);
86
85
  };
87
86
  verifyMessage(e) {
88
- return this.requireSignature(), c.verifyMessage(e, this.signature);
87
+ return this.requireSignature(), o.verifyMessage(e, this.signature);
89
88
  }
90
89
  verifySolanaMessage(e, t) {
91
90
  this.requireSignature();
92
- let n = new TextEncoder().encode(e), r = c.getBytes(this.signature), i = new u(t).toBytes();
93
- return f.sign.detached.verify(n, r, i);
91
+ let n = new TextEncoder().encode(e), r = o.getBytes(this.signature), i = new c(t).toBytes();
92
+ return d.sign.detached.verify(n, r, i);
94
93
  }
95
- static getRandomizedStealthPairOld = g.attach((e, n) => {
96
- let r = i(), a = e * (BigInt(n) % t) % t, o = r.mulPointEscalar(r.Base8, e), s = r.mulPointEscalar(r.Base8, a);
94
+ static getRandomizedStealthPairOld = m.attach((t, r) => {
95
+ let i = n(), a = t * (BigInt(r) % e) % e, o = i.mulPointEscalar(i.Base8, t), s = i.mulPointEscalar(i.Base8, a);
97
96
  return {
98
- H0: [BigInt(r.F.toString(o[0])), BigInt(r.F.toString(o[1]))],
99
- H1: [BigInt(r.F.toString(s[0])), BigInt(r.F.toString(s[1]))]
97
+ H0: [BigInt(i.F.toString(o[0])), BigInt(i.F.toString(o[1]))],
98
+ H1: [BigInt(i.F.toString(s[0])), BigInt(i.F.toString(s[1]))]
100
99
  };
101
100
  });
102
- static getRandomizedStealthPair = h.attach((e, n) => {
103
- let r = i(), a = BigInt(n) % t, o = r.mulPointEscalar(r.Base8, e), s = r.mulPointEscalar(o, a);
101
+ static getRandomizedStealthPair = p.attach((t, r) => {
102
+ let i = n(), a = BigInt(r) % e, o = i.mulPointEscalar(i.Base8, t), s = i.mulPointEscalar(o, a);
104
103
  return {
105
- H0: [BigInt(r.F.toString(o[0])), BigInt(r.F.toString(o[1]))],
106
- H1: [BigInt(r.F.toString(s[0])), BigInt(r.F.toString(s[1]))]
104
+ H0: [BigInt(i.F.toString(o[0])), BigInt(i.F.toString(o[1]))],
105
+ H1: [BigInt(i.F.toString(s[0])), BigInt(i.F.toString(s[1]))]
107
106
  };
108
107
  });
109
108
  static getStealthAddressCompressedPoints = (e, t) => {
110
- let { H0: n, H1: r } = this.getRandomizedStealthPairOld(e, t), [i, a] = [n, r].map((e) => BigInt(e[1]) + 2n ** 255n * s(e[0]));
109
+ let { H0: n, H1: r } = this.getRandomizedStealthPairOld(e, t), [i, o] = [n, r].map((e) => BigInt(e[1]) + 2n ** 255n * a(e[0]));
111
110
  return {
112
111
  h0: i,
113
- h1: a
112
+ h1: o
114
113
  };
115
114
  };
116
115
  static checkSignature = (e, t, n, r) => {
117
116
  let { h0: i, h1: a } = this.getStealthAddressCompressedPoints(e, r);
118
117
  return t === i && n === a;
119
118
  };
120
- static getStealthAddress = _.attach((e, t) => {
121
- let { H0: r, H1: i } = this.getRandomizedStealthPairOld(e, t);
122
- return n(2n * s(r[0]) + s(i[0]), r[1], i[1]);
119
+ static getStealthAddress = h.attach((e, n) => {
120
+ let { H0: r, H1: i } = this.getRandomizedStealthPairOld(e, n);
121
+ return t(2n * a(r[0]) + a(i[0]), r[1], i[1]);
123
122
  });
124
- static getH1FromH0 = (e, n) => {
125
- let r = i(), a = BigInt(n) % t, o = [r.F.e(e[0]), r.F.e(e[1])], s = r.mulPointEscalar(o, a);
126
- return [BigInt(r.F.toString(s[0])), BigInt(r.F.toString(s[1]))];
123
+ static getH1FromH0 = (t, r) => {
124
+ let i = n(), a = BigInt(r) % e, o = [i.F.e(t[0]), i.F.e(t[1])], s = i.mulPointEscalar(o, a);
125
+ return [BigInt(i.F.toString(s[0])), BigInt(i.F.toString(s[1]))];
127
126
  };
128
127
  static verifyStealthPair = (e, t, n, r = !0) => {
129
128
  let i = this.getH1FromH0(e, n);
130
129
  return r ? i[1] === t[1] : i === t;
131
130
  };
132
- static getStealthAddressNewStyle = (e, t, r) => {
131
+ static getStealthAddressNewStyle = (e, n, r) => {
133
132
  if (r?.length !== 2) throw Error("Spending public key must be an array of 2 elements");
134
- let i = this.getH1FromH0(e, t);
135
- return n(2n * s(e[0]) + s(i[0]), e[1], i[1], r[0], r[1], t);
133
+ let i = this.getH1FromH0(e, n);
134
+ return t(2n * a(e[0]) + a(i[0]), e[1], i[1], r[0], r[1], n);
136
135
  };
137
- static findCorrectRandomization(e, n) {
136
+ static findCorrectRandomization(t, n) {
138
137
  if (!n) throw Error("No Private Shielded Key Provided");
139
- let r = BigInt(n) % t, i, a, o = 0n;
138
+ let r = BigInt(n) % e, i, a, o = 0n;
140
139
  do
141
- i = e * 10n ** o % t, a = i * r % t, o += 1n;
140
+ i = t * 10n ** o % e, a = i * r % e, o += 1n;
142
141
  while (a >= 2n ** 253n || i >= 2n ** 253n);
143
142
  return i;
144
143
  }
145
144
  static getH0FromRandomization = (e) => {
146
- let t = i(), n = t.mulPointEscalar(t.Base8, e);
147
- return [BigInt(t.F.toString(n[0])), BigInt(t.F.toString(n[1]))];
145
+ let t = n(), r = t.mulPointEscalar(t.Base8, e);
146
+ return [BigInt(t.F.toString(r[0])), BigInt(t.F.toString(r[1]))];
148
147
  };
149
148
  static findH0(e, t) {
150
149
  if (!t) return;
@@ -152,14 +151,14 @@ var m = /* @__PURE__ */ e(r()), h = new o(), g = new o(), _ = new o(), v = class
152
151
  return n;
153
152
  }
154
153
  static getEncryptionKeyPair = (e) => {
155
- let t = m.default.crypto_box_seed_keypair(c.getBytes(e));
154
+ let t = u.crypto_box_seed_keypair(o.getBytes(e));
156
155
  return {
157
- privateKey: c.hexlify(t.privateKey),
158
- publicKey: c.hexlify(t.publicKey)
156
+ privateKey: o.hexlify(t.privateKey),
157
+ publicKey: o.hexlify(t.publicKey)
159
158
  };
160
159
  };
161
- getAccessKey = () => (this.requireKeyMaterial(), n(this.getShieldedPrivateKey(), this.getShieldedPublicKey()));
162
- getBackendToken = () => (this.requireKeyMaterial(), n(this.getAccessKey(), this.getShieldedPublicKey()));
160
+ getAccessKey = () => (this.requireKeyMaterial(), t(this.getShieldedPrivateKey(), this.getShieldedPublicKey()));
161
+ getBackendToken = () => (this.requireKeyMaterial(), t(this.getAccessKey(), this.getShieldedPublicKey()));
163
162
  };
164
163
  //#endregion
165
- export { v as UserKeys, _ as stealthAddressCacheDevice, h as stealthPairCacheDevice, g as stealthPairOldCacheDevice };
164
+ export { g as UserKeys, h as stealthAddressCacheDevice, p as stealthPairCacheDevice, m as stealthPairOldCacheDevice };
@@ -1 +1 @@
1
- const e=require("../../../../_virtual/_rolldown/runtime.cjs"),t=require(`./serialize.utils.cjs`),n=require(`../../../../vendor/libsodium-wrappers/dist/modules/libsodium-wrappers.cjs`),r=require(`./enclaveHandshakeService.cjs`);let i=require(`ethers`),a=require(`node-forge`);a=e.__toESM(a);var o=e.__toESM(n.default),s=e=>typeof e==`bigint`||typeof e==`number`?e.toString():e,c=e=>a.util.hexToBytes(e.replace(`0x`,``)),l=e=>{let t=structuredClone(e);return Object.entries(t).forEach(([e,n])=>{t[e]=s(n),Array.isArray(n)&&(Array.isArray(n[0])?t[e]=n.map(e=>e.map(s)):t[e]=n.map(s))}),t},u=(e,t)=>{let n=a.util.decode64(e),r=a.asn1.fromDer(a.util.createBuffer(n)),i=a.pki.publicKeyFromAsn1(r),o=a.util.binary.raw.encode(t),s=i.encrypt(o,`RSA-OAEP`,{md:a.md.sha1.create(),mgf1:{md:a.md.sha1.create()}});return a.util.encode64(s)},d=(e,t)=>{let n=o.default.randombytes_buf(o.default.crypto_secretbox_NONCEBYTES),r=o.default.crypto_secretbox_easy(t,n,e),s=c(i.ethers.hexlify(n)+i.ethers.hexlify(r).slice(2));return a.util.encode64(s)},f=(e,t)=>{let n=o.default.randombytes_buf(o.default.crypto_secretbox_KEYBYTES);return{keyCiphertext:u(t,n),inputCiphertext:d(n,e)}},p=(e,n)=>{let r=typeof e==`string`?e:t.safeJsonStringify(l(e));return f(new TextEncoder().encode(r),n)},m=async e=>p(e,await r.enclaveHandshakeService.getPublicKey()),h=async e=>f(e,await r.enclaveHandshakeService.getPublicKey());exports.makeEnclaveHandshakeAndEncryptInput=m,exports.makeEnclaveHandshakeAndEncryptUint8Array=h;
1
+ const e=require("../../../../_virtual/_rolldown/runtime.cjs"),t=require(`./serialize.utils.cjs`),n=require(`./enclaveHandshakeService.cjs`);let r=require(`ethers`),i=require(`libsodium-wrappers`);i=e.__toESM(i);let a=require(`node-forge`);a=e.__toESM(a);var o=e=>typeof e==`bigint`||typeof e==`number`?e.toString():e,s=e=>a.util.hexToBytes(e.replace(`0x`,``)),c=e=>{let t=structuredClone(e);return Object.entries(t).forEach(([e,n])=>{t[e]=o(n),Array.isArray(n)&&(Array.isArray(n[0])?t[e]=n.map(e=>e.map(o)):t[e]=n.map(o))}),t},l=(e,t)=>{let n=a.util.decode64(e),r=a.asn1.fromDer(a.util.createBuffer(n)),i=a.pki.publicKeyFromAsn1(r),o=a.util.binary.raw.encode(t),s=i.encrypt(o,`RSA-OAEP`,{md:a.md.sha1.create(),mgf1:{md:a.md.sha1.create()}});return a.util.encode64(s)},u=(e,t)=>{let n=i.default.randombytes_buf(i.default.crypto_secretbox_NONCEBYTES),o=i.default.crypto_secretbox_easy(t,n,e),c=s(r.ethers.hexlify(n)+r.ethers.hexlify(o).slice(2));return a.util.encode64(c)},d=(e,t)=>{let n=i.default.randombytes_buf(i.default.crypto_secretbox_KEYBYTES);return{keyCiphertext:l(t,n),inputCiphertext:u(n,e)}},f=(e,n)=>{let r=typeof e==`string`?e:t.safeJsonStringify(c(e));return d(new TextEncoder().encode(r),n)},p=async e=>f(e,await n.enclaveHandshakeService.getPublicKey()),m=async e=>d(e,await n.enclaveHandshakeService.getPublicKey());exports.makeEnclaveHandshakeAndEncryptInput=p,exports.makeEnclaveHandshakeAndEncryptUint8Array=m;
@@ -1,33 +1,32 @@
1
- import { __toESM as e } from "../../../../_virtual/_rolldown/runtime.mjs";
2
- import { safeJsonStringify as t } from "./serialize.utils.mjs";
3
- import { require_libsodium_wrappers as n } from "../../../../vendor/libsodium-wrappers/dist/modules/libsodium-wrappers.mjs";
4
- import { enclaveHandshakeService as r } from "./enclaveHandshakeService.mjs";
5
- import { ethers as i } from "ethers";
6
- import * as a from "node-forge";
1
+ import { safeJsonStringify as e } from "./serialize.utils.mjs";
2
+ import { enclaveHandshakeService as t } from "./enclaveHandshakeService.mjs";
3
+ import { ethers as n } from "ethers";
4
+ import r from "libsodium-wrappers";
5
+ import * as i from "node-forge";
7
6
  //#region common/src/functions/utils/encryptInputForEnclave.ts
8
- var o = /* @__PURE__ */ e(n()), s = (e) => typeof e == "bigint" || typeof e == "number" ? e.toString() : e, c = (e) => a.util.hexToBytes(e.replace("0x", "")), l = (e) => {
7
+ var a = (e) => typeof e == "bigint" || typeof e == "number" ? e.toString() : e, o = (e) => i.util.hexToBytes(e.replace("0x", "")), s = (e) => {
9
8
  let t = structuredClone(e);
10
9
  return Object.entries(t).forEach(([e, n]) => {
11
- t[e] = s(n), Array.isArray(n) && (Array.isArray(n[0]) ? t[e] = n.map((e) => e.map(s)) : t[e] = n.map(s));
10
+ t[e] = a(n), Array.isArray(n) && (Array.isArray(n[0]) ? t[e] = n.map((e) => e.map(a)) : t[e] = n.map(a));
12
11
  }), t;
13
- }, u = (e, t) => {
14
- let n = a.util.decode64(e), r = a.asn1.fromDer(a.util.createBuffer(n)), i = a.pki.publicKeyFromAsn1(r), o = a.util.binary.raw.encode(t), s = i.encrypt(o, "RSA-OAEP", {
15
- md: a.md.sha1.create(),
16
- mgf1: { md: a.md.sha1.create() }
12
+ }, c = (e, t) => {
13
+ let n = i.util.decode64(e), r = i.asn1.fromDer(i.util.createBuffer(n)), a = i.pki.publicKeyFromAsn1(r), o = i.util.binary.raw.encode(t), s = a.encrypt(o, "RSA-OAEP", {
14
+ md: i.md.sha1.create(),
15
+ mgf1: { md: i.md.sha1.create() }
17
16
  });
18
- return a.util.encode64(s);
19
- }, d = (e, t) => {
20
- let n = o.default.randombytes_buf(o.default.crypto_secretbox_NONCEBYTES), r = o.default.crypto_secretbox_easy(t, n, e), s = c(i.hexlify(n) + i.hexlify(r).slice(2));
21
- return a.util.encode64(s);
22
- }, f = (e, t) => {
23
- let n = o.default.randombytes_buf(o.default.crypto_secretbox_KEYBYTES);
17
+ return i.util.encode64(s);
18
+ }, l = (e, t) => {
19
+ let a = r.randombytes_buf(r.crypto_secretbox_NONCEBYTES), s = r.crypto_secretbox_easy(t, a, e), c = o(n.hexlify(a) + n.hexlify(s).slice(2));
20
+ return i.util.encode64(c);
21
+ }, u = (e, t) => {
22
+ let n = r.randombytes_buf(r.crypto_secretbox_KEYBYTES);
24
23
  return {
25
- keyCiphertext: u(t, n),
26
- inputCiphertext: d(n, e)
24
+ keyCiphertext: c(t, n),
25
+ inputCiphertext: l(n, e)
27
26
  };
28
- }, p = (e, n) => {
29
- let r = typeof e == "string" ? e : t(l(e));
30
- return f(new TextEncoder().encode(r), n);
31
- }, m = async (e) => p(e, await r.getPublicKey()), h = async (e) => f(e, await r.getPublicKey());
27
+ }, d = (t, n) => {
28
+ let r = typeof t == "string" ? t : e(s(t));
29
+ return u(new TextEncoder().encode(r), n);
30
+ }, f = async (e) => d(e, await t.getPublicKey()), p = async (e) => u(e, await t.getPublicKey());
32
31
  //#endregion
33
- export { m as makeEnclaveHandshakeAndEncryptInput, h as makeEnclaveHandshakeAndEncryptUint8Array };
32
+ export { f as makeEnclaveHandshakeAndEncryptInput, p as makeEnclaveHandshakeAndEncryptUint8Array };
@@ -1 +1 @@
1
- var e=`/assets/utxoWorkerLauncher-BT0VeiZB.js`;exports.default=e;
1
+ var e=`/assets/utxoWorkerLauncher-DvkI4llp.js`;exports.default=e;
@@ -1,4 +1,4 @@
1
1
  //#region common/src/webworker/utxoWorker/utxoWorkerLauncher.ts?worker&url
2
- var e = "/assets/utxoWorkerLauncher-BT0VeiZB.js";
2
+ var e = "/assets/utxoWorkerLauncher-DvkI4llp.js";
3
3
  //#endregion
4
4
  export { e as default };
@@ -2,9 +2,9 @@
2
2
  const domain = 'https://storage.googleapis.com/hinkal-workers-staging';
3
3
 
4
4
  const WORKER_CDN_URLS = {
5
- ZKProof: domain + '/0.3.88/' + 'zkProofWorkerLauncher.js',
6
- SnarkJS: domain + '/0.3.88/' + 'snarkjsWorkerLauncher.js',
7
- UTXO: domain + '/0.3.88/' + 'utxoWorkerLauncher.js',
5
+ ZKProof: domain + '/0.3.96/' + 'zkProofWorkerLauncher.js',
6
+ SnarkJS: domain + '/0.3.96/' + 'snarkjsWorkerLauncher.js',
7
+ UTXO: domain + '/0.3.96/' + 'utxoWorkerLauncher.js',
8
8
  };
9
9
 
10
10
  // Returns a blob:// URL which points
@@ -1 +1 @@
1
- var e=`/assets/zkProofWorkerLauncher-3TPbHuNd.js`;exports.default=e;
1
+ var e=`/assets/zkProofWorkerLauncher-sNtxURBH.js`;exports.default=e;
@@ -1,4 +1,4 @@
1
1
  //#region common/src/webworker/zkProofWorker/zkProofWorkerLauncher.ts?worker&url
2
- var e = "/assets/zkProofWorkerLauncher-3TPbHuNd.js";
2
+ var e = "/assets/zkProofWorkerLauncher-sNtxURBH.js";
3
3
  //#endregion
4
4
  export { e as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gurge/sdk-react-native",
3
- "version": "0.3.88",
3
+ "version": "0.3.96",
4
4
  "description": "Prebundled Hinkal SDK for React Native — no Metro config required.",
5
5
  "homepage": "hinkal.io",
6
6
  "author": {
@@ -50,7 +50,8 @@
50
50
  "build": "nx build sdk-react-native"
51
51
  },
52
52
  "dependencies": {
53
- "buffer": "6.0.3"
53
+ "buffer": "6.0.3",
54
+ "libsodium-wrappers": "^0.8.2"
54
55
  },
55
56
  "peerDependencies": {
56
57
  "react": ">=18.2.0",
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require("../_virtual/_rolldown/runtime.cjs");const e=require(`./HinkalWebViewWorker.cjs`);let t=require(`react/jsx-runtime`);var n=({children:n})=>(0,t.jsxs)(t.Fragment,{children:[n,(0,t.jsx)(e,{})]});exports.HinkalProvider=n;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require("../_virtual/_rolldown/runtime.cjs"),require(`../bootstrap.cjs`);const e=require(`./HinkalWebViewWorker.cjs`);let t=require(`react/jsx-runtime`);var n=({children:n})=>(0,t.jsxs)(t.Fragment,{children:[n,(0,t.jsx)(e,{})]});exports.HinkalProvider=n;
@@ -1,3 +1,4 @@
1
+ import "../bootstrap.mjs";
1
2
  import e from "./HinkalWebViewWorker.mjs";
2
3
  import { Fragment as t, jsx as n, jsxs as r } from "react/jsx-runtime";
3
4
  //#region ./react-native/HinkalProvider.tsx
@@ -0,0 +1,2 @@
1
+ // Static require so Metro can resolve it; subpath bypasses package "import" (ESM) exports.
2
+ module.exports = require("libsodium-wrappers/dist/modules/libsodium-wrappers.js");
@@ -0,0 +1,3 @@
1
+ import mod from "./libsodium-wrappers.cjs";
2
+ export function require_libsodium_wrappers() { return mod; }
3
+ export default mod;