@multiplatform.one/wallet 7.7.2
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/README.md +8 -0
- package/dist/cjs/SiweKeycloakProvider.cjs +273 -0
- package/dist/cjs/SiweKeycloakProvider.native.js +309 -0
- package/dist/cjs/SiweKeycloakProvider.native.js.map +1 -0
- package/dist/cjs/base64.cjs +51 -0
- package/dist/cjs/base64.native.js +55 -0
- package/dist/cjs/base64.native.js.map +1 -0
- package/dist/cjs/base64.spec.cjs +57 -0
- package/dist/cjs/base64.spec.native.js +79 -0
- package/dist/cjs/base64.spec.native.js.map +1 -0
- package/dist/cjs/context.cjs +29 -0
- package/dist/cjs/context.native.js +32 -0
- package/dist/cjs/context.native.js.map +1 -0
- package/dist/cjs/hooks/context.cjs +29 -0
- package/dist/cjs/hooks/context.native.js +32 -0
- package/dist/cjs/hooks/context.native.js.map +1 -0
- package/dist/cjs/hooks/index.cjs +20 -0
- package/dist/cjs/hooks/index.native.js +23 -0
- package/dist/cjs/hooks/index.native.js.map +1 -0
- package/dist/cjs/hooks/useSiweKeycloak.cjs +61 -0
- package/dist/cjs/hooks/useSiweKeycloak.native.js +64 -0
- package/dist/cjs/hooks/useSiweKeycloak.native.js.map +1 -0
- package/dist/cjs/index.cjs +133 -0
- package/dist/cjs/index.native.js +189 -0
- package/dist/cjs/index.native.js.map +1 -0
- package/dist/cjs/render.cjs +78 -0
- package/dist/cjs/render.native.js +82 -0
- package/dist/cjs/render.native.js.map +1 -0
- package/dist/cjs/siwe.cjs +76 -0
- package/dist/cjs/siwe.native.js +94 -0
- package/dist/cjs/siwe.native.js.map +1 -0
- package/dist/cjs/types.cjs +18 -0
- package/dist/cjs/types.native.js +21 -0
- package/dist/cjs/types.native.js.map +1 -0
- package/dist/cjs/util.cjs +53 -0
- package/dist/cjs/util.native.js +56 -0
- package/dist/cjs/util.native.js.map +1 -0
- package/dist/cjs/util.spec.cjs +53 -0
- package/dist/cjs/util.spec.native.js +62 -0
- package/dist/cjs/util.spec.native.js.map +1 -0
- package/dist/esm/SiweKeycloakProvider.mjs +237 -0
- package/dist/esm/SiweKeycloakProvider.mjs.map +1 -0
- package/dist/esm/SiweKeycloakProvider.native.js +270 -0
- package/dist/esm/SiweKeycloakProvider.native.js.map +1 -0
- package/dist/esm/base64.mjs +26 -0
- package/dist/esm/base64.mjs.map +1 -0
- package/dist/esm/base64.native.js +27 -0
- package/dist/esm/base64.native.js.map +1 -0
- package/dist/esm/base64.spec.mjs +58 -0
- package/dist/esm/base64.spec.mjs.map +1 -0
- package/dist/esm/base64.spec.native.js +77 -0
- package/dist/esm/base64.spec.native.js.map +1 -0
- package/dist/esm/context.mjs +4 -0
- package/dist/esm/context.mjs.map +1 -0
- package/dist/esm/context.native.js +4 -0
- package/dist/esm/context.native.js.map +1 -0
- package/dist/esm/hooks/context.mjs +4 -0
- package/dist/esm/hooks/context.mjs.map +1 -0
- package/dist/esm/hooks/context.native.js +4 -0
- package/dist/esm/hooks/context.native.js.map +1 -0
- package/dist/esm/hooks/index.mjs +2 -0
- package/dist/esm/hooks/index.mjs.map +1 -0
- package/dist/esm/hooks/index.native.js +2 -0
- package/dist/esm/hooks/index.native.js.map +1 -0
- package/dist/esm/hooks/useSiweKeycloak.mjs +36 -0
- package/dist/esm/hooks/useSiweKeycloak.mjs.map +1 -0
- package/dist/esm/hooks/useSiweKeycloak.native.js +36 -0
- package/dist/esm/hooks/useSiweKeycloak.native.js.map +1 -0
- package/dist/esm/index.mjs +107 -0
- package/dist/esm/index.mjs.map +1 -0
- package/dist/esm/index.native.js +160 -0
- package/dist/esm/index.native.js.map +1 -0
- package/dist/esm/render.mjs +42 -0
- package/dist/esm/render.mjs.map +1 -0
- package/dist/esm/render.native.js +43 -0
- package/dist/esm/render.native.js.map +1 -0
- package/dist/esm/siwe.mjs +51 -0
- package/dist/esm/siwe.mjs.map +1 -0
- package/dist/esm/siwe.native.js +66 -0
- package/dist/esm/siwe.native.js.map +1 -0
- package/dist/esm/types.mjs +2 -0
- package/dist/esm/types.mjs.map +1 -0
- package/dist/esm/types.native.js +2 -0
- package/dist/esm/types.native.js.map +1 -0
- package/dist/esm/util.mjs +27 -0
- package/dist/esm/util.mjs.map +1 -0
- package/dist/esm/util.native.js +27 -0
- package/dist/esm/util.native.js.map +1 -0
- package/dist/esm/util.spec.mjs +54 -0
- package/dist/esm/util.spec.mjs.map +1 -0
- package/dist/esm/util.spec.native.js +60 -0
- package/dist/esm/util.spec.native.js.map +1 -0
- package/package.json +81 -0
- package/src/SiweKeycloakProvider.tsx +297 -0
- package/src/base64.spec.ts +65 -0
- package/src/base64.ts +26 -0
- package/src/context.ts +10 -0
- package/src/hooks/context.ts +10 -0
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useSiweKeycloak.ts +23 -0
- package/src/index.ts +127 -0
- package/src/main/java/com/bitspur/keycloak/siwe/Errors.java +21 -0
- package/src/main/java/com/bitspur/keycloak/siwe/LiteAuthenticationService.java +167 -0
- package/src/main/java/com/bitspur/keycloak/siwe/SiweCredentials.java +36 -0
- package/src/main/java/com/bitspur/keycloak/siwe/SiweSession.java +36 -0
- package/src/main/java/com/bitspur/keycloak/siwe/SiweUtil.java +599 -0
- package/src/main/java/com/bitspur/keycloak/siwe/Token.java +85 -0
- package/src/main/java/com/bitspur/keycloak/siwe/authenticators/browser/SiweBrowserAuthenticator.java +109 -0
- package/src/main/java/com/bitspur/keycloak/siwe/authenticators/browser/SiweBrowserAuthenticatorFactory.java +93 -0
- package/src/main/java/com/bitspur/keycloak/siwe/authenticators/directgrant/SiweDirectGrantAuthenticator.java +153 -0
- package/src/main/java/com/bitspur/keycloak/siwe/authenticators/directgrant/SiweDirectGrantAuthenticatorFactory.java +93 -0
- package/src/main/java/com/bitspur/keycloak/siwe/jpa/nonce/SiweNonce.java +95 -0
- package/src/main/java/com/bitspur/keycloak/siwe/jpa/nonce/SiweNonceJpaEntityProvider.java +82 -0
- package/src/main/java/com/bitspur/keycloak/siwe/jpa/nonce/SiweNonceJpaEntityProviderFactory.java +46 -0
- package/src/main/java/com/bitspur/keycloak/siwe/jpa/wallet/SiweWalletAddress.java +103 -0
- package/src/main/java/com/bitspur/keycloak/siwe/jpa/wallet/SiweWalletJpaEntityProvider.java +43 -0
- package/src/main/java/com/bitspur/keycloak/siwe/jpa/wallet/SiweWalletJpaEntityProviderFactory.java +46 -0
- package/src/main/java/com/bitspur/keycloak/siwe/protocol/SiweWalletProtocolMapper.java +85 -0
- package/src/main/java/com/bitspur/keycloak/siwe/resource/SiweResource.java +210 -0
- package/src/main/java/com/bitspur/keycloak/siwe/resource/SiweResourceProvider.java +34 -0
- package/src/main/java/com/bitspur/keycloak/siwe/resource/SiweResourceProviderFactory.java +46 -0
- package/src/main/java/com/bitspur/keycloak/siwe/siu/SiuCredentials.java +52 -0
- package/src/main/java/com/bitspur/keycloak/siwe/siu/SiuMessage.java +362 -0
- package/src/main/java/com/bitspur/keycloak/siwe/siu/SiuParseException.java +23 -0
- package/src/main/java/com/bitspur/keycloak/siwe/siu/SiuUtil.java +547 -0
- package/src/main/java/com/bitspur/keycloak/siwe/siu/authenticators/browser/SiuBrowserAuthenticator.java +112 -0
- package/src/main/java/com/bitspur/keycloak/siwe/siu/authenticators/browser/SiuBrowserAuthenticatorFactory.java +96 -0
- package/src/main/java/com/bitspur/keycloak/siwe/siu/authenticators/directgrant/SiuDirectGrantAuthenticator.java +169 -0
- package/src/main/java/com/bitspur/keycloak/siwe/siu/authenticators/directgrant/SiuDirectGrantAuthenticatorFactory.java +96 -0
- package/src/main/java/com/bitspur/keycloak/siwe/siu/resource/SiuResource.java +244 -0
- package/src/main/java/com/bitspur/keycloak/siwe/siu/resource/SiuResourceProvider.java +34 -0
- package/src/main/java/com/bitspur/keycloak/siwe/siu/resource/SiuResourceProviderFactory.java +48 -0
- package/src/main/java/com/bitspur/keycloak/siwe/siws/SiwsCredentials.java +52 -0
- package/src/main/java/com/bitspur/keycloak/siwe/siws/SiwsMessage.java +362 -0
- package/src/main/java/com/bitspur/keycloak/siwe/siws/SiwsParseException.java +23 -0
- package/src/main/java/com/bitspur/keycloak/siwe/siws/SiwsUtil.java +564 -0
- package/src/main/java/com/bitspur/keycloak/siwe/siws/authenticators/browser/SiwsBrowserAuthenticator.java +112 -0
- package/src/main/java/com/bitspur/keycloak/siwe/siws/authenticators/browser/SiwsBrowserAuthenticatorFactory.java +96 -0
- package/src/main/java/com/bitspur/keycloak/siwe/siws/authenticators/directgrant/SiwsDirectGrantAuthenticator.java +169 -0
- package/src/main/java/com/bitspur/keycloak/siwe/siws/authenticators/directgrant/SiwsDirectGrantAuthenticatorFactory.java +96 -0
- package/src/main/java/com/bitspur/keycloak/siwe/siws/resource/SiwsResource.java +244 -0
- package/src/main/java/com/bitspur/keycloak/siwe/siws/resource/SiwsResourceProvider.java +34 -0
- package/src/main/java/com/bitspur/keycloak/siwe/siws/resource/SiwsResourceProviderFactory.java +48 -0
- package/src/main/resources/META-INF/keycloak-themes.json +8 -0
- package/src/main/resources/META-INF/services/org.keycloak.authentication.AuthenticatorFactory +6 -0
- package/src/main/resources/META-INF/services/org.keycloak.connections.jpa.entityprovider.JpaEntityProviderFactory +2 -0
- package/src/main/resources/META-INF/services/org.keycloak.protocol.ProtocolMapper +1 -0
- package/src/main/resources/META-INF/services/org.keycloak.services.resource.RealmResourceProviderFactory +3 -0
- package/src/main/resources/META-INF/siwe-nonce-changelog.xml +29 -0
- package/src/main/resources/META-INF/siwe-wallet-changelog.xml +46 -0
- package/src/render.tsx +47 -0
- package/src/siwe.tsx +57 -0
- package/src/types.ts +6 -0
- package/src/util.spec.ts +72 -0
- package/src/util.ts +28 -0
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: true
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
16
|
+
get: () => from[key],
|
|
17
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
23
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
24
|
+
value: true
|
|
25
|
+
}), mod);
|
|
26
|
+
var index_exports = {};
|
|
27
|
+
__export(index_exports, {
|
|
28
|
+
SiweKeycloak: () => SiweKeycloak
|
|
29
|
+
});
|
|
30
|
+
module.exports = __toCommonJS(index_exports);
|
|
31
|
+
var import_render = require("./render.native.js");
|
|
32
|
+
var import_util = require("./util.native.js");
|
|
33
|
+
__reExport(index_exports, require("./SiweKeycloakProvider.native.js"), module.exports);
|
|
34
|
+
__reExport(index_exports, require("./hooks/index.native.js"), module.exports);
|
|
35
|
+
__reExport(index_exports, require("./types.native.js"), module.exports);
|
|
36
|
+
__reExport(index_exports, require("./util.native.js"), module.exports);
|
|
37
|
+
function _class_call_check(instance, Constructor) {
|
|
38
|
+
if (!(instance instanceof Constructor)) {
|
|
39
|
+
throw new TypeError("Cannot call a class as a function");
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
function _defineProperties(target, props) {
|
|
43
|
+
for (var i = 0; i < props.length; i++) {
|
|
44
|
+
var descriptor = props[i];
|
|
45
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
46
|
+
descriptor.configurable = true;
|
|
47
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
48
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
function _create_class(Constructor, protoProps, staticProps) {
|
|
52
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
53
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
54
|
+
return Constructor;
|
|
55
|
+
}
|
|
56
|
+
function _define_property(obj, key, value) {
|
|
57
|
+
if (key in obj) {
|
|
58
|
+
Object.defineProperty(obj, key, {
|
|
59
|
+
value,
|
|
60
|
+
enumerable: true,
|
|
61
|
+
configurable: true,
|
|
62
|
+
writable: true
|
|
63
|
+
});
|
|
64
|
+
} else {
|
|
65
|
+
obj[key] = value;
|
|
66
|
+
}
|
|
67
|
+
return obj;
|
|
68
|
+
}
|
|
69
|
+
var SiweKeycloak = /* @__PURE__ */function () {
|
|
70
|
+
"use strict";
|
|
71
|
+
|
|
72
|
+
function SiweKeycloak2(options) {
|
|
73
|
+
var _this = this;
|
|
74
|
+
_class_call_check(this, SiweKeycloak2);
|
|
75
|
+
var _options_keycloak, _options_keycloak1, _options_keycloak2, _options_keycloak3, _options_keycloak4, _options_keycloak5, _options_keycloak6, _options_keycloak7;
|
|
76
|
+
_define_property(this, "_walletClientResolvers", []);
|
|
77
|
+
_define_property(this, "addresses", []);
|
|
78
|
+
_define_property(this, "client", void 0);
|
|
79
|
+
_define_property(this, "connect", void 0);
|
|
80
|
+
_define_property(this, "keycloakConfig", void 0);
|
|
81
|
+
_define_property(this, "openAbout", void 0);
|
|
82
|
+
_define_property(this, "openOnboarding", void 0);
|
|
83
|
+
_define_property(this, "openProfile", void 0);
|
|
84
|
+
_define_property(this, "openSIWE", void 0);
|
|
85
|
+
_define_property(this, "openSwitchNetworks", void 0);
|
|
86
|
+
_define_property(this, "signOut", void 0);
|
|
87
|
+
_define_property(this, "walletClient", void 0);
|
|
88
|
+
(0, import_render.render)({
|
|
89
|
+
...options,
|
|
90
|
+
onAddresses: function onAddresses(addresses) {
|
|
91
|
+
var _options_onAddresses;
|
|
92
|
+
_this.addresses = addresses;
|
|
93
|
+
if (!addresses.length) _this.walletClient = void 0;
|
|
94
|
+
options === null || options === void 0 ? void 0 : (_options_onAddresses = options.onAddresses) === null || _options_onAddresses === void 0 ? void 0 : _options_onAddresses.call(options, addresses);
|
|
95
|
+
},
|
|
96
|
+
onSetOpenAbout: function onSetOpenAbout(openAbout) {
|
|
97
|
+
_this.openAbout = openAbout;
|
|
98
|
+
},
|
|
99
|
+
onSetOpenOnboarding: function onSetOpenOnboarding(openOnboarding) {
|
|
100
|
+
_this.openOnboarding = openOnboarding;
|
|
101
|
+
},
|
|
102
|
+
onSetOpenProfile: function onSetOpenProfile(openProfile) {
|
|
103
|
+
_this.openProfile = _this._asyncTrigger(openProfile);
|
|
104
|
+
},
|
|
105
|
+
onSetOpenSIWE: function onSetOpenSIWE(openSIWE) {
|
|
106
|
+
_this.openSIWE = _this._asyncTrigger(openSIWE);
|
|
107
|
+
},
|
|
108
|
+
onSetConnect: function onSetConnect(connect) {
|
|
109
|
+
_this.connect = _this._asyncTrigger(connect);
|
|
110
|
+
},
|
|
111
|
+
onSetOpenSwitchNetworks: function onSetOpenSwitchNetworks(openSwitchNetworks) {
|
|
112
|
+
_this.openSwitchNetworks = openSwitchNetworks;
|
|
113
|
+
},
|
|
114
|
+
onSetSignOut: function onSetSignOut(signOut) {
|
|
115
|
+
_this.signOut = signOut;
|
|
116
|
+
},
|
|
117
|
+
onSetClient: function onSetClient(client) {
|
|
118
|
+
_this.client = client;
|
|
119
|
+
},
|
|
120
|
+
onSetWalletClient: function onSetWalletClient(walletClient) {
|
|
121
|
+
_this.walletClient = walletClient;
|
|
122
|
+
if (walletClient) {
|
|
123
|
+
_this._walletClientResolvers.forEach(function (resolve) {
|
|
124
|
+
return resolve(null);
|
|
125
|
+
});
|
|
126
|
+
_this._walletClientResolvers = [];
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
this.keycloakConfig = {
|
|
131
|
+
...(options === null || options === void 0 ? void 0 : options.keycloak),
|
|
132
|
+
...(typeof (options === null || options === void 0 ? void 0 : (_options_keycloak = options.keycloak) === null || _options_keycloak === void 0 ? void 0 : _options_keycloak.baseUrl) !== "undefined" ? {
|
|
133
|
+
baseUrl: options === null || options === void 0 ? void 0 : (_options_keycloak1 = options.keycloak) === null || _options_keycloak1 === void 0 ? void 0 : _options_keycloak1.baseUrl
|
|
134
|
+
} : {
|
|
135
|
+
baseUrl: "http://localhost:8080"
|
|
136
|
+
}),
|
|
137
|
+
...(typeof (options === null || options === void 0 ? void 0 : (_options_keycloak2 = options.keycloak) === null || _options_keycloak2 === void 0 ? void 0 : _options_keycloak2.clientId) !== "undefined" ? {
|
|
138
|
+
clientId: options === null || options === void 0 ? void 0 : (_options_keycloak3 = options.keycloak) === null || _options_keycloak3 === void 0 ? void 0 : _options_keycloak3.clientId
|
|
139
|
+
} : {
|
|
140
|
+
clientId: "app"
|
|
141
|
+
}),
|
|
142
|
+
...(typeof (options === null || options === void 0 ? void 0 : (_options_keycloak4 = options.keycloak) === null || _options_keycloak4 === void 0 ? void 0 : _options_keycloak4.realm) !== "undefined" ? {
|
|
143
|
+
realm: options === null || options === void 0 ? void 0 : (_options_keycloak5 = options.keycloak) === null || _options_keycloak5 === void 0 ? void 0 : _options_keycloak5.realm
|
|
144
|
+
} : {
|
|
145
|
+
realm: "main"
|
|
146
|
+
}),
|
|
147
|
+
...(typeof (options === null || options === void 0 ? void 0 : (_options_keycloak6 = options.keycloak) === null || _options_keycloak6 === void 0 ? void 0 : _options_keycloak6.scope) !== "undefined" ? {
|
|
148
|
+
scope: options === null || options === void 0 ? void 0 : (_options_keycloak7 = options.keycloak) === null || _options_keycloak7 === void 0 ? void 0 : _options_keycloak7.scope
|
|
149
|
+
} : {
|
|
150
|
+
scope: []
|
|
151
|
+
})
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
_create_class(SiweKeycloak2, [{
|
|
155
|
+
key: "_asyncTrigger",
|
|
156
|
+
value: function _asyncTrigger(trigger) {
|
|
157
|
+
var _this = this;
|
|
158
|
+
return async function () {
|
|
159
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
160
|
+
args[_key] = arguments[_key];
|
|
161
|
+
}
|
|
162
|
+
await new Promise(function (resolve, reject) {
|
|
163
|
+
try {
|
|
164
|
+
_this._walletClientResolvers.push(resolve);
|
|
165
|
+
trigger(...args);
|
|
166
|
+
if (_this.walletClient) return resolve(null);
|
|
167
|
+
} catch (err) {
|
|
168
|
+
reject(err);
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
}, {
|
|
174
|
+
key: "getNonce",
|
|
175
|
+
value: async function getNonce1() {
|
|
176
|
+
return (0, import_util.getNonce)(`${this.keycloakConfig.baseUrl}/realms/${this.keycloakConfig.realm || "main"}/siwe`);
|
|
177
|
+
}
|
|
178
|
+
}, {
|
|
179
|
+
key: "createMessage",
|
|
180
|
+
value: async function createMessage1(address) {
|
|
181
|
+
var _this_client;
|
|
182
|
+
if (!((_this_client = this.client) === null || _this_client === void 0 ? void 0 : _this_client.chain.id)) return;
|
|
183
|
+
var nonce = await this.getNonce();
|
|
184
|
+
return (0, import_util.createMessage)(nonce, address, this.client.chain.id);
|
|
185
|
+
}
|
|
186
|
+
}]);
|
|
187
|
+
return SiweKeycloak2;
|
|
188
|
+
}();
|
|
189
|
+
//# sourceMappingURL=index.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","index_exports","__export","SiweKeycloak","module","exports","import_render","require","import_util","__reExport","_class_call_check","instance","Constructor","TypeError","_defineProperties","target","props","i","length","descriptor","enumerable","configurable","writable","Object","defineProperty","key","_create_class","protoProps","staticProps","prototype","_define_property","obj","SiweKeycloak2","options","_this","_options_keycloak","_options_keycloak1","_options_keycloak2","_options_keycloak3","_options_keycloak4","_options_keycloak5","_options_keycloak6","_options_keycloak7","render","onAddresses","addresses","_options_onAddresses","walletClient","call","onSetOpenAbout","openAbout","onSetOpenOnboarding","openOnboarding","onSetOpenProfile","openProfile","_asyncTrigger","onSetOpenSIWE","openSIWE","onSetConnect","connect","onSetOpenSwitchNetworks","openSwitchNetworks","onSetSignOut","signOut","onSetClient","client","onSetWalletClient","_walletClientResolvers","forEach","resolve"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"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","ignoreList":[]}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: true
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
16
|
+
get: () => from[key],
|
|
17
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
23
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
24
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
25
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
26
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
27
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
28
|
+
value: mod,
|
|
29
|
+
enumerable: true
|
|
30
|
+
}) : target, mod));
|
|
31
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
32
|
+
value: true
|
|
33
|
+
}), mod);
|
|
34
|
+
var render_exports = {};
|
|
35
|
+
__export(render_exports, {
|
|
36
|
+
render: () => render
|
|
37
|
+
});
|
|
38
|
+
module.exports = __toCommonJS(render_exports);
|
|
39
|
+
var import_react = __toESM(require("react"));
|
|
40
|
+
var import_client = require("react-dom/client");
|
|
41
|
+
var import__ = require("./index.cjs");
|
|
42
|
+
var import_siwe = require("./siwe.cjs");
|
|
43
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
44
|
+
function render({
|
|
45
|
+
element,
|
|
46
|
+
onAddresses,
|
|
47
|
+
onSetClient,
|
|
48
|
+
onSetConnect,
|
|
49
|
+
onSetOpenAbout,
|
|
50
|
+
onSetOpenOnboarding,
|
|
51
|
+
onSetOpenProfile,
|
|
52
|
+
onSetOpenSIWE,
|
|
53
|
+
onSetOpenSwitchNetworks,
|
|
54
|
+
onSetSignOut,
|
|
55
|
+
onSetWalletClient,
|
|
56
|
+
setTokens: _setTokens,
|
|
57
|
+
...props
|
|
58
|
+
}) {
|
|
59
|
+
if (!element) element = document.createElement("div");
|
|
60
|
+
if (!element) return;
|
|
61
|
+
window.React = import_react.default;
|
|
62
|
+
const root = (0, import_client.createRoot)(element);
|
|
63
|
+
root.render(/* @__PURE__ */(0, import_jsx_runtime.jsx)(import__.SiweKeycloakProvider, {
|
|
64
|
+
...props,
|
|
65
|
+
children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_siwe.Siwe, {
|
|
66
|
+
onAddresses,
|
|
67
|
+
onSetClient,
|
|
68
|
+
onSetConnect,
|
|
69
|
+
onSetOpenAbout,
|
|
70
|
+
onSetOpenOnboarding,
|
|
71
|
+
onSetOpenProfile,
|
|
72
|
+
onSetOpenSIWE,
|
|
73
|
+
onSetOpenSwitchNetworks,
|
|
74
|
+
onSetSignOut,
|
|
75
|
+
onSetWalletClient
|
|
76
|
+
})
|
|
77
|
+
}));
|
|
78
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all) __defProp(target, name, {
|
|
11
|
+
get: all[name],
|
|
12
|
+
enumerable: true
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
var __copyProps = (to, from, except, desc) => {
|
|
16
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
17
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
18
|
+
get: () => from[key],
|
|
19
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return to;
|
|
23
|
+
};
|
|
24
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
25
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
26
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
27
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
28
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
29
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
30
|
+
value: mod,
|
|
31
|
+
enumerable: true
|
|
32
|
+
}) : target, mod));
|
|
33
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
34
|
+
value: true
|
|
35
|
+
}), mod);
|
|
36
|
+
var render_exports = {};
|
|
37
|
+
__export(render_exports, {
|
|
38
|
+
render: () => render
|
|
39
|
+
});
|
|
40
|
+
module.exports = __toCommonJS(render_exports);
|
|
41
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
42
|
+
var import_react = __toESM(require("react"));
|
|
43
|
+
var import_client = require("react-dom/client");
|
|
44
|
+
var import__ = require("./index.native.js");
|
|
45
|
+
var import_siwe = require("./siwe.native.js");
|
|
46
|
+
function render(param) {
|
|
47
|
+
var {
|
|
48
|
+
element,
|
|
49
|
+
onAddresses,
|
|
50
|
+
onSetClient,
|
|
51
|
+
onSetConnect,
|
|
52
|
+
onSetOpenAbout,
|
|
53
|
+
onSetOpenOnboarding,
|
|
54
|
+
onSetOpenProfile,
|
|
55
|
+
onSetOpenSIWE,
|
|
56
|
+
onSetOpenSwitchNetworks,
|
|
57
|
+
onSetSignOut,
|
|
58
|
+
onSetWalletClient,
|
|
59
|
+
setTokens: _setTokens,
|
|
60
|
+
...props
|
|
61
|
+
} = param;
|
|
62
|
+
if (!element) element = document.createElement("div");
|
|
63
|
+
if (!element) return;
|
|
64
|
+
window.React = import_react.default;
|
|
65
|
+
var root = (0, import_client.createRoot)(element);
|
|
66
|
+
root.render(/* @__PURE__ */(0, import_jsx_runtime.jsx)(import__.SiweKeycloakProvider, {
|
|
67
|
+
...props,
|
|
68
|
+
children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_siwe.Siwe, {
|
|
69
|
+
onAddresses,
|
|
70
|
+
onSetClient,
|
|
71
|
+
onSetConnect,
|
|
72
|
+
onSetOpenAbout,
|
|
73
|
+
onSetOpenOnboarding,
|
|
74
|
+
onSetOpenProfile,
|
|
75
|
+
onSetOpenSIWE,
|
|
76
|
+
onSetOpenSwitchNetworks,
|
|
77
|
+
onSetSignOut,
|
|
78
|
+
onSetWalletClient
|
|
79
|
+
})
|
|
80
|
+
}));
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=render.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","render_exports","__export","render","module","exports","import_jsx_runtime","require","import_react","__toESM","import_client","import__","import_siwe","param","element","onAddresses","onSetClient","onSetConnect","onSetOpenAbout","onSetOpenOnboarding","onSetOpenProfile","onSetOpenSIWE","onSetOpenSwitchNetworks","onSetSignOut","onSetWalletClient","setTokens","_setTokens","props","document","createElement","window","React","default","root","createRoot","jsx","SiweKeycloakProvider","children","Siwe"],"sources":["../../src/render.tsx"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,cAAA;AAAAC,QAAA,CAAAD,cAAA;EAAAE,MAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAT,YAAkB,CAAAK,cAAA;AAClB,IAAAK,kBAA2B,GAAAC,OAAA;AAC3B,IAAAC,YAAqC,GAAAC,OAAA,CAAAF,OAAA;AAErC,IAAAG,aAAA,GAAqBH,OAAA;AA4Bf,IAAAI,QAAA,GAAAJ,OAAA;AArBC,IAAAK,WAAS,GAAOL,OAAA;AAAA,SACrBJ,OAAAU,KAAA;EACA;IAAAC,OAAA;IAAAC,WAAA;IAAAC,WAAA;IAAAC,YAAA;IAAAC,cAAA;IAAAC,mBAAA;IAAAC,gBAAA;IAAAC,aAAA;IAAAC,uBAAA;IAAAC,YAAA;IAAAC,iBAAA;IAAAC,SAAA,EAAAC,UAAA;IAAA,GAAAC;EAAA,IAAAd,KAAA;EACA,KAAAC,OAAA,EAAAA,OAAA,GAAAc,QAAA,CAAAC,aAAA;EACA,KAAAf,OAAA;EACAgB,MAAA,CAAAC,KAAA,GAAAvB,YAAA,CAAAwB,OAAA;EACA,IAAAC,IAAA,OAAAvB,aAAA,CAAAwB,UAAA,EAAApB,OAAA;EACAmB,IAAA,CAAA9B,MAAA,oBAAAG,kBAAA,CAAA6B,GAAA,EAAAxB,QAAA,CAAAyB,oBAAA;IACA,GAAAT,KAAA;IACAU,QAAA,qBAAA/B,kBAAA,CAAA6B,GAAA,EAAAvB,WAAA,CAAA0B,IAAA;MACAvB,WAAA;MACAC,WAAA;MACAC,YAAW;MACRC,cAAA;MACaC,mBAAA;MACZC,gBAAU;MACVC,aAAU;MACdC,uBAAe;MACfC,YAAM;MACNC;IACE;EACE;AAAC","ignoreList":[]}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all) __defProp(target, name, {
|
|
7
|
+
get: all[name],
|
|
8
|
+
enumerable: true
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
14
|
+
get: () => from[key],
|
|
15
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
21
|
+
value: true
|
|
22
|
+
}), mod);
|
|
23
|
+
var siwe_exports = {};
|
|
24
|
+
__export(siwe_exports, {
|
|
25
|
+
Siwe: () => Siwe
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(siwe_exports);
|
|
28
|
+
var import_react = require("react");
|
|
29
|
+
var import_wagmi = require("wagmi");
|
|
30
|
+
var import_useSiweKeycloak = require("./hooks/useSiweKeycloak.cjs");
|
|
31
|
+
function Siwe({
|
|
32
|
+
onSetOpenAbout,
|
|
33
|
+
onSetOpenOnboarding,
|
|
34
|
+
onSetOpenProfile,
|
|
35
|
+
onSetOpenSIWE,
|
|
36
|
+
onSetOpenSwitchNetworks,
|
|
37
|
+
onSetSignOut,
|
|
38
|
+
onSetClient,
|
|
39
|
+
onSetWalletClient,
|
|
40
|
+
onSetConnect,
|
|
41
|
+
onAddresses
|
|
42
|
+
}) {
|
|
43
|
+
const {
|
|
44
|
+
addresses
|
|
45
|
+
} = (0, import_wagmi.useAccount)();
|
|
46
|
+
const {
|
|
47
|
+
data: walletClient
|
|
48
|
+
} = (0, import_wagmi.useWalletClient)();
|
|
49
|
+
const client = (0, import_wagmi.useClient)();
|
|
50
|
+
const {
|
|
51
|
+
openAbout,
|
|
52
|
+
openOnboarding,
|
|
53
|
+
openProfile,
|
|
54
|
+
openSIWE,
|
|
55
|
+
openSwitchNetworks,
|
|
56
|
+
signOut,
|
|
57
|
+
connect
|
|
58
|
+
} = (0, import_useSiweKeycloak.useSiweKeycloak)();
|
|
59
|
+
(0, import_react.useEffect)(() => onSetOpenAbout(openAbout), [onSetOpenAbout, openAbout]);
|
|
60
|
+
(0, import_react.useEffect)(() => onSetOpenOnboarding(openOnboarding), [onSetOpenOnboarding, openOnboarding]);
|
|
61
|
+
(0, import_react.useEffect)(() => onSetOpenProfile(openProfile), [onSetOpenProfile, openProfile]);
|
|
62
|
+
(0, import_react.useEffect)(() => onSetOpenSIWE(openSIWE), [onSetOpenSIWE, openSIWE]);
|
|
63
|
+
(0, import_react.useEffect)(() => onSetOpenSwitchNetworks(openSwitchNetworks), [onSetOpenSwitchNetworks, openSwitchNetworks]);
|
|
64
|
+
(0, import_react.useEffect)(() => onSetSignOut(signOut), [onSetSignOut, signOut]);
|
|
65
|
+
(0, import_react.useEffect)(() => {
|
|
66
|
+
if (walletClient) onSetWalletClient(walletClient);
|
|
67
|
+
}, [onSetWalletClient, walletClient]);
|
|
68
|
+
(0, import_react.useEffect)(() => {
|
|
69
|
+
if (client) onSetClient(client);
|
|
70
|
+
}, [onSetClient, client]);
|
|
71
|
+
(0, import_react.useEffect)(() => {
|
|
72
|
+
onSetConnect(connect);
|
|
73
|
+
}, [onSetConnect, connect]);
|
|
74
|
+
(0, import_react.useEffect)(() => onAddresses?.(addresses || []), [onAddresses, addresses?.length]);
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: true
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
16
|
+
get: () => from[key],
|
|
17
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
23
|
+
value: true
|
|
24
|
+
}), mod);
|
|
25
|
+
var siwe_exports = {};
|
|
26
|
+
__export(siwe_exports, {
|
|
27
|
+
Siwe: () => Siwe
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(siwe_exports);
|
|
30
|
+
var import_react = require("react");
|
|
31
|
+
var import_wagmi = require("wagmi");
|
|
32
|
+
var import_useSiweKeycloak = require("./hooks/useSiweKeycloak.native.js");
|
|
33
|
+
function Siwe(param) {
|
|
34
|
+
var {
|
|
35
|
+
onSetOpenAbout,
|
|
36
|
+
onSetOpenOnboarding,
|
|
37
|
+
onSetOpenProfile,
|
|
38
|
+
onSetOpenSIWE,
|
|
39
|
+
onSetOpenSwitchNetworks,
|
|
40
|
+
onSetSignOut,
|
|
41
|
+
onSetClient,
|
|
42
|
+
onSetWalletClient,
|
|
43
|
+
onSetConnect,
|
|
44
|
+
onAddresses
|
|
45
|
+
} = param;
|
|
46
|
+
var {
|
|
47
|
+
addresses
|
|
48
|
+
} = (0, import_wagmi.useAccount)();
|
|
49
|
+
var {
|
|
50
|
+
data: walletClient
|
|
51
|
+
} = (0, import_wagmi.useWalletClient)();
|
|
52
|
+
var client = (0, import_wagmi.useClient)();
|
|
53
|
+
var {
|
|
54
|
+
openAbout,
|
|
55
|
+
openOnboarding,
|
|
56
|
+
openProfile,
|
|
57
|
+
openSIWE,
|
|
58
|
+
openSwitchNetworks,
|
|
59
|
+
signOut,
|
|
60
|
+
connect
|
|
61
|
+
} = (0, import_useSiweKeycloak.useSiweKeycloak)();
|
|
62
|
+
(0, import_react.useEffect)(function () {
|
|
63
|
+
return onSetOpenAbout(openAbout);
|
|
64
|
+
}, [onSetOpenAbout, openAbout]);
|
|
65
|
+
(0, import_react.useEffect)(function () {
|
|
66
|
+
return onSetOpenOnboarding(openOnboarding);
|
|
67
|
+
}, [onSetOpenOnboarding, openOnboarding]);
|
|
68
|
+
(0, import_react.useEffect)(function () {
|
|
69
|
+
return onSetOpenProfile(openProfile);
|
|
70
|
+
}, [onSetOpenProfile, openProfile]);
|
|
71
|
+
(0, import_react.useEffect)(function () {
|
|
72
|
+
return onSetOpenSIWE(openSIWE);
|
|
73
|
+
}, [onSetOpenSIWE, openSIWE]);
|
|
74
|
+
(0, import_react.useEffect)(function () {
|
|
75
|
+
return onSetOpenSwitchNetworks(openSwitchNetworks);
|
|
76
|
+
}, [onSetOpenSwitchNetworks, openSwitchNetworks]);
|
|
77
|
+
(0, import_react.useEffect)(function () {
|
|
78
|
+
return onSetSignOut(signOut);
|
|
79
|
+
}, [onSetSignOut, signOut]);
|
|
80
|
+
(0, import_react.useEffect)(function () {
|
|
81
|
+
if (walletClient) onSetWalletClient(walletClient);
|
|
82
|
+
}, [onSetWalletClient, walletClient]);
|
|
83
|
+
(0, import_react.useEffect)(function () {
|
|
84
|
+
if (client) onSetClient(client);
|
|
85
|
+
}, [onSetClient, client]);
|
|
86
|
+
(0, import_react.useEffect)(function () {
|
|
87
|
+
onSetConnect(connect);
|
|
88
|
+
}, [onSetConnect, connect]);
|
|
89
|
+
(0, import_react.useEffect)(function () {
|
|
90
|
+
return onAddresses === null || onAddresses === void 0 ? void 0 : onAddresses(addresses || []);
|
|
91
|
+
}, [onAddresses, addresses === null || addresses === void 0 ? void 0 : addresses.length]);
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=siwe.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","siwe_exports","__export","Siwe","module","exports","import_react","require","import_wagmi","import_useSiweKeycloak","param","onSetOpenAbout","onSetOpenOnboarding","onSetOpenProfile","onSetOpenSIWE","onSetOpenSwitchNetworks","onSetSignOut","onSetClient","onSetWalletClient","onSetConnect","onAddresses","addresses","useAccount","data","walletClient","useWalletClient","client","useClient","openAbout","openOnboarding","openProfile","openSIWE","openSwitchNetworks","signOut","connect","useSiweKeycloak","useEffect"],"sources":["../../src/siwe.tsx"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,YAAA;AAAAC,QAAA,CAAAD,YAAA;EAAAE,IAAA,EAAAA,CAAA,KAAAA;AAAA;AACAC,MAAA,CAAAC,OAAA,GAAAT,YAA0B,CAAAK,YAAA;AAE1B,IAAAK,YAAA,GAAiFC,OAAA;AACjF,IAAAC,YAAA,GAAAD,OAAA,QAAgC;AAezB,IAAAE,sBAAc,GAAAF,OAAA;AAAA,SACnBJ,KAAAO,KAAA;EACA;IAAAC,cAAA;IAAAC,mBAAA;IAAAC,gBAAA;IAAAC,aAAA;IAAAC,uBAAA;IAAAC,YAAA;IAAAC,WAAA;IAAAC,iBAAA;IAAAC,YAAA;IAAAC;EAAA,IAAAV,KAAA;EACA;IAAAW;EAAA,QAAAb,YAAA,CAAAc,UAAA;EACA;IAAAC,IAAA,EAAAC;EAAA,QAAAhB,YAAA,CAAAiB,eAAA;EACA,IAAAC,MAAA,OAAAlB,YAAA,CAAAmB,SAAA;EACA;IAAAC,SAAA;IAAAC,cAAA;IAAAC,WAAA;IAAAC,QAAA;IAAAC,kBAAA;IAAAC,OAAA;IAAAC;EAAA,QAAAzB,sBAAA,CAAA0B,eAAA;EACA,IAAA7B,YAAA,CAAA8B,SAAA;IACA,OAAAzB,cAAA,CAAAiB,SAAA;EACA,IACAjB,cAAA,EACYiB,SAAA,CACZ;EACA,IAAAtB,YAAc,CAAA8B,SAAA,EAAa,YAAI;IAC/B,OAAMxB,mBAAS,CAAAiB,cAAU;EACzB,IAEAjB,mBAAA,EACAiB,cAAA,CACA;EACA,IAAAvB,YAAA,CAAA8B,SAAA,EAAU,YAAM;IAChB,OAAAvB,gBAAA,CAAAiB,WAAA;EAAA,GACE,CACAjB,gBAAC,EACHiB,WAAA,CACA;EACA,IAAAxB,YAAA,CAAA8B,SAAA,EAAU,YAAM;IACd,OAAItB,aAAc,CAAAiB,QAAA;EACpB,GAAG,CACHjB,aAAA,EACEiB,QAAI,CACN;EACA,IAAAzB,YAAA,CAAA8B,SAAA,EAAU,YAAM;IACd,OAAArB,uBAAoB,CAAAiB,kBAAA;EACtB,GAAG,CACHjB,uBAAA,EACAiB,kBAAO,CACT","ignoreList":[]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
8
|
+
get: () => from[key],
|
|
9
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
}), mod);
|
|
17
|
+
var types_exports = {};
|
|
18
|
+
module.exports = __toCommonJS(types_exports);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __copyProps = (to, from, except, desc) => {
|
|
8
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
9
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
10
|
+
get: () => from[key],
|
|
11
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
return to;
|
|
15
|
+
};
|
|
16
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
17
|
+
value: true
|
|
18
|
+
}), mod);
|
|
19
|
+
var types_exports = {};
|
|
20
|
+
module.exports = __toCommonJS(types_exports);
|
|
21
|
+
//# sourceMappingURL=types.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","types_exports"],"sources":["../../src/types.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,aAAA","ignoreList":[]}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all) __defProp(target, name, {
|
|
7
|
+
get: all[name],
|
|
8
|
+
enumerable: true
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
14
|
+
get: () => from[key],
|
|
15
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
21
|
+
value: true
|
|
22
|
+
}), mod);
|
|
23
|
+
var util_exports = {};
|
|
24
|
+
__export(util_exports, {
|
|
25
|
+
createMessage: () => createMessage,
|
|
26
|
+
getNonce: () => getNonce
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(util_exports);
|
|
29
|
+
var import_siwe = require("siwe");
|
|
30
|
+
async function getNonce(keycloakSiweUrl) {
|
|
31
|
+
const res = await fetch(`${keycloakSiweUrl}/nonce`, {
|
|
32
|
+
credentials: "include"
|
|
33
|
+
});
|
|
34
|
+
if (res.ok) {
|
|
35
|
+
const data = await res.text();
|
|
36
|
+
if (data?.length) return data;
|
|
37
|
+
}
|
|
38
|
+
throw new Error("failed to get nonce");
|
|
39
|
+
}
|
|
40
|
+
async function createMessage(nonce, address, chainId) {
|
|
41
|
+
if (typeof window === "undefined") {
|
|
42
|
+
throw new Error("createMessage requires browser context");
|
|
43
|
+
}
|
|
44
|
+
return new import_siwe.SiweMessage({
|
|
45
|
+
version: "1",
|
|
46
|
+
domain: window.location.host,
|
|
47
|
+
uri: window.location.origin,
|
|
48
|
+
address,
|
|
49
|
+
chainId,
|
|
50
|
+
nonce,
|
|
51
|
+
statement: "Sign in With Ethereum."
|
|
52
|
+
}).prepareMessage();
|
|
53
|
+
}
|