zigap-utils 0.0.477 → 0.0.478
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,20 +14043,45 @@ class y1 {
|
|
|
14043
14043
|
};
|
|
14044
14044
|
}
|
|
14045
14045
|
}
|
|
14046
|
-
const ri = new y1(), g1 = "loginRes",
|
|
14047
|
-
|
|
14048
|
-
account: void 0,
|
|
14049
|
-
payload: void 0,
|
|
14050
|
-
signature: void 0
|
|
14051
|
-
}, M1 = () => {
|
|
14052
|
-
const [f, e] = _r(m1), t = localStorage.getItem("loginRes");
|
|
14046
|
+
const ri = new y1(), g1 = "loginRes", M1 = () => {
|
|
14047
|
+
const [f, e] = _r(void 0), t = localStorage.getItem("loginRes");
|
|
14053
14048
|
return Ft(() => {
|
|
14054
14049
|
if (t) {
|
|
14055
|
-
const r = JSON.parse(t)
|
|
14056
|
-
e({
|
|
14050
|
+
const r = JSON.parse(t);
|
|
14051
|
+
e({
|
|
14052
|
+
...r,
|
|
14053
|
+
isLoggedIn: !!(f != null && f.token)
|
|
14054
|
+
});
|
|
14057
14055
|
}
|
|
14058
14056
|
}, []), f;
|
|
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"
|
|
14057
|
+
}, 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";
|
|
14058
|
+
class m1 {
|
|
14059
|
+
// Base64URL 인코딩 함수
|
|
14060
|
+
base64url(e) {
|
|
14061
|
+
return K0.enc.Base64.stringify(K0.enc.Utf8.parse(e)).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
|
|
14062
|
+
}
|
|
14063
|
+
// token 생성 함수
|
|
14064
|
+
createToken(e, t) {
|
|
14065
|
+
const r = { type: "token", alg: "XPSIG" }, a = this.base64url(JSON.stringify(r)), i = this.base64url(JSON.stringify(e));
|
|
14066
|
+
return `${a}.${i}.${t}`;
|
|
14067
|
+
}
|
|
14068
|
+
// token 검증 함수
|
|
14069
|
+
verifyToken(e) {
|
|
14070
|
+
const [t, r, a] = e.split("."), i = JSON.parse(K0.enc.Utf8.stringify(K0.enc.Base64.parse(r)));
|
|
14071
|
+
if (Xf.xphereVerify(i.message, i.publicKey, a))
|
|
14072
|
+
return i;
|
|
14073
|
+
throw new Error("Invalid token");
|
|
14074
|
+
}
|
|
14075
|
+
getAddress(e) {
|
|
14076
|
+
return mr.address(e);
|
|
14077
|
+
}
|
|
14078
|
+
}
|
|
14079
|
+
const _1 = new m1(), A1 = {
|
|
14080
|
+
Enc: rr,
|
|
14081
|
+
Sign: mr,
|
|
14082
|
+
Util: z0,
|
|
14083
|
+
Validation: _1
|
|
14084
|
+
}, S1 = ({
|
|
14060
14085
|
availableNetworks: f,
|
|
14061
14086
|
dapp: e,
|
|
14062
14087
|
url: t,
|
|
@@ -14081,17 +14106,10 @@ const ri = new y1(), g1 = "loginRes", m1 = {
|
|
|
14081
14106
|
try {
|
|
14082
14107
|
console.log("roomId", B);
|
|
14083
14108
|
const R = {
|
|
14084
|
-
|
|
14085
|
-
|
|
14086
|
-
|
|
14087
|
-
|
|
14088
|
-
nickName: "ccc"
|
|
14089
|
-
},
|
|
14090
|
-
payload: {
|
|
14091
|
-
publicKey: "ddd",
|
|
14092
|
-
message: "eee"
|
|
14093
|
-
},
|
|
14094
|
-
signature: "fff"
|
|
14109
|
+
address: "aaa",
|
|
14110
|
+
network: "bbb",
|
|
14111
|
+
nickName: "ccc",
|
|
14112
|
+
token: "ddd"
|
|
14095
14113
|
};
|
|
14096
14114
|
localStorage.setItem(g1, JSON.stringify(R));
|
|
14097
14115
|
const k = await p1.qrLogin(B, r, v), z = `${r}
|
|
@@ -14099,21 +14117,14 @@ const ri = new y1(), g1 = "loginRes", m1 = {
|
|
|
14099
14117
|
Nonce: ${v}`, F = {
|
|
14100
14118
|
publicKey: k.publicKey,
|
|
14101
14119
|
message: z
|
|
14102
|
-
},
|
|
14103
|
-
|
|
14104
|
-
|
|
14105
|
-
|
|
14106
|
-
|
|
14107
|
-
nickName: k.nickName
|
|
14108
|
-
},
|
|
14109
|
-
payload: F,
|
|
14110
|
-
signature: k.signature
|
|
14120
|
+
}, P = {
|
|
14121
|
+
address: k.address,
|
|
14122
|
+
network: k.network,
|
|
14123
|
+
nickName: k.nickName,
|
|
14124
|
+
token: A1.Validation.createToken(F, k.signature)
|
|
14111
14125
|
};
|
|
14112
|
-
|
|
14113
|
-
|
|
14114
|
-
i({
|
|
14115
|
-
isSuccess: !1
|
|
14116
|
-
});
|
|
14126
|
+
} catch (R) {
|
|
14127
|
+
console.log("error", R);
|
|
14117
14128
|
}
|
|
14118
14129
|
})();
|
|
14119
14130
|
}, [i, r]), o ? /* @__PURE__ */ vr.jsx(
|
|
@@ -14125,7 +14136,7 @@ Nonce: ${v}`, F = {
|
|
|
14125
14136
|
}
|
|
14126
14137
|
) : /* @__PURE__ */ vr.jsx("div", { children: "QR loading error" });
|
|
14127
14138
|
};
|
|
14128
|
-
class
|
|
14139
|
+
class E1 {
|
|
14129
14140
|
// 타입 가드 함수
|
|
14130
14141
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14131
14142
|
isAccountType(e) {
|
|
@@ -14148,7 +14159,7 @@ class _1 {
|
|
|
14148
14159
|
}
|
|
14149
14160
|
}
|
|
14150
14161
|
}
|
|
14151
|
-
const
|
|
14162
|
+
const w1 = new E1(), F1 = ({
|
|
14152
14163
|
availableNetworks: f,
|
|
14153
14164
|
dapp: e,
|
|
14154
14165
|
url: t,
|
|
@@ -14171,7 +14182,7 @@ const A1 = new _1(), F1 = ({
|
|
|
14171
14182
|
(async () => {
|
|
14172
14183
|
try {
|
|
14173
14184
|
console.log("roomId22", v);
|
|
14174
|
-
const B = await
|
|
14185
|
+
const B = await w1.qrAddressProvide(v), w = {
|
|
14175
14186
|
isSuccess: !0,
|
|
14176
14187
|
address: B.address,
|
|
14177
14188
|
network: B.network,
|
|
@@ -14192,40 +14203,13 @@ const A1 = new _1(), F1 = ({
|
|
|
14192
14203
|
...x
|
|
14193
14204
|
}
|
|
14194
14205
|
) : /* @__PURE__ */ vr.jsx("div", { children: "QR loading error" });
|
|
14195
|
-
}
|
|
14196
|
-
class E1 {
|
|
14197
|
-
// Base64URL 인코딩 함수
|
|
14198
|
-
base64url(e) {
|
|
14199
|
-
return K0.enc.Base64.stringify(K0.enc.Utf8.parse(e)).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
|
|
14200
|
-
}
|
|
14201
|
-
// token 생성 함수
|
|
14202
|
-
createToken(e, t) {
|
|
14203
|
-
const r = { type: "token", alg: "XPSIG" }, a = this.base64url(JSON.stringify(r)), i = this.base64url(JSON.stringify(e));
|
|
14204
|
-
return `${a}.${i}.${t}`;
|
|
14205
|
-
}
|
|
14206
|
-
// token 검증 함수
|
|
14207
|
-
verifyToken(e) {
|
|
14208
|
-
const [t, r, a] = e.split("."), i = JSON.parse(K0.enc.Utf8.stringify(K0.enc.Base64.parse(r)));
|
|
14209
|
-
if (Xf.xphereVerify(i.message, i.publicKey, a))
|
|
14210
|
-
return i;
|
|
14211
|
-
throw new Error("Invalid token");
|
|
14212
|
-
}
|
|
14213
|
-
getAddress(e) {
|
|
14214
|
-
return mr.address(e);
|
|
14215
|
-
}
|
|
14216
|
-
}
|
|
14217
|
-
const w1 = new E1(), D1 = {
|
|
14218
|
-
Enc: rr,
|
|
14219
|
-
Sign: mr,
|
|
14220
|
-
Util: z0,
|
|
14221
|
-
Validation: w1
|
|
14222
|
-
}, R1 = {
|
|
14206
|
+
}, D1 = {
|
|
14223
14207
|
Qr: ri
|
|
14224
14208
|
};
|
|
14225
14209
|
export {
|
|
14226
14210
|
F1 as AddressProvideQR,
|
|
14227
14211
|
S1 as LoginQR,
|
|
14228
|
-
|
|
14229
|
-
|
|
14212
|
+
A1 as Xphere,
|
|
14213
|
+
D1 as Zigap,
|
|
14230
14214
|
M1 as useZigap
|
|
14231
14215
|
};
|