zigap-utils 0.0.462 → 0.0.463
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/App.d.ts +2 -0
- package/dist/components/AddressProvideQR/AddressProvideQR.d.ts +4 -0
- package/dist/components/AddressProvideQR/AddressProvideQR.types.d.ts +15 -0
- package/dist/components/AddressProvideQR/index.d.ts +2 -0
- package/dist/components/LoginQR/LoginQR.d.ts +4 -0
- package/dist/components/LoginQR/LoginQR.types.d.ts +33 -0
- package/dist/components/LoginQR/index.d.ts +2 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/cryptoUtils.cjs.js +1 -0
- package/dist/cryptoUtils.es.js +5492 -0
- package/dist/index.cjs.js +42 -0
- package/dist/index.cjs2.js +14 -0
- package/dist/index.cjs3.js +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +1382 -0
- package/dist/index.es2.js +5025 -0
- package/dist/index.es3.js +2303 -0
- package/dist/main.d.ts +1 -0
- package/dist/utils/addressProvide.d.ts +9 -0
- package/dist/utils/cryptoUtils.d.ts +19 -0
- package/dist/utils/login.d.ts +11 -0
- package/dist/utils/socketInstance.d.ts +9 -0
- package/dist/utils/types.d.ts +23 -0
- package/dist/xphere/enc.d.ts +12 -0
- package/dist/xphere/index.d.ts +4 -0
- package/dist/xphere/sign.d.ts +18 -0
- package/dist/xphere/util.d.ts +10 -0
- package/dist/xphere/validation.d.ts +10 -0
- package/dist/xphere.cjs.js +1 -0
- package/dist/xphere.es.js +32 -0
- package/dist/zigap/index.d.ts +2 -0
- package/dist/zigap/qr.d.ts +7 -0
- package/dist/zigap/types.d.ts +4 -0
- package/dist/zigap.cjs.js +1 -0
- package/dist/zigap.es.js +5 -0
- package/package.json +2 -2
package/dist/main.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AccountProvideType } from './types';
|
|
2
|
+
|
|
3
|
+
declare class AddressProvideService {
|
|
4
|
+
private isAccountType;
|
|
5
|
+
getAccount(): Promise<AccountProvideType>;
|
|
6
|
+
qrAddressProvide(roomId: string): Promise<AccountProvideType>;
|
|
7
|
+
}
|
|
8
|
+
declare const _default: AddressProvideService;
|
|
9
|
+
export default _default;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ec as EC } from 'elliptic';
|
|
2
|
+
|
|
3
|
+
declare class CryptoService {
|
|
4
|
+
private ec;
|
|
5
|
+
constructor();
|
|
6
|
+
xphereSign(msg: string, prKey: string): string;
|
|
7
|
+
xphereVerify(msg: string, pubKey: string, sig: string): boolean;
|
|
8
|
+
generateKeys(): {
|
|
9
|
+
privateKey: string;
|
|
10
|
+
publicKey: string;
|
|
11
|
+
};
|
|
12
|
+
sign(msg: string, prKey: string): EC.Signature;
|
|
13
|
+
verify(msg: string, sig: EC.Signature, pubKey: string): boolean;
|
|
14
|
+
encrypt(text: string, key: string): string;
|
|
15
|
+
decrypt(encryptedText: string, key: string): string;
|
|
16
|
+
generateNonce(length: number): string;
|
|
17
|
+
}
|
|
18
|
+
declare const _default: CryptoService;
|
|
19
|
+
export default _default;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { AccountCryptoType, ResponseLoginType } from './types';
|
|
2
|
+
|
|
3
|
+
declare class LoginService {
|
|
4
|
+
private isAccountCryptoType;
|
|
5
|
+
getAccountCrypto(): Promise<AccountCryptoType>;
|
|
6
|
+
reciveRequest(): Promise<boolean>;
|
|
7
|
+
sendMessage(roomId: string, message: string): Promise<void>;
|
|
8
|
+
qrLogin(roomId: string, message: string, nonce: string): Promise<ResponseLoginType>;
|
|
9
|
+
}
|
|
10
|
+
declare const _default: LoginService;
|
|
11
|
+
export default _default;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ec as EC } from 'elliptic';
|
|
2
|
+
|
|
3
|
+
export type SignatureType = EC.Signature;
|
|
4
|
+
export interface AccountCryptoType {
|
|
5
|
+
signature: string;
|
|
6
|
+
publicKey: string;
|
|
7
|
+
address: string;
|
|
8
|
+
network: string;
|
|
9
|
+
nickName: string;
|
|
10
|
+
etc: string;
|
|
11
|
+
}
|
|
12
|
+
export interface AccountProvideType {
|
|
13
|
+
address: string;
|
|
14
|
+
network: string;
|
|
15
|
+
nickName: string;
|
|
16
|
+
}
|
|
17
|
+
export interface ResponseLoginType {
|
|
18
|
+
address: string;
|
|
19
|
+
network: string;
|
|
20
|
+
nickName: string;
|
|
21
|
+
signature: string;
|
|
22
|
+
publicKey: string;
|
|
23
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
type CryptoJSAlgo = 'SHA256' | 'RIPEMD160';
|
|
2
|
+
declare class Enc {
|
|
3
|
+
string(obj: any): string;
|
|
4
|
+
crypto(algo: CryptoJSAlgo, string: string): string;
|
|
5
|
+
hash(obj: any): string;
|
|
6
|
+
shortHash(obj: any): string;
|
|
7
|
+
checksum(hash: string): string;
|
|
8
|
+
idHash(obj: any): string;
|
|
9
|
+
isHex(str: string): boolean;
|
|
10
|
+
}
|
|
11
|
+
declare const _default: Enc;
|
|
12
|
+
export default _default;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
interface KeyPair {
|
|
2
|
+
private_key: string;
|
|
3
|
+
public_key: string;
|
|
4
|
+
address: string;
|
|
5
|
+
}
|
|
6
|
+
declare class Sign {
|
|
7
|
+
private KEY_SIZE;
|
|
8
|
+
private SIGNATURE_SIZE;
|
|
9
|
+
constructor();
|
|
10
|
+
keyPair(): KeyPair;
|
|
11
|
+
privateKey(): string;
|
|
12
|
+
publicKey(private_key: string): string;
|
|
13
|
+
address(public_key: string): string;
|
|
14
|
+
signature(obj: any, private_key: string): string;
|
|
15
|
+
signatureValidity(obj: any, public_key: string, signature: string): boolean;
|
|
16
|
+
}
|
|
17
|
+
declare const _default: Sign;
|
|
18
|
+
export default _default;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
declare class Util {
|
|
2
|
+
string(input: any): string;
|
|
3
|
+
stringToByte(str: string): Uint8Array;
|
|
4
|
+
stringToUnicode(str: string): string;
|
|
5
|
+
byteToHex(byte_array: Uint8Array): string;
|
|
6
|
+
hexToByte(hex: string): Uint8Array;
|
|
7
|
+
isHex(input: any): boolean;
|
|
8
|
+
}
|
|
9
|
+
declare const _default: Util;
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { PayloadType } from 'src/components';
|
|
2
|
+
|
|
3
|
+
declare class Validation {
|
|
4
|
+
private base64url;
|
|
5
|
+
createToken(payload: PayloadType, signature: string): string;
|
|
6
|
+
verifyToken(token: string): any;
|
|
7
|
+
getAddress(publicKey: string): string;
|
|
8
|
+
}
|
|
9
|
+
declare const _default: Validation;
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./cryptoUtils.cjs.js"),n=require("./index.cjs2.js");class c{base64url(e){return n.CryptoJS.enc.Base64.stringify(n.CryptoJS.enc.Utf8.parse(e)).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}createToken(e,s){const i={type:"token",alg:"XPSIG"},o=this.base64url(JSON.stringify(i)),t=this.base64url(JSON.stringify(e));return`${o}.${t}.${s}`}verifyToken(e){const[s,i,o]=e.split("."),t=JSON.parse(n.CryptoJS.enc.Utf8.stringify(n.CryptoJS.enc.Base64.parse(i)));if(r.cryptoUtils.xphereVerify(t.message,t.publicKey,o))return t;throw new Error("Invalid token")}getAddress(e){return r.sign.address(e)}}const d=new c;exports.Enc=r.enc;exports.Sign=r.sign;exports.Util=r.util;exports.Validation=d;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { c as i, s as c } from "./cryptoUtils.es.js";
|
|
3
|
+
import { e as k, u as m } from "./cryptoUtils.es.js";
|
|
4
|
+
import { C as r } from "./index.es2.js";
|
|
5
|
+
class d {
|
|
6
|
+
// Base64URL 인코딩 함수
|
|
7
|
+
base64url(e) {
|
|
8
|
+
return r.enc.Base64.stringify(r.enc.Utf8.parse(e)).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
|
|
9
|
+
}
|
|
10
|
+
// token 생성 함수
|
|
11
|
+
createToken(e, t) {
|
|
12
|
+
const a = { type: "token", alg: "XPSIG" }, n = this.base64url(JSON.stringify(a)), s = this.base64url(JSON.stringify(e));
|
|
13
|
+
return `${n}.${s}.${t}`;
|
|
14
|
+
}
|
|
15
|
+
// token 검증 함수
|
|
16
|
+
verifyToken(e) {
|
|
17
|
+
const [t, a, n] = e.split("."), s = JSON.parse(r.enc.Utf8.stringify(r.enc.Base64.parse(a)));
|
|
18
|
+
if (i.xphereVerify(s.message, s.publicKey, n))
|
|
19
|
+
return s;
|
|
20
|
+
throw new Error("Invalid token");
|
|
21
|
+
}
|
|
22
|
+
getAddress(e) {
|
|
23
|
+
return c.address(e);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
const g = new d();
|
|
27
|
+
export {
|
|
28
|
+
k as Enc,
|
|
29
|
+
c as Sign,
|
|
30
|
+
m as Util,
|
|
31
|
+
g as Validation
|
|
32
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index.cjs3.js");exports.Qr=e.Qr;
|
package/dist/zigap.es.js
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zigap-utils",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.463",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.es.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -70,4 +70,4 @@
|
|
|
70
70
|
"vite-plugin-dts": "^3.9.1",
|
|
71
71
|
"vite-tsconfig-paths": "^4.3.2"
|
|
72
72
|
}
|
|
73
|
-
}
|
|
73
|
+
}
|