@multiplatform.one/gpg 6.0.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.
Files changed (58) hide show
  1. package/LICENSE +201 -0
  2. package/dist/cjs/GpgButton.cjs +56 -0
  3. package/dist/cjs/GpgButton.native.js +78 -0
  4. package/dist/cjs/GpgButton.native.js.map +1 -0
  5. package/dist/cjs/GpgContext.cjs +37 -0
  6. package/dist/cjs/GpgContext.native.js +40 -0
  7. package/dist/cjs/GpgContext.native.js.map +1 -0
  8. package/dist/cjs/GpgProvider.cjs +112 -0
  9. package/dist/cjs/GpgProvider.native.js +127 -0
  10. package/dist/cjs/GpgProvider.native.js.map +1 -0
  11. package/dist/cjs/SignInWithGpg.cjs +132 -0
  12. package/dist/cjs/SignInWithGpg.native.js +159 -0
  13. package/dist/cjs/SignInWithGpg.native.js.map +1 -0
  14. package/dist/cjs/index.cjs +54 -0
  15. package/dist/cjs/index.native.js +57 -0
  16. package/dist/cjs/index.native.js.map +1 -0
  17. package/dist/cjs/screens.cjs +70 -0
  18. package/dist/cjs/screens.native.js +79 -0
  19. package/dist/cjs/screens.native.js.map +1 -0
  20. package/dist/cjs/useGpg.cjs +70 -0
  21. package/dist/cjs/useGpg.native.js +77 -0
  22. package/dist/cjs/useGpg.native.js.map +1 -0
  23. package/dist/esm/GpgButton.mjs +30 -0
  24. package/dist/esm/GpgButton.mjs.map +1 -0
  25. package/dist/esm/GpgButton.native.js +38 -0
  26. package/dist/esm/GpgButton.native.js.map +1 -0
  27. package/dist/esm/GpgContext.mjs +11 -0
  28. package/dist/esm/GpgContext.mjs.map +1 -0
  29. package/dist/esm/GpgContext.native.js +11 -0
  30. package/dist/esm/GpgContext.native.js.map +1 -0
  31. package/dist/esm/GpgProvider.mjs +86 -0
  32. package/dist/esm/GpgProvider.mjs.map +1 -0
  33. package/dist/esm/GpgProvider.native.js +98 -0
  34. package/dist/esm/GpgProvider.native.js.map +1 -0
  35. package/dist/esm/SignInWithGpg.mjs +107 -0
  36. package/dist/esm/SignInWithGpg.mjs.map +1 -0
  37. package/dist/esm/SignInWithGpg.native.js +120 -0
  38. package/dist/esm/SignInWithGpg.native.js.map +1 -0
  39. package/dist/esm/index.mjs +8 -0
  40. package/dist/esm/index.mjs.map +1 -0
  41. package/dist/esm/index.native.js +8 -0
  42. package/dist/esm/index.native.js.map +1 -0
  43. package/dist/esm/screens.mjs +32 -0
  44. package/dist/esm/screens.mjs.map +1 -0
  45. package/dist/esm/screens.native.js +38 -0
  46. package/dist/esm/screens.native.js.map +1 -0
  47. package/dist/esm/useGpg.mjs +45 -0
  48. package/dist/esm/useGpg.mjs.map +1 -0
  49. package/dist/esm/useGpg.native.js +49 -0
  50. package/dist/esm/useGpg.native.js.map +1 -0
  51. package/package.json +73 -0
  52. package/src/GpgButton.tsx +37 -0
  53. package/src/GpgContext.tsx +49 -0
  54. package/src/GpgProvider.tsx +126 -0
  55. package/src/SignInWithGpg.tsx +101 -0
  56. package/src/index.ts +14 -0
  57. package/src/screens.tsx +50 -0
  58. package/src/useGpg.ts +57 -0
@@ -0,0 +1,132 @@
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 SignInWithGpg_exports = {};
24
+ __export(SignInWithGpg_exports, {
25
+ default: () => SignInWithGpg_default
26
+ });
27
+ module.exports = __toCommonJS(SignInWithGpg_exports);
28
+ var import_react = require("react");
29
+ var import_connectkit = require("@multiplatform.one/connectkit");
30
+ var import_useGpg = require("./useGpg.cjs");
31
+ var import_jsx_runtime = require("react/jsx-runtime");
32
+ const textarea = {
33
+ width: "100%",
34
+ boxSizing: "border-box",
35
+ fontFamily: "var(--ck-font-family, monospace)",
36
+ fontSize: 11,
37
+ lineHeight: 1.4,
38
+ padding: 8,
39
+ borderRadius: "var(--ck-primary-button-border-radius, 12px)",
40
+ border: "1px solid var(--ck-body-divider, #d3d3d3)",
41
+ background: "var(--ck-body-background-secondary, #f6f7f9)",
42
+ color: "var(--ck-body-color, inherit)",
43
+ resize: "vertical"
44
+ };
45
+ const label = {
46
+ textAlign: "left",
47
+ fontSize: 14,
48
+ fontWeight: 500,
49
+ margin: "4px 0"
50
+ };
51
+ const SignInWithGpg = () => {
52
+ const context = (0, import_connectkit.useContext)();
53
+ const {
54
+ message,
55
+ command,
56
+ signIn,
57
+ isLoading,
58
+ isReady
59
+ } = (0, import_useGpg.useGpg)();
60
+ const [pasted, setPasted] = (0, import_react.useState)("");
61
+ const [error, setError] = (0, import_react.useState)(null);
62
+ const [busy, setBusy] = (0, import_react.useState)(false);
63
+ const onSubmit = async () => {
64
+ setError(null);
65
+ setBusy(true);
66
+ try {
67
+ await signIn(pasted);
68
+ setTimeout(() => context.setOpen(false), 1e3);
69
+ } catch (e) {
70
+ setError(e instanceof Error ? e.message : "GPG sign-in failed");
71
+ setBusy(false);
72
+ }
73
+ };
74
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_connectkit.PageContent, {
75
+ style: {
76
+ width: 320
77
+ },
78
+ children: /* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_connectkit.ModalContent, {
79
+ style: {
80
+ paddingBottom: 8,
81
+ gap: 6
82
+ },
83
+ children: [/* @__PURE__ */(0, import_jsx_runtime.jsx)(import_connectkit.ModalBody, {
84
+ style: label,
85
+ children: "1. Sign the challenge in your terminal:"
86
+ }), /* @__PURE__ */(0, import_jsx_runtime.jsxs)("div", {
87
+ style: {
88
+ display: "flex",
89
+ flexDirection: "column",
90
+ gap: 6
91
+ },
92
+ children: [/* @__PURE__ */(0, import_jsx_runtime.jsx)(import_connectkit.CopyToClipboard, {
93
+ variant: "button",
94
+ string: command ?? "",
95
+ children: "Copy gpg command"
96
+ }), /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_connectkit.CopyToClipboard, {
97
+ variant: "button",
98
+ string: message ?? "",
99
+ children: "Copy message only"
100
+ })]
101
+ }), /* @__PURE__ */(0, import_jsx_runtime.jsx)("textarea", {
102
+ readOnly: true,
103
+ rows: 4,
104
+ value: message ?? (isLoading ? "Loading challenge\u2026" : ""),
105
+ style: textarea
106
+ }), /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_connectkit.ModalBody, {
107
+ style: label,
108
+ children: "2. Paste the full output below:"
109
+ }), /* @__PURE__ */(0, import_jsx_runtime.jsx)("textarea", {
110
+ rows: 6,
111
+ value: pasted,
112
+ onChange: e => setPasted(e.target.value),
113
+ placeholder: "-----BEGIN PGP SIGNATURE----- \u2026 and your -----BEGIN PGP PUBLIC KEY BLOCK-----",
114
+ style: textarea
115
+ }), /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_connectkit.Button, {
116
+ onClick: onSubmit,
117
+ disabled: !isReady || !pasted || busy,
118
+ waiting: busy,
119
+ arrow: true,
120
+ children: "Sign in"
121
+ }), error && /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_connectkit.ModalBody, {
122
+ style: {
123
+ color: "var(--ck-body-color-danger, #c9190b)",
124
+ fontSize: 13,
125
+ textAlign: "left"
126
+ },
127
+ children: error
128
+ })]
129
+ })
130
+ });
131
+ };
132
+ var SignInWithGpg_default = SignInWithGpg;
@@ -0,0 +1,159 @@
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("@multiplatform.one/connectkit");
44
+ var import_useGpg = require("./useGpg.native.js");
45
+ function _instanceof(left, right) {
46
+ "@swc/helpers - instanceof";
47
+
48
+ if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
49
+ return !!right[Symbol.hasInstance](left);
50
+ } else {
51
+ return left instanceof right;
52
+ }
53
+ }
54
+ var textarea = {
55
+ width: "100%",
56
+ boxSizing: "border-box",
57
+ fontFamily: "var(--ck-font-family, monospace)",
58
+ fontSize: 11,
59
+ lineHeight: 1.4,
60
+ padding: 8,
61
+ borderRadius: "var(--ck-primary-button-border-radius, 12px)",
62
+ border: "1px solid var(--ck-body-divider, #d3d3d3)",
63
+ background: "var(--ck-body-background-secondary, #f6f7f9)",
64
+ color: "var(--ck-body-color, inherit)",
65
+ resize: "vertical"
66
+ };
67
+ var label = {
68
+ textAlign: "left",
69
+ fontSize: 14,
70
+ fontWeight: 500,
71
+ margin: "4px 0"
72
+ };
73
+ var SignInWithGpg = function SignInWithGpg2() {
74
+ var context = (0, import_connectkit.useContext)();
75
+ var {
76
+ message,
77
+ command,
78
+ signIn,
79
+ isLoading,
80
+ isReady
81
+ } = (0, import_useGpg.useGpg)();
82
+ var [pasted, setPasted] = (0, import_react.useState)("");
83
+ var [error, setError] = (0, import_react.useState)(null);
84
+ var [busy, setBusy] = (0, import_react.useState)(false);
85
+ var onSubmit = async function onSubmit2() {
86
+ setError(null);
87
+ setBusy(true);
88
+ try {
89
+ await signIn(pasted);
90
+ setTimeout(function () {
91
+ return context.setOpen(false);
92
+ }, 1e3);
93
+ } catch (e) {
94
+ setError(_instanceof(e, Error) ? e.message : "GPG sign-in failed");
95
+ setBusy(false);
96
+ }
97
+ };
98
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_connectkit.PageContent, {
99
+ style: {
100
+ width: 320
101
+ },
102
+ children: /* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_connectkit.ModalContent, {
103
+ style: {
104
+ paddingBottom: 8,
105
+ gap: 6
106
+ },
107
+ children: [/* @__PURE__ */(0, import_jsx_runtime.jsx)(import_connectkit.ModalBody, {
108
+ style: label,
109
+ children: "1. Sign the challenge in your terminal:"
110
+ }), /* @__PURE__ */(0, import_jsx_runtime.jsxs)("div", {
111
+ style: {
112
+ display: "flex",
113
+ flexDirection: "column",
114
+ gap: 6
115
+ },
116
+ children: [/* @__PURE__ */(0, import_jsx_runtime.jsx)(import_connectkit.CopyToClipboard, {
117
+ variant: "button",
118
+ string: command !== null && command !== void 0 ? command : "",
119
+ children: "Copy gpg command"
120
+ }), /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_connectkit.CopyToClipboard, {
121
+ variant: "button",
122
+ string: message !== null && message !== void 0 ? message : "",
123
+ children: "Copy message only"
124
+ })]
125
+ }), /* @__PURE__ */(0, import_jsx_runtime.jsx)("textarea", {
126
+ readOnly: true,
127
+ rows: 4,
128
+ value: message !== null && message !== void 0 ? message : isLoading ? "Loading challenge\u2026" : "",
129
+ style: textarea
130
+ }), /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_connectkit.ModalBody, {
131
+ style: label,
132
+ children: "2. Paste the full output below:"
133
+ }), /* @__PURE__ */(0, import_jsx_runtime.jsx)("textarea", {
134
+ rows: 6,
135
+ value: pasted,
136
+ onChange: function onChange(e) {
137
+ return setPasted(e.target.value);
138
+ },
139
+ placeholder: "-----BEGIN PGP SIGNATURE----- \u2026 and your -----BEGIN PGP PUBLIC KEY BLOCK-----",
140
+ style: textarea
141
+ }), /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_connectkit.Button, {
142
+ onClick: onSubmit,
143
+ disabled: !isReady || !pasted || busy,
144
+ waiting: busy,
145
+ arrow: true,
146
+ children: "Sign in"
147
+ }), error && /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_connectkit.ModalBody, {
148
+ style: {
149
+ color: "var(--ck-body-color-danger, #c9190b)",
150
+ fontSize: 13,
151
+ textAlign: "left"
152
+ },
153
+ children: error
154
+ })]
155
+ })
156
+ });
157
+ };
158
+ var SignInWithGpg_default = SignInWithGpg;
159
+ //# sourceMappingURL=SignInWithGpg.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["to","__toESM","mod","isNodeMode","target","__create","__getProtoOf","__copyProps","__esModule","__defProp","value","enumerable","__toCommonJS","SignInWithGpg_exports","__export","default","SignInWithGpg_default","module","exports","import_jsx_runtime","require","import_react","import_connectkit","import_useGpg","_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"],"sources":["../../src/SignInWithGpg.tsx"],"sourcesContent":[null],"mappings":"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","ignoreList":[]}
@@ -0,0 +1,54 @@
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 index_exports = {};
35
+ __export(index_exports, {
36
+ GPGButton: () => import_GpgButton.GPGButton,
37
+ GPG_NONCE_QUERY_KEY: () => import_GpgProvider.GPG_NONCE_QUERY_KEY,
38
+ GpgBridge: () => import_screens.GpgBridge,
39
+ GpgContext: () => import_GpgContext.GpgContext,
40
+ GpgProvider: () => import_GpgProvider.GpgProvider,
41
+ GpgScreenRegistrar: () => import_screens.GpgScreenRegistrar,
42
+ GpgStatusState: () => import_GpgContext.GpgStatusState,
43
+ SignInWithGpg: () => import_SignInWithGpg.default,
44
+ SignInWithGpgButton: () => import_GpgButton.default,
45
+ gpgScreen: () => import_screens.gpgScreen,
46
+ useGpg: () => import_useGpg.useGpg
47
+ });
48
+ module.exports = __toCommonJS(index_exports);
49
+ var import_useGpg = require("./useGpg.cjs");
50
+ var import_GpgProvider = require("./GpgProvider.cjs");
51
+ var import_GpgContext = require("./GpgContext.cjs");
52
+ var import_SignInWithGpg = __toESM(require("./SignInWithGpg.cjs"));
53
+ var import_GpgButton = __toESM(require("./GpgButton.cjs"));
54
+ var import_screens = require("./screens.cjs");
@@ -0,0 +1,57 @@
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 index_exports = {};
37
+ __export(index_exports, {
38
+ GPGButton: () => import_GpgButton.GPGButton,
39
+ GPG_NONCE_QUERY_KEY: () => import_GpgProvider.GPG_NONCE_QUERY_KEY,
40
+ GpgBridge: () => import_screens.GpgBridge,
41
+ GpgContext: () => import_GpgContext.GpgContext,
42
+ GpgProvider: () => import_GpgProvider.GpgProvider,
43
+ GpgScreenRegistrar: () => import_screens.GpgScreenRegistrar,
44
+ GpgStatusState: () => import_GpgContext.GpgStatusState,
45
+ SignInWithGpg: () => import_SignInWithGpg.default,
46
+ SignInWithGpgButton: () => import_GpgButton.default,
47
+ gpgScreen: () => import_screens.gpgScreen,
48
+ useGpg: () => import_useGpg.useGpg
49
+ });
50
+ module.exports = __toCommonJS(index_exports);
51
+ var import_useGpg = require("./useGpg.native.js");
52
+ var import_GpgProvider = require("./GpgProvider.native.js");
53
+ var import_GpgContext = require("./GpgContext.native.js");
54
+ var import_SignInWithGpg = __toESM(require("./SignInWithGpg.native.js"));
55
+ var import_GpgButton = __toESM(require("./GpgButton.native.js"));
56
+ var import_screens = require("./screens.native.js");
57
+ //# sourceMappingURL=index.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","index_exports","__export","GPGButton","import_GpgButton","GPG_NONCE_QUERY_KEY","import_GpgProvider","GpgBridge","import_screens","GpgContext","import_GpgContext","GpgProvider","GpgScreenRegistrar","GpgStatusState","SignInWithGpg","import_SignInWithGpg","default","SignInWithGpgButton","gpgScreen","useGpg","import_useGpg","module","exports","require","__toESM"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,aAAA;AAAAC,QAAA,CAAAD,aAAA;EAAAE,SAAA,EAAAA,CAAA,KAAAC,gBAAA,CAAAD,SAAA;EAAAE,mBAAA,EAAAA,CAAA,KAAAC,kBAAA,CAAAD,mBAAA;EAAAE,SAAA,EAAAA,CAAA,KAAAC,cAAA,CAAAD,SAAA;EAAAE,UAAA,EAAAA,CAAA,KAAAC,iBAAA,CAAAD,UAAA;EAAAE,WAAA,EAAAA,CAAA,KAAAL,kBAAA,CAAAK,WAAA;EAAAC,kBAAA,EAAAA,CAAA,KAAAJ,cAAA,CAAAI,kBAAA;EAAAC,cAAA,EAAAA,CAAA,KAAAH,iBAAA,CAAAG,cAAA;EAAAC,aAAA,EAAAA,CAAA,KAAAC,oBAAA,CAAAC,OAAA;EAAAC,mBAAA,EAAAA,CAAA,KAAAb,gBAAA,CAAAY,OAAA;EAAAE,SAAA,EAAAA,CAAA,KAAAV,cAAA,CAAAU,SAAA;EAAAC,MAAA,EAAAA,CAAA,KAAAC,aAAA,CAAAD;AAAA;AAKAE,MAAA,CAAAC,OAAA,GAAA1B,YAAuB,CAAAK,aAAA;AACvB,IAAAmB,aAAA,GAAAG,OAAiD;AACjD,IAAAjB,kBAAA,GAA2CiB,OAAA;AAG3C,IAAAb,iBAAA,GAAAa,OAAyC;AACzC,IAAAR,oBAA0D,GAAAS,OAAA,CAAAD,OAAA;AAE1D,IAAAnB,gBAAA,GAAyDoB,OAAA,CAAAD,OAAA","ignoreList":[]}
@@ -0,0 +1,70 @@
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 screens_exports = {};
35
+ __export(screens_exports, {
36
+ GpgBridge: () => GpgBridge,
37
+ GpgScreenRegistrar: () => GpgScreenRegistrar,
38
+ gpgScreen: () => gpgScreen
39
+ });
40
+ module.exports = __toCommonJS(screens_exports);
41
+ var import_connectkit = require("@multiplatform.one/connectkit");
42
+ var import_react = require("react");
43
+ var import_SignInWithGpg = __toESM(require("./SignInWithGpg.cjs"));
44
+ var import_GpgContext = require("./GpgContext.cjs");
45
+ var import_jsx_runtime = require("react/jsx-runtime");
46
+ const gpgScreen = {
47
+ id: import_connectkit.routes.SIGNINWITHGPG,
48
+ component: import_SignInWithGpg.default,
49
+ heading: "Sign in with GPG",
50
+ availableWhen: () => true,
51
+ showBack: false,
52
+ showInfo: false
53
+ };
54
+ const GpgScreenRegistrar = () => {
55
+ (0, import_connectkit.useRegisterScreens)([gpgScreen]);
56
+ return null;
57
+ };
58
+ const GpgBridge = ({
59
+ children
60
+ }) => {
61
+ const signInWithGpg = (0, import_react.useContext)(import_GpgContext.GpgContext)?.enabled ?? true;
62
+ return /* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
63
+ children: [/* @__PURE__ */(0, import_jsx_runtime.jsx)(GpgScreenRegistrar, {}), /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_connectkit.ModalStateProvider, {
64
+ value: {
65
+ signInWithGpg
66
+ },
67
+ children
68
+ })]
69
+ });
70
+ };
@@ -0,0 +1,79 @@
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 screens_exports = {};
37
+ __export(screens_exports, {
38
+ GpgBridge: () => GpgBridge,
39
+ GpgScreenRegistrar: () => GpgScreenRegistrar,
40
+ gpgScreen: () => gpgScreen
41
+ });
42
+ module.exports = __toCommonJS(screens_exports);
43
+ var import_jsx_runtime = require("react/jsx-runtime");
44
+ var import_react = __toESM(require("react"));
45
+ var import_connectkit = require("@multiplatform.one/connectkit");
46
+ var import_react2 = require("react");
47
+ var import_SignInWithGpg = __toESM(require("./SignInWithGpg.native.js"));
48
+ var import_GpgContext = require("./GpgContext.native.js");
49
+ var gpgScreen = {
50
+ id: import_connectkit.routes.SIGNINWITHGPG,
51
+ component: import_SignInWithGpg.default,
52
+ heading: "Sign in with GPG",
53
+ availableWhen: function availableWhen() {
54
+ return true;
55
+ },
56
+ showBack: false,
57
+ showInfo: false
58
+ };
59
+ var GpgScreenRegistrar = function GpgScreenRegistrar2() {
60
+ (0, import_connectkit.useRegisterScreens)([gpgScreen]);
61
+ return null;
62
+ };
63
+ var GpgBridge = function GpgBridge2(param) {
64
+ var {
65
+ children
66
+ } = param;
67
+ var _ref;
68
+ var _useReactContext;
69
+ var signInWithGpg = (_ref = (_useReactContext = (0, import_react2.useContext)(import_GpgContext.GpgContext)) === null || _useReactContext === void 0 ? void 0 : _useReactContext.enabled) !== null && _ref !== void 0 ? _ref : true;
70
+ return /* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
71
+ children: [/* @__PURE__ */(0, import_jsx_runtime.jsx)(GpgScreenRegistrar, {}), /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_connectkit.ModalStateProvider, {
72
+ value: {
73
+ signInWithGpg
74
+ },
75
+ children
76
+ })]
77
+ });
78
+ };
79
+ //# sourceMappingURL=screens.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","screens_exports","__export","GpgBridge","GpgScreenRegistrar","gpgScreen","module","exports","import_jsx_runtime","require","import_react","__toESM","import_connectkit","import_react2","import_SignInWithGpg","import_GpgContext","id","routes","SIGNINWITHGPG","component","default","heading","availableWhen","showBack","showInfo","GpgScreenRegistrar2","useRegisterScreens","GpgBridge2","param","children","_ref"],"sources":["../../src/screens.tsx"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,eAAA;AAAAC,QAAA,CAAAD,eAAA;EAAAE,SAAA,EAAAA,CAAA,KAAAA,SAAA;EAAAC,kBAAA,EAAAA,CAAA,KAAAA,kBAAA;EAAAC,SAAA,EAAAA,CAAA,KAAAA;AAAA;AACAC,MAAA,CAAAC,OAAA,GAAAX,YAMO,CAAAK,eAAA;AACP,IAAAO,kBAA8C,GAAAC,OAAA;AAC9C,IAAAC,YAAA,GAAAC,OAAA,CAA0BF,OAAA;AAC1B,IAAAG,iBAAA,GAA2BH,OAAA;AAkCvB,IAAAI,aAAA,GAAAJ,OAAA;AA9BG,IAAAK,oBAA6B,GAAAH,OAAA,CAAAF,OAAA;AAAA,IAClCM,iBAAI,GAAAN,OAAO;AAAA,IACXJ,SAAW;EACXW,EAAA,EAAAJ,iBAAS,CAAAK,MAAA,CAAAC,aAAA;EACTC,SAAA,EAAAL,oBAAqB,CAAAM,OAAA;EACrBC,OAAA,oBAAU;EACVC,aAAU,WAAAA,cAAA;IACZ;EAOO;EACLC,QAAA;EACAC,QAAO;AACT;AAQO,IAAApB,kBAAoF,YAAAqB,oBAAA;EACzF,IAAAb,iBAAA,CAAAc,kBAAA,GACFrB,SAAM,CACJ;EACA,OACE;AACE;AAAoB,IACpBF,SAAA,YAAAwB,WAAAC,KAAA;EAAwD,IAC1D;IAAAC;EAAA,IAAAD,KAAA;EAEJ,IAAAE,IAAA","ignoreList":[]}
@@ -0,0 +1,70 @@
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 useGpg_exports = {};
24
+ __export(useGpg_exports, {
25
+ useGpg: () => useGpg
26
+ });
27
+ module.exports = __toCommonJS(useGpg_exports);
28
+ var import_react = require("react");
29
+ var import_GpgContext = require("./GpgContext.cjs");
30
+ const useGpg = () => {
31
+ const gpg = (0, import_react.useContext)(import_GpgContext.GpgContext);
32
+ if (!gpg) {
33
+ return {
34
+ message: null,
35
+ command: null,
36
+ status: import_GpgContext.GpgStatusState.ERROR,
37
+ error: new Error("useGpg hook must be inside a GpgProvider."),
38
+ isLoading: false,
39
+ isSuccess: false,
40
+ isError: true,
41
+ isReady: false,
42
+ signIn: () => Promise.reject(),
43
+ reset: () => {}
44
+ };
45
+ }
46
+ const {
47
+ nonce,
48
+ message,
49
+ command,
50
+ status,
51
+ signIn,
52
+ resetStatus
53
+ } = gpg;
54
+ const isLoading = status === import_GpgContext.GpgStatusState.LOADING || nonce.isLoading;
55
+ const isSuccess = status === import_GpgContext.GpgStatusState.SUCCESS;
56
+ const isError = status === import_GpgContext.GpgStatusState.ERROR;
57
+ const isReady = !!message && !isLoading;
58
+ return {
59
+ message,
60
+ command,
61
+ status,
62
+ error: nonce.error,
63
+ isLoading,
64
+ isSuccess,
65
+ isError,
66
+ isReady,
67
+ signIn,
68
+ reset: () => resetStatus()
69
+ };
70
+ };