zigap-utils 0.0.498 → 0.0.499

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 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,9 @@
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;
@@ -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,2 @@
1
+ export declare function hashString(input: string): string;
2
+ export declare function verifyHash(input: string, hash: string): boolean;
@@ -0,0 +1,5 @@
1
+ import { PayloadType } from 'src/components';
2
+
3
+ export declare function createToken(payload: PayloadType, signature: string): string;
4
+ export declare function verifyToken(token: string): any;
5
+ export declare function getAddress(publicKey: string): string;
@@ -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,13 @@
1
+ import { default as Enc } from './enc';
2
+ import { default as Sign } from './sign';
3
+ import { default as Util } from './util';
4
+ import { default as Validation } from './validation';
5
+
6
+ type XphereType = {
7
+ Enc: typeof Enc;
8
+ Sign: typeof Sign;
9
+ Util: typeof Util;
10
+ Validation: typeof Validation;
11
+ };
12
+ export declare const Xphere: XphereType;
13
+ export {};
@@ -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,7 @@
1
+ import { Qr } from './qr';
2
+
3
+ type ZigapType = {
4
+ Qr: typeof Qr;
5
+ };
6
+ export declare const Zigap: ZigapType;
7
+ export {};
@@ -0,0 +1,7 @@
1
+ import { QrType } from './types';
2
+
3
+ declare class QrService {
4
+ generateQrCode(type: string, dapp: string, url: string, network: string[], icon: string | undefined): QrType;
5
+ }
6
+ export declare const Qr: QrService;
7
+ export {};
@@ -0,0 +1,4 @@
1
+ export interface QrType {
2
+ qrCode: string;
3
+ roomId: string;
4
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zigap-utils",
3
- "version": "0.0.498",
3
+ "version": "0.0.499",
4
4
  "description": "",
5
5
  "main": "dist/index.es.js",
6
6
  "types": "dist/index.d.ts",