@web3auth/no-modal 10.0.0-alpha.2 → 10.0.0-beta.0
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/lib.cjs/base/chain/config.js +2 -1
- package/dist/lib.cjs/base/connector/constants.js +5 -0
- package/dist/lib.cjs/base/utils.js +3 -2
- package/dist/lib.cjs/base/wallet/index.js +2 -1
- package/dist/lib.cjs/connectors/auth-connector/authConnector.js +67 -19
- package/dist/lib.cjs/connectors/injected-solana-connector/walletStandardConnector.js +0 -1
- package/dist/lib.cjs/connectors/metamask-connector/metamaskConnector.js +197 -0
- package/dist/lib.cjs/connectors/utils.js +61 -0
- package/dist/lib.cjs/connectors/wallet-connect-v2-connector/WalletConnectV2Provider.js +0 -1
- package/dist/lib.cjs/connectors/wallet-connect-v2-connector/config.js +3 -58
- package/dist/lib.cjs/connectors/wallet-connect-v2-connector/walletConnectV2Connector.js +6 -16
- package/dist/lib.cjs/index.js +1 -2
- package/dist/lib.cjs/noModal.js +119 -29
- package/dist/lib.cjs/plugins/wallet-services-plugin/plugin.js +1 -1
- package/dist/lib.cjs/providers/account-abstraction-provider/providers/AccountAbstractionProvider.js +18 -12
- package/dist/lib.cjs/providers/solana-provider/rpc/solanaRpcMiddlewares.js +1 -1
- package/dist/lib.cjs/types/base/chain/IChainInterface.d.ts +3 -45
- package/dist/lib.cjs/types/base/connector/constants.d.ts +4 -0
- package/dist/lib.cjs/types/base/connector/interfaces.d.ts +7 -3
- package/dist/lib.cjs/types/base/core/IWeb3Auth.d.ts +10 -4
- package/dist/lib.cjs/types/base/interfaces.d.ts +66 -9
- package/dist/lib.cjs/types/base/utils.d.ts +2 -2
- package/dist/lib.cjs/types/base/wallet/index.d.ts +2 -0
- package/dist/lib.cjs/types/connectors/auth-connector/authConnector.d.ts +5 -2
- package/dist/lib.cjs/types/connectors/auth-connector/interface.d.ts +4 -2
- package/dist/lib.cjs/types/connectors/metamask-connector/index.d.ts +1 -0
- package/dist/lib.cjs/types/connectors/metamask-connector/metamaskConnector.d.ts +6 -0
- package/dist/lib.cjs/types/connectors/utils.d.ts +8 -0
- package/dist/lib.cjs/types/noModal.d.ts +5 -3
- package/dist/lib.cjs/types/providers/account-abstraction-provider/providers/AccountAbstractionProvider.d.ts +4 -5
- package/dist/lib.cjs/types/providers/solana-provider/providers/index.d.ts +0 -1
- package/dist/lib.esm/base/chain/config.js +2 -1
- package/dist/lib.esm/base/connector/constants.js +5 -1
- package/dist/lib.esm/base/utils.js +3 -2
- package/dist/lib.esm/base/wallet/index.js +2 -1
- package/dist/lib.esm/connectors/auth-connector/authConnector.js +67 -19
- package/dist/lib.esm/connectors/injected-solana-connector/walletStandardConnector.js +0 -1
- package/dist/lib.esm/connectors/metamask-connector/metamaskConnector.js +195 -0
- package/dist/lib.esm/connectors/utils.js +58 -0
- package/dist/lib.esm/connectors/wallet-connect-v2-connector/WalletConnectV2Provider.js +1 -2
- package/dist/lib.esm/connectors/wallet-connect-v2-connector/config.js +1 -56
- package/dist/lib.esm/connectors/wallet-connect-v2-connector/walletConnectV2Connector.js +6 -16
- package/dist/lib.esm/connectors/wallet-connect-v2-connector/walletConnectV2Utils.js +1 -1
- package/dist/lib.esm/index.js +1 -2
- package/dist/lib.esm/noModal.js +121 -31
- package/dist/lib.esm/plugins/wallet-services-plugin/plugin.js +1 -1
- package/dist/lib.esm/providers/account-abstraction-provider/providers/AccountAbstractionProvider.js +18 -12
- package/dist/lib.esm/providers/solana-provider/rpc/solanaRpcMiddlewares.js +1 -1
- package/dist/noModal.umd.min.js +1 -1
- package/package.json +5 -4
- package/dist/lib.cjs/connectors/auth-connector/config/authConnectionConfig.js +0 -216
- package/dist/lib.cjs/connectors/auth-connector/config/config-build.js +0 -54
- package/dist/lib.cjs/connectors/auth-connector/config/config-env.js +0 -361
- package/dist/lib.cjs/providers/solana-provider/providers/privateKeyProvider/solanaPrivateKeyProvider.js +0 -161
- package/dist/lib.cjs/providers/solana-provider/providers/privateKeyProvider/solanaPrivateKeyUtils.js +0 -104
- package/dist/lib.cjs/types/connectors/auth-connector/config/authConnectionConfig.d.ts +0 -2
- package/dist/lib.cjs/types/connectors/auth-connector/config/config-build.d.ts +0 -18
- package/dist/lib.cjs/types/connectors/auth-connector/config/config-env.d.ts +0 -60
- package/dist/lib.cjs/types/providers/solana-provider/providers/privateKeyProvider/index.d.ts +0 -1
- package/dist/lib.cjs/types/providers/solana-provider/providers/privateKeyProvider/solanaPrivateKeyProvider.d.ts +0 -30
- package/dist/lib.cjs/types/providers/solana-provider/providers/privateKeyProvider/solanaPrivateKeyUtils.d.ts +0 -7
- package/dist/lib.esm/connectors/auth-connector/config/authConnectionConfig.js +0 -214
- package/dist/lib.esm/connectors/auth-connector/config/config-build.js +0 -48
- package/dist/lib.esm/connectors/auth-connector/config/config-env.js +0 -359
- package/dist/lib.esm/providers/solana-provider/providers/privateKeyProvider/solanaPrivateKeyProvider.js +0 -159
- package/dist/lib.esm/providers/solana-provider/providers/privateKeyProvider/solanaPrivateKeyUtils.js +0 -102
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
4
|
-
var auth = require('@web3auth/auth');
|
|
5
|
-
var index = require('../../../../base/errors/index.js');
|
|
6
|
-
var baseControllers = require('@toruslabs/base-controllers');
|
|
7
|
-
require('../../../../base/wallet/index.js');
|
|
8
|
-
require('../../../../base/connector/constants.js');
|
|
9
|
-
require('jwt-decode');
|
|
10
|
-
require('../../../../base/loglevel.js');
|
|
11
|
-
require('../../../../base/plugin/errors.js');
|
|
12
|
-
require('../../../../base/plugin/IPlugin.js');
|
|
13
|
-
require('@toruslabs/constants');
|
|
14
|
-
require('@toruslabs/http-helpers');
|
|
15
|
-
var baseProvider = require('../../../base-provider/baseProvider.js');
|
|
16
|
-
require('../../../base-provider/CommonJRPCProvider.js');
|
|
17
|
-
require('../../../base-provider/commonPrivateKeyProvider.js');
|
|
18
|
-
require('../../../base-provider/utils.js');
|
|
19
|
-
var JrpcClient = require('../../rpc/JrpcClient.js');
|
|
20
|
-
var solanaRpcMiddlewares = require('../../rpc/solanaRpcMiddlewares.js');
|
|
21
|
-
var solanaPrivateKeyUtils = require('./solanaPrivateKeyUtils.js');
|
|
22
|
-
|
|
23
|
-
var _SolanaPrivateKeyProvider;
|
|
24
|
-
class SolanaPrivateKeyProvider extends baseProvider.BaseProvider {
|
|
25
|
-
constructor({
|
|
26
|
-
config,
|
|
27
|
-
state
|
|
28
|
-
}) {
|
|
29
|
-
super({
|
|
30
|
-
config,
|
|
31
|
-
state
|
|
32
|
-
});
|
|
33
|
-
_defineProperty(this, "PROVIDER_CHAIN_NAMESPACE", baseControllers.CHAIN_NAMESPACES.SOLANA);
|
|
34
|
-
}
|
|
35
|
-
async enable() {
|
|
36
|
-
if (!this.state.privateKey) throw auth.providerErrors.custom({
|
|
37
|
-
message: "Private key is not found in state, plz pass it in constructor state param",
|
|
38
|
-
code: 4902
|
|
39
|
-
});
|
|
40
|
-
await this.setupProvider(this.state.privateKey, this.chainId);
|
|
41
|
-
return this._providerEngineProxy.request({
|
|
42
|
-
method: "eth_accounts"
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
getEd25519Key(privateKey) {
|
|
46
|
-
return auth.getED25519Key(privateKey).sk.toString("hex").padStart(128, "0");
|
|
47
|
-
}
|
|
48
|
-
async setupProvider(privKey, chainId) {
|
|
49
|
-
const chain = this.getChain(chainId);
|
|
50
|
-
const {
|
|
51
|
-
chainNamespace
|
|
52
|
-
} = chain;
|
|
53
|
-
if (chainNamespace !== this.PROVIDER_CHAIN_NAMESPACE) throw index.WalletInitializationError.incompatibleChainNameSpace("Invalid chain namespace");
|
|
54
|
-
const providerHandlers = await solanaPrivateKeyUtils.getProviderHandlers({
|
|
55
|
-
privKey,
|
|
56
|
-
getProviderEngineProxy: this.getProviderEngineProxy.bind(this),
|
|
57
|
-
keyExportEnabled: this.config.keyExportEnabled
|
|
58
|
-
});
|
|
59
|
-
const solanaMiddleware = solanaRpcMiddlewares.createSolanaMiddleware(providerHandlers);
|
|
60
|
-
const engine = new auth.JRPCEngine();
|
|
61
|
-
const {
|
|
62
|
-
networkMiddleware
|
|
63
|
-
} = JrpcClient.createSolanaJsonRpcClient(chain);
|
|
64
|
-
engine.push(this.getChainSwitchMiddleware());
|
|
65
|
-
engine.push(this.getAccountMiddleware());
|
|
66
|
-
engine.push(solanaMiddleware);
|
|
67
|
-
engine.push(networkMiddleware);
|
|
68
|
-
const provider = auth.providerFromEngine(engine);
|
|
69
|
-
this.updateProviderEngineProxy(provider);
|
|
70
|
-
await this.lookupNetwork(chainId);
|
|
71
|
-
this.emit("chainChanged", chainId);
|
|
72
|
-
this.emit("connect", {
|
|
73
|
-
chainId
|
|
74
|
-
});
|
|
75
|
-
this.update({
|
|
76
|
-
chainId
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
async updateAccount(params) {
|
|
80
|
-
if (!this._providerEngineProxy) throw auth.providerErrors.custom({
|
|
81
|
-
message: "Provider is not initialized",
|
|
82
|
-
code: 4902
|
|
83
|
-
});
|
|
84
|
-
const existingKey = await this._providerEngineProxy.request({
|
|
85
|
-
method: "solanaPrivateKey"
|
|
86
|
-
});
|
|
87
|
-
if (existingKey !== params.privateKey) {
|
|
88
|
-
await this.setupProvider(params.privateKey, this.chainId);
|
|
89
|
-
const accounts = await this._providerEngineProxy.request({
|
|
90
|
-
method: "requestAccounts"
|
|
91
|
-
});
|
|
92
|
-
this.emit("accountsChanged", accounts);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
async switchChain(params) {
|
|
96
|
-
if (!this._providerEngineProxy) throw auth.providerErrors.custom({
|
|
97
|
-
message: "Provider is not initialized",
|
|
98
|
-
code: 4902
|
|
99
|
-
});
|
|
100
|
-
const newChainId = params.chainId;
|
|
101
|
-
if (this.chainId === newChainId) return;
|
|
102
|
-
this.update({
|
|
103
|
-
chainId: "loading"
|
|
104
|
-
});
|
|
105
|
-
const privKey = await this._providerEngineProxy.request({
|
|
106
|
-
method: "solanaPrivateKey"
|
|
107
|
-
});
|
|
108
|
-
await this.setupProvider(privKey, newChainId);
|
|
109
|
-
}
|
|
110
|
-
async lookupNetwork(chainId) {
|
|
111
|
-
if (!this._providerEngineProxy) throw auth.providerErrors.custom({
|
|
112
|
-
message: "Provider is not initialized",
|
|
113
|
-
code: 4902
|
|
114
|
-
});
|
|
115
|
-
const health = await this._providerEngineProxy.request({
|
|
116
|
-
method: "getHealth",
|
|
117
|
-
params: []
|
|
118
|
-
});
|
|
119
|
-
const chain = this.getChain(chainId);
|
|
120
|
-
if (health !== "ok") throw index.WalletInitializationError.rpcConnectionError(`Failed to lookup network for following rpc target: ${chain.rpcTarget}`);
|
|
121
|
-
}
|
|
122
|
-
getChainSwitchMiddleware() {
|
|
123
|
-
const chainSwitchHandlers = {
|
|
124
|
-
switchSolanaChain: async req => {
|
|
125
|
-
if (!req.params) throw auth.rpcErrors.invalidParams("Missing request params");
|
|
126
|
-
if (!req.params.chainId) throw auth.rpcErrors.invalidParams("Missing chainId");
|
|
127
|
-
await this.switchChain(req.params);
|
|
128
|
-
}
|
|
129
|
-
};
|
|
130
|
-
const chainSwitchMiddleware = solanaRpcMiddlewares.createSolanaChainSwitchMiddleware(chainSwitchHandlers);
|
|
131
|
-
return chainSwitchMiddleware;
|
|
132
|
-
}
|
|
133
|
-
getAccountMiddleware() {
|
|
134
|
-
const accountHandlers = {
|
|
135
|
-
updatePrivatekey: async req => {
|
|
136
|
-
if (!req.params) throw auth.rpcErrors.invalidParams("Missing request params");
|
|
137
|
-
if (!req.params.privateKey) throw auth.rpcErrors.invalidParams("Missing privateKey");
|
|
138
|
-
const {
|
|
139
|
-
privateKey
|
|
140
|
-
} = req.params;
|
|
141
|
-
await this.updateAccount({
|
|
142
|
-
privateKey
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
};
|
|
146
|
-
return solanaRpcMiddlewares.createSolanaAccountMiddleware(accountHandlers);
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
_SolanaPrivateKeyProvider = SolanaPrivateKeyProvider;
|
|
150
|
-
_defineProperty(SolanaPrivateKeyProvider, "getProviderInstance", async params => {
|
|
151
|
-
const providerFactory = new _SolanaPrivateKeyProvider({
|
|
152
|
-
config: {
|
|
153
|
-
chain: params.chain,
|
|
154
|
-
chains: params.chains
|
|
155
|
-
}
|
|
156
|
-
});
|
|
157
|
-
await providerFactory.setupProvider(params.privKey, params.chain.chainId);
|
|
158
|
-
return providerFactory;
|
|
159
|
-
});
|
|
160
|
-
|
|
161
|
-
exports.SolanaPrivateKeyProvider = SolanaPrivateKeyProvider;
|
package/dist/lib.cjs/providers/solana-provider/providers/privateKeyProvider/solanaPrivateKeyUtils.js
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var web3_js = require('@solana/web3.js');
|
|
4
|
-
var bs58 = require('@toruslabs/bs58');
|
|
5
|
-
var tweetnaclJs = require('@toruslabs/tweetnacl-js');
|
|
6
|
-
var auth = require('@web3auth/auth');
|
|
7
|
-
var index = require('../../../../base/errors/index.js');
|
|
8
|
-
require('@toruslabs/base-controllers');
|
|
9
|
-
require('@babel/runtime/helpers/defineProperty');
|
|
10
|
-
require('../../../../base/wallet/index.js');
|
|
11
|
-
require('../../../../base/connector/constants.js');
|
|
12
|
-
require('jwt-decode');
|
|
13
|
-
require('../../../../base/loglevel.js');
|
|
14
|
-
require('../../../../base/plugin/errors.js');
|
|
15
|
-
require('../../../../base/plugin/IPlugin.js');
|
|
16
|
-
require('@toruslabs/constants');
|
|
17
|
-
require('@toruslabs/http-helpers');
|
|
18
|
-
|
|
19
|
-
async function getProviderHandlers({
|
|
20
|
-
privKey,
|
|
21
|
-
keyExportEnabled,
|
|
22
|
-
getProviderEngineProxy
|
|
23
|
-
}) {
|
|
24
|
-
const keyPairGenerator = () => {
|
|
25
|
-
return web3_js.Keypair.fromSecretKey(Buffer.from(privKey, "hex"));
|
|
26
|
-
};
|
|
27
|
-
if (typeof privKey !== "string") throw index.WalletInitializationError.invalidParams("privKey must be a string");
|
|
28
|
-
const keyPair = keyPairGenerator();
|
|
29
|
-
const providerHandlers = {
|
|
30
|
-
requestAccounts: async () => {
|
|
31
|
-
return [keyPair.publicKey.toBase58()];
|
|
32
|
-
},
|
|
33
|
-
getAccounts: async () => [keyPair.publicKey.toBase58()],
|
|
34
|
-
getPublicKey: async () => keyPair.publicKey.toBase58(),
|
|
35
|
-
getPrivateKey: async () => {
|
|
36
|
-
if (!keyExportEnabled) {
|
|
37
|
-
throw auth.providerErrors.custom({
|
|
38
|
-
message: "Private key export is disabled",
|
|
39
|
-
code: 4902
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
return privKey;
|
|
43
|
-
},
|
|
44
|
-
getSecretKey: async () => bs58.bs58.encode(keyPair.secretKey),
|
|
45
|
-
signTransaction: async req => {
|
|
46
|
-
var _req$params;
|
|
47
|
-
if (!((_req$params = req.params) !== null && _req$params !== void 0 && _req$params.message)) {
|
|
48
|
-
throw auth.rpcErrors.invalidParams("message");
|
|
49
|
-
}
|
|
50
|
-
const serializedTransaction = req.params.message;
|
|
51
|
-
const transaction = web3_js.VersionedTransaction.deserialize(Buffer.from(serializedTransaction, "base64"));
|
|
52
|
-
transaction.sign([keyPair]);
|
|
53
|
-
return bs58.bs58.encode(transaction.signatures[0]);
|
|
54
|
-
},
|
|
55
|
-
signMessage: async req => {
|
|
56
|
-
var _req$params2;
|
|
57
|
-
if (!((_req$params2 = req.params) !== null && _req$params2 !== void 0 && _req$params2.data)) {
|
|
58
|
-
throw auth.rpcErrors.invalidParams("data");
|
|
59
|
-
}
|
|
60
|
-
const signedMsg = tweetnaclJs.sign.detached(Buffer.from(req.params.data, "utf-8"), keyPair.secretKey);
|
|
61
|
-
return bs58.bs58.encode(signedMsg);
|
|
62
|
-
},
|
|
63
|
-
signAndSendTransaction: async req => {
|
|
64
|
-
var _req$params3;
|
|
65
|
-
if (!((_req$params3 = req.params) !== null && _req$params3 !== void 0 && _req$params3.message)) {
|
|
66
|
-
throw auth.rpcErrors.invalidParams("message");
|
|
67
|
-
}
|
|
68
|
-
const _providerEngineProxy = getProviderEngineProxy();
|
|
69
|
-
if (!_providerEngineProxy) throw auth.providerErrors.custom({
|
|
70
|
-
message: "Provider is not initialized",
|
|
71
|
-
code: 4902
|
|
72
|
-
});
|
|
73
|
-
const serializedTransaction = req.params.message;
|
|
74
|
-
const transaction = web3_js.VersionedTransaction.deserialize(Buffer.from(serializedTransaction, "base64"));
|
|
75
|
-
transaction.sign([keyPair]);
|
|
76
|
-
const sig = await _providerEngineProxy.request({
|
|
77
|
-
method: "sendTransaction",
|
|
78
|
-
params: [Buffer.from(transaction.serialize()).toString("base64"), {
|
|
79
|
-
encoding: "base64",
|
|
80
|
-
preflightCommitment: "confirmed"
|
|
81
|
-
}]
|
|
82
|
-
});
|
|
83
|
-
return sig;
|
|
84
|
-
},
|
|
85
|
-
signAllTransactions: async req => {
|
|
86
|
-
var _req$params4, _req$params5, _req$params6;
|
|
87
|
-
if (!((_req$params4 = req.params) !== null && _req$params4 !== void 0 && _req$params4.message) || !((_req$params5 = req.params) !== null && _req$params5 !== void 0 && _req$params5.message.length)) {
|
|
88
|
-
throw auth.rpcErrors.invalidParams("message");
|
|
89
|
-
}
|
|
90
|
-
const txns = (_req$params6 = req.params) === null || _req$params6 === void 0 ? void 0 : _req$params6.message;
|
|
91
|
-
const res = [];
|
|
92
|
-
for (const tx of txns || []) {
|
|
93
|
-
const serializedTransaction = tx;
|
|
94
|
-
const transaction = web3_js.VersionedTransaction.deserialize(Buffer.from(serializedTransaction, "base64"));
|
|
95
|
-
transaction.sign([keyPair]);
|
|
96
|
-
res.push(Buffer.from(transaction.serialize()).toString("base64"));
|
|
97
|
-
}
|
|
98
|
-
return res;
|
|
99
|
-
}
|
|
100
|
-
};
|
|
101
|
-
return providerHandlers;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
exports.getProviderHandlers = getProviderHandlers;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { BUILD_ENV_TYPE } from "@web3auth/auth";
|
|
2
|
-
import { LogLevelDesc } from "loglevel";
|
|
3
|
-
export declare const PASSWORDLESS_SERVER_API_URL = "https://api.web3auth.io/passwordless-service";
|
|
4
|
-
export declare const PASSWORDLESS_SERVER_SOCKET_URL = "https://api-passwordless.web3auth.io";
|
|
5
|
-
export declare const DEVELOP_PASSWORDLESS_SERVER_API_URL = "https://api-develop.web3auth.io/passwordless-service";
|
|
6
|
-
export declare const DEVELOP_PASSWORDLESS_SERVER_SOCKET_URL = "https://api-develop-passwordless.web3auth.io";
|
|
7
|
-
export declare const AUTH_SERVER_URL = "https://api.web3auth.io/auth-service";
|
|
8
|
-
export declare const DEVELOP_AUTH_SERVER_URL = "https://api-develop.web3auth.io/auth-service";
|
|
9
|
-
export interface ConfigBuild {
|
|
10
|
-
apiHost: string;
|
|
11
|
-
passwordlessBackendHost: string;
|
|
12
|
-
passwordlessHost: string;
|
|
13
|
-
sentrySampleRate: string;
|
|
14
|
-
sentryTransactionSampleRate: string;
|
|
15
|
-
supportsVersioning: boolean;
|
|
16
|
-
logLevel: LogLevelDesc;
|
|
17
|
-
}
|
|
18
|
-
export declare const configBuild: Record<BUILD_ENV_TYPE, ConfigBuild>;
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { WEB3AUTH_NETWORK_TYPE } from "@web3auth/auth";
|
|
2
|
-
export interface ConfigEnv {
|
|
3
|
-
googleClientId: string;
|
|
4
|
-
appleClientId: string;
|
|
5
|
-
discordClientId: string;
|
|
6
|
-
facebookClientId: string;
|
|
7
|
-
githubClientId: string;
|
|
8
|
-
kakaoClientId: string;
|
|
9
|
-
lineClientId: string;
|
|
10
|
-
linkedinClientId: string;
|
|
11
|
-
redditClientId: string;
|
|
12
|
-
twitchClientId: string;
|
|
13
|
-
twitterClientId: string;
|
|
14
|
-
weiboClientId: string;
|
|
15
|
-
wechatClientId: string;
|
|
16
|
-
hostedEmailPasswordlessClientId: string;
|
|
17
|
-
hostedSmsPasswordlessClientId: string;
|
|
18
|
-
hostedFarcasterClientId?: string;
|
|
19
|
-
passkeysClientId: string;
|
|
20
|
-
authenticatorClientId: string;
|
|
21
|
-
googleVerifier: string;
|
|
22
|
-
appleVerifier: string;
|
|
23
|
-
discordVerifier: string;
|
|
24
|
-
facebookVerifier: string;
|
|
25
|
-
githubVerifier: string;
|
|
26
|
-
kakaoVerifier: string;
|
|
27
|
-
lineVerifier: string;
|
|
28
|
-
linkedinVerifier: string;
|
|
29
|
-
redditVerifier: string;
|
|
30
|
-
twitchVerifier: string;
|
|
31
|
-
twitterVerifier: string;
|
|
32
|
-
weiboVerifier: string;
|
|
33
|
-
wechatVerifier: string;
|
|
34
|
-
hostedEmailPasswordlessVerifier: string;
|
|
35
|
-
hostedSmsPasswordlessVerifier: string;
|
|
36
|
-
passkeysVerifier: string;
|
|
37
|
-
authenticatorVerifier: string;
|
|
38
|
-
hostedFarcasterVerifier?: string;
|
|
39
|
-
walletGoogleVerifier?: string;
|
|
40
|
-
walletAppleVerifier?: string;
|
|
41
|
-
walletDiscordVerifier?: string;
|
|
42
|
-
walletFacebookVerifier?: string;
|
|
43
|
-
walletGithubVerifier?: string;
|
|
44
|
-
walletKakaoVerifier?: string;
|
|
45
|
-
walletLineVerifier?: string;
|
|
46
|
-
walletLinkedinVerifier?: string;
|
|
47
|
-
walletRedditVerifier?: string;
|
|
48
|
-
walletTwitchVerifier?: string;
|
|
49
|
-
walletTwitterVerifier?: string;
|
|
50
|
-
walletWeiboVerifier?: string;
|
|
51
|
-
walletWechatVerifier?: string;
|
|
52
|
-
walletHostedEmailPasswordlessVerifier?: string;
|
|
53
|
-
walletHostedSmsPasswordlessVerifier?: string;
|
|
54
|
-
loginDomain: string;
|
|
55
|
-
farcasterLoginDomain?: string;
|
|
56
|
-
verifierSubIdentifier: string;
|
|
57
|
-
signerHost: string;
|
|
58
|
-
metadataHost: string;
|
|
59
|
-
}
|
|
60
|
-
export declare const configEnv: Record<WEB3AUTH_NETWORK_TYPE, ConfigEnv>;
|
package/dist/lib.cjs/types/providers/solana-provider/providers/privateKeyProvider/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./solanaPrivateKeyProvider";
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { CustomChainConfig } from "../../../../base";
|
|
2
|
-
import { BaseProvider, BaseProviderConfig, BaseProviderState } from "../../../base-provider";
|
|
3
|
-
export type SolanaPrivKeyProviderConfig = BaseProviderConfig;
|
|
4
|
-
export interface SolanaPrivKeyProviderState extends BaseProviderState {
|
|
5
|
-
privateKey?: string;
|
|
6
|
-
}
|
|
7
|
-
export declare class SolanaPrivateKeyProvider extends BaseProvider<BaseProviderConfig, SolanaPrivKeyProviderState, string> {
|
|
8
|
-
readonly PROVIDER_CHAIN_NAMESPACE: "solana";
|
|
9
|
-
constructor({ config, state }: {
|
|
10
|
-
config: SolanaPrivKeyProviderConfig;
|
|
11
|
-
state?: BaseProviderState;
|
|
12
|
-
});
|
|
13
|
-
static getProviderInstance: (params: {
|
|
14
|
-
privKey: string;
|
|
15
|
-
chain: CustomChainConfig;
|
|
16
|
-
chains: CustomChainConfig[];
|
|
17
|
-
}) => Promise<SolanaPrivateKeyProvider>;
|
|
18
|
-
enable(): Promise<string[]>;
|
|
19
|
-
getEd25519Key(privateKey: string): string;
|
|
20
|
-
setupProvider(privKey: string, chainId: string): Promise<void>;
|
|
21
|
-
updateAccount(params: {
|
|
22
|
-
privateKey: string;
|
|
23
|
-
}): Promise<void>;
|
|
24
|
-
switchChain(params: {
|
|
25
|
-
chainId: string;
|
|
26
|
-
}): Promise<void>;
|
|
27
|
-
protected lookupNetwork(chainId: string): Promise<void>;
|
|
28
|
-
private getChainSwitchMiddleware;
|
|
29
|
-
private getAccountMiddleware;
|
|
30
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { SafeEventEmitterProvider } from "../../../../base";
|
|
2
|
-
import { ISolanaProviderHandlers } from "../../rpc";
|
|
3
|
-
export declare function getProviderHandlers({ privKey, keyExportEnabled, getProviderEngineProxy, }: {
|
|
4
|
-
privKey: string;
|
|
5
|
-
keyExportEnabled: boolean;
|
|
6
|
-
getProviderEngineProxy: () => SafeEventEmitterProvider | null;
|
|
7
|
-
}): Promise<ISolanaProviderHandlers>;
|
|
@@ -1,214 +0,0 @@
|
|
|
1
|
-
import { AUTH_CONNECTION, EMAIL_FLOW } from '@web3auth/auth';
|
|
2
|
-
import { configBuild } from './config-build.js';
|
|
3
|
-
import { configEnv } from './config-env.js';
|
|
4
|
-
|
|
5
|
-
const getAuthConnectionConfig = (environment, network) => {
|
|
6
|
-
const currentConfigEnv = configEnv[network];
|
|
7
|
-
const currentBuildEnv = configBuild[environment];
|
|
8
|
-
if (!currentConfigEnv || !currentBuildEnv) {
|
|
9
|
-
throw new Error("Invalid environment settings");
|
|
10
|
-
}
|
|
11
|
-
return [{
|
|
12
|
-
authConnectionId: currentConfigEnv.verifierSubIdentifier || currentConfigEnv.googleVerifier,
|
|
13
|
-
authConnection: AUTH_CONNECTION.GOOGLE,
|
|
14
|
-
name: AUTH_CONNECTION.GOOGLE,
|
|
15
|
-
description: "login.verifier-google-desc",
|
|
16
|
-
clientId: currentConfigEnv.googleClientId,
|
|
17
|
-
groupedAuthConnectionId: currentConfigEnv.verifierSubIdentifier ? currentConfigEnv.googleVerifier : "",
|
|
18
|
-
mainOption: true,
|
|
19
|
-
// For torus only
|
|
20
|
-
walletAuthConnectionId: currentConfigEnv.walletGoogleVerifier
|
|
21
|
-
}, {
|
|
22
|
-
authConnectionId: currentConfigEnv.verifierSubIdentifier || currentConfigEnv.facebookVerifier,
|
|
23
|
-
authConnection: AUTH_CONNECTION.FACEBOOK,
|
|
24
|
-
name: AUTH_CONNECTION.FACEBOOK,
|
|
25
|
-
description: "",
|
|
26
|
-
clientId: currentConfigEnv.facebookClientId,
|
|
27
|
-
groupedAuthConnectionId: currentConfigEnv.verifierSubIdentifier ? currentConfigEnv.facebookVerifier : "",
|
|
28
|
-
mainOption: true,
|
|
29
|
-
// For torus only
|
|
30
|
-
walletAuthConnectionId: currentConfigEnv.walletFacebookVerifier
|
|
31
|
-
}, {
|
|
32
|
-
authConnectionId: currentConfigEnv.verifierSubIdentifier || currentConfigEnv.twitterVerifier,
|
|
33
|
-
authConnection: AUTH_CONNECTION.TWITTER,
|
|
34
|
-
name: AUTH_CONNECTION.TWITTER,
|
|
35
|
-
description: "",
|
|
36
|
-
clientId: currentConfigEnv.twitterClientId,
|
|
37
|
-
groupedAuthConnectionId: currentConfigEnv.verifierSubIdentifier ? currentConfigEnv.twitterVerifier : "",
|
|
38
|
-
mainOption: true,
|
|
39
|
-
jwtParameters: {
|
|
40
|
-
domain: currentConfigEnv.loginDomain,
|
|
41
|
-
connection: "twitter",
|
|
42
|
-
isUserIdCaseSensitive: false
|
|
43
|
-
},
|
|
44
|
-
// For torus only
|
|
45
|
-
walletAuthConnectionId: currentConfigEnv.walletTwitterVerifier
|
|
46
|
-
}, {
|
|
47
|
-
authConnectionId: currentConfigEnv.verifierSubIdentifier || currentConfigEnv.discordVerifier,
|
|
48
|
-
authConnection: AUTH_CONNECTION.DISCORD,
|
|
49
|
-
name: AUTH_CONNECTION.DISCORD,
|
|
50
|
-
description: "",
|
|
51
|
-
clientId: currentConfigEnv.discordClientId,
|
|
52
|
-
groupedAuthConnectionId: currentConfigEnv.verifierSubIdentifier ? currentConfigEnv.discordVerifier : "",
|
|
53
|
-
// For torus only
|
|
54
|
-
walletAuthConnectionId: currentConfigEnv.walletDiscordVerifier
|
|
55
|
-
}, {
|
|
56
|
-
authConnectionId: currentConfigEnv.verifierSubIdentifier || currentConfigEnv.lineVerifier,
|
|
57
|
-
authConnection: AUTH_CONNECTION.LINE,
|
|
58
|
-
name: AUTH_CONNECTION.LINE,
|
|
59
|
-
description: "",
|
|
60
|
-
clientId: currentConfigEnv.lineClientId,
|
|
61
|
-
groupedAuthConnectionId: currentConfigEnv.verifierSubIdentifier ? currentConfigEnv.lineVerifier : "",
|
|
62
|
-
mainOption: false,
|
|
63
|
-
jwtParameters: {
|
|
64
|
-
domain: currentConfigEnv.loginDomain,
|
|
65
|
-
connection: "line",
|
|
66
|
-
prompt: "consent"
|
|
67
|
-
},
|
|
68
|
-
// For torus only
|
|
69
|
-
walletAuthConnectionId: currentConfigEnv.walletLineVerifier
|
|
70
|
-
}, {
|
|
71
|
-
authConnectionId: currentConfigEnv.verifierSubIdentifier || currentConfigEnv.redditVerifier,
|
|
72
|
-
authConnection: AUTH_CONNECTION.REDDIT,
|
|
73
|
-
name: AUTH_CONNECTION.REDDIT,
|
|
74
|
-
description: "",
|
|
75
|
-
clientId: currentConfigEnv.redditClientId,
|
|
76
|
-
groupedAuthConnectionId: currentConfigEnv.verifierSubIdentifier ? currentConfigEnv.redditVerifier : "",
|
|
77
|
-
mainOption: false,
|
|
78
|
-
jwtParameters: {
|
|
79
|
-
domain: currentConfigEnv.loginDomain,
|
|
80
|
-
userIdField: "name",
|
|
81
|
-
connection: "Reddit"
|
|
82
|
-
},
|
|
83
|
-
// For torus only
|
|
84
|
-
walletAuthConnectionId: currentConfigEnv.walletRedditVerifier
|
|
85
|
-
}, {
|
|
86
|
-
authConnectionId: currentConfigEnv.verifierSubIdentifier || currentConfigEnv.appleVerifier,
|
|
87
|
-
authConnection: AUTH_CONNECTION.APPLE,
|
|
88
|
-
name: AUTH_CONNECTION.APPLE,
|
|
89
|
-
description: "",
|
|
90
|
-
clientId: currentConfigEnv.appleClientId,
|
|
91
|
-
groupedAuthConnectionId: currentConfigEnv.verifierSubIdentifier ? currentConfigEnv.appleVerifier : "",
|
|
92
|
-
mainOption: false,
|
|
93
|
-
jwtParameters: {
|
|
94
|
-
domain: currentConfigEnv.loginDomain,
|
|
95
|
-
connection: "apple"
|
|
96
|
-
},
|
|
97
|
-
// For torus only
|
|
98
|
-
walletAuthConnectionId: currentConfigEnv.walletAppleVerifier
|
|
99
|
-
}, {
|
|
100
|
-
authConnectionId: currentConfigEnv.verifierSubIdentifier || currentConfigEnv.githubVerifier,
|
|
101
|
-
authConnection: AUTH_CONNECTION.GITHUB,
|
|
102
|
-
description: "",
|
|
103
|
-
name: AUTH_CONNECTION.GITHUB,
|
|
104
|
-
clientId: currentConfigEnv.githubClientId,
|
|
105
|
-
groupedAuthConnectionId: currentConfigEnv.verifierSubIdentifier ? currentConfigEnv.githubVerifier : "",
|
|
106
|
-
mainOption: false,
|
|
107
|
-
jwtParameters: {
|
|
108
|
-
domain: currentConfigEnv.loginDomain,
|
|
109
|
-
connection: "github",
|
|
110
|
-
isUserIdCaseSensitive: false
|
|
111
|
-
},
|
|
112
|
-
// For torus only
|
|
113
|
-
walletAuthConnectionId: currentConfigEnv.walletGithubVerifier
|
|
114
|
-
}, {
|
|
115
|
-
authConnectionId: currentConfigEnv.verifierSubIdentifier || currentConfigEnv.twitchVerifier,
|
|
116
|
-
authConnection: AUTH_CONNECTION.TWITCH,
|
|
117
|
-
description: "",
|
|
118
|
-
name: AUTH_CONNECTION.TWITCH,
|
|
119
|
-
clientId: currentConfigEnv.twitchClientId,
|
|
120
|
-
groupedAuthConnectionId: currentConfigEnv.verifierSubIdentifier ? currentConfigEnv.twitchVerifier : "",
|
|
121
|
-
mainOption: false,
|
|
122
|
-
// For torus only
|
|
123
|
-
walletAuthConnectionId: currentConfigEnv.walletTwitchVerifier
|
|
124
|
-
}, {
|
|
125
|
-
authConnectionId: currentConfigEnv.verifierSubIdentifier || currentConfigEnv.linkedinVerifier,
|
|
126
|
-
authConnection: AUTH_CONNECTION.LINKEDIN,
|
|
127
|
-
description: "",
|
|
128
|
-
name: AUTH_CONNECTION.LINKEDIN,
|
|
129
|
-
clientId: currentConfigEnv.linkedinClientId,
|
|
130
|
-
groupedAuthConnectionId: currentConfigEnv.verifierSubIdentifier ? currentConfigEnv.linkedinVerifier : "",
|
|
131
|
-
mainOption: false,
|
|
132
|
-
jwtParameters: {
|
|
133
|
-
domain: currentConfigEnv.loginDomain,
|
|
134
|
-
connection: "linkedin"
|
|
135
|
-
},
|
|
136
|
-
// For torus only
|
|
137
|
-
walletAuthConnectionId: currentConfigEnv.walletLinkedinVerifier
|
|
138
|
-
}, {
|
|
139
|
-
authConnectionId: currentConfigEnv.verifierSubIdentifier || currentConfigEnv.wechatVerifier,
|
|
140
|
-
authConnection: AUTH_CONNECTION.WECHAT,
|
|
141
|
-
description: "",
|
|
142
|
-
name: AUTH_CONNECTION.WECHAT,
|
|
143
|
-
clientId: currentConfigEnv.wechatClientId,
|
|
144
|
-
groupedAuthConnectionId: currentConfigEnv.verifierSubIdentifier ? currentConfigEnv.wechatVerifier : "",
|
|
145
|
-
mainOption: false,
|
|
146
|
-
showOnSocialBackupFactor: true,
|
|
147
|
-
jwtParameters: {
|
|
148
|
-
domain: currentConfigEnv.loginDomain,
|
|
149
|
-
connection: "Wechat"
|
|
150
|
-
},
|
|
151
|
-
// For torus only
|
|
152
|
-
walletAuthConnectionId: currentConfigEnv.walletWechatVerifier
|
|
153
|
-
}, {
|
|
154
|
-
authConnectionId: currentConfigEnv.verifierSubIdentifier || currentConfigEnv.kakaoVerifier,
|
|
155
|
-
authConnection: AUTH_CONNECTION.KAKAO,
|
|
156
|
-
description: "",
|
|
157
|
-
name: AUTH_CONNECTION.KAKAO,
|
|
158
|
-
clientId: currentConfigEnv.kakaoClientId,
|
|
159
|
-
groupedAuthConnectionId: currentConfigEnv.verifierSubIdentifier ? currentConfigEnv.kakaoVerifier : "",
|
|
160
|
-
mainOption: false,
|
|
161
|
-
jwtParameters: {
|
|
162
|
-
domain: currentConfigEnv.loginDomain,
|
|
163
|
-
connection: "Kakao"
|
|
164
|
-
},
|
|
165
|
-
// For torus only
|
|
166
|
-
walletAuthConnectionId: currentConfigEnv.walletKakaoVerifier
|
|
167
|
-
}, {
|
|
168
|
-
authConnectionId: currentConfigEnv.verifierSubIdentifier || currentConfigEnv.hostedEmailPasswordlessVerifier,
|
|
169
|
-
description: "login.verifier-email-desc",
|
|
170
|
-
authConnection: AUTH_CONNECTION.EMAIL_PASSWORDLESS,
|
|
171
|
-
name: "email",
|
|
172
|
-
clientId: currentConfigEnv.hostedEmailPasswordlessClientId,
|
|
173
|
-
groupedAuthConnectionId: currentConfigEnv.verifierSubIdentifier ? currentConfigEnv.hostedEmailPasswordlessVerifier : "",
|
|
174
|
-
mainOption: false,
|
|
175
|
-
jwtParameters: {
|
|
176
|
-
domain: currentBuildEnv.passwordlessHost,
|
|
177
|
-
userIdField: "name",
|
|
178
|
-
isUserIdCaseSensitive: false,
|
|
179
|
-
flow_type: EMAIL_FLOW.code
|
|
180
|
-
},
|
|
181
|
-
// For torus only
|
|
182
|
-
walletAuthConnectionId: currentConfigEnv.walletHostedEmailPasswordlessVerifier
|
|
183
|
-
}, {
|
|
184
|
-
authConnectionId: currentConfigEnv.verifierSubIdentifier || currentConfigEnv.hostedSmsPasswordlessVerifier,
|
|
185
|
-
description: "login.verifier-sms-desc-2",
|
|
186
|
-
authConnection: AUTH_CONNECTION.SMS_PASSWORDLESS,
|
|
187
|
-
name: "mobile",
|
|
188
|
-
clientId: currentConfigEnv.hostedSmsPasswordlessClientId,
|
|
189
|
-
groupedAuthConnectionId: currentConfigEnv.verifierSubIdentifier ? currentConfigEnv.hostedSmsPasswordlessVerifier : "",
|
|
190
|
-
mainOption: false,
|
|
191
|
-
jwtParameters: {
|
|
192
|
-
domain: currentBuildEnv.passwordlessHost,
|
|
193
|
-
userIdField: "name",
|
|
194
|
-
isVerifierIdCaseSensitive: false
|
|
195
|
-
},
|
|
196
|
-
// for torus only.
|
|
197
|
-
walletAuthConnectionId: currentConfigEnv.walletHostedSmsPasswordlessVerifier
|
|
198
|
-
}, {
|
|
199
|
-
authConnectionId: currentConfigEnv.verifierSubIdentifier || currentConfigEnv.hostedFarcasterVerifier,
|
|
200
|
-
description: "",
|
|
201
|
-
authConnection: AUTH_CONNECTION.FARCASTER,
|
|
202
|
-
name: "Farcaster",
|
|
203
|
-
clientId: currentConfigEnv.hostedFarcasterClientId,
|
|
204
|
-
groupedAuthConnectionId: currentConfigEnv.verifierSubIdentifier ? currentConfigEnv.hostedFarcasterVerifier : "",
|
|
205
|
-
mainOption: false,
|
|
206
|
-
jwtParameters: {
|
|
207
|
-
domain: currentConfigEnv.farcasterLoginDomain
|
|
208
|
-
},
|
|
209
|
-
// For torus only
|
|
210
|
-
walletAuthConnectionId: ""
|
|
211
|
-
}];
|
|
212
|
-
};
|
|
213
|
-
|
|
214
|
-
export { getAuthConnectionConfig };
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { BUILD_ENV } from '@web3auth/auth';
|
|
2
|
-
|
|
3
|
-
// Passwordless backend service
|
|
4
|
-
const PASSWORDLESS_SERVER_API_URL = "https://api.web3auth.io/passwordless-service";
|
|
5
|
-
const DEVELOP_PASSWORDLESS_SERVER_API_URL = "https://api-develop.web3auth.io/passwordless-service";
|
|
6
|
-
// Auth backend service
|
|
7
|
-
const AUTH_SERVER_URL = "https://api.web3auth.io/auth-service";
|
|
8
|
-
const DEVELOP_AUTH_SERVER_URL = "https://api-develop.web3auth.io/auth-service";
|
|
9
|
-
const configBuild = {
|
|
10
|
-
[BUILD_ENV.DEVELOPMENT]: {
|
|
11
|
-
apiHost: `${DEVELOP_AUTH_SERVER_URL}`,
|
|
12
|
-
logLevel: "debug",
|
|
13
|
-
passwordlessBackendHost: `${DEVELOP_PASSWORDLESS_SERVER_API_URL}/api/v3/`,
|
|
14
|
-
passwordlessHost: "https://develop-passwordless.web3auth.io",
|
|
15
|
-
sentrySampleRate: "0",
|
|
16
|
-
sentryTransactionSampleRate: "0",
|
|
17
|
-
supportsVersioning: false
|
|
18
|
-
},
|
|
19
|
-
[BUILD_ENV.STAGING]: {
|
|
20
|
-
apiHost: AUTH_SERVER_URL,
|
|
21
|
-
logLevel: "debug",
|
|
22
|
-
passwordlessBackendHost: `${PASSWORDLESS_SERVER_API_URL}/api/v3/`,
|
|
23
|
-
passwordlessHost: "https://staging-passwordless.web3auth.io/v6",
|
|
24
|
-
sentrySampleRate: "0.1",
|
|
25
|
-
sentryTransactionSampleRate: "0.1",
|
|
26
|
-
supportsVersioning: true
|
|
27
|
-
},
|
|
28
|
-
[BUILD_ENV.PRODUCTION]: {
|
|
29
|
-
apiHost: AUTH_SERVER_URL,
|
|
30
|
-
logLevel: "error",
|
|
31
|
-
passwordlessBackendHost: `${PASSWORDLESS_SERVER_API_URL}/api/v3/`,
|
|
32
|
-
passwordlessHost: "https://passwordless.web3auth.io/v6",
|
|
33
|
-
sentrySampleRate: "0.5",
|
|
34
|
-
sentryTransactionSampleRate: "0.001",
|
|
35
|
-
supportsVersioning: true
|
|
36
|
-
},
|
|
37
|
-
[BUILD_ENV.TESTING]: {
|
|
38
|
-
apiHost: DEVELOP_AUTH_SERVER_URL,
|
|
39
|
-
logLevel: "debug",
|
|
40
|
-
passwordlessBackendHost: `${DEVELOP_PASSWORDLESS_SERVER_API_URL}/api/v3/`,
|
|
41
|
-
passwordlessHost: "https://develop-passwordless.web3auth.io",
|
|
42
|
-
sentrySampleRate: "1",
|
|
43
|
-
sentryTransactionSampleRate: "0.1",
|
|
44
|
-
supportsVersioning: false
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
export { AUTH_SERVER_URL, DEVELOP_AUTH_SERVER_URL, DEVELOP_PASSWORDLESS_SERVER_API_URL, PASSWORDLESS_SERVER_API_URL, configBuild };
|