zigap-utils 0.0.461 → 0.0.462

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/main.d.ts DELETED
@@ -1 +0,0 @@
1
- export {};
@@ -1,9 +0,0 @@
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;
@@ -1,19 +0,0 @@
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;
@@ -1,11 +0,0 @@
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;
@@ -1,9 +0,0 @@
1
- import { Socket } from 'socket.io-client';
2
-
3
- declare class SocketInstance {
4
- private static instance;
5
- socket: Socket;
6
- private constructor();
7
- static getInstance(): SocketInstance;
8
- }
9
- export default SocketInstance;
@@ -1,23 +0,0 @@
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
- }
@@ -1,12 +0,0 @@
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;
@@ -1,4 +0,0 @@
1
- export { default as Enc } from './enc';
2
- export { default as Sign } from './sign';
3
- export { default as Util } from './util';
4
- export { default as Validation } from './validation';
@@ -1,18 +0,0 @@
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;
@@ -1,10 +0,0 @@
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;
@@ -1,10 +0,0 @@
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;
@@ -1 +0,0 @@
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;
package/dist/xphere.es.js DELETED
@@ -1,32 +0,0 @@
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
- };
@@ -1,2 +0,0 @@
1
- export * from './qr';
2
- export * from './types';
@@ -1,7 +0,0 @@
1
- import { QrType } from './types';
2
-
3
- declare class QrService {
4
- generateQrCode(type: string, dapp: string, url: string, network: string[]): QrType;
5
- }
6
- export declare const Qr: QrService;
7
- export {};
@@ -1,4 +0,0 @@
1
- export interface QrType {
2
- qrCode: string;
3
- roomId: string;
4
- }
package/dist/zigap.cjs.js DELETED
@@ -1 +0,0 @@
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 DELETED
@@ -1,5 +0,0 @@
1
- "use client";
2
- import { Q as o } from "./index.es3.js";
3
- export {
4
- o as Qr
5
- };