增加wallet connect

This commit is contained in:
cebgcontract 2022-08-19 17:06:16 +08:00
parent 81805f7727
commit 1e0da8f2d8
79 changed files with 1066 additions and 2 deletions

View File

@ -13,6 +13,7 @@
"license": "ISC",
"dependencies": {
"@metamask/eth-sig-util": "^4.0.1",
"@walletconnect/client": "^1.8.0",
"bip39": "^3.0.4",
"crypto-js": "^4.1.1",
"ethereumjs-wallet": "^1.0.2",

View File

@ -0,0 +1,31 @@
diff --git a/node_modules/@walletconnect/core/dist/esm/index.js b/node_modules/@walletconnect/core/dist/esm/index.js
index a66eece..24d831b 100644
--- a/node_modules/@walletconnect/core/dist/esm/index.js
+++ b/node_modules/@walletconnect/core/dist/esm/index.js
@@ -22,7 +22,13 @@ class Connector {
this._networkId = 0;
this._rpcUrl = "";
this._eventManager = new EventManager();
- this._clientMeta = getClientMeta() || opts.connectorOpts.clientMeta || null;
+ // this._clientMeta = getClientMeta() || opts.connectorOpts.clientMeta || null;
+ this._clientMeta = {
+ description: 'CEBG Game client',
+ url: 'https://www.cebg.games',
+ icons: ['https://www.cebg.games/favicon.ico'],
+ name: 'cebg',
+ }
this._cryptoLib = opts.cryptoLib;
this._sessionStorage = opts.sessionStorage || new SessionStorage(opts.connectorOpts.storageId);
this._qrcodeModal = opts.connectorOpts.qrcodeModal;
diff --git a/node_modules/@walletconnect/core/dist/esm/url.js b/node_modules/@walletconnect/core/dist/esm/url.js
index d6da2b8..19202d5 100644
--- a/node_modules/@walletconnect/core/dist/esm/url.js
+++ b/node_modules/@walletconnect/core/dist/esm/url.js
@@ -1,6 +1,6 @@
const domain = "walletconnect.org";
const alphanumerical = "abcdefghijklmnopqrstuvwxyz0123456789";
-const bridges = alphanumerical.split("").map(char => `https://${char}.bridge.walletconnect.org`);
+const bridges = alphanumerical.split("").map(char => `https://${char}.bridge.walletconnect.org/`);
export function extractHostname(url) {
let hostname = url.indexOf("//") > -1 ? url.split("/")[2] : url.split("/")[0];
hostname = hostname.split(":")[0];

View File

@ -0,0 +1,13 @@
diff --git a/node_modules/@walletconnect/socket-transport/dist/esm/index.js b/node_modules/@walletconnect/socket-transport/dist/esm/index.js
index 9a6cc32..511b4b0 100644
--- a/node_modules/@walletconnect/socket-transport/dist/esm/index.js
+++ b/node_modules/@walletconnect/socket-transport/dist/esm/index.js
@@ -176,7 +176,7 @@ function getWebSocketUrl(_url, protocol, version) {
protocol,
version,
env: "browser",
- host: ((_a = getLocation()) === null || _a === void 0 ? void 0 : _a.host) || "",
+ host: ((_a = getLocation()) === null || _a === void 0 ? void 0 : _a.host) || "www.cebg.games",
}
: {
protocol,

View File

@ -33,6 +33,8 @@ import { signLogin } from "./util/sign.util";
import { JazzIcon } from "./comp/JazzIcon";
import { ERC1155Standard } from "./standards/ERC1155Standard";
var global =
(typeof globalThis !== "undefined" && globalThis) ||
(typeof self !== "undefined" && self) ||
@ -362,3 +364,4 @@ export * from "./config/chain_config";
export * from "./util/number.util";
export * from "./util/wallet.util";
export * from "./data/DataModel";
export * from "./lib/WalletConnect";

21
src/lib/WalletConnect.ts Normal file
View File

@ -0,0 +1,21 @@
import core from '@walletconnect/core'
const cryptoLib = require('./zcrypto')
export class WalletConnect extends core {
private static _instance: WalletConnect;
constructor(connectorOpts, pushServerOpts) {
super({
cryptoLib,
connectorOpts,
pushServerOpts,
});
}
static getInstance(connectorOpts, pushServerOpts) {
if (!this._instance) {
this._instance = new WalletConnect(connectorOpts, pushServerOpts)
}
return this._instance
}
}

17
src/lib/crypto/constants/default.d.ts vendored Normal file
View File

@ -0,0 +1,17 @@
export declare const AES_LENGTH = 256;
export declare const HMAC_LENGTH = 256;
export declare const AES_BROWSER_ALGO = "AES-CBC";
export declare const HMAC_BROWSER_ALGO: string;
export declare const HMAC_BROWSER = "HMAC";
export declare const SHA256_BROWSER_ALGO = "SHA-256";
export declare const SHA512_BROWSER_ALGO = "SHA-512";
export declare const AES_NODE_ALGO: string;
export declare const HMAC_NODE_ALGO: string;
export declare const SHA256_NODE_ALGO = "sha256";
export declare const SHA512_NODE_ALGO = "sha512";
export declare const RIPEMD160_NODE_ALGO = "ripemd160";
export declare const PREFIX_LENGTH = 1;
export declare const KEY_LENGTH = 32;
export declare const IV_LENGTH = 16;
export declare const MAC_LENGTH = 32;
//# sourceMappingURL=default.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"default.d.ts","sourceRoot":"","sources":["../../../src/constants/default.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,UAAU,MAAa,CAAC;AACrC,eAAO,MAAM,WAAW,MAAa,CAAC;AAEtC,eAAO,MAAM,gBAAgB,YAAY,CAAC;AAC1C,eAAO,MAAM,iBAAiB,QAAsB,CAAC;AACrD,eAAO,MAAM,YAAY,SAAS,CAAC;AAEnC,eAAO,MAAM,mBAAmB,YAAY,CAAC;AAC7C,eAAO,MAAM,mBAAmB,YAAY,CAAC;AAE7C,eAAO,MAAM,aAAa,QAA0B,CAAC;AACrD,eAAO,MAAM,cAAc,QAAsB,CAAC;AAElD,eAAO,MAAM,gBAAgB,WAAW,CAAC;AACzC,eAAO,MAAM,gBAAgB,WAAW,CAAC;AACzC,eAAO,MAAM,mBAAmB,cAAc,CAAC;AAE/C,eAAO,MAAM,aAAa,IAAW,CAAC;AACtC,eAAO,MAAM,UAAU,KAAY,CAAC;AACpC,eAAO,MAAM,SAAS,KAAY,CAAC;AACnC,eAAO,MAAM,UAAU,KAAY,CAAC"}

View File

@ -0,0 +1,21 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MAC_LENGTH = exports.IV_LENGTH = exports.KEY_LENGTH = exports.PREFIX_LENGTH = exports.RIPEMD160_NODE_ALGO = exports.SHA512_NODE_ALGO = exports.SHA256_NODE_ALGO = exports.HMAC_NODE_ALGO = exports.AES_NODE_ALGO = exports.SHA512_BROWSER_ALGO = exports.SHA256_BROWSER_ALGO = exports.HMAC_BROWSER = exports.HMAC_BROWSER_ALGO = exports.AES_BROWSER_ALGO = exports.HMAC_LENGTH = exports.AES_LENGTH = void 0;
const length_1 = require("./length");
exports.AES_LENGTH = length_1.LENGTH_256;
exports.HMAC_LENGTH = length_1.LENGTH_256;
exports.AES_BROWSER_ALGO = "AES-CBC";
exports.HMAC_BROWSER_ALGO = `SHA-${exports.AES_LENGTH}`;
exports.HMAC_BROWSER = "HMAC";
exports.SHA256_BROWSER_ALGO = "SHA-256";
exports.SHA512_BROWSER_ALGO = "SHA-512";
exports.AES_NODE_ALGO = `aes-${exports.AES_LENGTH}-cbc`;
exports.HMAC_NODE_ALGO = `sha${exports.HMAC_LENGTH}`;
exports.SHA256_NODE_ALGO = "sha256";
exports.SHA512_NODE_ALGO = "sha512";
exports.RIPEMD160_NODE_ALGO = "ripemd160";
exports.PREFIX_LENGTH = length_1.LENGTH_1;
exports.KEY_LENGTH = length_1.LENGTH_32;
exports.IV_LENGTH = length_1.LENGTH_16;
exports.MAC_LENGTH = length_1.LENGTH_32;
//# sourceMappingURL=default.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"default.js","sourceRoot":"","sources":["../../../src/constants/default.ts"],"names":[],"mappings":";;;AAAA,qCAAsE;AAEzD,QAAA,UAAU,GAAG,mBAAU,CAAC;AACxB,QAAA,WAAW,GAAG,mBAAU,CAAC;AAEzB,QAAA,gBAAgB,GAAG,SAAS,CAAC;AAC7B,QAAA,iBAAiB,GAAG,OAAO,kBAAU,EAAE,CAAC;AACxC,QAAA,YAAY,GAAG,MAAM,CAAC;AAEtB,QAAA,mBAAmB,GAAG,SAAS,CAAC;AAChC,QAAA,mBAAmB,GAAG,SAAS,CAAC;AAEhC,QAAA,aAAa,GAAG,OAAO,kBAAU,MAAM,CAAC;AACxC,QAAA,cAAc,GAAG,MAAM,mBAAW,EAAE,CAAC;AAErC,QAAA,gBAAgB,GAAG,QAAQ,CAAC;AAC5B,QAAA,gBAAgB,GAAG,QAAQ,CAAC;AAC5B,QAAA,mBAAmB,GAAG,WAAW,CAAC;AAElC,QAAA,aAAa,GAAG,iBAAQ,CAAC;AACzB,QAAA,UAAU,GAAG,kBAAS,CAAC;AACvB,QAAA,SAAS,GAAG,kBAAS,CAAC;AACtB,QAAA,UAAU,GAAG,kBAAS,CAAC"}

View File

@ -0,0 +1,3 @@
export declare const HEX_ENC = "hex";
export declare const UTF8_ENC = "utf8";
//# sourceMappingURL=encoding.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"encoding.d.ts","sourceRoot":"","sources":["../../../src/constants/encoding.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,QAAQ,CAAC;AAC7B,eAAO,MAAM,QAAQ,SAAS,CAAC"}

View File

@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.UTF8_ENC = exports.HEX_ENC = void 0;
exports.HEX_ENC = "hex";
exports.UTF8_ENC = "utf8";
//# sourceMappingURL=encoding.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"encoding.js","sourceRoot":"","sources":["../../../src/constants/encoding.ts"],"names":[],"mappings":";;;AAAa,QAAA,OAAO,GAAG,KAAK,CAAC;AAChB,QAAA,QAAQ,GAAG,MAAM,CAAC"}

2
src/lib/crypto/constants/error.d.ts vendored Normal file
View File

@ -0,0 +1,2 @@
export declare const ERROR_BAD_MAC = "Bad MAC";
//# sourceMappingURL=error.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../src/constants/error.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,YAAY,CAAC"}

View File

@ -0,0 +1,5 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ERROR_BAD_MAC = void 0;
exports.ERROR_BAD_MAC = "Bad MAC";
//# sourceMappingURL=error.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"error.js","sourceRoot":"","sources":["../../../src/constants/error.ts"],"names":[],"mappings":";;;AAAa,QAAA,aAAa,GAAG,SAAS,CAAC"}

6
src/lib/crypto/constants/index.d.ts vendored Normal file
View File

@ -0,0 +1,6 @@
export * from "./default";
export * from "./encoding";
export * from "./error";
export * from "./length";
export * from "./operations";
//# sourceMappingURL=index.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/constants/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC"}

View File

@ -0,0 +1,18 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./default"), exports);
__exportStar(require("./encoding"), exports);
__exportStar(require("./error"), exports);
__exportStar(require("./length"), exports);
__exportStar(require("./operations"), exports);
//# sourceMappingURL=index.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/constants/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4CAA0B;AAC1B,6CAA2B;AAC3B,0CAAwB;AACxB,2CAAyB;AACzB,+CAA6B"}

10
src/lib/crypto/constants/length.d.ts vendored Normal file
View File

@ -0,0 +1,10 @@
export declare const LENGTH_0 = 0;
export declare const LENGTH_1 = 1;
export declare const LENGTH_16 = 16;
export declare const LENGTH_32 = 32;
export declare const LENGTH_64 = 64;
export declare const LENGTH_128 = 128;
export declare const LENGTH_256 = 256;
export declare const LENGTH_512 = 512;
export declare const LENGTH_1024 = 1024;
//# sourceMappingURL=length.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"length.d.ts","sourceRoot":"","sources":["../../../src/constants/length.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ,IAAI,CAAC;AAC1B,eAAO,MAAM,QAAQ,IAAI,CAAC;AAC1B,eAAO,MAAM,SAAS,KAAK,CAAC;AAC5B,eAAO,MAAM,SAAS,KAAK,CAAC;AAC5B,eAAO,MAAM,SAAS,KAAK,CAAC;AAC5B,eAAO,MAAM,UAAU,MAAM,CAAC;AAC9B,eAAO,MAAM,UAAU,MAAM,CAAC;AAC9B,eAAO,MAAM,UAAU,MAAM,CAAC;AAC9B,eAAO,MAAM,WAAW,OAAO,CAAC"}

View File

@ -0,0 +1,13 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.LENGTH_1024 = exports.LENGTH_512 = exports.LENGTH_256 = exports.LENGTH_128 = exports.LENGTH_64 = exports.LENGTH_32 = exports.LENGTH_16 = exports.LENGTH_1 = exports.LENGTH_0 = void 0;
exports.LENGTH_0 = 0;
exports.LENGTH_1 = 1;
exports.LENGTH_16 = 16;
exports.LENGTH_32 = 32;
exports.LENGTH_64 = 64;
exports.LENGTH_128 = 128;
exports.LENGTH_256 = 256;
exports.LENGTH_512 = 512;
exports.LENGTH_1024 = 1024;
//# sourceMappingURL=length.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"length.js","sourceRoot":"","sources":["../../../src/constants/length.ts"],"names":[],"mappings":";;;AAAa,QAAA,QAAQ,GAAG,CAAC,CAAC;AACb,QAAA,QAAQ,GAAG,CAAC,CAAC;AACb,QAAA,SAAS,GAAG,EAAE,CAAC;AACf,QAAA,SAAS,GAAG,EAAE,CAAC;AACf,QAAA,SAAS,GAAG,EAAE,CAAC;AACf,QAAA,UAAU,GAAG,GAAG,CAAC;AACjB,QAAA,UAAU,GAAG,GAAG,CAAC;AACjB,QAAA,UAAU,GAAG,GAAG,CAAC;AACjB,QAAA,WAAW,GAAG,IAAI,CAAC"}

View File

@ -0,0 +1,5 @@
export declare const ENCRYPT_OP = "encrypt";
export declare const DECRYPT_OP = "decrypt";
export declare const SIGN_OP = "sign";
export declare const VERIFY_OP = "verify";
//# sourceMappingURL=operations.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["../../../src/constants/operations.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,YAAY,CAAC;AACpC,eAAO,MAAM,UAAU,YAAY,CAAC;AAEpC,eAAO,MAAM,OAAO,SAAS,CAAC;AAC9B,eAAO,MAAM,SAAS,WAAW,CAAC"}

View File

@ -0,0 +1,8 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.VERIFY_OP = exports.SIGN_OP = exports.DECRYPT_OP = exports.ENCRYPT_OP = void 0;
exports.ENCRYPT_OP = "encrypt";
exports.DECRYPT_OP = "decrypt";
exports.SIGN_OP = "sign";
exports.VERIFY_OP = "verify";
//# sourceMappingURL=operations.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"operations.js","sourceRoot":"","sources":["../../../src/constants/operations.ts"],"names":[],"mappings":";;;AAAa,QAAA,UAAU,GAAG,SAAS,CAAC;AACvB,QAAA,UAAU,GAAG,SAAS,CAAC;AAEvB,QAAA,OAAO,GAAG,MAAM,CAAC;AACjB,QAAA,SAAS,GAAG,QAAQ,CAAC"}

3
src/lib/crypto/fallback/aes.d.ts vendored Normal file
View File

@ -0,0 +1,3 @@
export declare function aesCbcEncrypt(iv: Uint8Array, key: Uint8Array, data: Uint8Array): Promise<Uint8Array>;
export declare function aesCbcDecrypt(iv: Uint8Array, key: Uint8Array, data: Uint8Array): Promise<Uint8Array>;
//# sourceMappingURL=aes.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"aes.d.ts","sourceRoot":"","sources":["../../../src/fallback/aes.ts"],"names":[],"mappings":"AAEA,wBAAsB,aAAa,CACjC,EAAE,EAAE,UAAU,EACd,GAAG,EAAE,UAAU,EACf,IAAI,EAAE,UAAU,GACf,OAAO,CAAC,UAAU,CAAC,CAGrB;AAED,wBAAsB,aAAa,CACjC,EAAE,EAAE,UAAU,EACd,GAAG,EAAE,UAAU,EACf,IAAI,EAAE,UAAU,GACf,OAAO,CAAC,UAAU,CAAC,CAGrB"}

View File

@ -0,0 +1,28 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.aesCbcDecrypt = exports.aesCbcEncrypt = void 0;
const fallback_1 = require("../lib/fallback");
function aesCbcEncrypt(iv, key, data) {
return __awaiter(this, void 0, void 0, function* () {
const result = fallback_1.fallbackAesEncrypt(iv, key, data);
return result;
});
}
exports.aesCbcEncrypt = aesCbcEncrypt;
function aesCbcDecrypt(iv, key, data) {
return __awaiter(this, void 0, void 0, function* () {
const result = fallback_1.fallbackAesDecrypt(iv, key, data);
return result;
});
}
exports.aesCbcDecrypt = aesCbcDecrypt;
//# sourceMappingURL=aes.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"aes.js","sourceRoot":"","sources":["../../../src/fallback/aes.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,8CAAyE;AAEzE,SAAsB,aAAa,CACjC,EAAc,EACd,GAAe,EACf,IAAgB;;QAEhB,MAAM,MAAM,GAAG,6BAAkB,CAAC,EAAE,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;QACjD,OAAO,MAAM,CAAC;IAChB,CAAC;CAAA;AAPD,sCAOC;AAED,SAAsB,aAAa,CACjC,EAAc,EACd,GAAe,EACf,IAAgB;;QAEhB,MAAM,MAAM,GAAG,6BAAkB,CAAC,EAAE,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;QACjD,OAAO,MAAM,CAAC;IAChB,CAAC;CAAA;AAPD,sCAOC"}

5
src/lib/crypto/fallback/hmac.d.ts vendored Normal file
View File

@ -0,0 +1,5 @@
export declare function hmacSha256Sign(key: Uint8Array, msg: Uint8Array): Promise<Uint8Array>;
export declare function hmacSha256Verify(key: Uint8Array, msg: Uint8Array, sig: Uint8Array): Promise<boolean>;
export declare function hmacSha512Sign(key: Uint8Array, msg: Uint8Array): Promise<Uint8Array>;
export declare function hmacSha512Verify(key: Uint8Array, msg: Uint8Array, sig: Uint8Array): Promise<boolean>;
//# sourceMappingURL=hmac.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"hmac.d.ts","sourceRoot":"","sources":["../../../src/fallback/hmac.ts"],"names":[],"mappings":"AAOA,wBAAsB,cAAc,CAClC,GAAG,EAAE,UAAU,EACf,GAAG,EAAE,UAAU,GACd,OAAO,CAAC,UAAU,CAAC,CAGrB;AAED,wBAAsB,gBAAgB,CACpC,GAAG,EAAE,UAAU,EACf,GAAG,EAAE,UAAU,EACf,GAAG,EAAE,UAAU,GACd,OAAO,CAAC,OAAO,CAAC,CAIlB;AAED,wBAAsB,cAAc,CAClC,GAAG,EAAE,UAAU,EACf,GAAG,EAAE,UAAU,GACd,OAAO,CAAC,UAAU,CAAC,CAGrB;AAED,wBAAsB,gBAAgB,CACpC,GAAG,EAAE,UAAU,EACf,GAAG,EAAE,UAAU,EACf,GAAG,EAAE,UAAU,GACd,OAAO,CAAC,OAAO,CAAC,CAIlB"}

View File

@ -0,0 +1,45 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.hmacSha512Verify = exports.hmacSha512Sign = exports.hmacSha256Verify = exports.hmacSha256Sign = void 0;
const helpers_1 = require("../helpers");
const fallback_1 = require("../lib/fallback");
function hmacSha256Sign(key, msg) {
return __awaiter(this, void 0, void 0, function* () {
const result = fallback_1.fallbackHmacSha256Sign(key, msg);
return result;
});
}
exports.hmacSha256Sign = hmacSha256Sign;
function hmacSha256Verify(key, msg, sig) {
return __awaiter(this, void 0, void 0, function* () {
const expectedSig = fallback_1.fallbackHmacSha256Sign(key, msg);
const result = helpers_1.isConstantTime(expectedSig, sig);
return result;
});
}
exports.hmacSha256Verify = hmacSha256Verify;
function hmacSha512Sign(key, msg) {
return __awaiter(this, void 0, void 0, function* () {
const result = fallback_1.fallbackHmacSha512Sign(key, msg);
return result;
});
}
exports.hmacSha512Sign = hmacSha512Sign;
function hmacSha512Verify(key, msg, sig) {
return __awaiter(this, void 0, void 0, function* () {
const expectedSig = fallback_1.fallbackHmacSha512Sign(key, msg);
const result = helpers_1.isConstantTime(expectedSig, sig);
return result;
});
}
exports.hmacSha512Verify = hmacSha512Verify;
//# sourceMappingURL=hmac.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"hmac.js","sourceRoot":"","sources":["../../../src/fallback/hmac.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,wCAA4C;AAE5C,8CAGyB;AAEzB,SAAsB,cAAc,CAClC,GAAe,EACf,GAAe;;QAEf,MAAM,MAAM,GAAG,iCAAsB,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;QAChD,OAAO,MAAM,CAAC;IAChB,CAAC;CAAA;AAND,wCAMC;AAED,SAAsB,gBAAgB,CACpC,GAAe,EACf,GAAe,EACf,GAAe;;QAEf,MAAM,WAAW,GAAG,iCAAsB,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;QACrD,MAAM,MAAM,GAAG,wBAAc,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;QAChD,OAAO,MAAM,CAAC;IAChB,CAAC;CAAA;AARD,4CAQC;AAED,SAAsB,cAAc,CAClC,GAAe,EACf,GAAe;;QAEf,MAAM,MAAM,GAAG,iCAAsB,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;QAChD,OAAO,MAAM,CAAC;IAChB,CAAC;CAAA;AAND,wCAMC;AAED,SAAsB,gBAAgB,CACpC,GAAe,EACf,GAAe,EACf,GAAe;;QAEf,MAAM,WAAW,GAAG,iCAAsB,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;QACrD,MAAM,MAAM,GAAG,wBAAc,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;QAChD,OAAO,MAAM,CAAC;IAChB,CAAC;CAAA;AARD,4CAQC"}

6
src/lib/crypto/fallback/index.d.ts vendored Normal file
View File

@ -0,0 +1,6 @@
export * from "./aes";
export * from "./hmac";
export * from "./sha2";
export * from "../helpers";
export * from "../constants";
//# sourceMappingURL=index.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fallback/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAE3C,cAAc,OAAO,CAAC;AACtB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AAEvB,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC"}

View File

@ -0,0 +1,18 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./aes"), exports);
__exportStar(require("./hmac"), exports);
__exportStar(require("./sha2"), exports);
__exportStar(require("../helpers"), exports);
__exportStar(require("../constants"), exports);
//# sourceMappingURL=index.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/fallback/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6DAA2C;AAE3C,wCAAsB;AACtB,yCAAuB;AACvB,yCAAuB;AAEvB,6CAA2B;AAC3B,+CAA6B"}

4
src/lib/crypto/fallback/sha2.d.ts vendored Normal file
View File

@ -0,0 +1,4 @@
export declare function sha256(msg: Uint8Array): Promise<Uint8Array>;
export declare function sha512(msg: Uint8Array): Promise<Uint8Array>;
export declare function ripemd160(msg: Uint8Array): Promise<Uint8Array>;
//# sourceMappingURL=sha2.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"sha2.d.ts","sourceRoot":"","sources":["../../../src/fallback/sha2.ts"],"names":[],"mappings":"AAMA,wBAAsB,MAAM,CAAC,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAGjE;AAED,wBAAsB,MAAM,CAAC,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAGjE;AAED,wBAAsB,SAAS,CAAC,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAIpE"}

View File

@ -0,0 +1,35 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ripemd160 = exports.sha512 = exports.sha256 = void 0;
const fallback_1 = require("../lib/fallback");
function sha256(msg) {
return __awaiter(this, void 0, void 0, function* () {
const result = fallback_1.fallbackSha256(msg);
return result;
});
}
exports.sha256 = sha256;
function sha512(msg) {
return __awaiter(this, void 0, void 0, function* () {
const result = fallback_1.fallbackSha512(msg);
return result;
});
}
exports.sha512 = sha512;
function ripemd160(msg) {
return __awaiter(this, void 0, void 0, function* () {
const result = fallback_1.fallbackRipemd160(msg);
return result;
});
}
exports.ripemd160 = ripemd160;
//# sourceMappingURL=sha2.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"sha2.js","sourceRoot":"","sources":["../../../src/fallback/sha2.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,8CAIyB;AAEzB,SAAsB,MAAM,CAAC,GAAe;;QAC1C,MAAM,MAAM,GAAG,yBAAc,CAAC,GAAG,CAAC,CAAC;QACnC,OAAO,MAAM,CAAC;IAChB,CAAC;CAAA;AAHD,wBAGC;AAED,SAAsB,MAAM,CAAC,GAAe;;QAC1C,MAAM,MAAM,GAAG,yBAAc,CAAC,GAAG,CAAC,CAAC;QACnC,OAAO,MAAM,CAAC;IAChB,CAAC;CAAA;AAHD,wBAGC;AAED,SAAsB,SAAS,CAAC,GAAe;;QAC7C,MAAM,MAAM,GAAG,4BAAiB,CAAC,GAAG,CAAC,CAAC;QAEtC,OAAO,MAAM,CAAC;IAChB,CAAC;CAAA;AAJD,8BAIC"}

2
src/lib/crypto/helpers/env.d.ts vendored Normal file
View File

@ -0,0 +1,2 @@
export * from "@walletconnect/environment";
//# sourceMappingURL=env.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../../src/helpers/env.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC"}

View File

@ -0,0 +1,14 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("@walletconnect/environment"), exports);
//# sourceMappingURL=env.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"env.js","sourceRoot":"","sources":["../../../src/helpers/env.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6DAA2C"}

5
src/lib/crypto/helpers/index.d.ts vendored Normal file
View File

@ -0,0 +1,5 @@
export * from "./env";
export * from "./pkcs7";
export * from "./types";
export * from "./validators";
//# sourceMappingURL=index.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/helpers/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACtB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC"}

View File

@ -0,0 +1,17 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./env"), exports);
__exportStar(require("./pkcs7"), exports);
__exportStar(require("./types"), exports);
__exportStar(require("./validators"), exports);
//# sourceMappingURL=index.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/helpers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,wCAAsB;AACtB,0CAAwB;AACxB,0CAAwB;AACxB,+CAA6B"}

5
src/lib/crypto/helpers/pkcs7.d.ts vendored Normal file
View File

@ -0,0 +1,5 @@
export declare const pkcs7: {
pad(plaintext: Uint8Array): Uint8Array;
unpad(padded: Uint8Array): Uint8Array;
};
//# sourceMappingURL=pkcs7.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"pkcs7.d.ts","sourceRoot":"","sources":["../../../src/helpers/pkcs7.ts"],"names":[],"mappings":"AA2BA,eAAO,MAAM,KAAK;mBAQD,UAAU,GAAG,UAAU;kBAgBxB,UAAU,GAAG,UAAU;CAMtC,CAAC"}

View File

@ -0,0 +1,34 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.pkcs7 = void 0;
const PADDING = [
[16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16],
[15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15],
[14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14],
[13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13],
[12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12],
[11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11],
[10, 10, 10, 10, 10, 10, 10, 10, 10, 10],
[9, 9, 9, 9, 9, 9, 9, 9, 9],
[8, 8, 8, 8, 8, 8, 8, 8],
[7, 7, 7, 7, 7, 7, 7],
[6, 6, 6, 6, 6, 6],
[5, 5, 5, 5, 5],
[4, 4, 4, 4],
[3, 3, 3],
[2, 2],
[1],
];
exports.pkcs7 = {
pad(plaintext) {
const padding = PADDING[plaintext.byteLength % 16 || 0];
const result = new Uint8Array(plaintext.byteLength + padding.length);
result.set(plaintext);
result.set(padding, plaintext.byteLength);
return result;
},
unpad(padded) {
return padded.subarray(0, padded.byteLength - padded[padded.byteLength - 1]);
},
};
//# sourceMappingURL=pkcs7.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"pkcs7.js","sourceRoot":"","sources":["../../../src/helpers/pkcs7.ts"],"names":[],"mappings":";;;AAQA,MAAM,OAAO,GAAe;IAC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1,19 @@
export interface Encrypted {
iv: Uint8Array;
mac: Uint8Array;
publicKey: Uint8Array;
ciphertext: Uint8Array;
}
export interface EncryptOpts {
iv?: Uint8Array;
sender?: KeyPair;
}
export interface KeyPair {
privateKey: Uint8Array;
publicKey: Uint8Array;
}
export interface PNRG {
isAvailable: boolean;
randomBytes(length: number): Uint8Array;
}
//# sourceMappingURL=types.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/helpers/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,UAAU,CAAC;IACf,GAAG,EAAE,UAAU,CAAC;IAChB,SAAS,EAAE,UAAU,CAAC;IACtB,UAAU,EAAE,UAAU,CAAC;CACxB;AAED,MAAM,WAAW,WAAW;IAC1B,EAAE,CAAC,EAAE,UAAU,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,OAAO;IACtB,UAAU,EAAE,UAAU,CAAC;IACvB,SAAS,EAAE,UAAU,CAAC;CACvB;AAED,MAAM,WAAW,IAAI;IACnB,WAAW,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,CAAC;CACzC"}

View File

@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=types.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/helpers/types.ts"],"names":[],"mappings":""}

View File

@ -0,0 +1,3 @@
export declare function assert(condition: boolean, message: string): void;
export declare function isConstantTime(arr1: Uint8Array, arr2: Uint8Array): boolean;
//# sourceMappingURL=validators.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"validators.d.ts","sourceRoot":"","sources":["../../../src/helpers/validators.ts"],"names":[],"mappings":"AAAA,wBAAgB,MAAM,CAAC,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAIhE;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,UAAU,GAAG,OAAO,CAS1E"}

View File

@ -0,0 +1,21 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isConstantTime = exports.assert = void 0;
function assert(condition, message) {
if (!condition) {
throw new Error(message || "Assertion failed");
}
}
exports.assert = assert;
function isConstantTime(arr1, arr2) {
if (arr1.length !== arr2.length) {
return false;
}
let res = 0;
for (let i = 0; i < arr1.length; i++) {
res |= arr1[i] ^ arr2[i];
}
return res === 0;
}
exports.isConstantTime = isConstantTime;
//# sourceMappingURL=validators.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"validators.js","sourceRoot":"","sources":["../../../src/helpers/validators.ts"],"names":[],"mappings":";;;AAAA,SAAgB,MAAM,CAAC,SAAkB,EAAE,OAAe;IACxD,IAAI,CAAC,SAAS,EAAE;QACd,MAAM,IAAI,KAAK,CAAC,OAAO,IAAI,kBAAkB,CAAC,CAAC;KAChD;AACH,CAAC;AAJD,wBAIC;AAED,SAAgB,cAAc,CAAC,IAAgB,EAAE,IAAgB;IAC/D,IAAI,IAAI,CAAC,MAAM,KAAK,IAAI,CAAC,MAAM,EAAE;QAC/B,OAAO,KAAK,CAAC;KACd;IACD,IAAI,GAAG,GAAG,CAAC,CAAC;IACZ,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACpC,GAAG,IAAI,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;KAC1B;IACD,OAAO,GAAG,KAAK,CAAC,CAAC;AACnB,CAAC;AATD,wCASC"}

11
src/lib/crypto/lib/browser.d.ts vendored Normal file
View File

@ -0,0 +1,11 @@
export declare function getAlgo(type: string): AesKeyAlgorithm | HmacImportParams;
export declare function getOps(type: string): string[];
export declare function browserExportKey(cryptoKey: CryptoKey, type?: string): Promise<Uint8Array>;
export declare function browserImportKey(buffer: Uint8Array, type?: string): Promise<CryptoKey>;
export declare function browserAesEncrypt(iv: Uint8Array, key: Uint8Array, data: Uint8Array): Promise<Uint8Array>;
export declare function browserAesDecrypt(iv: Uint8Array, key: Uint8Array, data: Uint8Array): Promise<Uint8Array>;
export declare function browserHmacSha256Sign(key: Uint8Array, data: Uint8Array): Promise<Uint8Array>;
export declare function browserHmacSha512Sign(key: Uint8Array, data: Uint8Array): Promise<Uint8Array>;
export declare function browserSha256(data: Uint8Array): Promise<Uint8Array>;
export declare function browserSha512(data: Uint8Array): Promise<Uint8Array>;
//# sourceMappingURL=browser.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../../src/lib/browser.ts"],"names":[],"mappings":"AAgBA,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,GAAG,gBAAgB,CAOxE;AAED,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAI7C;AAED,wBAAsB,gBAAgB,CACpC,SAAS,EAAE,SAAS,EACpB,IAAI,GAAE,MAAyB,GAC9B,OAAO,CAAC,UAAU,CAAC,CAGrB;AAED,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,UAAU,EAClB,IAAI,GAAE,MAAyB,GAC9B,OAAO,CAAC,SAAS,CAAC,CAQpB;AAED,wBAAsB,iBAAiB,CACrC,EAAE,EAAE,UAAU,EACd,GAAG,EAAE,UAAU,EACf,IAAI,EAAE,UAAU,GACf,OAAO,CAAC,UAAU,CAAC,CAYrB;AAED,wBAAsB,iBAAiB,CACrC,EAAE,EAAE,UAAU,EACd,GAAG,EAAE,UAAU,EACf,IAAI,EAAE,UAAU,GACf,OAAO,CAAC,UAAU,CAAC,CAYrB;AAED,wBAAsB,qBAAqB,CACzC,GAAG,EAAE,UAAU,EACf,IAAI,EAAE,UAAU,GACf,OAAO,CAAC,UAAU,CAAC,CAYrB;AAED,wBAAsB,qBAAqB,CACzC,GAAG,EAAE,UAAU,EACf,IAAI,EAAE,UAAU,GACf,OAAO,CAAC,UAAU,CAAC,CAYrB;AAED,wBAAsB,aAAa,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CASzE;AAED,wBAAsB,aAAa,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CASzE"}

View File

@ -0,0 +1,130 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.browserSha512 = exports.browserSha256 = exports.browserHmacSha512Sign = exports.browserHmacSha256Sign = exports.browserAesDecrypt = exports.browserAesEncrypt = exports.browserImportKey = exports.browserExportKey = exports.getOps = exports.getAlgo = void 0;
const env = __importStar(require("@walletconnect/environment"));
const constants_1 = require("../constants");
function getAlgo(type) {
return type === constants_1.AES_BROWSER_ALGO
? { length: constants_1.AES_LENGTH, name: constants_1.AES_BROWSER_ALGO }
: {
hash: { name: constants_1.HMAC_BROWSER_ALGO },
name: constants_1.HMAC_BROWSER,
};
}
exports.getAlgo = getAlgo;
function getOps(type) {
return type === constants_1.AES_BROWSER_ALGO
? [constants_1.ENCRYPT_OP, constants_1.DECRYPT_OP]
: [constants_1.SIGN_OP, constants_1.VERIFY_OP];
}
exports.getOps = getOps;
function browserExportKey(cryptoKey, type = constants_1.AES_BROWSER_ALGO) {
return __awaiter(this, void 0, void 0, function* () {
const subtle = env.getSubtleCrypto();
return new Uint8Array(yield subtle.exportKey("raw", cryptoKey));
});
}
exports.browserExportKey = browserExportKey;
function browserImportKey(buffer, type = constants_1.AES_BROWSER_ALGO) {
return __awaiter(this, void 0, void 0, function* () {
return env.getSubtleCrypto().importKey("raw", buffer, getAlgo(type), true, getOps(type));
});
}
exports.browserImportKey = browserImportKey;
function browserAesEncrypt(iv, key, data) {
return __awaiter(this, void 0, void 0, function* () {
const subtle = env.getSubtleCrypto();
const cryptoKey = yield browserImportKey(key, constants_1.AES_BROWSER_ALGO);
const result = yield subtle.encrypt({
iv,
name: constants_1.AES_BROWSER_ALGO,
}, cryptoKey, data);
return new Uint8Array(result);
});
}
exports.browserAesEncrypt = browserAesEncrypt;
function browserAesDecrypt(iv, key, data) {
return __awaiter(this, void 0, void 0, function* () {
const subtle = env.getSubtleCrypto();
const cryptoKey = yield browserImportKey(key, constants_1.AES_BROWSER_ALGO);
const result = yield subtle.decrypt({
iv,
name: constants_1.AES_BROWSER_ALGO,
}, cryptoKey, data);
return new Uint8Array(result);
});
}
exports.browserAesDecrypt = browserAesDecrypt;
function browserHmacSha256Sign(key, data) {
return __awaiter(this, void 0, void 0, function* () {
const subtle = env.getSubtleCrypto();
const cryptoKey = yield browserImportKey(key, constants_1.HMAC_BROWSER);
const signature = yield subtle.sign({
length: constants_1.HMAC_LENGTH,
name: constants_1.HMAC_BROWSER,
}, cryptoKey, data);
return new Uint8Array(signature);
});
}
exports.browserHmacSha256Sign = browserHmacSha256Sign;
function browserHmacSha512Sign(key, data) {
return __awaiter(this, void 0, void 0, function* () {
const subtle = env.getSubtleCrypto();
const cryptoKey = yield browserImportKey(key, constants_1.HMAC_BROWSER);
const signature = yield subtle.sign({
length: constants_1.LENGTH_512,
name: constants_1.HMAC_BROWSER,
}, cryptoKey, data);
return new Uint8Array(signature);
});
}
exports.browserHmacSha512Sign = browserHmacSha512Sign;
function browserSha256(data) {
return __awaiter(this, void 0, void 0, function* () {
const subtle = env.getSubtleCrypto();
const result = yield subtle.digest({
name: constants_1.SHA256_BROWSER_ALGO,
}, data);
return new Uint8Array(result);
});
}
exports.browserSha256 = browserSha256;
function browserSha512(data) {
return __awaiter(this, void 0, void 0, function* () {
const subtle = env.getSubtleCrypto();
const result = yield subtle.digest({
name: constants_1.SHA512_BROWSER_ALGO,
}, data);
return new Uint8Array(result);
});
}
exports.browserSha512 = browserSha512;
//# sourceMappingURL=browser.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"browser.js","sourceRoot":"","sources":["../../../src/lib/browser.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gEAAkD;AAClD,4CAasB;AAEtB,SAAgB,OAAO,CAAC,IAAY;IAClC,OAAO,IAAI,KAAK,4BAAgB;QAC9B,CAAC,CAAC,EAAE,MAAM,EAAE,sBAAU,EAAE,IAAI,EAAE,4BAAgB,EAAE;QAChD,CAAC,CAAC;YACE,IAAI,EAAE,EAAE,IAAI,EAAE,6BAAiB,EAAE;YACjC,IAAI,EAAE,wBAAY;SACnB,CAAC;AACR,CAAC;AAPD,0BAOC;AAED,SAAgB,MAAM,CAAC,IAAY;IACjC,OAAO,IAAI,KAAK,4BAAgB;QAC9B,CAAC,CAAC,CAAC,sBAAU,EAAE,sBAAU,CAAC;QAC1B,CAAC,CAAC,CAAC,mBAAO,EAAE,qBAAS,CAAC,CAAC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AAM,MAAM,GAAG,MAAM,MAAM,CAAC,MAAM,CAChC;YACE,IAAI,EAAE,+BAAmB;SAC1B,EACD,IAAI,CACL,CAAC;QACF,OAAO,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC;IAChC,CAAC;CAAA;AATD,sCASC"}

8
src/lib/crypto/lib/fallback.d.ts vendored Normal file
View File

@ -0,0 +1,8 @@
export declare function fallbackAesEncrypt(iv: Uint8Array, key: Uint8Array, data: Uint8Array): Uint8Array;
export declare function fallbackAesDecrypt(iv: Uint8Array, key: Uint8Array, data: Uint8Array): Uint8Array;
export declare function fallbackHmacSha256Sign(key: Uint8Array, data: Uint8Array): Uint8Array;
export declare function fallbackHmacSha512Sign(key: Uint8Array, data: Uint8Array): Uint8Array;
export declare function fallbackSha256(msg: Uint8Array): Uint8Array;
export declare function fallbackSha512(msg: Uint8Array): Uint8Array;
export declare function fallbackRipemd160(msg: Uint8Array): Uint8Array;
//# sourceMappingURL=fallback.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"fallback.d.ts","sourceRoot":"","sources":["../../../src/lib/fallback.ts"],"names":[],"mappings":"AAOA,wBAAgB,kBAAkB,CAChC,EAAE,EAAE,UAAU,EACd,GAAG,EAAE,UAAU,EACf,IAAI,EAAE,UAAU,cAMjB;AAED,wBAAgB,kBAAkB,CAChC,EAAE,EAAE,UAAU,EACd,GAAG,EAAE,UAAU,EACf,IAAI,EAAE,UAAU,cAOjB;AAED,wBAAgB,sBAAsB,CACpC,GAAG,EAAE,UAAU,EACf,IAAI,EAAE,UAAU,GACf,UAAU,CAMZ;AAED,wBAAgB,sBAAsB,CACpC,GAAG,EAAE,UAAU,EACf,IAAI,EAAE,UAAU,GACf,UAAU,CAMZ;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,UAAU,GAAG,UAAU,CAM1D;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,UAAU,GAAG,UAAU,CAM1D;AAED,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,UAAU,GAAG,UAAU,CAM7D"}

View File

@ -0,0 +1,86 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.fallbackRipemd160 = exports.fallbackSha512 = exports.fallbackSha256 = exports.fallbackHmacSha512Sign = exports.fallbackHmacSha256Sign = exports.fallbackAesDecrypt = exports.fallbackAesEncrypt = void 0;
const aes_js_1 = __importDefault(require("aes-js"));
const encoding_1 = require("@walletconnect/encoding");
const hash = __importStar(require("hash.js"));
const constants_1 = require("../constants");
const helpers_1 = require("../helpers");
function fallbackAesEncrypt(iv, key, data) {
const aesCbc = new aes_js_1.default.ModeOfOperation.cbc(key, iv);
const padded = helpers_1.pkcs7.pad(data);
const encryptedBytes = aesCbc.encrypt(padded);
return new Uint8Array(encryptedBytes);
}
exports.fallbackAesEncrypt = fallbackAesEncrypt;
function fallbackAesDecrypt(iv, key, data) {
const aesCbc = new aes_js_1.default.ModeOfOperation.cbc(key, iv);
const encryptedBytes = aesCbc.decrypt(data);
const padded = new Uint8Array(encryptedBytes);
const result = helpers_1.pkcs7.unpad(padded);
return result;
}
exports.fallbackAesDecrypt = fallbackAesDecrypt;
function fallbackHmacSha256Sign(key, data) {
const result = hash
.hmac(hash[constants_1.SHA256_NODE_ALGO], key)
.update(data)
.digest(constants_1.HEX_ENC);
return encoding_1.hexToArray(result);
}
exports.fallbackHmacSha256Sign = fallbackHmacSha256Sign;
function fallbackHmacSha512Sign(key, data) {
const result = hash
.hmac(hash[constants_1.SHA512_NODE_ALGO], key)
.update(data)
.digest(constants_1.HEX_ENC);
return encoding_1.hexToArray(result);
}
exports.fallbackHmacSha512Sign = fallbackHmacSha512Sign;
function fallbackSha256(msg) {
const result = hash
.sha256()
.update(msg)
.digest(constants_1.HEX_ENC);
return encoding_1.hexToArray(result);
}
exports.fallbackSha256 = fallbackSha256;
function fallbackSha512(msg) {
const result = hash
.sha512()
.update(msg)
.digest(constants_1.HEX_ENC);
return encoding_1.hexToArray(result);
}
exports.fallbackSha512 = fallbackSha512;
function fallbackRipemd160(msg) {
const result = hash
.ripemd160()
.update(msg)
.digest(constants_1.HEX_ENC);
return encoding_1.hexToArray(result);
}
exports.fallbackRipemd160 = fallbackRipemd160;
//# sourceMappingURL=fallback.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"fallback.js","sourceRoot":"","sources":["../../../src/lib/fallback.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAA2B;AAC3B,sDAAqD;AACrD,8CAAgC;AAEhC,4CAA2E;AAC3E,wCAAmC;AAEnC,SAAgB,kBAAkB,CAChC,EAAc,EACd,GAAe,EACf,IAAgB;IAEhB,MAAM,MAAM,GAAG,IAAI,gBAAK,CAAC,eAAe,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;IACtD,MAAM,MAAM,GAAG,eAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC/B,MAAM,cAAc,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAC9C,OAAO,IAAI,UAAU,CAAC,cAAc,CAAC,CAAC;AACxC,CAAC;AATD,gDASC;AAED,SAAgB,kBAAkB,CAChC,EAAc,EACd,GAA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MAAM,CAAC,mBAAO,CAAC,CAAC;IACnB,OAAO,qBAAU,CAAC,MAAM,CAAC,CAAC;AAC5B,CAAC;AAND,wCAMC;AAED,SAAgB,iBAAiB,CAAC,GAAe;IAC/C,MAAM,MAAM,GAAG,IAAI;SAChB,SAAS,EAAE;SACX,MAAM,CAAC,GAAG,CAAC;SACX,MAAM,CAAC,mBAAO,CAAC,CAAC;IACnB,OAAO,qBAAU,CAAC,MAAM,CAAC,CAAC;AAC5B,CAAC;AAND,8CAMC"}

8
src/lib/crypto/lib/node.d.ts vendored Normal file
View File

@ -0,0 +1,8 @@
export declare function nodeAesEncrypt(iv: Uint8Array, key: Uint8Array, data: Uint8Array): Uint8Array;
export declare function nodeAesDecrypt(iv: Uint8Array, key: Uint8Array, data: Uint8Array): Uint8Array;
export declare function nodeHmacSha256Sign(key: Uint8Array, data: Uint8Array): Uint8Array;
export declare function nodeHmacSha512Sign(key: Uint8Array, data: Uint8Array): Uint8Array;
export declare function nodeSha256(data: Uint8Array): Uint8Array;
export declare function nodeSha512(data: Uint8Array): Uint8Array;
export declare function nodeRipemd160(data: Uint8Array): Uint8Array;
//# sourceMappingURL=node.d.ts.map

View File

@ -0,0 +1 @@
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../../src/lib/node.ts"],"names":[],"mappings":"AAWA,wBAAgB,cAAc,CAC5B,EAAE,EAAE,UAAU,EACd,GAAG,EAAE,UAAU,EACf,IAAI,EAAE,UAAU,GACf,UAAU,CASZ;AAED,wBAAgB,cAAc,CAC5B,EAAE,EAAE,UAAU,EACd,GAAG,EAAE,UAAU,EACf,IAAI,EAAE,UAAU,GACf,UAAU,CASZ;AAED,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,UAAU,EACf,IAAI,EAAE,UAAU,GACf,UAAU,CAMZ;AAED,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,UAAU,EACf,IAAI,EAAE,UAAU,GACf,UAAU,CAMZ;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,UAAU,GAAG,UAAU,CAMvD;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,UAAU,GAAG,UAAU,CAMvD;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,UAAU,GAAG,UAAU,CAM1D"}

View File

@ -0,0 +1,60 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.nodeRipemd160 = exports.nodeSha512 = exports.nodeSha256 = exports.nodeHmacSha512Sign = exports.nodeHmacSha256Sign = exports.nodeAesDecrypt = exports.nodeAesEncrypt = void 0;
const crypto_1 = __importDefault(require("crypto"));
const encoding_1 = require("@walletconnect/encoding");
const constants_1 = require("../constants");
function nodeAesEncrypt(iv, key, data) {
const cipher = crypto_1.default.createCipheriv(constants_1.AES_NODE_ALGO, Buffer.from(key), Buffer.from(iv));
return encoding_1.bufferToArray(encoding_1.concatBuffers(cipher.update(Buffer.from(data)), cipher.final()));
}
exports.nodeAesEncrypt = nodeAesEncrypt;
function nodeAesDecrypt(iv, key, data) {
const decipher = crypto_1.default.createDecipheriv(constants_1.AES_NODE_ALGO, Buffer.from(key), Buffer.from(iv));
return encoding_1.bufferToArray(encoding_1.concatBuffers(decipher.update(Buffer.from(data)), decipher.final()));
}
exports.nodeAesDecrypt = nodeAesDecrypt;
function nodeHmacSha256Sign(key, data) {
const buf = crypto_1.default
.createHmac(constants_1.HMAC_NODE_ALGO, Buffer.from(key))
.update(Buffer.from(data))
.digest();
return encoding_1.bufferToArray(buf);
}
exports.nodeHmacSha256Sign = nodeHmacSha256Sign;
function nodeHmacSha512Sign(key, data) {
const buf = crypto_1.default
.createHmac(constants_1.SHA512_NODE_ALGO, Buffer.from(key))
.update(Buffer.from(data))
.digest();
return encoding_1.bufferToArray(buf);
}
exports.nodeHmacSha512Sign = nodeHmacSha512Sign;
function nodeSha256(data) {
const buf = crypto_1.default
.createHash(constants_1.SHA256_NODE_ALGO)
.update(Buffer.from(data))
.digest();
return encoding_1.bufferToArray(buf);
}
exports.nodeSha256 = nodeSha256;
function nodeSha512(data) {
const buf = crypto_1.default
.createHash(constants_1.SHA512_NODE_ALGO)
.update(Buffer.from(data))
.digest();
return encoding_1.bufferToArray(buf);
}
exports.nodeSha512 = nodeSha512;
function nodeRipemd160(data) {
const buf = crypto_1.default
.createHash(constants_1.RIPEMD160_NODE_ALGO)
.update(Buffer.from(data))
.digest();
return encoding_1.bufferToArray(buf);
}
exports.nodeRipemd160 = nodeRipemd160;
//# sourceMappingURL=node.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"node.js","sourceRoot":"","sources":["../../../src/lib/node.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA4B;AAC5B,sDAAuE;AAEvE,4CAMsB;AAEtB,SAAgB,cAAc,CAC5B,EAAc,EACd,GAAe,EACf,IAAgB;IAEhB,MAAM,MAAM,GAAG,gBAAM,CAAC,cAAc,CAClC,yBAAa,EACb,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAChB,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAChB,CAAC;IACF,OAAO,wBAAa,CAClB,wBAAa,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC,CAChE,CAAC;AACJ,CAAC;AAbD,wCAaC;AAED,SAAgB,cAAc,CAC5B,EAAc,EACd,GAAe,EACf,IAAgB;IAEhB,MAAM,QAAQ,GAAG,gBAAM,CAAC,gBAAgB,CACtC,yBAAa,EACb,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAChB,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAChB,CAAC;IACF,OAAO,wBAAa,CAClB,wBAAa,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,QAAQ,CAAC,KAAK,EAAE,CAAC,CAC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AC/B,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SACzB,MAAM,EAAE,CAAC;IACZ,OAAO,wBAAa,CAAC,GAAG,CAAC,CAAC;AAC5B,CAAC;AAND,sCAMC"}

105
src/lib/zcrypto.js Normal file
View File

@ -0,0 +1,105 @@
const Buffer = require('safe-buffer').Buffer;
const encoding = require("@walletconnect/encoding");
const utils = require("@walletconnect/utils");
const crypto = require('./crypto/fallback/index');
function getRandomValues(array) {
for (var i = 0, l = array.length; i < l; i++) {
array[i] = Math.floor(Math.random() * 256);
}
return array;
}
const MAX_BYTES = 65536;
const MAX_UINT32 = 4294967295;
window.Buffer = Buffer;
function randomBytes(size) {
if (size > MAX_UINT32) throw new RangeError('requested too many random bytes')
var bytes = Buffer.allocUnsafe(size)
if (size > 0) { // getRandomValues fails on IE if size == 0
if (size > MAX_BYTES) { // this is the max bytes crypto.getRandomValues
// can do at once see https://developer.mozilla.org/en-US/docs/Web/API/window.crypto.getRandomValues
for (var generated = 0; generated < size; generated += MAX_BYTES) {
// buffer.slice automatically checks if the end is past the end of
// the buffer so we don't have to here
getRandomValues(bytes.slice(generated, generated + MAX_BYTES))
}
} else {
getRandomValues(bytes)
}
}
return encoding.bufferToArray(bytes);
}
function bowserRandomBytes(length) {
return window.crypto.getRandomValues(new Uint8Array(length))
}
function generateKey(length) {
const _length = (length || 256) / 8;
//const bytes = bowserRandomBytes(_length)
const bytes = randomBytes(_length);
const result = (0, utils.convertBufferToArrayBuffer)(encoding.arrayToBuffer(bytes));
return result;
}
exports.generateKey = generateKey;
async function verifyHmac(payload, key) {
const cipherText = encoding.hexToArray(payload.data);
const iv = encoding.hexToArray(payload.iv);
const hmac = encoding.hexToArray(payload.hmac);
const hmacHex = encoding.arrayToHex(hmac, false);
const unsigned = encoding.concatArrays(cipherText, iv);
const chmac = await crypto.hmacSha256Sign(key, unsigned);
const chmacHex = encoding.arrayToHex(chmac, false);
if (encoding.removeHexPrefix(hmacHex) === encoding.removeHexPrefix(chmacHex)) {
return true;
}
return false;
}
exports.verifyHmac = verifyHmac;
async function encrypt(data, key, providedIv) {
const _key = encoding.bufferToArray((0, utils.convertArrayBufferToBuffer)(key));
const ivArrayBuffer = providedIv || ( generateKey(128));
const iv = encoding.bufferToArray((0, utils.convertArrayBufferToBuffer)(ivArrayBuffer));
const ivHex = encoding.arrayToHex(iv, false);
const contentString = JSON.stringify(data);
const content = encoding.utf8ToArray(contentString);
const cipherText = await crypto.aesCbcEncrypt(iv, _key, content);
const cipherTextHex = encoding.arrayToHex(cipherText, false);
const unsigned = encoding.concatArrays(cipherText, iv);
const hmac =await crypto.hmacSha256Sign(_key, unsigned);
const hmacHex = encoding.arrayToHex(hmac, false);
return {
data: cipherTextHex,
hmac: hmacHex,
iv: ivHex,
};
}
exports.encrypt = encrypt;
async function decrypt(payload, key) {
const _key = encoding.bufferToArray((0, utils.convertArrayBufferToBuffer)(key));
if (!_key) {
throw new Error("Missing key: required for decryption");
}
const verified = await verifyHmac(payload, _key);
if (!verified) {
return null;
}
const cipherText = encoding.hexToArray(payload.data);
const iv = encoding.hexToArray(payload.iv);
const buffer =await crypto.aesCbcDecrypt(iv, _key, cipherText);
const utf8 = encoding.arrayToUtf8(buffer);
let data;
try {
data = JSON.parse(utf8);
}
catch (error) {
return null;
}
return data;
}
exports.decrypt = decrypt;

174
yarn.lock
View File

@ -1262,6 +1262,137 @@
dependencies:
"@types/node" "*"
"@walletconnect/browser-utils@^1.8.0":
version "1.8.0"
resolved "https://registry.npmmirror.com/@walletconnect/browser-utils/-/browser-utils-1.8.0.tgz#33c10e777aa6be86c713095b5206d63d32df0951"
integrity sha512-Wcqqx+wjxIo9fv6eBUFHPsW1y/bGWWRboni5dfD8PtOmrihrEpOCmvRJe4rfl7xgJW8Ea9UqKEaq0bIRLHlK4A==
dependencies:
"@walletconnect/safe-json" "1.0.0"
"@walletconnect/types" "^1.8.0"
"@walletconnect/window-getters" "1.0.0"
"@walletconnect/window-metadata" "1.0.0"
detect-browser "5.2.0"
"@walletconnect/client@^1.8.0":
version "1.8.0"
resolved "https://registry.npmmirror.com/@walletconnect/client/-/client-1.8.0.tgz#6f46b5499c7c861c651ff1ebe5da5b66225ca696"
integrity sha512-svyBQ14NHx6Cs2j4TpkQaBI/2AF4+LXz64FojTjMtV4VMMhl81jSO1vNeg+yYhQzvjcGH/GpSwixjyCW0xFBOQ==
dependencies:
"@walletconnect/core" "^1.8.0"
"@walletconnect/iso-crypto" "^1.8.0"
"@walletconnect/types" "^1.8.0"
"@walletconnect/utils" "^1.8.0"
"@walletconnect/core@^1.8.0":
version "1.8.0"
resolved "https://registry.npmmirror.com/@walletconnect/core/-/core-1.8.0.tgz#6b2748b90c999d9d6a70e52e26a8d5e8bfeaa81e"
integrity sha512-aFTHvEEbXcZ8XdWBw6rpQDte41Rxwnuk3SgTD8/iKGSRTni50gI9S3YEzMj05jozSiOBxQci4pJDMVhIUMtarw==
dependencies:
"@walletconnect/socket-transport" "^1.8.0"
"@walletconnect/types" "^1.8.0"
"@walletconnect/utils" "^1.8.0"
"@walletconnect/crypto@^1.0.2":
version "1.0.2"
resolved "https://registry.npmmirror.com/@walletconnect/crypto/-/crypto-1.0.2.tgz#3fcc2b2cde6f529a19eadd883dc555cd0e861992"
integrity sha512-+OlNtwieUqVcOpFTvLBvH+9J9pntEqH5evpINHfVxff1XIgwV55PpbdvkHu6r9Ib4WQDOFiD8OeeXs1vHw7xKQ==
dependencies:
"@walletconnect/encoding" "^1.0.1"
"@walletconnect/environment" "^1.0.0"
"@walletconnect/randombytes" "^1.0.2"
aes-js "^3.1.2"
hash.js "^1.1.7"
"@walletconnect/encoding@^1.0.1":
version "1.0.1"
resolved "https://registry.npmmirror.com/@walletconnect/encoding/-/encoding-1.0.1.tgz#93c18ce9478c3d5283dbb88c41eb2864b575269a"
integrity sha512-8opL2rs6N6E3tJfsqwS82aZQDL3gmupWUgmvuZ3CGU7z/InZs3R9jkzH8wmYtpbq0sFK3WkJkQRZFFk4BkrmFA==
dependencies:
is-typedarray "1.0.0"
typedarray-to-buffer "3.1.5"
"@walletconnect/environment@^1.0.0":
version "1.0.0"
resolved "https://registry.npmmirror.com/@walletconnect/environment/-/environment-1.0.0.tgz#c4545869fa9c389ec88c364e1a5f8178e8ab5034"
integrity sha512-4BwqyWy6KpSvkocSaV7WR3BlZfrxLbJSLkg+j7Gl6pTDE+U55lLhJvQaMuDVazXYxcjBsG09k7UlH7cGiUI5vQ==
"@walletconnect/iso-crypto@^1.8.0":
version "1.8.0"
resolved "https://registry.npmmirror.com/@walletconnect/iso-crypto/-/iso-crypto-1.8.0.tgz#44ddf337c4f02837c062dbe33fa7ab36789df451"
integrity sha512-pWy19KCyitpfXb70hA73r9FcvklS+FvO9QUIttp3c2mfW8frxgYeRXfxLRCIQTkaYueRKvdqPjbyhPLam508XQ==
dependencies:
"@walletconnect/crypto" "^1.0.2"
"@walletconnect/types" "^1.8.0"
"@walletconnect/utils" "^1.8.0"
"@walletconnect/jsonrpc-types@^1.0.1":
version "1.0.1"
resolved "https://registry.npmmirror.com/@walletconnect/jsonrpc-types/-/jsonrpc-types-1.0.1.tgz#a96b4bb2bcc8838a70e06f15c1b5ab11c47d8e95"
integrity sha512-+6coTtOuChCqM+AoYyi4Q83p9l/laI6NvuM2/AHaZFuf0gT0NjW7IX2+86qGyizn7Ptq4AYZmfxurAxTnhefuw==
dependencies:
keyvaluestorage-interface "^1.0.0"
"@walletconnect/jsonrpc-utils@^1.0.3":
version "1.0.3"
resolved "https://registry.npmmirror.com/@walletconnect/jsonrpc-utils/-/jsonrpc-utils-1.0.3.tgz#5bd49865eef0eae48e8b45a06731dc18691cf8c7"
integrity sha512-3yb49bPk16MNLk6uIIHPSHQCpD6UAo1OMOx1rM8cW/MPEAYAzrSW5hkhG7NEUwX9SokRIgnZK3QuQkiyNzBMhQ==
dependencies:
"@walletconnect/environment" "^1.0.0"
"@walletconnect/jsonrpc-types" "^1.0.1"
"@walletconnect/randombytes@^1.0.2":
version "1.0.2"
resolved "https://registry.npmmirror.com/@walletconnect/randombytes/-/randombytes-1.0.2.tgz#95c644251a15e6675f58fbffc9513a01486da49c"
integrity sha512-ivgOtAyqQnN0rLQmOFPemsgYGysd/ooLfaDA/ACQ3cyqlca56t3rZc7pXfqJOIETx/wSyoF5XbwL+BqYodw27A==
dependencies:
"@walletconnect/encoding" "^1.0.1"
"@walletconnect/environment" "^1.0.0"
randombytes "^2.1.0"
"@walletconnect/safe-json@1.0.0":
version "1.0.0"
resolved "https://registry.npmmirror.com/@walletconnect/safe-json/-/safe-json-1.0.0.tgz#12eeb11d43795199c045fafde97e3c91646683b2"
integrity sha512-QJzp/S/86sUAgWY6eh5MKYmSfZaRpIlmCJdi5uG4DJlKkZrHEF7ye7gA+VtbVzvTtpM/gRwO2plQuiooIeXjfg==
"@walletconnect/socket-transport@^1.8.0":
version "1.8.0"
resolved "https://registry.npmmirror.com/@walletconnect/socket-transport/-/socket-transport-1.8.0.tgz#9a1128a249628a0be11a0979b522fe82b44afa1b"
integrity sha512-5DyIyWrzHXTcVp0Vd93zJ5XMW61iDM6bcWT4p8DTRfFsOtW46JquruMhxOLeCOieM4D73kcr3U7WtyR4JUsGuQ==
dependencies:
"@walletconnect/types" "^1.8.0"
"@walletconnect/utils" "^1.8.0"
ws "7.5.3"
"@walletconnect/types@^1.8.0":
version "1.8.0"
resolved "https://registry.npmmirror.com/@walletconnect/types/-/types-1.8.0.tgz#3f5e85b2d6b149337f727ab8a71b8471d8d9a195"
integrity sha512-Cn+3I0V0vT9ghMuzh1KzZvCkiAxTq+1TR2eSqw5E5AVWfmCtECFkVZBP6uUJZ8YjwLqXheI+rnjqPy7sVM4Fyg==
"@walletconnect/utils@^1.8.0":
version "1.8.0"
resolved "https://registry.npmmirror.com/@walletconnect/utils/-/utils-1.8.0.tgz#2591a197c1fa7429941fe428876088fda6632060"
integrity sha512-zExzp8Mj1YiAIBfKNm5u622oNw44WOESzo6hj+Q3apSMIb0Jph9X3GDIdbZmvVZsNPxWDL7uodKgZcCInZv2vA==
dependencies:
"@walletconnect/browser-utils" "^1.8.0"
"@walletconnect/encoding" "^1.0.1"
"@walletconnect/jsonrpc-utils" "^1.0.3"
"@walletconnect/types" "^1.8.0"
bn.js "4.11.8"
js-sha3 "0.8.0"
query-string "6.13.5"
"@walletconnect/window-getters@1.0.0", "@walletconnect/window-getters@^1.0.0":
version "1.0.0"
resolved "https://registry.npmmirror.com/@walletconnect/window-getters/-/window-getters-1.0.0.tgz#1053224f77e725dfd611c83931b5f6c98c32bfc8"
integrity sha512-xB0SQsLaleIYIkSsl43vm8EwETpBzJ2gnzk7e0wMF3ktqiTGS6TFHxcprMl5R44KKh4tCcHCJwolMCaDSwtAaA==
"@walletconnect/window-metadata@1.0.0":
version "1.0.0"
resolved "https://registry.npmmirror.com/@walletconnect/window-metadata/-/window-metadata-1.0.0.tgz#93b1cc685e6b9b202f29c26be550fde97800c4e5"
integrity sha512-9eFvmJxIKCC3YWOL97SgRkKhlyGXkrHwamfechmqszbypFspaSk+t2jQXAEU7YClHF6Qjw5eYOmy1//zFi9/GA==
dependencies:
"@walletconnect/window-getters" "^1.0.0"
"@webassemblyjs/ast@1.9.0":
version "1.9.0"
resolved "https://registry.npmmirror.com/@webassemblyjs/ast/-/ast-1.9.0.tgz#bd850604b4042459a5a41cd7d338cbed695ed964"
@ -1747,6 +1878,11 @@ bn.js@4.11.6:
resolved "https://registry.npmmirror.com/bn.js/-/bn.js-4.11.6.tgz#53344adb14617a13f6e8dd2ce28905d1c0ba3215"
integrity sha512-XWwnNNFCuuSQ0m3r3C4LE3EiORltHd9M05pq6FOlVeiophzRbMo50Sbz1ehl8K3Z+jw9+vmgnXefY1hz8X+2wA==
bn.js@4.11.8:
version "4.11.8"
resolved "https://registry.npmmirror.com/bn.js/-/bn.js-4.11.8.tgz#2cde09eb5ee341f484746bb0309b3253b1b1442f"
integrity sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA==
bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.11.0, bn.js@^4.11.6, bn.js@^4.11.8, bn.js@^4.11.9:
version "4.12.0"
resolved "https://registry.npmmirror.com/bn.js/-/bn.js-4.12.0.tgz#775b3f278efbb9718eec7361f483fb36fbbfea88"
@ -2500,6 +2636,11 @@ destroy@1.2.0:
resolved "https://registry.npmmirror.com/destroy/-/destroy-1.2.0.tgz#4803735509ad8be552934c67df614f94e66fa015"
integrity sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==
detect-browser@5.2.0:
version "5.2.0"
resolved "https://registry.npmmirror.com/detect-browser/-/detect-browser-5.2.0.tgz#c9cd5afa96a6a19fda0bbe9e9be48a6b6e1e9c97"
integrity sha512-tr7XntDAu50BVENgQfajMLzacmSe34D+qZc4zjnniz0ZVuw/TZcLcyxHQjYpJTM36sGEkZZlYLnIM1hH7alTMA==
diffie-hellman@^5.0.0:
version "5.0.3"
resolved "https://registry.npmmirror.com/diffie-hellman/-/diffie-hellman-5.0.3.tgz#40e8ee98f55a2149607146921c63e1ae5f3d2875"
@ -3835,7 +3976,7 @@ is-typed-array@^1.1.3, is-typed-array@^1.1.9:
for-each "^0.3.3"
has-tostringtag "^1.0.0"
is-typedarray@^1.0.0, is-typedarray@~1.0.0:
is-typedarray@1.0.0, is-typedarray@^1.0.0, is-typedarray@~1.0.0:
version "1.0.0"
resolved "https://registry.npmmirror.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a"
integrity sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA==
@ -3999,6 +4140,11 @@ keyv@^3.0.0:
dependencies:
json-buffer "3.0.0"
keyvaluestorage-interface@^1.0.0:
version "1.0.0"
resolved "https://registry.npmmirror.com/keyvaluestorage-interface/-/keyvaluestorage-interface-1.0.0.tgz#13ebdf71f5284ad54be94bd1ad9ed79adad515ff"
integrity sha512-8t6Q3TclQ4uZynJY9IGr2+SsIGwK9JHcO6ootkHCGA0CrQCRy+VkouYNO2xicET6b9al7QKzpebNow+gkpCL8g==
kind-of@^3.0.2, kind-of@^3.0.3, kind-of@^3.2.0:
version "3.2.2"
resolved "https://registry.npmmirror.com/kind-of/-/kind-of-3.2.2.tgz#31ea21a734bab9bbb0f32466d893aea51e4a3c64"
@ -4915,6 +5061,15 @@ qs@~6.5.2:
resolved "https://registry.npmmirror.com/qs/-/qs-6.5.3.tgz#3aeeffc91967ef6e35c0e488ef46fb296ab76aad"
integrity sha512-qxXIEh4pCGfHICj1mAJQ2/2XVZkjCDTcEgfoSQxc/fYivUZxTkk7L3bDBJSoNrEzXI17oUO5Dp07ktqE5KzczA==
query-string@6.13.5:
version "6.13.5"
resolved "https://registry.npmmirror.com/query-string/-/query-string-6.13.5.tgz#99e95e2fb7021db90a6f373f990c0c814b3812d8"
integrity sha512-svk3xg9qHR39P3JlHuD7g3nRnyay5mHbrPctEBDUxUkHRifPHXJDhBUycdCC0NBjXoDf44Gb+IsOZL1Uwn8M/Q==
dependencies:
decode-uri-component "^0.2.0"
split-on-first "^1.0.0"
strict-uri-encode "^2.0.0"
query-string@^5.0.1:
version "5.1.1"
resolved "https://registry.npmmirror.com/query-string/-/query-string-5.1.1.tgz#a78c012b71c17e05f2e3fa2319dd330682efb3cb"
@ -5461,6 +5616,11 @@ source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.1:
resolved "https://registry.npmmirror.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263"
integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==
split-on-first@^1.0.0:
version "1.1.0"
resolved "https://registry.npmmirror.com/split-on-first/-/split-on-first-1.1.0.tgz#f610afeee3b12bce1d0c30425e76398b78249a5f"
integrity sha512-43ZssAJaMusuKWL8sKUBQXHWOpq8d6CfN/u1p4gUzfJkM05C8rxTmYrkIPTXapZpORA6LkkzcUulJ8FqA7Uudw==
split-string@^3.0.1, split-string@^3.0.2:
version "3.1.0"
resolved "https://registry.npmmirror.com/split-string/-/split-string-3.1.0.tgz#7cb09dda3a86585705c64b39a6466038682e8fe2"
@ -5558,6 +5718,11 @@ strict-uri-encode@^1.0.0:
resolved "https://registry.npmmirror.com/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz#279b225df1d582b1f54e65addd4352e18faa0713"
integrity sha512-R3f198pcvnB+5IpnBlRkphuE9n46WyVl8I39W/ZUTZLz4nqSP/oLYUrcnJrw462Ds8he4YKMov2efsTIw1BDGQ==
strict-uri-encode@^2.0.0:
version "2.0.0"
resolved "https://registry.npmmirror.com/strict-uri-encode/-/strict-uri-encode-2.0.0.tgz#b9c7330c7042862f6b142dc274bbcc5866ce3546"
integrity sha512-QwiXZgpRcKkhTj2Scnn++4PKtWsH0kpzZ62L2R6c/LUVYv7hVnZqcg2+sMuT6R7Jusu1vviK/MFsu6kNJfWlEQ==
string.prototype.trimend@^1.0.5:
version "1.0.5"
resolved "https://registry.npmmirror.com/string.prototype.trimend/-/string.prototype.trimend-1.0.5.tgz#914a65baaab25fbdd4ee291ca7dde57e869cb8d0"
@ -5818,7 +5983,7 @@ type@^2.5.0:
resolved "https://registry.npmmirror.com/type/-/type-2.6.0.tgz#3ca6099af5981d36ca86b78442973694278a219f"
integrity sha512-eiDBDOmkih5pMbo9OqsqPRGMljLodLcwd5XD5JbtNB0o89xZAwynY9EdCDsJU7LtcVCClu9DvM7/0Ep1hYX3EQ==
typedarray-to-buffer@^3.1.5:
typedarray-to-buffer@3.1.5, typedarray-to-buffer@^3.1.5:
version "3.1.5"
resolved "https://registry.npmmirror.com/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz#a97ee7a9ff42691b9f783ff1bc5112fe3fca9080"
integrity sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==
@ -6444,6 +6609,11 @@ wrappy@1:
resolved "https://registry.npmmirror.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"
integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==
ws@7.5.3:
version "7.5.3"
resolved "https://registry.npmmirror.com/ws/-/ws-7.5.3.tgz#160835b63c7d97bfab418fc1b8a9fced2ac01a74"
integrity sha512-kQ/dHIzuLrS6Je9+uv81ueZomEwH0qVYstcAQ4/Z93K8zeko9gtAbttJWzoC5ukqXY1PpoouV3+VSOqEAFt5wg==
ws@^3.0.0:
version "3.3.3"
resolved "https://registry.npmmirror.com/ws/-/ws-3.3.3.tgz#f1cf84fe2d5e901ebce94efaece785f187a228f2"