@forge-connect/react 1.0.16 → 1.0.17

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/index.d.cts CHANGED
@@ -815,4 +815,38 @@ declare function isOAuthMethod(method: LoginMethod): method is OAuthProvider;
815
815
  */
816
816
  declare function resolveLoginMethods(config: ForgeConnectConfig): LoginMethod[];
817
817
 
818
- export { AccountButton, AccountModal, type AccountModalState, type AccountModalTab, type AdminUser, type ApiClient, type AppearanceConfig, type AuthMethod, type AuthProvider, type AuthState, type AuthStatus, type Chain, DeleteAccountModal, ErrorView, type ErrorViewProps, ForgeConnectApiError, type ForgeConnectConfig, ForgeConnectContext, type ForgeConnectContextValue, ForgeConnectProvider, LinkAuthModal, type LinkModalState, LoginButton, type LoginMethod, LoginModal, type LoginResponse, ModalOverlay, type ModalState, type ModalStep, type MwaOptions, type OAuthProvider, type PaginatedResponse, type Passkey, PasskeysModal, type PermissionDomains, type Role, type RoleUser, type Session, type TokenVerificationResult, type TotpSetup, TwoFactorModal, type TwoFactorStatus, type User, type UserRoleAssignment, type UserStatus, type Wallet, type WalletAdapterContext, type WalletConfig, type WalletUserResult, createApiClient, hasAllPermissions, hasAnyPermission, hasPermission, isOAuthMethod, registerMwaIfAvailable, resolveLoginMethods, useAdmin, useForgeConnect, useRoles, useSessions, useUser, useWallets };
818
+ interface NomuSeekerBridge {
819
+ version: string;
820
+ isSeeker: true;
821
+ connect(): Promise<{
822
+ publicKey: string;
823
+ authToken: string | null;
824
+ label: string | null;
825
+ }>;
826
+ disconnect(): Promise<{
827
+ ok: true;
828
+ }>;
829
+ signMessage(messageBase64: string): Promise<{
830
+ signature: string;
831
+ publicKey: string;
832
+ }>;
833
+ signAndSendTransaction(txBase64: string): Promise<{
834
+ signature: string;
835
+ }>;
836
+ }
837
+ declare global {
838
+ interface Window {
839
+ nomuSeeker?: NomuSeekerBridge;
840
+ }
841
+ }
842
+ declare function isSeekerApp(): boolean;
843
+ /**
844
+ * Connect via the Nomu Seeker bridge and return an address + signMessage function
845
+ * shaped exactly like the existing `loginWithWallet` expects.
846
+ */
847
+ declare function connectSeekerBridge(): Promise<{
848
+ address: string;
849
+ signMessage: (msg: Uint8Array) => Promise<Uint8Array>;
850
+ }>;
851
+
852
+ export { AccountButton, AccountModal, type AccountModalState, type AccountModalTab, type AdminUser, type ApiClient, type AppearanceConfig, type AuthMethod, type AuthProvider, type AuthState, type AuthStatus, type Chain, DeleteAccountModal, ErrorView, type ErrorViewProps, ForgeConnectApiError, type ForgeConnectConfig, ForgeConnectContext, type ForgeConnectContextValue, ForgeConnectProvider, LinkAuthModal, type LinkModalState, LoginButton, type LoginMethod, LoginModal, type LoginResponse, ModalOverlay, type ModalState, type ModalStep, type MwaOptions, type NomuSeekerBridge, type OAuthProvider, type PaginatedResponse, type Passkey, PasskeysModal, type PermissionDomains, type Role, type RoleUser, type Session, type TokenVerificationResult, type TotpSetup, TwoFactorModal, type TwoFactorStatus, type User, type UserRoleAssignment, type UserStatus, type Wallet, type WalletAdapterContext, type WalletConfig, type WalletUserResult, connectSeekerBridge, createApiClient, hasAllPermissions, hasAnyPermission, hasPermission, isOAuthMethod, isSeekerApp, registerMwaIfAvailable, resolveLoginMethods, useAdmin, useForgeConnect, useRoles, useSessions, useUser, useWallets };
package/dist/index.d.ts CHANGED
@@ -815,4 +815,38 @@ declare function isOAuthMethod(method: LoginMethod): method is OAuthProvider;
815
815
  */
816
816
  declare function resolveLoginMethods(config: ForgeConnectConfig): LoginMethod[];
817
817
 
818
- export { AccountButton, AccountModal, type AccountModalState, type AccountModalTab, type AdminUser, type ApiClient, type AppearanceConfig, type AuthMethod, type AuthProvider, type AuthState, type AuthStatus, type Chain, DeleteAccountModal, ErrorView, type ErrorViewProps, ForgeConnectApiError, type ForgeConnectConfig, ForgeConnectContext, type ForgeConnectContextValue, ForgeConnectProvider, LinkAuthModal, type LinkModalState, LoginButton, type LoginMethod, LoginModal, type LoginResponse, ModalOverlay, type ModalState, type ModalStep, type MwaOptions, type OAuthProvider, type PaginatedResponse, type Passkey, PasskeysModal, type PermissionDomains, type Role, type RoleUser, type Session, type TokenVerificationResult, type TotpSetup, TwoFactorModal, type TwoFactorStatus, type User, type UserRoleAssignment, type UserStatus, type Wallet, type WalletAdapterContext, type WalletConfig, type WalletUserResult, createApiClient, hasAllPermissions, hasAnyPermission, hasPermission, isOAuthMethod, registerMwaIfAvailable, resolveLoginMethods, useAdmin, useForgeConnect, useRoles, useSessions, useUser, useWallets };
818
+ interface NomuSeekerBridge {
819
+ version: string;
820
+ isSeeker: true;
821
+ connect(): Promise<{
822
+ publicKey: string;
823
+ authToken: string | null;
824
+ label: string | null;
825
+ }>;
826
+ disconnect(): Promise<{
827
+ ok: true;
828
+ }>;
829
+ signMessage(messageBase64: string): Promise<{
830
+ signature: string;
831
+ publicKey: string;
832
+ }>;
833
+ signAndSendTransaction(txBase64: string): Promise<{
834
+ signature: string;
835
+ }>;
836
+ }
837
+ declare global {
838
+ interface Window {
839
+ nomuSeeker?: NomuSeekerBridge;
840
+ }
841
+ }
842
+ declare function isSeekerApp(): boolean;
843
+ /**
844
+ * Connect via the Nomu Seeker bridge and return an address + signMessage function
845
+ * shaped exactly like the existing `loginWithWallet` expects.
846
+ */
847
+ declare function connectSeekerBridge(): Promise<{
848
+ address: string;
849
+ signMessage: (msg: Uint8Array) => Promise<Uint8Array>;
850
+ }>;
851
+
852
+ export { AccountButton, AccountModal, type AccountModalState, type AccountModalTab, type AdminUser, type ApiClient, type AppearanceConfig, type AuthMethod, type AuthProvider, type AuthState, type AuthStatus, type Chain, DeleteAccountModal, ErrorView, type ErrorViewProps, ForgeConnectApiError, type ForgeConnectConfig, ForgeConnectContext, type ForgeConnectContextValue, ForgeConnectProvider, LinkAuthModal, type LinkModalState, LoginButton, type LoginMethod, LoginModal, type LoginResponse, ModalOverlay, type ModalState, type ModalStep, type MwaOptions, type NomuSeekerBridge, type OAuthProvider, type PaginatedResponse, type Passkey, PasskeysModal, type PermissionDomains, type Role, type RoleUser, type Session, type TokenVerificationResult, type TotpSetup, TwoFactorModal, type TwoFactorStatus, type User, type UserRoleAssignment, type UserStatus, type Wallet, type WalletAdapterContext, type WalletConfig, type WalletUserResult, connectSeekerBridge, createApiClient, hasAllPermissions, hasAnyPermission, hasPermission, isOAuthMethod, isSeekerApp, registerMwaIfAvailable, resolveLoginMethods, useAdmin, useForgeConnect, useRoles, useSessions, useUser, useWallets };
package/dist/index.js CHANGED
@@ -982,6 +982,52 @@ async function connectAndPrepareStandardWallet(wallet) {
982
982
  return { address: account.address, signMessage };
983
983
  }
984
984
 
985
+ // src/lib/seeker-bridge.ts
986
+ function isSeekerApp() {
987
+ return typeof window !== "undefined" && window.nomuSeeker?.isSeeker === true;
988
+ }
989
+ function uint8ToBase64(bytes) {
990
+ let bin = "";
991
+ for (let i = 0; i < bytes.length; i++) bin += String.fromCharCode(bytes[i]);
992
+ return btoa(bin);
993
+ }
994
+ function base58ToUint8(s) {
995
+ const ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
996
+ const map = /* @__PURE__ */ new Map();
997
+ for (let i = 0; i < ALPHABET.length; i++) map.set(ALPHABET[i], i);
998
+ const bytes = [0];
999
+ for (const ch of s) {
1000
+ const v = map.get(ch);
1001
+ if (v === void 0) throw new Error("Invalid base58 character");
1002
+ let carry = v;
1003
+ for (let j = 0; j < bytes.length; j++) {
1004
+ carry += bytes[j] * 58;
1005
+ bytes[j] = carry & 255;
1006
+ carry >>= 8;
1007
+ }
1008
+ while (carry > 0) {
1009
+ bytes.push(carry & 255);
1010
+ carry >>= 8;
1011
+ }
1012
+ }
1013
+ for (const ch of s) {
1014
+ if (ch !== "1") break;
1015
+ bytes.push(0);
1016
+ }
1017
+ return new Uint8Array(bytes.reverse());
1018
+ }
1019
+ async function connectSeekerBridge() {
1020
+ const bridge = window.nomuSeeker;
1021
+ if (!bridge) throw new Error("NomuSeeker bridge not available");
1022
+ const { publicKey } = await bridge.connect();
1023
+ const signMessage = async (msg) => {
1024
+ const { signature } = await bridge.signMessage(uint8ToBase64(msg));
1025
+ return base58ToUint8(signature);
1026
+ };
1027
+ return { address: publicKey, signMessage };
1028
+ }
1029
+ var SEEKER_ICON = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA0OCA0OCI+PHJlY3Qgd2lkdGg9IjQ4IiBoZWlnaHQ9IjQ4IiByeD0iMTAiIGZpbGw9IiMwMDAiLz48dGV4dCB4PSI1MCUiIHk9IjU4JSIgZm9udC1zaXplPSIyMCIgZmlsbD0iI2ZmZiIgdGV4dC1hbmNob3I9Im1pZGRsZSIgZm9udC1mYW1pbHk9InNhbnMtc2VyaWYiIGZvbnQtd2VpZ2h0PSI3MDAiPlM8L3RleHQ+PC9zdmc+";
1030
+
985
1031
  // src/components/tabs/wallet-connect.tsx
986
1032
  import { Fragment, jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
987
1033
  function MatricaWalletEntry() {
@@ -1022,6 +1068,22 @@ function isMobile() {
1022
1068
  if (typeof navigator === "undefined") return false;
1023
1069
  return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
1024
1070
  }
1071
+ function SeekerWalletEntry({ onError }) {
1072
+ const { loginWithWallet } = useForgeConnect();
1073
+ const handleClick = async () => {
1074
+ try {
1075
+ const { address, signMessage } = await connectSeekerBridge();
1076
+ await loginWithWallet(address, signMessage, "solana");
1077
+ } catch (e) {
1078
+ onError(e instanceof Error ? e.message : "Seeker Wallet connection failed.");
1079
+ }
1080
+ };
1081
+ return /* @__PURE__ */ jsxs5("button", { type: "button", className: "fc-btn fc-btn-wallet", onClick: handleClick, children: [
1082
+ /* @__PURE__ */ jsx6("span", { style: { position: "relative", display: "inline-flex" }, children: /* @__PURE__ */ jsx6("img", { src: SEEKER_ICON, alt: "", className: "fc-wallet-icon" }) }),
1083
+ /* @__PURE__ */ jsx6("span", { className: "fc-wallet-name", children: "Seeker Wallet" }),
1084
+ /* @__PURE__ */ jsx6("span", { className: "fc-badge-preferred", children: "Detected" })
1085
+ ] });
1086
+ }
1025
1087
  function WalletConnectForm() {
1026
1088
  const { walletAdapter, setModalStep, config } = useForgeConnect();
1027
1089
  const methods = resolveLoginMethods(config);
@@ -1103,6 +1165,10 @@ function MobileWalletFlow() {
1103
1165
  ] })
1104
1166
  ] }),
1105
1167
  !loading && /* @__PURE__ */ jsxs5("div", { className: "fc-wallet-list", children: [
1168
+ isSeekerApp() && /* @__PURE__ */ jsx6(SeekerWalletEntry, { onError: (m) => {
1169
+ setError(m);
1170
+ setLoading(false);
1171
+ } }),
1106
1172
  showMatrica && /* @__PURE__ */ jsx6(MatricaWalletEntry, {}),
1107
1173
  standardWallets.map((w) => /* @__PURE__ */ jsxs5(
1108
1174
  "button",
@@ -1267,6 +1333,10 @@ function WalletAdapterFlow() {
1267
1333
  ] })
1268
1334
  ] }) : /* @__PURE__ */ jsxs5(Fragment, { children: [
1269
1335
  /* @__PURE__ */ jsxs5("div", { className: "fc-wallet-list", children: [
1336
+ isSeekerApp() && /* @__PURE__ */ jsx6(SeekerWalletEntry, { onError: (m) => {
1337
+ setError(m);
1338
+ setLoading(false);
1339
+ } }),
1270
1340
  methods.includes("matrica") && /* @__PURE__ */ jsx6(MatricaWalletEntry, {}),
1271
1341
  preferredWallets.map((w) => {
1272
1342
  const installed = w.readyState === "Installed";
@@ -4912,11 +4982,13 @@ export {
4912
4982
  ModalOverlay,
4913
4983
  PasskeysModal,
4914
4984
  TwoFactorModal,
4985
+ connectSeekerBridge,
4915
4986
  createApiClient,
4916
4987
  hasAllPermissions,
4917
4988
  hasAnyPermission,
4918
4989
  hasPermission,
4919
4990
  isOAuthMethod,
4991
+ isSeekerApp,
4920
4992
  registerMwaIfAvailable,
4921
4993
  resolveLoginMethods,
4922
4994
  useAdmin,