auramaxx 0.0.1
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/LICENSE +26 -0
- package/README.md +77 -0
- package/apps/desktop-electron/main.js +428 -0
- package/bin/auramaxx.js +1063 -0
- package/docs/ADAPTERS.md +466 -0
- package/docs/AGENT_SETUP.md +159 -0
- package/docs/API.md +127 -0
- package/docs/APPS.md +199 -0
- package/docs/ARCHITECTURE.md +235 -0
- package/docs/AUTH.md +318 -0
- package/docs/BEST-PRACTICES.md +82 -0
- package/docs/CLI.md +141 -0
- package/docs/DESKTOP_ELECTRON.md +26 -0
- package/docs/DEVELOPING-APPS.md +453 -0
- package/docs/MCP.md +122 -0
- package/docs/PACKAGING_POLICY.md +19 -0
- package/docs/PERMISSION.md +137 -0
- package/docs/PROTOCOL.md +142 -0
- package/docs/README.md +50 -0
- package/docs/SKILLS.md +132 -0
- package/docs/TROUBLESHOOTING.md +376 -0
- package/docs/WORKSPACE.md +673 -0
- package/docs/agent-auth.md +14 -0
- package/docs/api/authentication.md +79 -0
- package/docs/api/secrets/api-keys.md +28 -0
- package/docs/api/secrets/credentials.md +80 -0
- package/docs/api/secrets/sharing.md +48 -0
- package/docs/api/system.md +41 -0
- package/docs/api/wallets/apps-strategies.md +66 -0
- package/docs/api/wallets/core.md +46 -0
- package/docs/api/wallets/data-portfolio.md +42 -0
- package/docs/aura-file.md +48 -0
- package/docs/core-concepts/FEATURES.md +114 -0
- package/docs/credentials.md +120 -0
- package/docs/external/HOW_TO_AURAMAXX/GETTING_SECRETS.md +33 -0
- package/docs/external/HOW_TO_AURAMAXX/README.md +45 -0
- package/docs/external/getting-started.md +10 -0
- package/docs/external/overview.md +19 -0
- package/docs/external/persona-paths.md +7 -0
- package/docs/external/share-secret.md +76 -0
- package/docs/external/why-aura.md +7 -0
- package/docs/security.md +227 -0
- package/docs/templates/RELEASE_NOTES_TEMPLATE.md +22 -0
- package/docs/wallet/AI.md +508 -0
- package/docs/wallet/DEVELOPING-STRATEGIES.md +713 -0
- package/docs/wallet/README.md +47 -0
- package/docs/wallet/STRATEGY.md +89 -0
- package/next.config.ts +28 -0
- package/package.json +167 -0
- package/postcss.config.mjs +8 -0
- package/prisma/migrations/20260214170000_baseline/migration.sql +511 -0
- package/prisma/migrations/20260216214537_add_passkey_model/migration.sql +18 -0
- package/prisma/migrations/20260217150500_add_credential_access_audit/migration.sql +31 -0
- package/prisma/migrations/20260222090000_update_admin_ttl_default/migration.sql +10 -0
- package/prisma/migrations/migration_lock.toml +3 -0
- package/prisma/schema.prisma +447 -0
- package/public/logo.webp +0 -0
- package/scripts/add-app.js +245 -0
- package/server/abi/SwapHelper.json +438 -0
- package/server/cli/approval.ts +447 -0
- package/server/cli/commands/actions.ts +474 -0
- package/server/cli/commands/api.ts +220 -0
- package/server/cli/commands/apikey.ts +277 -0
- package/server/cli/commands/app.ts +204 -0
- package/server/cli/commands/auth.ts +464 -0
- package/server/cli/commands/cron.ts +24 -0
- package/server/cli/commands/diary.ts +274 -0
- package/server/cli/commands/doctor.ts +1247 -0
- package/server/cli/commands/env.ts +476 -0
- package/server/cli/commands/experimental.ts +69 -0
- package/server/cli/commands/init.ts +798 -0
- package/server/cli/commands/lock.ts +157 -0
- package/server/cli/commands/mcp.ts +285 -0
- package/server/cli/commands/quickhack.ts +86 -0
- package/server/cli/commands/release-check.ts +231 -0
- package/server/cli/commands/restore.ts +314 -0
- package/server/cli/commands/service.ts +320 -0
- package/server/cli/commands/shell-hook.ts +512 -0
- package/server/cli/commands/skill.ts +216 -0
- package/server/cli/commands/start.ts +139 -0
- package/server/cli/commands/status.ts +59 -0
- package/server/cli/commands/stop.ts +36 -0
- package/server/cli/commands/token.ts +180 -0
- package/server/cli/commands/unlock.ts +50 -0
- package/server/cli/commands/vault.ts +1323 -0
- package/server/cli/commands/wallet.ts +209 -0
- package/server/cli/index.ts +280 -0
- package/server/cli/lib/approval-poll.ts +94 -0
- package/server/cli/lib/aura-parser.ts +64 -0
- package/server/cli/lib/credential-create.ts +74 -0
- package/server/cli/lib/credential-resolve.ts +280 -0
- package/server/cli/lib/dotenv-migrate.ts +116 -0
- package/server/cli/lib/dotenv-parser.ts +146 -0
- package/server/cli/lib/escalation.ts +57 -0
- package/server/cli/lib/http.ts +91 -0
- package/server/cli/lib/init-steps.ts +76 -0
- package/server/cli/lib/local-agent-trust.ts +45 -0
- package/server/cli/lib/lock-unlock-helper.ts +71 -0
- package/server/cli/lib/process.ts +162 -0
- package/server/cli/lib/prompt.ts +294 -0
- package/server/cli/lib/theme.ts +240 -0
- package/server/cli/socket.ts +579 -0
- package/server/cli/transport-client.ts +50 -0
- package/server/cron/index.ts +137 -0
- package/server/cron/job.ts +31 -0
- package/server/cron/jobs/balance-sync.ts +436 -0
- package/server/cron/jobs/incoming-scan.ts +506 -0
- package/server/cron/jobs/native-price.ts +70 -0
- package/server/cron/jobs/orphan-cleanup.ts +40 -0
- package/server/cron/jobs/strategy-runner.ts +175 -0
- package/server/cron/scheduler.ts +125 -0
- package/server/index.ts +420 -0
- package/server/lib/adapters/factory.ts +119 -0
- package/server/lib/adapters/index.ts +19 -0
- package/server/lib/adapters/router.ts +297 -0
- package/server/lib/adapters/telegram.ts +645 -0
- package/server/lib/adapters/types.ts +89 -0
- package/server/lib/adapters/webhook.ts +95 -0
- package/server/lib/address.ts +49 -0
- package/server/lib/agent-auth/contracts.ts +1194 -0
- package/server/lib/agent-profiles.ts +419 -0
- package/server/lib/ai.ts +285 -0
- package/server/lib/api-registry/contracts.ts +86 -0
- package/server/lib/api-registry/validation.ts +172 -0
- package/server/lib/apikey-migration.ts +258 -0
- package/server/lib/app-installer.ts +505 -0
- package/server/lib/app-tokens.ts +247 -0
- package/server/lib/approval-link.ts +27 -0
- package/server/lib/auth.ts +314 -0
- package/server/lib/auto-execute.ts +160 -0
- package/server/lib/batch.ts +242 -0
- package/server/lib/cold.ts +1048 -0
- package/server/lib/config.ts +408 -0
- package/server/lib/credential-access-audit.ts +85 -0
- package/server/lib/credential-access-policy.ts +111 -0
- package/server/lib/credential-health.ts +343 -0
- package/server/lib/credential-import.ts +608 -0
- package/server/lib/credential-scope.ts +102 -0
- package/server/lib/credential-shares.ts +190 -0
- package/server/lib/credential-transport.ts +533 -0
- package/server/lib/credential-vault.ts +77 -0
- package/server/lib/credentials.ts +422 -0
- package/server/lib/crypto.ts +8 -0
- package/server/lib/db.ts +58 -0
- package/server/lib/defaults.ts +386 -0
- package/server/lib/dex/index.ts +80 -0
- package/server/lib/dex/relay.ts +235 -0
- package/server/lib/dex/types.ts +59 -0
- package/server/lib/dex/uniswap.ts +370 -0
- package/server/lib/diary.ts +34 -0
- package/server/lib/dont-ask-again-policy.ts +41 -0
- package/server/lib/e2e-agent/artifacts.ts +36 -0
- package/server/lib/e2e-agent/contracts.ts +112 -0
- package/server/lib/e2e-agent/validation.ts +135 -0
- package/server/lib/encrypt.ts +114 -0
- package/server/lib/error.ts +20 -0
- package/server/lib/events.ts +217 -0
- package/server/lib/feature-flags.ts +93 -0
- package/server/lib/hot.ts +357 -0
- package/server/lib/human-action-summary.ts +80 -0
- package/server/lib/key-fingerprint.ts +28 -0
- package/server/lib/logger.ts +340 -0
- package/server/lib/network.ts +137 -0
- package/server/lib/notifications.ts +230 -0
- package/server/lib/oauth2-refresh.ts +241 -0
- package/server/lib/oursecret.ts +71 -0
- package/server/lib/passkey-credential.ts +360 -0
- package/server/lib/passkey.ts +68 -0
- package/server/lib/permissions.ts +299 -0
- package/server/lib/pino.ts +24 -0
- package/server/lib/policy-preview.ts +138 -0
- package/server/lib/price.ts +338 -0
- package/server/lib/prices.ts +34 -0
- package/server/lib/project-scope.ts +297 -0
- package/server/lib/resolve-action.ts +328 -0
- package/server/lib/resolve.ts +36 -0
- package/server/lib/secret-gist-share.ts +296 -0
- package/server/lib/sessions.ts +634 -0
- package/server/lib/socket-path.ts +56 -0
- package/server/lib/solana/connection.ts +26 -0
- package/server/lib/solana/jupiter.ts +128 -0
- package/server/lib/solana/transfer.ts +108 -0
- package/server/lib/solana/wallet.ts +136 -0
- package/server/lib/strategy/emits.ts +21 -0
- package/server/lib/strategy/engine.ts +1305 -0
- package/server/lib/strategy/executor.ts +115 -0
- package/server/lib/strategy/hook-context.ts +159 -0
- package/server/lib/strategy/hooks.ts +990 -0
- package/server/lib/strategy/index.ts +28 -0
- package/server/lib/strategy/installer.ts +305 -0
- package/server/lib/strategy/loader.ts +256 -0
- package/server/lib/strategy/message.ts +237 -0
- package/server/lib/strategy/repository.ts +218 -0
- package/server/lib/strategy/session-logger.ts +693 -0
- package/server/lib/strategy/sources.ts +288 -0
- package/server/lib/strategy/state.ts +189 -0
- package/server/lib/strategy/templates.ts +403 -0
- package/server/lib/strategy/tick.ts +404 -0
- package/server/lib/strategy/types.ts +230 -0
- package/server/lib/swap.ts +3 -0
- package/server/lib/temp.ts +86 -0
- package/server/lib/token-metadata.ts +86 -0
- package/server/lib/token-safety.ts +200 -0
- package/server/lib/token-search.ts +444 -0
- package/server/lib/totp.ts +194 -0
- package/server/lib/transactions.ts +123 -0
- package/server/lib/transport.ts +84 -0
- package/server/lib/txhistory/decoder.ts +262 -0
- package/server/lib/txhistory/enricher.ts +652 -0
- package/server/lib/txhistory/index.ts +391 -0
- package/server/lib/txhistory/signatures.ts +59 -0
- package/server/lib/update-check.ts +35 -0
- package/server/lib/verified-summary.ts +414 -0
- package/server/lib/view-registry.ts +80 -0
- package/server/mcp/profile-policy.ts +30 -0
- package/server/mcp/server.ts +1589 -0
- package/server/mcp/tools.ts +276 -0
- package/server/middleware/auth.ts +119 -0
- package/server/middleware/requestLogger.ts +84 -0
- package/server/routes/actions.ts +539 -0
- package/server/routes/adapters.ts +711 -0
- package/server/routes/addressbook.ts +113 -0
- package/server/routes/ai.ts +34 -0
- package/server/routes/apikeys.ts +343 -0
- package/server/routes/apps.ts +601 -0
- package/server/routes/auth.ts +406 -0
- package/server/routes/backup.ts +404 -0
- package/server/routes/batch.ts +270 -0
- package/server/routes/bookmarks.ts +162 -0
- package/server/routes/credential-shares.ts +380 -0
- package/server/routes/credential-vaults.ts +159 -0
- package/server/routes/credentials.ts +1782 -0
- package/server/routes/dashboard.ts +97 -0
- package/server/routes/defaults.ts +124 -0
- package/server/routes/flags.ts +11 -0
- package/server/routes/fund.ts +225 -0
- package/server/routes/heartbeat.ts +375 -0
- package/server/routes/import.ts +364 -0
- package/server/routes/launch.ts +665 -0
- package/server/routes/lock.ts +54 -0
- package/server/routes/logs.ts +68 -0
- package/server/routes/nuke.ts +111 -0
- package/server/routes/passkey-credentials.ts +99 -0
- package/server/routes/passkey.ts +366 -0
- package/server/routes/portfolio.ts +217 -0
- package/server/routes/price.ts +63 -0
- package/server/routes/resolve.ts +31 -0
- package/server/routes/security.ts +45 -0
- package/server/routes/send-evm.ts +241 -0
- package/server/routes/send-solana.ts +281 -0
- package/server/routes/send.ts +178 -0
- package/server/routes/setup.ts +210 -0
- package/server/routes/strategy.ts +894 -0
- package/server/routes/swap-evm.ts +352 -0
- package/server/routes/swap-solana.ts +176 -0
- package/server/routes/swap.ts +356 -0
- package/server/routes/token.ts +247 -0
- package/server/routes/unlock.ts +467 -0
- package/server/routes/views.ts +41 -0
- package/server/routes/wallet-assets.ts +361 -0
- package/server/routes/wallet-transactions.ts +515 -0
- package/server/routes/wallet.ts +709 -0
- package/server/types.ts +146 -0
- package/shared/credential-field-schema.ts +248 -0
- package/skills/auramaxx/HEARTBEAT.md +78 -0
- package/skills/auramaxx/SKILL.md +745 -0
- package/skills/auramaxx/docs/AGENT_SETUP.md +155 -0
- package/skills/auramaxx/docs/API.md +127 -0
- package/skills/auramaxx/docs/AUTH.md +318 -0
- package/skills/auramaxx/docs/CLI.md +130 -0
- package/skills/auramaxx/docs/MCP.md +122 -0
- package/skills/auramaxx/docs/TROUBLESHOOTING.md +357 -0
- package/skills/auramaxx/docs/WORKSPACE.md +673 -0
- package/skills/auramaxx/docs/security.md +227 -0
- package/skills/task-lifecycle/SKILL.md +378 -0
- package/src/app/api/[...doc]/page.tsx +36 -0
- package/src/app/api/agent-requests/route.ts +30 -0
- package/src/app/api/apps/install/route.ts +132 -0
- package/src/app/api/apps/manifests/route.ts +16 -0
- package/src/app/api/apps/static/[...path]/route.ts +57 -0
- package/src/app/api/docs/plain/route.ts +74 -0
- package/src/app/api/events/route.ts +92 -0
- package/src/app/api/page.tsx +290 -0
- package/src/app/api/workspace/[id]/apps/[wid]/route.ts +119 -0
- package/src/app/api/workspace/[id]/apps/route.ts +81 -0
- package/src/app/api/workspace/[id]/export/route.ts +67 -0
- package/src/app/api/workspace/[id]/route.ts +168 -0
- package/src/app/api/workspace/auth.ts +40 -0
- package/src/app/api/workspace/config/route.ts +121 -0
- package/src/app/api/workspace/import/route.ts +127 -0
- package/src/app/api/workspace/route.ts +116 -0
- package/src/app/app-legacy-do-not-use/page.tsx +2245 -0
- package/src/app/apple-icon.png +0 -0
- package/src/app/approve/[actionId]/page.tsx +409 -0
- package/src/app/docs/DocsPageContent.tsx +269 -0
- package/src/app/docs/[...doc]/page.tsx +41 -0
- package/src/app/docs/page.tsx +38 -0
- package/src/app/favicon.ico +0 -0
- package/src/app/globals.css +819 -0
- package/src/app/health/page.tsx +5 -0
- package/src/app/hello/page.tsx +102 -0
- package/src/app/icon.png +0 -0
- package/src/app/layout.tsx +39 -0
- package/src/app/page.tsx +1964 -0
- package/src/app/privacy/page.tsx +63 -0
- package/src/app/providers.tsx +87 -0
- package/src/app/share/[token]/page.tsx +295 -0
- package/src/app/terms/page.tsx +80 -0
- package/src/components/ChainSelector.tsx +44 -0
- package/src/components/HumanActionBar.tsx +697 -0
- package/src/components/NotificationDrawer.tsx +387 -0
- package/src/components/PasskeyEnrollmentPrompt.tsx +235 -0
- package/src/components/apps/AgentKeysApp.tsx +490 -0
- package/src/components/apps/App.tsx +153 -0
- package/src/components/apps/AppGrid.tsx +15 -0
- package/src/components/apps/DetailedAddressDrawer.tsx +325 -0
- package/src/components/apps/DraggableApp.tsx +562 -0
- package/src/components/apps/IFrameApp.tsx +73 -0
- package/src/components/apps/LogsApp.tsx +360 -0
- package/src/components/apps/SendApp.tsx +394 -0
- package/src/components/apps/SetupWizardApp.tsx +1004 -0
- package/src/components/apps/SystemDefaultsApp.tsx +845 -0
- package/src/components/apps/ThirdPartyApp.tsx +428 -0
- package/src/components/apps/TokenApp.tsx +319 -0
- package/src/components/apps/TransactionsApp.tsx +438 -0
- package/src/components/apps/WalletDetailApp.tsx +1505 -0
- package/src/components/apps/index.ts +13 -0
- package/src/components/design-system/Button.tsx +88 -0
- package/src/components/design-system/ChainIndicator.tsx +65 -0
- package/src/components/design-system/ChainSelector.tsx +147 -0
- package/src/components/design-system/ConfirmationModal.tsx +107 -0
- package/src/components/design-system/ConfirmationPopover.tsx +81 -0
- package/src/components/design-system/DownloadButton.tsx +149 -0
- package/src/components/design-system/Drawer.tsx +133 -0
- package/src/components/design-system/FilterDropdown.tsx +183 -0
- package/src/components/design-system/ItemPicker.tsx +157 -0
- package/src/components/design-system/Modal.tsx +296 -0
- package/src/components/design-system/Popover.tsx +142 -0
- package/src/components/design-system/TextInput.tsx +85 -0
- package/src/components/design-system/Toggle.tsx +65 -0
- package/src/components/design-system/TyvekCollapsibleSection.tsx +55 -0
- package/src/components/design-system/index.ts +14 -0
- package/src/components/docs/ClientSideMarkdown.tsx +51 -0
- package/src/components/docs/DocsSearchBar.tsx +118 -0
- package/src/components/docs/DocsThemeToggle.tsx +38 -0
- package/src/components/docs/PersistentDocGroup.tsx +91 -0
- package/src/components/docs/ShareUrlButton.tsx +33 -0
- package/src/components/docs/SidebarScrollMemory.tsx +56 -0
- package/src/components/health/CredentialHealthDashboard.tsx +214 -0
- package/src/components/icons/ChainIcons.tsx +72 -0
- package/src/components/layout/AppStoreDrawer.tsx +369 -0
- package/src/components/layout/ContentArea.tsx +21 -0
- package/src/components/layout/CreateViewModal.tsx +88 -0
- package/src/components/layout/LeftRail.tsx +114 -0
- package/src/components/layout/TabBar.tsx +284 -0
- package/src/components/layout/WalletSidebar.tsx +1030 -0
- package/src/components/layout/index.ts +6 -0
- package/src/components/marketing/AuraMaxxSpecOverlay.tsx +653 -0
- package/src/components/marketing/DeviceMorphExperience.tsx +216 -0
- package/src/components/vault/ApiKeysConsole.tsx +1272 -0
- package/src/components/vault/AuditConsole.tsx +600 -0
- package/src/components/vault/CredentialDetail.tsx +625 -0
- package/src/components/vault/CredentialEmpty.tsx +55 -0
- package/src/components/vault/CredentialField.tsx +583 -0
- package/src/components/vault/CredentialForm.tsx +1484 -0
- package/src/components/vault/CredentialList.tsx +265 -0
- package/src/components/vault/CredentialRow.tsx +130 -0
- package/src/components/vault/CredentialShareModal.tsx +273 -0
- package/src/components/vault/CredentialVault.tsx +1662 -0
- package/src/components/vault/CredentialWalletWidget.tsx +103 -0
- package/src/components/vault/DocsConsole.tsx +113 -0
- package/src/components/vault/ImportCredentialsModal.tsx +578 -0
- package/src/components/vault/LargeTypeModal.tsx +88 -0
- package/src/components/vault/PasswordGenerator.tsx +232 -0
- package/src/components/vault/TOTPDisplay.tsx +108 -0
- package/src/components/vault/TotpSetupPanel.tsx +198 -0
- package/src/components/vault/VaultSidebar.tsx +881 -0
- package/src/components/vault/credentialFormName.ts +91 -0
- package/src/components/vault/hooks/useVaultKeyboardShortcuts.ts +69 -0
- package/src/components/vault/types.ts +56 -0
- package/src/context/AuthContext.tsx +365 -0
- package/src/context/PriceContext.tsx +113 -0
- package/src/context/ThemeContext.tsx +164 -0
- package/src/context/WebSocketContext.tsx +269 -0
- package/src/context/WorkspaceContext.tsx +668 -0
- package/src/hooks/index.ts +4 -0
- package/src/hooks/useAgentActions.ts +552 -0
- package/src/hooks/useBalance.ts +103 -0
- package/src/hooks/useBalances.ts +129 -0
- package/src/hooks/useTheme.ts +156 -0
- package/src/instrumentation.ts +12 -0
- package/src/lib/api-docs.ts +154 -0
- package/src/lib/api.ts +474 -0
- package/src/lib/app-loader.ts +148 -0
- package/src/lib/app-registry.ts +178 -0
- package/src/lib/app-sdk.ts +157 -0
- package/src/lib/audit-console-adapter.ts +151 -0
- package/src/lib/auth-client.ts +75 -0
- package/src/lib/config.ts +74 -0
- package/src/lib/credential-field-schema.ts +11 -0
- package/src/lib/crypto.ts +112 -0
- package/src/lib/db.ts +21 -0
- package/src/lib/docs.ts +544 -0
- package/src/lib/events.ts +363 -0
- package/src/lib/pino.ts +24 -0
- package/src/lib/theme-handlers.ts +168 -0
- package/src/lib/theme.ts +351 -0
- package/src/lib/tokenData.ts +378 -0
- package/src/lib/totp-import.ts +57 -0
- package/src/lib/vault-crypto.ts +129 -0
- package/src/lib/view-registry.ts +57 -0
- package/src/lib/websocket-server.ts +302 -0
- package/src/lib/websocket-setup.ts +79 -0
- package/src/lib/wordlist.ts +2050 -0
- package/src/lib/workspace-handlers.ts +285 -0
- package/start.sh +170 -0
- package/tailwind.config.ts +99 -0
- package/tsconfig.json +42 -0
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import React, { useMemo } from 'react';
|
|
4
|
+
import { Search, Plus, KeyRound, Upload } from 'lucide-react';
|
|
5
|
+
import { Button, TextInput } from '@/components/design-system';
|
|
6
|
+
import { CredentialRow } from './CredentialRow';
|
|
7
|
+
import type { CredentialMeta } from './types';
|
|
8
|
+
|
|
9
|
+
interface CredentialListProps {
|
|
10
|
+
credentials: CredentialMeta[];
|
|
11
|
+
latestAccessById?: Record<string, number>;
|
|
12
|
+
selectedId: string | null;
|
|
13
|
+
searchQuery: string;
|
|
14
|
+
onSearchChange: (query: string) => void;
|
|
15
|
+
onSelect: (id: string) => void;
|
|
16
|
+
onAdd: () => void;
|
|
17
|
+
canAdd?: boolean;
|
|
18
|
+
onImport?: () => void;
|
|
19
|
+
canImport?: boolean;
|
|
20
|
+
onOpenGenerator?: () => void;
|
|
21
|
+
canGenerate?: boolean;
|
|
22
|
+
onClearFilters?: () => void;
|
|
23
|
+
onCreateWithFilter?: () => void;
|
|
24
|
+
hasActiveFilters?: boolean;
|
|
25
|
+
showSearch?: boolean;
|
|
26
|
+
fieldSearchSuggestions?: string[];
|
|
27
|
+
onApplySearchSuggestion?: (query: string) => void;
|
|
28
|
+
searchInputRef?: React.Ref<HTMLInputElement>;
|
|
29
|
+
className?: string;
|
|
30
|
+
leadingAction?: React.ReactNode;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const normalize = (value: string) => value.trim().toLowerCase();
|
|
34
|
+
const createdTs = (credential: CredentialMeta) => {
|
|
35
|
+
const created = Date.parse(credential.createdAt);
|
|
36
|
+
if (Number.isFinite(created)) return created;
|
|
37
|
+
return 0;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const effectiveAccessTs = (credential: CredentialMeta, latestAccessById?: Record<string, number>) => {
|
|
41
|
+
const known = latestAccessById?.[credential.id];
|
|
42
|
+
if (typeof known === 'number' && Number.isFinite(known) && known > 0) return known;
|
|
43
|
+
return createdTs(credential);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const searchRank = (credential: CredentialMeta, query: string) => {
|
|
47
|
+
const q = normalize(query);
|
|
48
|
+
if (!q) return 0;
|
|
49
|
+
const name = normalize(credential.name);
|
|
50
|
+
const username = normalize(String(credential.meta.username || ''));
|
|
51
|
+
const url = normalize(String(credential.meta.url || ''));
|
|
52
|
+
if (name === q) return 3;
|
|
53
|
+
if (name.startsWith(q) || username.startsWith(q) || url.startsWith(q)) return 2;
|
|
54
|
+
if (name.includes(q) || username.includes(q) || url.includes(q)) return 1;
|
|
55
|
+
return 0;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export const CredentialList: React.FC<CredentialListProps> = ({
|
|
59
|
+
credentials,
|
|
60
|
+
latestAccessById,
|
|
61
|
+
selectedId,
|
|
62
|
+
searchQuery,
|
|
63
|
+
onSearchChange,
|
|
64
|
+
onSelect,
|
|
65
|
+
onAdd,
|
|
66
|
+
canAdd = true,
|
|
67
|
+
onImport,
|
|
68
|
+
canImport = true,
|
|
69
|
+
onOpenGenerator,
|
|
70
|
+
canGenerate = true,
|
|
71
|
+
onClearFilters,
|
|
72
|
+
onCreateWithFilter,
|
|
73
|
+
hasActiveFilters = false,
|
|
74
|
+
showSearch = true,
|
|
75
|
+
fieldSearchSuggestions = [],
|
|
76
|
+
onApplySearchSuggestion,
|
|
77
|
+
searchInputRef,
|
|
78
|
+
className = 'w-[300px] h-full flex flex-col border-r border-[var(--color-credential-array-border,#8d8d95)]',
|
|
79
|
+
leadingAction,
|
|
80
|
+
}) => {
|
|
81
|
+
const sorted = useMemo(() => {
|
|
82
|
+
return [...credentials].sort((a, b) => {
|
|
83
|
+
const aAccessTs = effectiveAccessTs(a, latestAccessById);
|
|
84
|
+
const bAccessTs = effectiveAccessTs(b, latestAccessById);
|
|
85
|
+
if (bAccessTs !== aAccessTs) return bAccessTs - aAccessTs;
|
|
86
|
+
|
|
87
|
+
const aRank = searchRank(a, searchQuery);
|
|
88
|
+
const bRank = searchRank(b, searchQuery);
|
|
89
|
+
if (bRank !== aRank) return bRank - aRank;
|
|
90
|
+
|
|
91
|
+
const aFav = a.meta.favorite ? 1 : 0;
|
|
92
|
+
const bFav = b.meta.favorite ? 1 : 0;
|
|
93
|
+
if (bFav !== aFav) return bFav - aFav;
|
|
94
|
+
|
|
95
|
+
const aName = normalize(a.name);
|
|
96
|
+
const bName = normalize(b.name);
|
|
97
|
+
const lexical = aName.localeCompare(bName);
|
|
98
|
+
if (lexical !== 0) return lexical;
|
|
99
|
+
|
|
100
|
+
return a.id.localeCompare(b.id);
|
|
101
|
+
});
|
|
102
|
+
}, [credentials, latestAccessById, searchQuery]);
|
|
103
|
+
|
|
104
|
+
return (
|
|
105
|
+
<div className={className} style={{ fontSize: 'var(--font-size-sm)' }}>
|
|
106
|
+
{/* Pinned header */}
|
|
107
|
+
<div
|
|
108
|
+
className={`border-b border-[var(--color-credential-array-border,#8d8d95)] ${showSearch ? 'flex items-center' : ''}`}
|
|
109
|
+
style={{ gap: 'var(--space-sm)', padding: 'var(--space-md)' }}
|
|
110
|
+
>
|
|
111
|
+
{showSearch ? (
|
|
112
|
+
<>
|
|
113
|
+
{leadingAction}
|
|
114
|
+
<div className="flex-1">
|
|
115
|
+
<TextInput
|
|
116
|
+
compact
|
|
117
|
+
leftElement={<Search size={12} />}
|
|
118
|
+
placeholder="Search..."
|
|
119
|
+
value={searchQuery}
|
|
120
|
+
onChange={(e) => onSearchChange(e.target.value)}
|
|
121
|
+
inputRef={searchInputRef}
|
|
122
|
+
/>
|
|
123
|
+
</div>
|
|
124
|
+
{onOpenGenerator && (
|
|
125
|
+
<Button
|
|
126
|
+
variant="secondary"
|
|
127
|
+
size="sm"
|
|
128
|
+
onClick={onOpenGenerator}
|
|
129
|
+
icon={<KeyRound size={10} />}
|
|
130
|
+
disabled={!canGenerate}
|
|
131
|
+
title="Generate password"
|
|
132
|
+
aria-label="Generate password"
|
|
133
|
+
>
|
|
134
|
+
GEN
|
|
135
|
+
</Button>
|
|
136
|
+
)}
|
|
137
|
+
{onImport && (
|
|
138
|
+
<Button
|
|
139
|
+
variant="secondary"
|
|
140
|
+
size="sm"
|
|
141
|
+
onClick={onImport}
|
|
142
|
+
icon={<Upload size={10} />}
|
|
143
|
+
disabled={!canImport}
|
|
144
|
+
title={canImport ? 'Import credentials' : 'Switch to Active to import credentials'}
|
|
145
|
+
aria-label="Import credentials"
|
|
146
|
+
>
|
|
147
|
+
IMPORT
|
|
148
|
+
</Button>
|
|
149
|
+
)}
|
|
150
|
+
<Button
|
|
151
|
+
size="sm"
|
|
152
|
+
onClick={onAdd}
|
|
153
|
+
icon={<Plus size={10} />}
|
|
154
|
+
disabled={!canAdd}
|
|
155
|
+
title={canAdd ? 'Create credential' : 'Switch to Active to create credentials'}
|
|
156
|
+
>
|
|
157
|
+
ADD
|
|
158
|
+
</Button>
|
|
159
|
+
</>
|
|
160
|
+
) : (
|
|
161
|
+
<div className="w-full space-y-2">
|
|
162
|
+
{leadingAction && <div className="flex">{leadingAction}</div>}
|
|
163
|
+
<div className="flex w-full items-center gap-2 overflow-hidden">
|
|
164
|
+
{onOpenGenerator && (
|
|
165
|
+
<Button
|
|
166
|
+
variant="secondary"
|
|
167
|
+
size="sm"
|
|
168
|
+
onClick={onOpenGenerator}
|
|
169
|
+
icon={<KeyRound size={10} />}
|
|
170
|
+
disabled={!canGenerate}
|
|
171
|
+
title="Generate password"
|
|
172
|
+
aria-label="Generate password"
|
|
173
|
+
className="flex-1 min-w-0"
|
|
174
|
+
>
|
|
175
|
+
GEN
|
|
176
|
+
</Button>
|
|
177
|
+
)}
|
|
178
|
+
{onImport && (
|
|
179
|
+
<Button
|
|
180
|
+
variant="secondary"
|
|
181
|
+
size="sm"
|
|
182
|
+
onClick={onImport}
|
|
183
|
+
icon={<Upload size={10} />}
|
|
184
|
+
disabled={!canImport}
|
|
185
|
+
title={canImport ? 'Import credentials' : 'Switch to Active to import credentials'}
|
|
186
|
+
aria-label="Import credentials"
|
|
187
|
+
className="flex-1 min-w-0"
|
|
188
|
+
>
|
|
189
|
+
IMPORT
|
|
190
|
+
</Button>
|
|
191
|
+
)}
|
|
192
|
+
<Button
|
|
193
|
+
size="sm"
|
|
194
|
+
onClick={onAdd}
|
|
195
|
+
icon={<Plus size={10} />}
|
|
196
|
+
disabled={!canAdd}
|
|
197
|
+
title={canAdd ? 'Create credential' : 'Switch to Active to create credentials'}
|
|
198
|
+
className="flex-1 min-w-0"
|
|
199
|
+
>
|
|
200
|
+
ADD
|
|
201
|
+
</Button>
|
|
202
|
+
</div>
|
|
203
|
+
</div>
|
|
204
|
+
)}
|
|
205
|
+
</div>
|
|
206
|
+
|
|
207
|
+
{/* Scrollable list */}
|
|
208
|
+
<div className="flex-1 overflow-y-auto overflow-x-hidden">
|
|
209
|
+
{sorted.length === 0 ? (
|
|
210
|
+
<div className="flex items-center justify-center h-full px-4">
|
|
211
|
+
<div className="text-center tyvek-label corner-marks p-6">
|
|
212
|
+
<span className="label-specimen text-[var(--color-text-muted,#6b7280)] block">
|
|
213
|
+
{hasActiveFilters ? 'NO SPECIMENS MATCH' : 'NO SPECIMENS FOUND'}
|
|
214
|
+
</span>
|
|
215
|
+
{fieldSearchSuggestions.length > 0 && onApplySearchSuggestion && (
|
|
216
|
+
<div className="mt-3 flex flex-wrap items-center justify-center gap-2">
|
|
217
|
+
{fieldSearchSuggestions.map((suggestion) => (
|
|
218
|
+
<button
|
|
219
|
+
key={suggestion}
|
|
220
|
+
type="button"
|
|
221
|
+
className="font-mono text-[9px] px-2 py-1 border border-[var(--color-border,#d4d4d8)] bg-[var(--color-surface,#ffffff)] text-[var(--color-text-muted,#6b7280)] hover:text-[var(--color-text,#0a0a0a)] hover:border-[var(--color-border-focus,#0a0a0a)]"
|
|
222
|
+
onClick={() => onApplySearchSuggestion(suggestion)}
|
|
223
|
+
title={`Search by ${suggestion}`}
|
|
224
|
+
>
|
|
225
|
+
{suggestion}
|
|
226
|
+
</button>
|
|
227
|
+
))}
|
|
228
|
+
</div>
|
|
229
|
+
)}
|
|
230
|
+
{hasActiveFilters && onClearFilters && (
|
|
231
|
+
<div className="mt-3 flex flex-col items-center gap-2">
|
|
232
|
+
<Button
|
|
233
|
+
variant="secondary"
|
|
234
|
+
size="sm"
|
|
235
|
+
onClick={onClearFilters}
|
|
236
|
+
>
|
|
237
|
+
CLEAR FILTERS
|
|
238
|
+
</Button>
|
|
239
|
+
{onCreateWithFilter && (
|
|
240
|
+
<Button
|
|
241
|
+
variant="secondary"
|
|
242
|
+
size="sm"
|
|
243
|
+
onClick={onCreateWithFilter}
|
|
244
|
+
>
|
|
245
|
+
CREATE WITH FILTER
|
|
246
|
+
</Button>
|
|
247
|
+
)}
|
|
248
|
+
</div>
|
|
249
|
+
)}
|
|
250
|
+
</div>
|
|
251
|
+
</div>
|
|
252
|
+
) : (
|
|
253
|
+
sorted.map((credential) => (
|
|
254
|
+
<CredentialRow
|
|
255
|
+
key={credential.id}
|
|
256
|
+
credential={credential}
|
|
257
|
+
selected={credential.id === selectedId}
|
|
258
|
+
onClick={() => onSelect(credential.id)}
|
|
259
|
+
/>
|
|
260
|
+
))
|
|
261
|
+
)}
|
|
262
|
+
</div>
|
|
263
|
+
</div>
|
|
264
|
+
);
|
|
265
|
+
};
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { Key, CreditCard, FileText, Star, RefreshCw, Terminal, ShieldCheck, Wallet } from 'lucide-react';
|
|
5
|
+
import type { CredentialMeta } from './types';
|
|
6
|
+
|
|
7
|
+
interface CredentialRowProps {
|
|
8
|
+
credential: CredentialMeta;
|
|
9
|
+
selected: boolean;
|
|
10
|
+
onClick: () => void;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const typeIcons: Record<string, React.FC<{ size: number; className?: string }>> = {
|
|
14
|
+
login: Key,
|
|
15
|
+
card: CreditCard,
|
|
16
|
+
note: FileText,
|
|
17
|
+
hot_wallet: Wallet,
|
|
18
|
+
plain_note: FileText,
|
|
19
|
+
apikey: Key,
|
|
20
|
+
oauth2: RefreshCw,
|
|
21
|
+
ssh: Terminal,
|
|
22
|
+
gpg: ShieldCheck,
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
function getSubtitle(credential: CredentialMeta): string {
|
|
26
|
+
switch (credential.type) {
|
|
27
|
+
case 'login':
|
|
28
|
+
return credential.meta.username || credential.meta.url || '';
|
|
29
|
+
case 'card':
|
|
30
|
+
return credential.meta.last4 ? `\u2022\u2022\u2022\u2022 ${credential.meta.last4}` : '';
|
|
31
|
+
case 'note':
|
|
32
|
+
return 'Secure Note';
|
|
33
|
+
case 'hot_wallet':
|
|
34
|
+
return (credential.meta.address as string) || (credential.meta.chain as string) || 'Hot Wallet';
|
|
35
|
+
case 'plain_note':
|
|
36
|
+
return (credential.meta.content as string) || (credential.meta.value as string) || 'Plain Note';
|
|
37
|
+
case 'apikey':
|
|
38
|
+
return (credential.meta.key as string) || 'API Key';
|
|
39
|
+
case 'oauth2':
|
|
40
|
+
return (credential.meta.scopes as string) || 'OAuth2';
|
|
41
|
+
case 'ssh':
|
|
42
|
+
return (credential.meta.fingerprint as string) || (credential.meta.key_type as string) || 'SSH Key';
|
|
43
|
+
case 'gpg':
|
|
44
|
+
return (credential.meta.key_id as string) || (credential.meta.uid_email as string) || 'GPG Key';
|
|
45
|
+
default:
|
|
46
|
+
return '';
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function getOAuth2ExpiryBadge(credential: CredentialMeta): { label: string; color: string; background: string } | null {
|
|
51
|
+
if (credential.type !== 'oauth2') return null;
|
|
52
|
+
const expiresAt = credential.meta.expires_at as number | null | undefined;
|
|
53
|
+
if (!expiresAt) {
|
|
54
|
+
return {
|
|
55
|
+
label: 'No token',
|
|
56
|
+
color: 'var(--color-text-muted,#6b7280)',
|
|
57
|
+
background: 'var(--color-background-alt,#f4f4f5)',
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
const now = Math.floor(Date.now() / 1000);
|
|
61
|
+
if (now >= expiresAt) {
|
|
62
|
+
return {
|
|
63
|
+
label: 'Expired',
|
|
64
|
+
color: 'var(--color-danger,#ef4444)',
|
|
65
|
+
background: 'color-mix(in srgb, var(--color-danger,#ef4444) 12%, transparent)',
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
const remaining = expiresAt - now;
|
|
69
|
+
if (remaining < 300) {
|
|
70
|
+
return {
|
|
71
|
+
label: '<5m',
|
|
72
|
+
color: 'var(--color-warning,#ff4d00)',
|
|
73
|
+
background: 'color-mix(in srgb, var(--color-warning,#ff4d00) 12%, transparent)',
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
return {
|
|
77
|
+
label: remaining < 3600 ? `${Math.floor(remaining / 60)}m` : `${Math.floor(remaining / 3600)}h`,
|
|
78
|
+
color: 'var(--color-success,#00c853)',
|
|
79
|
+
background: 'color-mix(in srgb, var(--color-success,#00c853) 12%, transparent)',
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export const CredentialRow: React.FC<CredentialRowProps> = ({ credential, selected, onClick }) => {
|
|
84
|
+
const Icon = typeIcons[credential.type] || FileText;
|
|
85
|
+
const subtitle = getSubtitle(credential);
|
|
86
|
+
const isFavorite = credential.meta.favorite;
|
|
87
|
+
|
|
88
|
+
return (
|
|
89
|
+
<div
|
|
90
|
+
onClick={onClick}
|
|
91
|
+
className={`flex items-center cursor-pointer border-b border-[var(--color-credential-array-border,#8d8d95)] transition-all hover:bg-[var(--color-background-alt,#f4f4f5)] hover:shadow-mech-hover ${selected ? 'corner-marks' : ''}`}
|
|
92
|
+
style={{
|
|
93
|
+
gap: 'var(--space-sm)',
|
|
94
|
+
padding: 'var(--space-sm) var(--space-md)',
|
|
95
|
+
borderLeft: selected ? '2px solid var(--color-accent, #ccff00)' : '2px solid transparent',
|
|
96
|
+
background: selected ? 'var(--color-background-alt, #f4f4f5)' : undefined,
|
|
97
|
+
}}
|
|
98
|
+
>
|
|
99
|
+
<Icon size={14} className="text-[var(--color-text-muted,#6b7280)] flex-shrink-0" />
|
|
100
|
+
<div className="flex-1 min-w-0">
|
|
101
|
+
<div className="font-mono text-[11px] font-bold text-[var(--color-text,#0a0a0a)] truncate">
|
|
102
|
+
{credential.name}
|
|
103
|
+
</div>
|
|
104
|
+
{subtitle && (
|
|
105
|
+
<div className="font-mono text-[9px] text-[var(--color-text-muted,#6b7280)] truncate">
|
|
106
|
+
{subtitle}
|
|
107
|
+
</div>
|
|
108
|
+
)}
|
|
109
|
+
</div>
|
|
110
|
+
{(() => {
|
|
111
|
+
const badge = getOAuth2ExpiryBadge(credential);
|
|
112
|
+
return badge ? (
|
|
113
|
+
<span
|
|
114
|
+
className="flex-shrink-0 font-mono text-[8px] font-bold px-1.5 py-0.5 rounded-sm"
|
|
115
|
+
style={{ color: badge.color, background: badge.background, borderRadius: 'var(--radius-sm)' }}
|
|
116
|
+
>
|
|
117
|
+
{badge.label}
|
|
118
|
+
</span>
|
|
119
|
+
) : null;
|
|
120
|
+
})()}
|
|
121
|
+
{isFavorite && (
|
|
122
|
+
<Star
|
|
123
|
+
size={10}
|
|
124
|
+
className="flex-shrink-0"
|
|
125
|
+
style={{ fill: 'var(--color-accent,#ccff00)', color: 'var(--color-accent,#ccff00)' }}
|
|
126
|
+
/>
|
|
127
|
+
)}
|
|
128
|
+
</div>
|
|
129
|
+
);
|
|
130
|
+
};
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import React, { useEffect, useState } from 'react';
|
|
4
|
+
import { Check, Copy, Link2 } from 'lucide-react';
|
|
5
|
+
import { Button, FilterDropdown, Modal, TextInput } from '@/components/design-system';
|
|
6
|
+
import { api, Api } from '@/lib/api';
|
|
7
|
+
|
|
8
|
+
interface CredentialShareModalProps {
|
|
9
|
+
isOpen: boolean;
|
|
10
|
+
onClose: () => void;
|
|
11
|
+
credentialId: string;
|
|
12
|
+
credentialName: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
type ExpiryPreset = '15m' | '1h' | '24h' | '7d' | '30d';
|
|
16
|
+
type AccessMode = 'anyone' | 'password';
|
|
17
|
+
|
|
18
|
+
const EXPIRY_OPTIONS: { value: ExpiryPreset; label: string }[] = [
|
|
19
|
+
{ value: '15m', label: '15 Minutes' },
|
|
20
|
+
{ value: '1h', label: '1 Hour' },
|
|
21
|
+
{ value: '24h', label: '24 Hours' },
|
|
22
|
+
{ value: '7d', label: '7 Days' },
|
|
23
|
+
{ value: '30d', label: '30 Days' },
|
|
24
|
+
];
|
|
25
|
+
|
|
26
|
+
const ACCESS_OPTIONS: { value: AccessMode; label: string }[] = [
|
|
27
|
+
{ value: 'anyone', label: 'Anyone with link' },
|
|
28
|
+
{ value: 'password', label: 'Set password' },
|
|
29
|
+
];
|
|
30
|
+
|
|
31
|
+
export const CredentialShareModal: React.FC<CredentialShareModalProps> = ({
|
|
32
|
+
isOpen,
|
|
33
|
+
onClose,
|
|
34
|
+
credentialId,
|
|
35
|
+
credentialName,
|
|
36
|
+
}) => {
|
|
37
|
+
const [expiresAfter, setExpiresAfter] = useState<ExpiryPreset>('24h');
|
|
38
|
+
const [accessMode, setAccessMode] = useState<AccessMode>('anyone');
|
|
39
|
+
const [sharePassword, setSharePassword] = useState('');
|
|
40
|
+
const [oneTimeOnly, setOneTimeOnly] = useState(false);
|
|
41
|
+
|
|
42
|
+
const [gistCopied, setGistCopied] = useState(false);
|
|
43
|
+
const [gistGenerating, setGistGenerating] = useState(false);
|
|
44
|
+
const [gistError, setGistError] = useState<string | null>(null);
|
|
45
|
+
const [gistLink, setGistLink] = useState('');
|
|
46
|
+
|
|
47
|
+
const [linkCopied, setLinkCopied] = useState(false);
|
|
48
|
+
const [linkGenerating, setLinkGenerating] = useState(false);
|
|
49
|
+
const [linkError, setLinkError] = useState<string | null>(null);
|
|
50
|
+
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
if (!isOpen) return;
|
|
53
|
+
setGistError(null);
|
|
54
|
+
setGistCopied(false);
|
|
55
|
+
setGistLink('');
|
|
56
|
+
setLinkError(null);
|
|
57
|
+
setLinkCopied(false);
|
|
58
|
+
}, [isOpen]);
|
|
59
|
+
|
|
60
|
+
const resolveSharePageUrl = (token: string): string => `${window.location.origin}/share/${token}`;
|
|
61
|
+
|
|
62
|
+
const validateOptions = (): string | null => {
|
|
63
|
+
if (accessMode === 'password' && !sharePassword.trim()) {
|
|
64
|
+
return 'Password is required when access mode is Set password';
|
|
65
|
+
}
|
|
66
|
+
return null;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const handleCopySecretGist = async () => {
|
|
70
|
+
setGistError(null);
|
|
71
|
+
const validationError = validateOptions();
|
|
72
|
+
if (validationError) {
|
|
73
|
+
setGistError(validationError);
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
try {
|
|
78
|
+
setGistGenerating(true);
|
|
79
|
+
setGistCopied(false);
|
|
80
|
+
const res = await api.post<{
|
|
81
|
+
success: boolean;
|
|
82
|
+
gist: {
|
|
83
|
+
url: string;
|
|
84
|
+
marker: string;
|
|
85
|
+
identifier: string;
|
|
86
|
+
title: string;
|
|
87
|
+
};
|
|
88
|
+
share: {
|
|
89
|
+
token: string;
|
|
90
|
+
credentialId: string;
|
|
91
|
+
expiresAt: number;
|
|
92
|
+
accessMode: AccessMode;
|
|
93
|
+
oneTimeOnly: boolean;
|
|
94
|
+
};
|
|
95
|
+
link: string;
|
|
96
|
+
}>(Api.Wallet, '/credential-shares/gist', {
|
|
97
|
+
credentialId,
|
|
98
|
+
expiresAfter,
|
|
99
|
+
accessMode,
|
|
100
|
+
oneTimeOnly,
|
|
101
|
+
shareBaseUrl: window.location.origin,
|
|
102
|
+
...(accessMode === 'password' ? { password: sharePassword } : {}),
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
setGistLink(res.gist.url);
|
|
106
|
+
await navigator.clipboard.writeText(res.gist.url);
|
|
107
|
+
setGistCopied(true);
|
|
108
|
+
setTimeout(() => setGistCopied(false), 2000);
|
|
109
|
+
} catch {
|
|
110
|
+
setGistError(
|
|
111
|
+
`Failed to create secret gist. Check "gh auth status" in terminal. If needed, run "gh auth login".`,
|
|
112
|
+
);
|
|
113
|
+
} finally {
|
|
114
|
+
setGistGenerating(false);
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
const handleCopyShareLink = async () => {
|
|
119
|
+
setLinkError(null);
|
|
120
|
+
const validationError = validateOptions();
|
|
121
|
+
if (validationError) {
|
|
122
|
+
setLinkError(validationError);
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
try {
|
|
127
|
+
setLinkGenerating(true);
|
|
128
|
+
const res = await api.post<{
|
|
129
|
+
success: boolean;
|
|
130
|
+
share: {
|
|
131
|
+
token: string;
|
|
132
|
+
credentialId: string;
|
|
133
|
+
expiresAt: number;
|
|
134
|
+
accessMode: AccessMode;
|
|
135
|
+
oneTimeOnly: boolean;
|
|
136
|
+
};
|
|
137
|
+
}>(Api.Wallet, '/credential-shares', {
|
|
138
|
+
credentialId,
|
|
139
|
+
expiresAfter,
|
|
140
|
+
accessMode,
|
|
141
|
+
oneTimeOnly,
|
|
142
|
+
...(accessMode === 'password' ? { password: sharePassword } : {}),
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
const link = resolveSharePageUrl(res.share.token);
|
|
146
|
+
await navigator.clipboard.writeText(link);
|
|
147
|
+
setLinkCopied(true);
|
|
148
|
+
setTimeout(() => setLinkCopied(false), 2000);
|
|
149
|
+
} catch (err) {
|
|
150
|
+
setLinkError(err instanceof Error ? err.message : 'Failed to generate share link');
|
|
151
|
+
} finally {
|
|
152
|
+
setLinkGenerating(false);
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
const handleClose = () => {
|
|
157
|
+
setGistError(null);
|
|
158
|
+
setGistCopied(false);
|
|
159
|
+
setGistGenerating(false);
|
|
160
|
+
setGistLink('');
|
|
161
|
+
setLinkError(null);
|
|
162
|
+
setLinkCopied(false);
|
|
163
|
+
setLinkGenerating(false);
|
|
164
|
+
onClose();
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
return (
|
|
168
|
+
<Modal
|
|
169
|
+
isOpen={isOpen}
|
|
170
|
+
onClose={handleClose}
|
|
171
|
+
title={`Sharing ${credentialName}`}
|
|
172
|
+
icon={<Link2 size={16} className="text-[var(--color-text,#0a0a0a)]" />}
|
|
173
|
+
size="md"
|
|
174
|
+
footer={(
|
|
175
|
+
<div className="flex items-center justify-end gap-2">
|
|
176
|
+
<Button variant="secondary" size="sm" onClick={handleClose}>
|
|
177
|
+
CLOSE
|
|
178
|
+
</Button>
|
|
179
|
+
</div>
|
|
180
|
+
)}
|
|
181
|
+
>
|
|
182
|
+
<div className="space-y-4">
|
|
183
|
+
<div className="space-y-2">
|
|
184
|
+
<div className="font-mono text-[8px] uppercase tracking-widest text-[var(--color-text-faint,#9ca3af)]">
|
|
185
|
+
GitHub Gist (Recommended)
|
|
186
|
+
</div>
|
|
187
|
+
<div className="font-mono text-[9px] text-[var(--color-text-muted,#6b7280)]">
|
|
188
|
+
Check <span className="text-[var(--color-text,#0a0a0a)]">`gh auth status`</span> first; run <span className="text-[var(--color-text,#0a0a0a)]">`gh auth login`</span> only if needed.
|
|
189
|
+
</div>
|
|
190
|
+
<div className="flex items-center justify-between gap-2">
|
|
191
|
+
{gistLink ? (
|
|
192
|
+
<a
|
|
193
|
+
href={gistLink}
|
|
194
|
+
target="_blank"
|
|
195
|
+
rel="noreferrer"
|
|
196
|
+
className="flex-1 min-w-0 font-mono text-[9px] text-[var(--color-text-muted,#6b7280)] truncate hover:underline"
|
|
197
|
+
title={gistLink}
|
|
198
|
+
>
|
|
199
|
+
{gistLink}
|
|
200
|
+
</a>
|
|
201
|
+
) : (
|
|
202
|
+
<div className="flex-1 min-w-0 font-mono text-[9px] text-[var(--color-text-muted,#6b7280)] truncate">
|
|
203
|
+
Click SHARE GIST to generate a link.
|
|
204
|
+
</div>
|
|
205
|
+
)}
|
|
206
|
+
<Button variant="primary" size="sm" onClick={handleCopySecretGist} loading={gistGenerating}>
|
|
207
|
+
{gistCopied ? <Check size={10} /> : <Copy size={10} />}
|
|
208
|
+
{gistCopied ? 'COPIED' : 'SHARE GIST'}
|
|
209
|
+
</Button>
|
|
210
|
+
</div>
|
|
211
|
+
{gistError && (
|
|
212
|
+
<div className="font-mono text-[9px] text-[var(--color-danger,#ef4444)]">
|
|
213
|
+
{gistError}
|
|
214
|
+
</div>
|
|
215
|
+
)}
|
|
216
|
+
</div>
|
|
217
|
+
|
|
218
|
+
<div className="space-y-3">
|
|
219
|
+
<div className="font-mono text-[8px] uppercase tracking-widest text-[var(--color-text-faint,#9ca3af)]">
|
|
220
|
+
Share Link (Local)
|
|
221
|
+
</div>
|
|
222
|
+
<FilterDropdown
|
|
223
|
+
label="Link Expires After"
|
|
224
|
+
options={EXPIRY_OPTIONS}
|
|
225
|
+
value={expiresAfter}
|
|
226
|
+
onChange={(value) => setExpiresAfter(value as ExpiryPreset)}
|
|
227
|
+
compact
|
|
228
|
+
/>
|
|
229
|
+
<FilterDropdown
|
|
230
|
+
label="Available To"
|
|
231
|
+
options={ACCESS_OPTIONS}
|
|
232
|
+
value={accessMode}
|
|
233
|
+
onChange={(value) => setAccessMode(value as AccessMode)}
|
|
234
|
+
compact
|
|
235
|
+
/>
|
|
236
|
+
{accessMode === 'password' && (
|
|
237
|
+
<TextInput
|
|
238
|
+
label="Share Password"
|
|
239
|
+
type="password"
|
|
240
|
+
value={sharePassword}
|
|
241
|
+
onChange={(e) => setSharePassword(e.target.value)}
|
|
242
|
+
placeholder="Enter password"
|
|
243
|
+
compact
|
|
244
|
+
/>
|
|
245
|
+
)}
|
|
246
|
+
<div className="flex items-center justify-between gap-2">
|
|
247
|
+
<label className="flex items-center gap-2 cursor-pointer">
|
|
248
|
+
<input
|
|
249
|
+
type="checkbox"
|
|
250
|
+
checked={oneTimeOnly}
|
|
251
|
+
onChange={(e) => setOneTimeOnly(e.target.checked)}
|
|
252
|
+
className="accent-[var(--color-accent,#ccff00)]"
|
|
253
|
+
/>
|
|
254
|
+
<span className="font-mono text-[10px] text-[var(--color-text,#0a0a0a)]">
|
|
255
|
+
Can only be viewed one time
|
|
256
|
+
</span>
|
|
257
|
+
</label>
|
|
258
|
+
<Button variant="primary" size="sm" onClick={handleCopyShareLink} loading={linkGenerating}>
|
|
259
|
+
{linkCopied ? <Check size={10} /> : <Copy size={10} />}
|
|
260
|
+
{linkCopied ? 'COPIED' : 'COPY LINK'}
|
|
261
|
+
</Button>
|
|
262
|
+
</div>
|
|
263
|
+
{linkError && (
|
|
264
|
+
<div className="font-mono text-[9px] text-[var(--color-danger,#ef4444)]">
|
|
265
|
+
{linkError}
|
|
266
|
+
</div>
|
|
267
|
+
)}
|
|
268
|
+
</div>
|
|
269
|
+
|
|
270
|
+
</div>
|
|
271
|
+
</Modal>
|
|
272
|
+
);
|
|
273
|
+
};
|