shogun-core 1.2.6 → 1.2.7
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/browser/shogun-core.js +1 -1
- package/dist/browser/shogun-core.light.js +1 -1
- package/dist/browser.js +4 -0
- package/dist/plugins/index.js +10 -1
- package/dist/plugins/nostr/index.js +6 -0
- package/dist/plugins/nostr/nostrChain.js +45 -0
- package/dist/plugins/web3/index.js +6 -0
- package/dist/plugins/web3/web3Chain.js +33 -0
- package/dist/plugins/webauthn/index.js +6 -0
- package/dist/plugins/webauthn/webauthnChain.js +36 -0
- package/dist/types/plugins/index.d.ts +3 -0
- package/dist/types/plugins/nostr/index.d.ts +1 -0
- package/dist/types/plugins/nostr/nostrChain.d.ts +2 -0
- package/dist/types/plugins/web3/index.d.ts +1 -0
- package/dist/types/plugins/web3/web3Chain.d.ts +2 -0
- package/dist/types/plugins/webauthn/index.d.ts +1 -0
- package/dist/types/plugins/webauthn/webauthnChain.d.ts +2 -0
- package/package.json +1 -1
package/dist/browser.js
CHANGED
|
@@ -40,6 +40,8 @@ exports.ShogunCore = exports.modules = void 0;
|
|
|
40
40
|
exports.initShogunBrowser = initShogunBrowser;
|
|
41
41
|
const index_1 = require("./index");
|
|
42
42
|
Object.defineProperty(exports, "ShogunCore", { enumerable: true, get: function () { return index_1.ShogunCore; } });
|
|
43
|
+
const webauthn_1 = require("./plugins/webauthn");
|
|
44
|
+
const web3_1 = require("./plugins/web3");
|
|
43
45
|
// Lazy loading modules - organized by functionality
|
|
44
46
|
const lazyModules = {
|
|
45
47
|
// Authentication modules
|
|
@@ -76,6 +78,8 @@ function initShogunBrowser(config) {
|
|
|
76
78
|
// Create a new ShogunCore instance with browser-optimized configuration
|
|
77
79
|
shogunCoreInstance = new index_1.ShogunCore(browserConfig);
|
|
78
80
|
gun = shogunCoreInstance?.gun;
|
|
81
|
+
(0, webauthn_1.webauthnChain)();
|
|
82
|
+
(0, web3_1.web3Chain)();
|
|
79
83
|
// Support use as a global variable when included via <script>
|
|
80
84
|
if (typeof window !== "undefined") {
|
|
81
85
|
window.shogun = shogunCoreInstance;
|
package/dist/plugins/index.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NostrConnectorPlugin = exports.NostrConnector = exports.Web3ConnectorPlugin = exports.Web3Connector = exports.WebauthnPlugin = exports.Webauthn = exports.BasePlugin = void 0;
|
|
6
|
+
exports.nostrChain = exports.NostrConnectorPlugin = exports.NostrConnector = exports.web3Chain = exports.Web3ConnectorPlugin = exports.Web3Connector = exports.webauthnChain = exports.WebauthnPlugin = exports.Webauthn = exports.BasePlugin = void 0;
|
|
4
7
|
// Base plugin interface and types
|
|
5
8
|
var base_1 = require("./base");
|
|
6
9
|
Object.defineProperty(exports, "BasePlugin", { enumerable: true, get: function () { return base_1.BasePlugin; } });
|
|
@@ -9,13 +12,19 @@ var webauthn_1 = require("./webauthn/webauthn");
|
|
|
9
12
|
Object.defineProperty(exports, "Webauthn", { enumerable: true, get: function () { return webauthn_1.Webauthn; } });
|
|
10
13
|
var webauthnPlugin_1 = require("./webauthn/webauthnPlugin");
|
|
11
14
|
Object.defineProperty(exports, "WebauthnPlugin", { enumerable: true, get: function () { return webauthnPlugin_1.WebauthnPlugin; } });
|
|
15
|
+
var webauthnChain_1 = require("./webauthn/webauthnChain");
|
|
16
|
+
Object.defineProperty(exports, "webauthnChain", { enumerable: true, get: function () { return __importDefault(webauthnChain_1).default; } });
|
|
12
17
|
// Ethereum plugin exports
|
|
13
18
|
var web3Connector_1 = require("./web3/web3Connector");
|
|
14
19
|
Object.defineProperty(exports, "Web3Connector", { enumerable: true, get: function () { return web3Connector_1.Web3Connector; } });
|
|
15
20
|
var web3ConnectorPlugin_1 = require("./web3/web3ConnectorPlugin");
|
|
16
21
|
Object.defineProperty(exports, "Web3ConnectorPlugin", { enumerable: true, get: function () { return web3ConnectorPlugin_1.Web3ConnectorPlugin; } });
|
|
22
|
+
var web3Chain_1 = require("./web3/web3Chain");
|
|
23
|
+
Object.defineProperty(exports, "web3Chain", { enumerable: true, get: function () { return __importDefault(web3Chain_1).default; } });
|
|
17
24
|
// Bitcoin plugin exports
|
|
18
25
|
var nostrConnector_1 = require("./nostr/nostrConnector");
|
|
19
26
|
Object.defineProperty(exports, "NostrConnector", { enumerable: true, get: function () { return nostrConnector_1.NostrConnector; } });
|
|
20
27
|
var nostrConnectorPlugin_1 = require("./nostr/nostrConnectorPlugin");
|
|
21
28
|
Object.defineProperty(exports, "NostrConnectorPlugin", { enumerable: true, get: function () { return nostrConnectorPlugin_1.NostrConnectorPlugin; } });
|
|
29
|
+
var nostrChain_1 = require("./nostr/nostrChain");
|
|
30
|
+
Object.defineProperty(exports, "nostrChain", { enumerable: true, get: function () { return __importDefault(nostrChain_1).default; } });
|
|
@@ -13,7 +13,13 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
13
13
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
+
};
|
|
16
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.nostrChain = void 0;
|
|
17
21
|
__exportStar(require("./nostrConnectorPlugin"), exports);
|
|
18
22
|
__exportStar(require("./nostrConnector"), exports);
|
|
19
23
|
__exportStar(require("./types"), exports);
|
|
24
|
+
var nostrChain_1 = require("./nostrChain");
|
|
25
|
+
Object.defineProperty(exports, "nostrChain", { enumerable: true, get: function () { return __importDefault(nostrChain_1).default; } });
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const gun_1 = __importDefault(require("gun"));
|
|
7
|
+
const nostrConnector_1 = require("./nostrConnector");
|
|
8
|
+
const nostrChain = () => {
|
|
9
|
+
const nostr = new nostrConnector_1.NostrConnector();
|
|
10
|
+
gun_1.default.chain.nostr = {};
|
|
11
|
+
gun_1.default.chain.nostr.isAvailable = function () {
|
|
12
|
+
return nostr.isAvailable();
|
|
13
|
+
};
|
|
14
|
+
gun_1.default.chain.nostr.isNostrExtensionAvailable = function () {
|
|
15
|
+
return nostr.isNostrExtensionAvailable();
|
|
16
|
+
};
|
|
17
|
+
gun_1.default.chain.nostr.connectWallet = async function (type = "nostr") {
|
|
18
|
+
return await nostr.connectWallet(type);
|
|
19
|
+
};
|
|
20
|
+
gun_1.default.chain.nostr.generateCredentials = async function (address) {
|
|
21
|
+
return await nostr.generateCredentials(address);
|
|
22
|
+
};
|
|
23
|
+
gun_1.default.chain.nostr.generatePassword = async function (signature) {
|
|
24
|
+
return await nostr.generatePassword(signature);
|
|
25
|
+
};
|
|
26
|
+
gun_1.default.chain.nostr.verifySignature = async function (message, signature, address) {
|
|
27
|
+
return await nostr.verifySignature(message, signature, address);
|
|
28
|
+
};
|
|
29
|
+
gun_1.default.chain.nostr.getConnectedAddress = function () {
|
|
30
|
+
return nostr.getConnectedAddress();
|
|
31
|
+
};
|
|
32
|
+
gun_1.default.chain.nostr.getConnectedType = function () {
|
|
33
|
+
return nostr.getConnectedType();
|
|
34
|
+
};
|
|
35
|
+
gun_1.default.chain.nostr.setKeyPair = function (keyPair) {
|
|
36
|
+
return nostr.setKeyPair(keyPair);
|
|
37
|
+
};
|
|
38
|
+
gun_1.default.chain.nostr.clearSignatureCache = function (address) {
|
|
39
|
+
return nostr.clearSignatureCache(address);
|
|
40
|
+
};
|
|
41
|
+
gun_1.default.chain.nostr.cleanup = function () {
|
|
42
|
+
return nostr.cleanup();
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
exports.default = nostrChain;
|
|
@@ -13,7 +13,13 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
13
13
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
+
};
|
|
16
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.web3Chain = void 0;
|
|
17
21
|
__exportStar(require("./web3ConnectorPlugin"), exports);
|
|
18
22
|
__exportStar(require("./types"), exports);
|
|
19
23
|
__exportStar(require("./web3Connector"), exports);
|
|
24
|
+
var web3Chain_1 = require("./web3Chain");
|
|
25
|
+
Object.defineProperty(exports, "web3Chain", { enumerable: true, get: function () { return __importDefault(web3Chain_1).default; } });
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const gun_1 = __importDefault(require("gun"));
|
|
7
|
+
const web3Connector_1 = require("./web3Connector");
|
|
8
|
+
const web3Chain = () => {
|
|
9
|
+
const web3 = new web3Connector_1.Web3Connector();
|
|
10
|
+
gun_1.default.chain.web3.connect = async function () {
|
|
11
|
+
return await web3.connectMetaMask();
|
|
12
|
+
};
|
|
13
|
+
gun_1.default.chain.web3.generateCredentials = async function (address) {
|
|
14
|
+
return await web3.generateCredentials(address);
|
|
15
|
+
};
|
|
16
|
+
gun_1.default.chain.web3.getSigner = async function () {
|
|
17
|
+
return await web3.getSigner();
|
|
18
|
+
};
|
|
19
|
+
gun_1.default.chain.web3.getProvider = async function () {
|
|
20
|
+
return await web3.getProvider();
|
|
21
|
+
};
|
|
22
|
+
gun_1.default.chain.web3.signMessage = async function (message) {
|
|
23
|
+
const signer = await web3.getSigner();
|
|
24
|
+
return await signer.signMessage(message);
|
|
25
|
+
};
|
|
26
|
+
gun_1.default.chain.verifySignature = async function (message, signature) {
|
|
27
|
+
return await web3.verifySignature(message, signature);
|
|
28
|
+
};
|
|
29
|
+
gun_1.default.chain.isMetaMaskAvailable = function () {
|
|
30
|
+
return web3Connector_1.Web3Connector.isMetaMaskAvailable();
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
exports.default = web3Chain;
|
|
@@ -13,7 +13,13 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
13
13
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
+
};
|
|
16
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.webauthnChain = void 0;
|
|
17
21
|
__exportStar(require("./webauthnPlugin"), exports);
|
|
18
22
|
__exportStar(require("./types"), exports);
|
|
19
23
|
__exportStar(require("./webauthn"), exports);
|
|
24
|
+
var webauthnChain_1 = require("./webauthnChain");
|
|
25
|
+
Object.defineProperty(exports, "webauthnChain", { enumerable: true, get: function () { return __importDefault(webauthnChain_1).default; } });
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const gun_1 = __importDefault(require("gun"));
|
|
7
|
+
const webauthn_1 = require("./webauthn");
|
|
8
|
+
const webauthnChain = () => {
|
|
9
|
+
const webauthn = new webauthn_1.Webauthn();
|
|
10
|
+
gun_1.default.chain.webauthn = {};
|
|
11
|
+
gun_1.default.chain.webauthn.isSupported = function () {
|
|
12
|
+
return webauthn.isSupported();
|
|
13
|
+
};
|
|
14
|
+
gun_1.default.chain.webauthn.createAccount = async function (username, credentials = null, isNewDevice = false) {
|
|
15
|
+
return await webauthn.createAccount(username, credentials, isNewDevice);
|
|
16
|
+
};
|
|
17
|
+
gun_1.default.chain.webauthn.authenticateUser = async function (username, salt, options = {}) {
|
|
18
|
+
return await webauthn.authenticateUser(username, salt, options);
|
|
19
|
+
};
|
|
20
|
+
gun_1.default.chain.webauthn.generateCredentials = async function (username, existingCredential = null, isLogin = false) {
|
|
21
|
+
return await webauthn.generateCredentials(username, existingCredential, isLogin);
|
|
22
|
+
};
|
|
23
|
+
gun_1.default.chain.webauthn.abortAuthentication = function () {
|
|
24
|
+
return webauthn.abortAuthentication();
|
|
25
|
+
};
|
|
26
|
+
gun_1.default.chain.webauthn.removeDevice = async function (username, credentialId, credentials) {
|
|
27
|
+
return await webauthn.removeDevice(username, credentialId, credentials);
|
|
28
|
+
};
|
|
29
|
+
gun_1.default.chain.webauthn.sign = async function (data) {
|
|
30
|
+
return await webauthn.sign(data);
|
|
31
|
+
};
|
|
32
|
+
gun_1.default.chain.webauthn.validateUsername = function (username) {
|
|
33
|
+
return webauthn.validateUsername(username);
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
exports.default = webauthnChain;
|
|
@@ -3,9 +3,12 @@ export type { ShogunPlugin, PluginManager } from "../types/plugin";
|
|
|
3
3
|
export { Webauthn } from "./webauthn/webauthn";
|
|
4
4
|
export { WebauthnPlugin } from "./webauthn/webauthnPlugin";
|
|
5
5
|
export type { WebauthnPluginInterface } from "./webauthn/types";
|
|
6
|
+
export { default as webauthnChain } from "./webauthn/webauthnChain";
|
|
6
7
|
export { Web3Connector } from "./web3/web3Connector";
|
|
7
8
|
export { Web3ConnectorPlugin } from "./web3/web3ConnectorPlugin";
|
|
8
9
|
export type { Web3ConectorPluginInterface } from "./web3/types";
|
|
10
|
+
export { default as web3Chain } from "./web3/web3Chain";
|
|
9
11
|
export { NostrConnector } from "./nostr/nostrConnector";
|
|
10
12
|
export { NostrConnectorPlugin } from "./nostr/nostrConnectorPlugin";
|
|
11
13
|
export type { NostrConnectorPluginInterface, NostrConnectorCredentials, NostrConnectorKeyPair, NostrConnectorConfig, AlbyProvider, NostrProvider, } from "./nostr/types";
|
|
14
|
+
export { default as nostrChain } from "./nostr/nostrChain";
|