Files
spacesops-startos/startos/actions/showOperatorCredentials.ts
T
spacesopsandClaude Opus 4.7 35c1013520 Build SpacesOps StartOS package (v1.0.0:0)
Initial .s9pk for SpacesOps, targeting StartOS 0.4.0.x with SDK 1.5.1.

- Single managed daemon from spacesops/spacesops:v1.0.0 (x86_64 + aarch64),
  keeping the image entrypoint (/app/docker-entrypoint.sh node server.js).
  Forces PLATFORM_HOST=0.0.0.0 / PLATFORM_PORT=7264 so the StartOS proxy can
  reach the app. Single `ui` interface on 7264.
- Depends on the Spaces service (>=0.0.9:3) and auto-wires the spaced RPC creds:
  main.ts mounts the Spaces `main` volume read-only at /spaces-data, execs a
  read of its store.json inside the subcontainer, and injects SPACED_RPC_USER/
  PASSWORD + SPACED_RPC_URL=http://spaces.startos:7225. Throws to retry until
  Spaces is installed and seeded.
- Generates a Nostr operator keypair (nostr-tools, bundled by ncc) and a strong
  session secret in idempotent init tasks (.once() reads, allowWriteAfterConst
  merges). Actions: show-operator-credentials, import-operator-key,
  show-admin-credentials (surfaces the fixed admin/Whatever! login with a
  warning), configure-platform (optional relay/mode/CoinGecko/SUBSD).
- Install alert warns to install Spaces first and about the fixed admin
  credential. Backs up the `main` volume.
- Icon: icon.svg (source spacesops.svg). The `spaces` dependency uses
  assets/spaces-icon.png for its Marketplace metadata.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-26 10:28:18 -04:00

89 lines
2.3 KiB
TypeScript

import { storeJson } from '../fileModels/storeJson'
import { i18n } from '../i18n'
import { encodeNpub, encodeNsec } from '../nostr'
import { sdk } from '../sdk'
export const showOperatorCredentials = sdk.Action.withoutInput(
// id
'show-operator-credentials',
// metadata
async ({ effects }) => ({
name: i18n('Show Operator Credentials'),
description: i18n(
'Display the Nostr operator keypair SpacesOps signs events with (npub, nsec, and hex public key).',
),
warning: null,
allowedStatuses: 'any',
group: null,
visibility: 'enabled',
}),
// run
async ({ effects }) => {
const store = await storeJson.read().once()
const secretHex = store?.operatorSecretHex ?? null
const publicHex = store?.operatorPublicHex ?? null
if (!secretHex || !publicHex) {
return {
version: '1',
title: i18n('Operator Credentials'),
message: i18n(
'The operator keypair has not been generated yet. Start the service once to generate it.',
),
result: null,
}
}
return {
version: '1',
title: i18n('Operator Credentials'),
message: i18n(
'SpacesOps signs operator events on Nostr with this keypair. Keep the secret (nsec / hex) private.',
),
result: {
type: 'group',
value: [
{
type: 'single',
name: i18n('Public Key (npub)'),
description: null,
value: encodeNpub(publicHex),
masked: false,
copyable: true,
qr: true,
},
{
type: 'single',
name: i18n('Public Key (hex)'),
description: null,
value: publicHex,
masked: false,
copyable: true,
qr: false,
},
{
type: 'single',
name: i18n('Secret Key (nsec)'),
description: null,
value: encodeNsec(secretHex),
masked: true,
copyable: true,
qr: false,
},
{
type: 'single',
name: i18n('Secret Key (hex)'),
description: null,
value: secretHex,
masked: true,
copyable: true,
qr: false,
},
],
},
}
},
)