zigap-utils 0.0.47 → 0.0.48

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/index.es.js CHANGED
@@ -14043,19 +14043,53 @@ class y1 {
14043
14043
  };
14044
14044
  }
14045
14045
  }
14046
- const ri = new y1(), g1 = "loginRes", C1 = () => {
14047
- const [f, e] = _r(void 0);
14046
+ const ri = new y1(), g1 = "loginRes", M1 = () => {
14047
+ const [f, e] = _r(void 0), t = localStorage.getItem("loginRes");
14048
14048
  return Ft(() => {
14049
- const t = localStorage.getItem("loginRes");
14050
- t && e(JSON.parse(t));
14051
- }, []), f;
14052
- }, ca = "data:image/svg+xml,%3csvg%20width='167'%20height='166'%20viewBox='0%200%20167%20166'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M116.052%20115.296H166.355H166.36V0H51.0675V50.3042H0.759995V165.6H116.052V115.296ZM90.3366%2065.3428L40.21%20115.296H40.4307L40.2551%20115.471H101.014V150.561H15.7981V65.3428H90.3366ZM76.7327%20100.257H151.317V15.0386H66.1006V50.1536L109.424%2050.3042H126.684L126.624%2050.364L126.669%2050.3642L113.846%2063.1431L76.7327%20100.257Z'%20fill='url(%23paint0_linear_2322_66)'/%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_2322_66'%20x1='167.74'%20y1='-2.07'%20x2='-3.37985'%20y2='172.5'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%231349F8'/%3e%3cstop%20offset='1'%20stop-color='%235C13F8'/%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e", M1 = ({
14049
+ if (t) {
14050
+ const r = JSON.parse(t);
14051
+ console.log("useEffect"), e(r);
14052
+ }
14053
+ }, [t]), {
14054
+ address: (f == null ? void 0 : f.address) ?? void 0,
14055
+ network: (f == null ? void 0 : f.network) ?? void 0,
14056
+ nickName: (f == null ? void 0 : f.nickName) ?? void 0,
14057
+ token: (f == null ? void 0 : f.token) ?? void 0
14058
+ };
14059
+ }, ca = "data:image/svg+xml,%3csvg%20width='167'%20height='166'%20viewBox='0%200%20167%20166'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M116.052%20115.296H166.355H166.36V0H51.0675V50.3042H0.759995V165.6H116.052V115.296ZM90.3366%2065.3428L40.21%20115.296H40.4307L40.2551%20115.471H101.014V150.561H15.7981V65.3428H90.3366ZM76.7327%20100.257H151.317V15.0386H66.1006V50.1536L109.424%2050.3042H126.684L126.624%2050.364L126.669%2050.3642L113.846%2063.1431L76.7327%20100.257Z'%20fill='url(%23paint0_linear_2322_66)'/%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_2322_66'%20x1='167.74'%20y1='-2.07'%20x2='-3.37985'%20y2='172.5'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%231349F8'/%3e%3cstop%20offset='1'%20stop-color='%235C13F8'/%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e";
14060
+ class m1 {
14061
+ // Base64URL 인코딩 함수
14062
+ base64url(e) {
14063
+ return K0.enc.Base64.stringify(K0.enc.Utf8.parse(e)).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
14064
+ }
14065
+ // token 생성 함수
14066
+ createToken(e, t) {
14067
+ const r = { type: "token", alg: "XPSIG" }, a = this.base64url(JSON.stringify(r)), i = this.base64url(JSON.stringify(e));
14068
+ return `${a}.${i}.${t}`;
14069
+ }
14070
+ // token 검증 함수
14071
+ verifyToken(e) {
14072
+ const [t, r, a] = e.split("."), i = JSON.parse(K0.enc.Utf8.stringify(K0.enc.Base64.parse(r)));
14073
+ if (Xf.xphereVerify(i.message, i.publicKey, a))
14074
+ return i;
14075
+ throw new Error("Invalid token");
14076
+ }
14077
+ getAddress(e) {
14078
+ return mr.address(e);
14079
+ }
14080
+ }
14081
+ const _1 = new m1(), A1 = {
14082
+ Enc: rr,
14083
+ Sign: mr,
14084
+ Util: z0,
14085
+ Validation: _1
14086
+ }, S1 = ({
14053
14087
  availableNetworks: f,
14054
14088
  dapp: e,
14055
14089
  url: t,
14056
14090
  sigMessage: r,
14057
- validTime: a,
14058
- onReceive: i,
14091
+ onReceive: a,
14092
+ validTime: i,
14059
14093
  isShowLogo: y = !1,
14060
14094
  logoSize: x = 30,
14061
14095
  ...u
@@ -14066,25 +14100,18 @@ const ri = new y1(), g1 = "loginRes", C1 = () => {
14066
14100
  () => {
14067
14101
  xt.leaveRoom(B), c(!1);
14068
14102
  },
14069
- a * 60 * 1e3
14103
+ i * 60 * 1e3
14070
14104
  );
14071
14105
  return () => clearTimeout(w);
14072
- }, [B, a]), Ft(() => {
14106
+ }, [B, i]), Ft(() => {
14073
14107
  (async () => {
14074
14108
  try {
14075
14109
  console.log("roomId", B);
14076
14110
  const R = {
14077
- isSuccess: !0,
14078
- account: {
14079
- address: "aaa",
14080
- network: "bbb",
14081
- nickName: "ccc"
14082
- },
14083
- payload: {
14084
- publicKey: "ddd",
14085
- message: "eee"
14086
- },
14087
- signature: "fff"
14111
+ address: "aaa",
14112
+ network: "bbb",
14113
+ nickName: "ccc",
14114
+ token: "ddd"
14088
14115
  };
14089
14116
  localStorage.setItem(g1, JSON.stringify(R));
14090
14117
  const k = await p1.qrLogin(B, r, v), z = `${r}
@@ -14092,24 +14119,18 @@ const ri = new y1(), g1 = "loginRes", C1 = () => {
14092
14119
  Nonce: ${v}`, F = {
14093
14120
  publicKey: k.publicKey,
14094
14121
  message: z
14095
- }, T = {
14096
- isSuccess: !0,
14097
- account: {
14098
- address: k.address,
14099
- network: k.network,
14100
- nickName: k.nickName
14101
- },
14102
- payload: F,
14103
- signature: k.signature
14122
+ }, P = {
14123
+ address: k.address,
14124
+ network: k.network,
14125
+ nickName: k.nickName,
14126
+ token: A1.Validation.createToken(F, k.signature)
14104
14127
  };
14105
- i(T);
14128
+ a(!0);
14106
14129
  } catch {
14107
- i({
14108
- isSuccess: !1
14109
- });
14130
+ a(!1);
14110
14131
  }
14111
14132
  })();
14112
- }, [i, r]), o ? /* @__PURE__ */ vr.jsx(
14133
+ }, [r]), o ? /* @__PURE__ */ vr.jsx(
14113
14134
  vn,
14114
14135
  {
14115
14136
  value: b,
@@ -14118,7 +14139,7 @@ Nonce: ${v}`, F = {
14118
14139
  }
14119
14140
  ) : /* @__PURE__ */ vr.jsx("div", { children: "QR loading error" });
14120
14141
  };
14121
- class m1 {
14142
+ class E1 {
14122
14143
  // 타입 가드 함수
14123
14144
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
14124
14145
  isAccountType(e) {
@@ -14141,7 +14162,7 @@ class m1 {
14141
14162
  }
14142
14163
  }
14143
14164
  }
14144
- const _1 = new m1(), S1 = ({
14165
+ const w1 = new E1(), F1 = ({
14145
14166
  availableNetworks: f,
14146
14167
  dapp: e,
14147
14168
  url: t,
@@ -14164,20 +14185,18 @@ const _1 = new m1(), S1 = ({
14164
14185
  (async () => {
14165
14186
  try {
14166
14187
  console.log("roomId22", v);
14167
- const B = await _1.qrAddressProvide(v), w = {
14188
+ const B = await w1.qrAddressProvide(v), w = {
14168
14189
  isSuccess: !0,
14169
14190
  address: B.address,
14170
14191
  network: B.network,
14171
14192
  nickName: B.nickName
14172
14193
  };
14173
- a(w);
14194
+ a(!0);
14174
14195
  } catch {
14175
- a({
14176
- isSuccess: !1
14177
- });
14196
+ a(!1);
14178
14197
  }
14179
14198
  })();
14180
- }, [a]), u ? /* @__PURE__ */ vr.jsx(
14199
+ }, []), u ? /* @__PURE__ */ vr.jsx(
14181
14200
  vn,
14182
14201
  {
14183
14202
  value: c,
@@ -14185,40 +14204,13 @@ const _1 = new m1(), S1 = ({
14185
14204
  ...x
14186
14205
  }
14187
14206
  ) : /* @__PURE__ */ vr.jsx("div", { children: "QR loading error" });
14188
- };
14189
- class A1 {
14190
- // Base64URL 인코딩 함수
14191
- base64url(e) {
14192
- return K0.enc.Base64.stringify(K0.enc.Utf8.parse(e)).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
14193
- }
14194
- // token 생성 함수
14195
- createToken(e, t) {
14196
- const r = { type: "token", alg: "XPSIG" }, a = this.base64url(JSON.stringify(r)), i = this.base64url(JSON.stringify(e));
14197
- return `${a}.${i}.${t}`;
14198
- }
14199
- // token 검증 함수
14200
- verifyToken(e) {
14201
- const [t, r, a] = e.split("."), i = JSON.parse(K0.enc.Utf8.stringify(K0.enc.Base64.parse(r)));
14202
- if (Xf.xphereVerify(i.message, i.publicKey, a))
14203
- return i;
14204
- throw new Error("Invalid token");
14205
- }
14206
- getAddress(e) {
14207
- return mr.address(e);
14208
- }
14209
- }
14210
- const E1 = new A1(), F1 = {
14211
- Enc: rr,
14212
- Sign: mr,
14213
- Util: z0,
14214
- Validation: E1
14215
14207
  }, D1 = {
14216
14208
  Qr: ri
14217
14209
  };
14218
14210
  export {
14219
- S1 as AddressProvideQR,
14220
- M1 as LoginQR,
14221
- F1 as Xphere,
14211
+ F1 as AddressProvideQR,
14212
+ S1 as LoginQR,
14213
+ A1 as Xphere,
14222
14214
  D1 as Zigap,
14223
- C1 as useZigap
14215
+ M1 as useZigap
14224
14216
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zigap-utils",
3
- "version": "0.0.47",
3
+ "version": "0.0.48",
4
4
  "description": "",
5
5
  "main": "dist/index.es.js",
6
6
  "types": "dist/index.d.ts",