Files
spaces-startos/startos/actions/showRegistryApiKeys.ts
T
spacesopsandCursor 073344d4d1
Build Service / BuildPackage (push) Canceled after 0s
0.3.0:1
Group Actions and Config by category (Space-CLI, Bitcoin, Spaced,
Subspaces, Certrelay, Nacho) and build x86 + arm only.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-24 03:34:34 -04:00

76 lines
2.2 KiB
TypeScript

import { storeJson } from '../fileModels/storeJson'
import { actionGroups } from '../actionGroups'
import { i18n } from '../i18n'
import { sdk } from '../sdk'
export const showRegistryApiKeys = sdk.Action.withoutInput(
// id
'show-registry-api-keys',
// metadata
async ({ effects }) => ({
name: i18n('Show Registry API Keys'),
description: i18n(
'Display the stored REGISTRY_API_KEY and SUBSD_API_KEY used by registry-server. Returns blanks if Create Registry API Keys has not been run yet.',
),
warning: null,
allowedStatuses: 'any',
group: actionGroups.subspacesRegistry,
visibility: 'enabled',
}),
// run
async ({ effects }) => {
const [registryApiKey, subsdApiKey] = await Promise.all([
storeJson.read((s) => s.registryApiKey).once(),
storeJson.read((s) => s.subsdApiKey).once(),
])
const ready =
!!registryApiKey &&
!!subsdApiKey &&
registryApiKey.length > 0 &&
subsdApiKey.length > 0 &&
registryApiKey !== subsdApiKey
return {
version: '1',
title: i18n('Show Registry API Keys'),
message: ready
? i18n(
'Paste SUBSD_API_KEY into subs Settings → Registry Server → Auth Token. Use REGISTRY_API_KEY as the Bearer token for POST /register clients.',
)
: i18n(
'No valid registry API keys are stored yet. Run Create Registry API Keys first (both keys must be non-empty and different).',
),
result: {
type: 'group',
value: [
{
type: 'single',
name: i18n('REGISTRY_API_KEY'),
description: i18n(
'Bearer secret for intake/POST /register clients.',
),
value: registryApiKey ?? '',
masked: true,
copyable: true,
qr: false,
},
{
type: 'single',
name: i18n('SUBSD_API_KEY'),
description: i18n(
'Paste into subs Settings → Registry Server → Auth Token (subs↔registry channel).',
),
value: subsdApiKey ?? '',
masked: true,
copyable: true,
qr: false,
},
],
},
}
},
)