@multiplatform.one/web3 5.0.28 → 5.1.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/cjs/connectkit/components/Common/Button/index.cjs +1 -0
- package/dist/cjs/connectkit/components/Common/Button/index.native.js +3 -0
- package/dist/cjs/connectkit/components/Common/Button/index.native.js.map +1 -1
- package/dist/cjs/connectkit/components/Common/Modal/index.cjs +3 -0
- package/dist/cjs/connectkit/components/Common/Modal/index.native.js +3 -0
- package/dist/cjs/connectkit/components/Common/Modal/index.native.js.map +1 -1
- package/dist/cjs/connectkit/components/ConnectKit.cjs +4 -1
- package/dist/cjs/connectkit/components/ConnectKit.native.js +6 -3
- package/dist/cjs/connectkit/components/ConnectKit.native.js.map +1 -1
- package/dist/cjs/connectkit/components/ConnectModal/index.cjs +8 -3
- package/dist/cjs/connectkit/components/ConnectModal/index.native.js +8 -3
- package/dist/cjs/connectkit/components/ConnectModal/index.native.js.map +1 -1
- package/dist/cjs/connectkit/components/Pages/SignInWithGpg/index.cjs +146 -0
- package/dist/cjs/connectkit/components/Pages/SignInWithGpg/index.native.js +162 -0
- package/dist/cjs/connectkit/components/Pages/SignInWithGpg/index.native.js.map +1 -0
- package/dist/cjs/connectkit/components/Standard/GPG/index.cjs +69 -0
- package/dist/cjs/connectkit/components/Standard/GPG/index.native.js +80 -0
- package/dist/cjs/connectkit/components/Standard/GPG/index.native.js.map +1 -0
- package/dist/cjs/connectkit/gpg/GpgContext.cjs +37 -0
- package/dist/cjs/connectkit/gpg/GpgContext.native.js +40 -0
- package/dist/cjs/connectkit/gpg/GpgContext.native.js.map +1 -0
- package/dist/cjs/connectkit/gpg/GpgProvider.cjs +112 -0
- package/dist/cjs/connectkit/gpg/GpgProvider.native.js +127 -0
- package/dist/cjs/connectkit/gpg/GpgProvider.native.js.map +1 -0
- package/dist/cjs/connectkit/gpg/index.cjs +34 -0
- package/dist/cjs/connectkit/gpg/index.native.js +37 -0
- package/dist/cjs/connectkit/gpg/index.native.js.map +1 -0
- package/dist/cjs/connectkit/gpg/useGpg.cjs +70 -0
- package/dist/cjs/connectkit/gpg/useGpg.native.js +77 -0
- package/dist/cjs/connectkit/gpg/useGpg.native.js.map +1 -0
- package/dist/cjs/connectkit/hooks/useModal.cjs +7 -3
- package/dist/cjs/connectkit/hooks/useModal.native.js +8 -2
- package/dist/cjs/connectkit/hooks/useModal.native.js.map +1 -1
- package/dist/cjs/connectkit/index.cjs +7 -0
- package/dist/cjs/connectkit/index.native.js +7 -0
- package/dist/cjs/connectkit/index.native.js.map +1 -1
- package/dist/esm/connectkit/components/Common/Button/index.mjs +1 -0
- package/dist/esm/connectkit/components/Common/Button/index.mjs.map +1 -1
- package/dist/esm/connectkit/components/Common/Button/index.native.js +3 -0
- package/dist/esm/connectkit/components/Common/Button/index.native.js.map +1 -1
- package/dist/esm/connectkit/components/Common/Modal/index.mjs +3 -0
- package/dist/esm/connectkit/components/Common/Modal/index.mjs.map +1 -1
- package/dist/esm/connectkit/components/Common/Modal/index.native.js +3 -0
- package/dist/esm/connectkit/components/Common/Modal/index.native.js.map +1 -1
- package/dist/esm/connectkit/components/ConnectKit.mjs +4 -1
- package/dist/esm/connectkit/components/ConnectKit.mjs.map +1 -1
- package/dist/esm/connectkit/components/ConnectKit.native.js +6 -3
- package/dist/esm/connectkit/components/ConnectKit.native.js.map +1 -1
- package/dist/esm/connectkit/components/ConnectModal/index.mjs +8 -3
- package/dist/esm/connectkit/components/ConnectModal/index.mjs.map +1 -1
- package/dist/esm/connectkit/components/ConnectModal/index.native.js +8 -3
- package/dist/esm/connectkit/components/ConnectModal/index.native.js.map +1 -1
- package/dist/esm/connectkit/components/Pages/SignInWithGpg/index.mjs +110 -0
- package/dist/esm/connectkit/components/Pages/SignInWithGpg/index.mjs.map +1 -0
- package/dist/esm/connectkit/components/Pages/SignInWithGpg/index.native.js +123 -0
- package/dist/esm/connectkit/components/Pages/SignInWithGpg/index.native.js.map +1 -0
- package/dist/esm/connectkit/components/Standard/GPG/index.mjs +32 -0
- package/dist/esm/connectkit/components/Standard/GPG/index.mjs.map +1 -0
- package/dist/esm/connectkit/components/Standard/GPG/index.native.js +40 -0
- package/dist/esm/connectkit/components/Standard/GPG/index.native.js.map +1 -0
- package/dist/esm/connectkit/gpg/GpgContext.mjs +11 -0
- package/dist/esm/connectkit/gpg/GpgContext.mjs.map +1 -0
- package/dist/esm/connectkit/gpg/GpgContext.native.js +11 -0
- package/dist/esm/connectkit/gpg/GpgContext.native.js.map +1 -0
- package/dist/esm/connectkit/gpg/GpgProvider.mjs +86 -0
- package/dist/esm/connectkit/gpg/GpgProvider.mjs.map +1 -0
- package/dist/esm/connectkit/gpg/GpgProvider.native.js +98 -0
- package/dist/esm/connectkit/gpg/GpgProvider.native.js.map +1 -0
- package/dist/esm/connectkit/gpg/index.mjs +5 -0
- package/dist/esm/connectkit/gpg/index.mjs.map +1 -0
- package/dist/esm/connectkit/gpg/index.native.js +5 -0
- package/dist/esm/connectkit/gpg/index.native.js.map +1 -0
- package/dist/esm/connectkit/gpg/useGpg.mjs +45 -0
- package/dist/esm/connectkit/gpg/useGpg.mjs.map +1 -0
- package/dist/esm/connectkit/gpg/useGpg.native.js +49 -0
- package/dist/esm/connectkit/gpg/useGpg.native.js.map +1 -0
- package/dist/esm/connectkit/hooks/useModal.mjs +7 -3
- package/dist/esm/connectkit/hooks/useModal.mjs.map +1 -1
- package/dist/esm/connectkit/hooks/useModal.native.js +8 -2
- package/dist/esm/connectkit/hooks/useModal.native.js.map +1 -1
- package/dist/esm/connectkit/index.mjs +7 -5
- package/dist/esm/connectkit/index.mjs.map +1 -1
- package/dist/esm/connectkit/index.native.js +7 -5
- package/dist/esm/connectkit/index.native.js.map +1 -1
- package/dist/jsx/connectkit/components/Common/Button/index.mjs +1 -0
- package/dist/jsx/connectkit/components/Common/Button/index.mjs.map +1 -1
- package/dist/jsx/connectkit/components/Common/Button/index.native.js +3 -0
- package/dist/jsx/connectkit/components/Common/Button/index.native.js.map +1 -1
- package/dist/jsx/connectkit/components/Common/Modal/index.mjs +3 -0
- package/dist/jsx/connectkit/components/Common/Modal/index.mjs.map +1 -1
- package/dist/jsx/connectkit/components/Common/Modal/index.native.js +3 -0
- package/dist/jsx/connectkit/components/Common/Modal/index.native.js.map +1 -1
- package/dist/jsx/connectkit/components/ConnectKit.mjs +4 -1
- package/dist/jsx/connectkit/components/ConnectKit.mjs.map +1 -1
- package/dist/jsx/connectkit/components/ConnectKit.native.js +6 -3
- package/dist/jsx/connectkit/components/ConnectKit.native.js.map +1 -1
- package/dist/jsx/connectkit/components/ConnectModal/index.mjs +8 -3
- package/dist/jsx/connectkit/components/ConnectModal/index.mjs.map +1 -1
- package/dist/jsx/connectkit/components/ConnectModal/index.native.js +8 -3
- package/dist/jsx/connectkit/components/ConnectModal/index.native.js.map +1 -1
- package/dist/jsx/connectkit/components/Pages/SignInWithGpg/index.mjs +110 -0
- package/dist/jsx/connectkit/components/Pages/SignInWithGpg/index.mjs.map +1 -0
- package/dist/jsx/connectkit/components/Pages/SignInWithGpg/index.native.js +162 -0
- package/dist/jsx/connectkit/components/Pages/SignInWithGpg/index.native.js.map +1 -0
- package/dist/jsx/connectkit/components/Standard/GPG/index.mjs +32 -0
- package/dist/jsx/connectkit/components/Standard/GPG/index.mjs.map +1 -0
- package/dist/jsx/connectkit/components/Standard/GPG/index.native.js +80 -0
- package/dist/jsx/connectkit/components/Standard/GPG/index.native.js.map +1 -0
- package/dist/jsx/connectkit/gpg/GpgContext.mjs +11 -0
- package/dist/jsx/connectkit/gpg/GpgContext.mjs.map +1 -0
- package/dist/jsx/connectkit/gpg/GpgContext.native.js +40 -0
- package/dist/jsx/connectkit/gpg/GpgContext.native.js.map +1 -0
- package/dist/jsx/connectkit/gpg/GpgProvider.mjs +86 -0
- package/dist/jsx/connectkit/gpg/GpgProvider.mjs.map +1 -0
- package/dist/jsx/connectkit/gpg/GpgProvider.native.js +127 -0
- package/dist/jsx/connectkit/gpg/GpgProvider.native.js.map +1 -0
- package/dist/jsx/connectkit/gpg/index.mjs +5 -0
- package/dist/jsx/connectkit/gpg/index.mjs.map +1 -0
- package/dist/jsx/connectkit/gpg/index.native.js +37 -0
- package/dist/jsx/connectkit/gpg/index.native.js.map +1 -0
- package/dist/jsx/connectkit/gpg/useGpg.mjs +45 -0
- package/dist/jsx/connectkit/gpg/useGpg.mjs.map +1 -0
- package/dist/jsx/connectkit/gpg/useGpg.native.js +77 -0
- package/dist/jsx/connectkit/gpg/useGpg.native.js.map +1 -0
- package/dist/jsx/connectkit/hooks/useModal.mjs +7 -3
- package/dist/jsx/connectkit/hooks/useModal.mjs.map +1 -1
- package/dist/jsx/connectkit/hooks/useModal.native.js +8 -2
- package/dist/jsx/connectkit/hooks/useModal.native.js.map +1 -1
- package/dist/jsx/connectkit/index.mjs +7 -5
- package/dist/jsx/connectkit/index.mjs.map +1 -1
- package/dist/jsx/connectkit/index.native.js +7 -0
- package/dist/jsx/connectkit/index.native.js.map +1 -1
- package/package.json +1 -1
- package/src/connectkit/components/Common/Button/index.tsx +3 -0
- package/src/connectkit/components/Common/Modal/index.tsx +3 -0
- package/src/connectkit/components/ConnectKit.tsx +4 -0
- package/src/connectkit/components/ConnectModal/index.tsx +10 -2
- package/src/connectkit/components/Pages/SignInWithGpg/index.tsx +102 -0
- package/src/connectkit/components/Standard/GPG/index.tsx +37 -0
- package/src/connectkit/gpg/GpgContext.tsx +49 -0
- package/src/connectkit/gpg/GpgProvider.tsx +131 -0
- package/src/connectkit/gpg/index.ts +4 -0
- package/src/connectkit/gpg/useGpg.ts +57 -0
- package/src/connectkit/hooks/useModal.ts +10 -1
- package/src/connectkit/index.ts +11 -0
|
@@ -0,0 +1,162 @@
|
|
|
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 SignInWithGpg_exports = {};
|
|
37
|
+
__export(SignInWithGpg_exports, {
|
|
38
|
+
default: () => SignInWithGpg_default
|
|
39
|
+
});
|
|
40
|
+
module.exports = __toCommonJS(SignInWithGpg_exports);
|
|
41
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
42
|
+
var import_react = __toESM(require("react"));
|
|
43
|
+
var import_ConnectKit = require("../../ConnectKit.native.js");
|
|
44
|
+
var import_styles = require("../../Common/Modal/styles.native.js");
|
|
45
|
+
var import_Button = __toESM(require("../../Common/Button/index.native.js"));
|
|
46
|
+
var import_CopyToClipboard = __toESM(require("../../Common/CopyToClipboard/index.native.js"));
|
|
47
|
+
var import_gpg = require("../../../gpg/index.native.js");
|
|
48
|
+
function _instanceof(left, right) {
|
|
49
|
+
"@swc/helpers - instanceof";
|
|
50
|
+
|
|
51
|
+
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
52
|
+
return !!right[Symbol.hasInstance](left);
|
|
53
|
+
} else {
|
|
54
|
+
return left instanceof right;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
var textarea = {
|
|
58
|
+
width: "100%",
|
|
59
|
+
boxSizing: "border-box",
|
|
60
|
+
fontFamily: "var(--ck-font-family, monospace)",
|
|
61
|
+
fontSize: 11,
|
|
62
|
+
lineHeight: 1.4,
|
|
63
|
+
padding: 8,
|
|
64
|
+
borderRadius: "var(--ck-primary-button-border-radius, 12px)",
|
|
65
|
+
border: "1px solid var(--ck-body-divider, #d3d3d3)",
|
|
66
|
+
background: "var(--ck-body-background-secondary, #f6f7f9)",
|
|
67
|
+
color: "var(--ck-body-color, inherit)",
|
|
68
|
+
resize: "vertical"
|
|
69
|
+
};
|
|
70
|
+
var label = {
|
|
71
|
+
textAlign: "left",
|
|
72
|
+
fontSize: 14,
|
|
73
|
+
fontWeight: 500,
|
|
74
|
+
margin: "4px 0"
|
|
75
|
+
};
|
|
76
|
+
var SignInWithGpg = function SignInWithGpg2() {
|
|
77
|
+
var context = (0, import_ConnectKit.useContext)();
|
|
78
|
+
var {
|
|
79
|
+
message,
|
|
80
|
+
command,
|
|
81
|
+
signIn,
|
|
82
|
+
isLoading,
|
|
83
|
+
isReady
|
|
84
|
+
} = (0, import_gpg.useGpg)();
|
|
85
|
+
var [pasted, setPasted] = (0, import_react.useState)("");
|
|
86
|
+
var [error, setError] = (0, import_react.useState)(null);
|
|
87
|
+
var [busy, setBusy] = (0, import_react.useState)(false);
|
|
88
|
+
var onSubmit = async function onSubmit2() {
|
|
89
|
+
setError(null);
|
|
90
|
+
setBusy(true);
|
|
91
|
+
try {
|
|
92
|
+
await signIn(pasted);
|
|
93
|
+
setTimeout(function () {
|
|
94
|
+
return context.setOpen(false);
|
|
95
|
+
}, 1e3);
|
|
96
|
+
} catch (e) {
|
|
97
|
+
setError(_instanceof(e, Error) ? e.message : "GPG sign-in failed");
|
|
98
|
+
setBusy(false);
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_styles.PageContent, {
|
|
102
|
+
style: {
|
|
103
|
+
width: 320
|
|
104
|
+
},
|
|
105
|
+
children: /* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_styles.ModalContent, {
|
|
106
|
+
style: {
|
|
107
|
+
paddingBottom: 8,
|
|
108
|
+
gap: 6
|
|
109
|
+
},
|
|
110
|
+
children: [/* @__PURE__ */(0, import_jsx_runtime.jsx)(import_styles.ModalBody, {
|
|
111
|
+
style: label,
|
|
112
|
+
children: "1. Sign the challenge in your terminal:"
|
|
113
|
+
}), /* @__PURE__ */(0, import_jsx_runtime.jsxs)("div", {
|
|
114
|
+
style: {
|
|
115
|
+
display: "flex",
|
|
116
|
+
flexDirection: "column",
|
|
117
|
+
gap: 6
|
|
118
|
+
},
|
|
119
|
+
children: [/* @__PURE__ */(0, import_jsx_runtime.jsx)(import_CopyToClipboard.default, {
|
|
120
|
+
variant: "button",
|
|
121
|
+
string: command !== null && command !== void 0 ? command : "",
|
|
122
|
+
children: "Copy gpg command"
|
|
123
|
+
}), /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_CopyToClipboard.default, {
|
|
124
|
+
variant: "button",
|
|
125
|
+
string: message !== null && message !== void 0 ? message : "",
|
|
126
|
+
children: "Copy message only"
|
|
127
|
+
})]
|
|
128
|
+
}), /* @__PURE__ */(0, import_jsx_runtime.jsx)("textarea", {
|
|
129
|
+
readOnly: true,
|
|
130
|
+
rows: 4,
|
|
131
|
+
value: message !== null && message !== void 0 ? message : isLoading ? "Loading challenge\u2026" : "",
|
|
132
|
+
style: textarea
|
|
133
|
+
}), /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_styles.ModalBody, {
|
|
134
|
+
style: label,
|
|
135
|
+
children: "2. Paste the full output below:"
|
|
136
|
+
}), /* @__PURE__ */(0, import_jsx_runtime.jsx)("textarea", {
|
|
137
|
+
rows: 6,
|
|
138
|
+
value: pasted,
|
|
139
|
+
onChange: function onChange(e) {
|
|
140
|
+
return setPasted(e.target.value);
|
|
141
|
+
},
|
|
142
|
+
placeholder: "-----BEGIN PGP SIGNATURE----- \u2026 and your -----BEGIN PGP PUBLIC KEY BLOCK-----",
|
|
143
|
+
style: textarea
|
|
144
|
+
}), /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_Button.default, {
|
|
145
|
+
onClick: onSubmit,
|
|
146
|
+
disabled: !isReady || !pasted || busy,
|
|
147
|
+
waiting: busy,
|
|
148
|
+
arrow: true,
|
|
149
|
+
children: "Sign in"
|
|
150
|
+
}), error && /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_styles.ModalBody, {
|
|
151
|
+
style: {
|
|
152
|
+
color: "var(--ck-body-color-danger, #c9190b)",
|
|
153
|
+
fontSize: 13,
|
|
154
|
+
textAlign: "left"
|
|
155
|
+
},
|
|
156
|
+
children: error
|
|
157
|
+
})]
|
|
158
|
+
})
|
|
159
|
+
});
|
|
160
|
+
};
|
|
161
|
+
var SignInWithGpg_default = SignInWithGpg;
|
|
162
|
+
//# sourceMappingURL=index.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","SignInWithGpg_exports","__export","default","SignInWithGpg_default","module","exports","import_jsx_runtime","require","import_react","__toESM","import_ConnectKit","import_styles","import_Button","import_CopyToClipboard","import_gpg","_instanceof","left","right","Symbol","hasInstance","textarea","width","boxSizing","fontFamily","fontSize","lineHeight","padding","borderRadius","border","background","color","resize","label","textAlign","fontWeight","margin","SignInWithGpg","SignInWithGpg2","context","useContext","message","command","signIn","isLoading","isReady","useGpg","pasted","setPasted","useState","error","setError","busy","setBusy","onSubmit","onSubmit2","setTimeout","setOpen","e","Error","jsx","PageContent","style","children","jsxs","ModalContent","paddingBottom","gap","ModalBody","display","flexDirection","variant","string","readOnly","rows"],"sources":["../../../../../../src/connectkit/components/Pages/SignInWithGpg/index.tsx"],"sourcesContent":[null],"mappings":"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","ignoreList":[]}
|
|
@@ -0,0 +1,69 @@
|
|
|
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 GPG_exports = {};
|
|
35
|
+
__export(GPG_exports, {
|
|
36
|
+
GPGButton: () => GPGButton,
|
|
37
|
+
default: () => GPG_default
|
|
38
|
+
});
|
|
39
|
+
module.exports = __toCommonJS(GPG_exports);
|
|
40
|
+
var import_Button = __toESM(require("../../Common/Button/index.cjs"));
|
|
41
|
+
var import_styles = require("../../../styles/index.cjs");
|
|
42
|
+
var import_useModal = require("../../../hooks/useModal.cjs");
|
|
43
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
44
|
+
const GPGButton = ({
|
|
45
|
+
children
|
|
46
|
+
}) => {
|
|
47
|
+
const {
|
|
48
|
+
openGpg
|
|
49
|
+
} = (0, import_useModal.useModal)();
|
|
50
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_Button.default, {
|
|
51
|
+
style: {
|
|
52
|
+
margin: 0
|
|
53
|
+
},
|
|
54
|
+
arrow: true,
|
|
55
|
+
onClick: e => {
|
|
56
|
+
e?.preventDefault?.();
|
|
57
|
+
openGpg();
|
|
58
|
+
},
|
|
59
|
+
children: children ?? "Sign in with GPG"
|
|
60
|
+
}, "button");
|
|
61
|
+
};
|
|
62
|
+
const GPGButtonComponent = ({
|
|
63
|
+
...props
|
|
64
|
+
}) => /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_styles.ResetContainer, {
|
|
65
|
+
children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(GPGButton, {
|
|
66
|
+
...props
|
|
67
|
+
})
|
|
68
|
+
});
|
|
69
|
+
var GPG_default = GPGButtonComponent;
|
|
@@ -0,0 +1,80 @@
|
|
|
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 GPG_exports = {};
|
|
37
|
+
__export(GPG_exports, {
|
|
38
|
+
GPGButton: () => GPGButton,
|
|
39
|
+
default: () => GPG_default
|
|
40
|
+
});
|
|
41
|
+
module.exports = __toCommonJS(GPG_exports);
|
|
42
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
43
|
+
var import_react = __toESM(require("react"));
|
|
44
|
+
var import_Button = __toESM(require("../../Common/Button/index.native.js"));
|
|
45
|
+
var import_styles = require("../../../styles/index.native.js");
|
|
46
|
+
var import_useModal = require("../../../hooks/useModal.native.js");
|
|
47
|
+
var GPGButton = function GPGButton2(param) {
|
|
48
|
+
var {
|
|
49
|
+
children
|
|
50
|
+
} = param;
|
|
51
|
+
var {
|
|
52
|
+
openGpg
|
|
53
|
+
} = (0, import_useModal.useModal)();
|
|
54
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_Button.default, {
|
|
55
|
+
style: {
|
|
56
|
+
margin: 0
|
|
57
|
+
},
|
|
58
|
+
arrow: true,
|
|
59
|
+
// preventDefault so we never submit a surrounding host <form> (e.g. keycloak's
|
|
60
|
+
// login form) — the underlying styled button can render as type=submit.
|
|
61
|
+
onClick: function onClick(e) {
|
|
62
|
+
var _e_preventDefault;
|
|
63
|
+
e === null || e === void 0 ? void 0 : (_e_preventDefault = e.preventDefault) === null || _e_preventDefault === void 0 ? void 0 : _e_preventDefault.call(e);
|
|
64
|
+
openGpg();
|
|
65
|
+
},
|
|
66
|
+
children: children !== null && children !== void 0 ? children : "Sign in with GPG"
|
|
67
|
+
}, "button");
|
|
68
|
+
};
|
|
69
|
+
var GPGButtonComponent = function GPGButtonComponent2(param) {
|
|
70
|
+
var {
|
|
71
|
+
...props
|
|
72
|
+
} = param;
|
|
73
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_styles.ResetContainer, {
|
|
74
|
+
children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(GPGButton, {
|
|
75
|
+
...props
|
|
76
|
+
})
|
|
77
|
+
});
|
|
78
|
+
};
|
|
79
|
+
var GPG_default = GPGButtonComponent;
|
|
80
|
+
//# sourceMappingURL=index.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","GPG_exports","__export","GPGButton","default","GPG_default","module","exports","import_jsx_runtime","require","import_react","__toESM","import_Button","import_styles","import_useModal","GPGButton2","param","children","openGpg","useModal","jsx","style","margin","arrow","onClick","e","_e_preventDefault","preventDefault","call"],"sources":["../../../../../../src/connectkit/components/Standard/GPG/index.tsx"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,WAAA;AAAAC,QAAA,CAAAD,WAAA;EAAAE,SAAA,EAAAA,CAAA,KAAAA,SAAA;EAAAC,OAAA,EAAAA,CAAA,KAAAC;AAAA;AACAC,MAAA,CAAAC,OAAA,GAAAX,YAAmB,CAAAK,WAAA;AACnB,IAAAO,kBAA+B,GAAAC,OAAA;AAC/B,IAAAC,YAAA,GAAAC,OAAyB,CAAAF,OAAA;AAYrB,IAAAG,aAAA,GAAAD,OAAA,CAAAF,OAAA;AAHG,IAAAI,aAAM,GAAoCJ,OAAE,kCAAe;AAChE,IAAAK,eAAgB,GAAAL,OAAI,oCAAS;AAC7B,IAAAN,SACE,YAAAY,WAAAC,KAAA;EAAA,IAAC;IAAAC;EAAA,IAAAD,KAAA;EAAA;IAAAE;EAAA,QAAAJ,eAAA,CAAAK,QAAA;EAAA,OAEC,eAAmB,IAAAX,kBAAA,CAAAY,GAAA,EAAAR,aAAA,CAAAR,OAAA;IAAAiB,KACnB;MAGAC,MAAA;IACE;IACAC,KAAA;IAAQ;IACV;IAEaC,OAAA,WAAAA,QAAAC,CAAA;MAVT,IAAAC,iBAAA;MAWND,CAAA,aAAAA,CAAA,wBAAAC,iBAAA,GAAAD,CAAA,CAAAE,cAAA,cAAAD,iBAAA,uBAAAA,iBAAA,CAAAE,IAAA,CAAAH,CAAA;MAEJP,OAAA;IAEA;IAKOD,QAAA,EAAAA,QAAQ,aAAAA,QAAA,cAAAA,QAAA","ignoreList":[]}
|
|
@@ -0,0 +1,37 @@
|
|
|
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 GpgContext_exports = {};
|
|
24
|
+
__export(GpgContext_exports, {
|
|
25
|
+
GpgContext: () => GpgContext,
|
|
26
|
+
GpgStatusState: () => GpgStatusState
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(GpgContext_exports);
|
|
29
|
+
var import_react = require("react");
|
|
30
|
+
var GpgStatusState = /* @__PURE__ */(GpgStatusState2 => {
|
|
31
|
+
GpgStatusState2["READY"] = "ready";
|
|
32
|
+
GpgStatusState2["LOADING"] = "loading";
|
|
33
|
+
GpgStatusState2["SUCCESS"] = "success";
|
|
34
|
+
GpgStatusState2["ERROR"] = "error";
|
|
35
|
+
return GpgStatusState2;
|
|
36
|
+
})(GpgStatusState || {});
|
|
37
|
+
const GpgContext = (0, import_react.createContext)(null);
|
|
@@ -0,0 +1,40 @@
|
|
|
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 GpgContext_exports = {};
|
|
26
|
+
__export(GpgContext_exports, {
|
|
27
|
+
GpgContext: () => GpgContext,
|
|
28
|
+
GpgStatusState: () => GpgStatusState
|
|
29
|
+
});
|
|
30
|
+
module.exports = __toCommonJS(GpgContext_exports);
|
|
31
|
+
var import_react = require("react");
|
|
32
|
+
var GpgStatusState = /* @__PURE__ */function (GpgStatusState2) {
|
|
33
|
+
GpgStatusState2["READY"] = "ready";
|
|
34
|
+
GpgStatusState2["LOADING"] = "loading";
|
|
35
|
+
GpgStatusState2["SUCCESS"] = "success";
|
|
36
|
+
GpgStatusState2["ERROR"] = "error";
|
|
37
|
+
return GpgStatusState2;
|
|
38
|
+
}({});
|
|
39
|
+
var GpgContext = /* @__PURE__ */(0, import_react.createContext)(null);
|
|
40
|
+
//# sourceMappingURL=GpgContext.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","GpgContext_exports","__export","GpgContext","GpgStatusState","module","exports","import_react","require","GpgStatusState2"],"sources":["../../../../src/connectkit/gpg/GpgContext.tsx"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,kBAAA;AAAAC,QAAA,CAAAD,kBAAA;EAAAE,UAAA,EAAAA,CAAA,KAAAA,UAAA;EAAAC,cAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAV,YAA8B,CAAAK,kBAAA;AAQvB,IAAKM,YAAA,GAAAC,OAAL;AACL,IAAAJ,cAAA,kBAAQ,UAAAK,eAAA;EACRA,eAAA,mBAAU;EACVA,eAAA,cAAU;EACVA,eAAA,cAAQ;EAJEA,eAAA;EAAA,OAAAA,eAAA;AAwCL,KAAM","ignoreList":[]}
|
|
@@ -0,0 +1,112 @@
|
|
|
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 GpgProvider_exports = {};
|
|
24
|
+
__export(GpgProvider_exports, {
|
|
25
|
+
GPG_NONCE_QUERY_KEY: () => GPG_NONCE_QUERY_KEY,
|
|
26
|
+
GpgProvider: () => GpgProvider
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(GpgProvider_exports);
|
|
29
|
+
var import_react = require("react");
|
|
30
|
+
var import_react_query = require("@tanstack/react-query");
|
|
31
|
+
var import_ConnectKit = require("../components/ConnectKit.cjs");
|
|
32
|
+
var import_GpgContext = require("./GpgContext.cjs");
|
|
33
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
34
|
+
const GPG_NONCE_QUERY_KEY = "ckGpgNonce";
|
|
35
|
+
const b64 = s => window.btoa(unescape(encodeURIComponent(s)));
|
|
36
|
+
function defaultBuildMessage({
|
|
37
|
+
nonce
|
|
38
|
+
}) {
|
|
39
|
+
return `${window.location.host} wants you to sign in with your GPG key.
|
|
40
|
+
|
|
41
|
+
URI: ${window.location.origin}
|
|
42
|
+
Version: 1
|
|
43
|
+
Nonce: ${nonce}
|
|
44
|
+
Issued At: ${(/* @__PURE__ */new Date()).toISOString()}`;
|
|
45
|
+
}
|
|
46
|
+
const GpgProvider = ({
|
|
47
|
+
children,
|
|
48
|
+
enabled = true,
|
|
49
|
+
nonceRefetchInterval = 1e3 * 60 * 5,
|
|
50
|
+
buildMessage,
|
|
51
|
+
onSignIn,
|
|
52
|
+
...gpgConfig
|
|
53
|
+
}) => {
|
|
54
|
+
const [status, setStatus] = (0, import_react.useState)(import_GpgContext.GpgStatusState.READY);
|
|
55
|
+
const resetStatus = () => setStatus(import_GpgContext.GpgStatusState.READY);
|
|
56
|
+
if ((0, import_react.useContext)(import_GpgContext.GpgContext)) {
|
|
57
|
+
throw new Error("Multiple, nested usages of GpgProvider detected. Please use only one.");
|
|
58
|
+
}
|
|
59
|
+
if ((0, import_react.useContext)(import_ConnectKit.Context)) {
|
|
60
|
+
throw new Error("ConnectKitProvider must be mounted inside GpgProvider.");
|
|
61
|
+
}
|
|
62
|
+
const nonce = (0, import_react_query.useQuery)({
|
|
63
|
+
queryKey: [GPG_NONCE_QUERY_KEY],
|
|
64
|
+
queryFn: () => gpgConfig.getNonce(),
|
|
65
|
+
refetchInterval: nonceRefetchInterval
|
|
66
|
+
});
|
|
67
|
+
const message = (0, import_react.useMemo)(() => nonce.data ? (buildMessage ?? defaultBuildMessage)({
|
|
68
|
+
nonce: nonce.data
|
|
69
|
+
}) : null, [nonce.data, buildMessage]);
|
|
70
|
+
const command = (0, import_react.useMemo)(() => message ? `{ printf %s '${message}' | gpg --detach-sign --armor; gpg --armor --export; }` : null, [message]);
|
|
71
|
+
const signIn = async pastedBlob => {
|
|
72
|
+
const blob = pastedBlob.trim();
|
|
73
|
+
if (!blob.includes("-----BEGIN PGP SIGNATURE-----") || !blob.includes("-----BEGIN PGP PUBLIC KEY BLOCK-----")) {
|
|
74
|
+
setStatus(import_GpgContext.GpgStatusState.ERROR);
|
|
75
|
+
throw new Error("Paste the FULL output \u2014 it must contain both a PGP SIGNATURE and a PUBLIC KEY block.");
|
|
76
|
+
}
|
|
77
|
+
if (!message) {
|
|
78
|
+
setStatus(import_GpgContext.GpgStatusState.ERROR);
|
|
79
|
+
throw new Error("Could not fetch nonce");
|
|
80
|
+
}
|
|
81
|
+
try {
|
|
82
|
+
setStatus(import_GpgContext.GpgStatusState.LOADING);
|
|
83
|
+
const result = await gpgConfig.onSign({
|
|
84
|
+
username: b64(blob),
|
|
85
|
+
password: b64(message),
|
|
86
|
+
message
|
|
87
|
+
});
|
|
88
|
+
if (result === false) throw new Error("GPG sign-in was rejected");
|
|
89
|
+
setStatus(import_GpgContext.GpgStatusState.SUCCESS);
|
|
90
|
+
onSignIn?.();
|
|
91
|
+
return true;
|
|
92
|
+
} catch (error) {
|
|
93
|
+
setStatus(import_GpgContext.GpgStatusState.ERROR);
|
|
94
|
+
throw error;
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_GpgContext.GpgContext.Provider, {
|
|
98
|
+
value: {
|
|
99
|
+
enabled,
|
|
100
|
+
nonceRefetchInterval,
|
|
101
|
+
buildMessage,
|
|
102
|
+
...gpgConfig,
|
|
103
|
+
nonce,
|
|
104
|
+
message,
|
|
105
|
+
command,
|
|
106
|
+
status,
|
|
107
|
+
signIn,
|
|
108
|
+
resetStatus
|
|
109
|
+
},
|
|
110
|
+
children
|
|
111
|
+
});
|
|
112
|
+
};
|
|
@@ -0,0 +1,127 @@
|
|
|
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 GpgProvider_exports = {};
|
|
26
|
+
__export(GpgProvider_exports, {
|
|
27
|
+
GPG_NONCE_QUERY_KEY: () => GPG_NONCE_QUERY_KEY,
|
|
28
|
+
GpgProvider: () => GpgProvider
|
|
29
|
+
});
|
|
30
|
+
module.exports = __toCommonJS(GpgProvider_exports);
|
|
31
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
32
|
+
var import_react = require("react");
|
|
33
|
+
var import_react_query = require("@tanstack/react-query");
|
|
34
|
+
var import_ConnectKit = require("../components/ConnectKit.native.js");
|
|
35
|
+
var import_GpgContext = require("./GpgContext.native.js");
|
|
36
|
+
var GPG_NONCE_QUERY_KEY = "ckGpgNonce";
|
|
37
|
+
var b64 = function b642(s) {
|
|
38
|
+
return window.btoa(unescape(encodeURIComponent(s)));
|
|
39
|
+
};
|
|
40
|
+
function defaultBuildMessage(param) {
|
|
41
|
+
var {
|
|
42
|
+
nonce
|
|
43
|
+
} = param;
|
|
44
|
+
return `${window.location.host} wants you to sign in with your GPG key.
|
|
45
|
+
|
|
46
|
+
URI: ${window.location.origin}
|
|
47
|
+
Version: 1
|
|
48
|
+
Nonce: ${nonce}
|
|
49
|
+
Issued At: ${(/* @__PURE__ */new Date()).toISOString()}`;
|
|
50
|
+
}
|
|
51
|
+
var GpgProvider = function GpgProvider2(param) {
|
|
52
|
+
var {
|
|
53
|
+
children,
|
|
54
|
+
enabled = true,
|
|
55
|
+
nonceRefetchInterval = 1e3 * 60 * 5,
|
|
56
|
+
buildMessage,
|
|
57
|
+
onSignIn,
|
|
58
|
+
...gpgConfig
|
|
59
|
+
} = param;
|
|
60
|
+
var [status, setStatus] = (0, import_react.useState)(import_GpgContext.GpgStatusState.READY);
|
|
61
|
+
var resetStatus = function resetStatus2() {
|
|
62
|
+
return setStatus(import_GpgContext.GpgStatusState.READY);
|
|
63
|
+
};
|
|
64
|
+
if ((0, import_react.useContext)(import_GpgContext.GpgContext)) {
|
|
65
|
+
throw new Error("Multiple, nested usages of GpgProvider detected. Please use only one.");
|
|
66
|
+
}
|
|
67
|
+
if ((0, import_react.useContext)(import_ConnectKit.Context)) {
|
|
68
|
+
throw new Error("ConnectKitProvider must be mounted inside GpgProvider.");
|
|
69
|
+
}
|
|
70
|
+
var nonce = (0, import_react_query.useQuery)({
|
|
71
|
+
queryKey: [GPG_NONCE_QUERY_KEY],
|
|
72
|
+
queryFn: function queryFn() {
|
|
73
|
+
return gpgConfig.getNonce();
|
|
74
|
+
},
|
|
75
|
+
refetchInterval: nonceRefetchInterval
|
|
76
|
+
});
|
|
77
|
+
var message = (0, import_react.useMemo)(function () {
|
|
78
|
+
return nonce.data ? (buildMessage !== null && buildMessage !== void 0 ? buildMessage : defaultBuildMessage)({
|
|
79
|
+
nonce: nonce.data
|
|
80
|
+
}) : null;
|
|
81
|
+
}, [nonce.data, buildMessage]);
|
|
82
|
+
var command = (0, import_react.useMemo)(function () {
|
|
83
|
+
return message ? `{ printf %s '${message}' | gpg --detach-sign --armor; gpg --armor --export; }` : null;
|
|
84
|
+
}, [message]);
|
|
85
|
+
var signIn = async function signIn2(pastedBlob) {
|
|
86
|
+
var blob = pastedBlob.trim();
|
|
87
|
+
if (!blob.includes("-----BEGIN PGP SIGNATURE-----") || !blob.includes("-----BEGIN PGP PUBLIC KEY BLOCK-----")) {
|
|
88
|
+
setStatus(import_GpgContext.GpgStatusState.ERROR);
|
|
89
|
+
throw new Error("Paste the FULL output \u2014 it must contain both a PGP SIGNATURE and a PUBLIC KEY block.");
|
|
90
|
+
}
|
|
91
|
+
if (!message) {
|
|
92
|
+
setStatus(import_GpgContext.GpgStatusState.ERROR);
|
|
93
|
+
throw new Error("Could not fetch nonce");
|
|
94
|
+
}
|
|
95
|
+
try {
|
|
96
|
+
setStatus(import_GpgContext.GpgStatusState.LOADING);
|
|
97
|
+
var result = await gpgConfig.onSign({
|
|
98
|
+
username: b64(blob),
|
|
99
|
+
password: b64(message),
|
|
100
|
+
message
|
|
101
|
+
});
|
|
102
|
+
if (result === false) throw new Error("GPG sign-in was rejected");
|
|
103
|
+
setStatus(import_GpgContext.GpgStatusState.SUCCESS);
|
|
104
|
+
onSignIn === null || onSignIn === void 0 ? void 0 : onSignIn();
|
|
105
|
+
return true;
|
|
106
|
+
} catch (error) {
|
|
107
|
+
setStatus(import_GpgContext.GpgStatusState.ERROR);
|
|
108
|
+
throw error;
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_GpgContext.GpgContext.Provider, {
|
|
112
|
+
value: {
|
|
113
|
+
enabled,
|
|
114
|
+
nonceRefetchInterval,
|
|
115
|
+
buildMessage,
|
|
116
|
+
...gpgConfig,
|
|
117
|
+
nonce,
|
|
118
|
+
message,
|
|
119
|
+
command,
|
|
120
|
+
status,
|
|
121
|
+
signIn,
|
|
122
|
+
resetStatus
|
|
123
|
+
},
|
|
124
|
+
children
|
|
125
|
+
});
|
|
126
|
+
};
|
|
127
|
+
//# sourceMappingURL=GpgProvider.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","GpgProvider_exports","__export","GPG_NONCE_QUERY_KEY","GpgProvider","module","exports","import_jsx_runtime","require","import_react","import_react_query","import_ConnectKit","import_GpgContext","b64","b642","s","window","btoa","unescape","encodeURIComponent","defaultBuildMessage","param","nonce","location","host","origin","Date","toISOString","GpgProvider2","children","enabled","nonceRefetchInterval","buildMessage","onSignIn","gpgConfig","status","setStatus","useState","GpgStatusState","READY","resetStatus","resetStatus2","useContext","GpgContext","Error","Context","useQuery","queryKey","queryFn","getNonce","refetchInterval","message","useMemo","data","command","signIn","signIn2","pastedBlob","blob","trim","includes","ERROR","LOADING","result","onSign","username","password","SUCCESS","error","jsx","Provider"],"sources":["../../../../src/connectkit/gpg/GpgProvider.tsx"],"sourcesContent":[null],"mappings":"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","ignoreList":[]}
|