Skip to content

std: os/secret for stored passwords, udprelay can pick and report its port - #4282

Merged
BaseMax merged 2 commits into
mainfrom
os-secret
Nov 26, 2026
Merged

BaseMax merged 2 commits into
mainfrom
os-secret

Conversation

@BaseMax

@BaseMax BaseMax commented Nov 26, 2026 •

Copy link
Copy Markdown
Member
  • New os.secret: Available, Set, Get and Delete, on the macOS Keychain, the Linux Secret Service (libsecret) and the Windows Credential Manager.
  • gui/webview now uses it, so the three implementations move out of the webview package instead of being duplicated.
  • net/udprelay: with ServerOptions.announce_fd set, Listen accepts port 0, picks a free port and writes it there, so a chosen port can no longer collide with another program.
  • Docs and tests in English and Persian.

Tested: macOS arm64 (the new tests against the real Keychain and the webview secret checks), Linux arm64 in a container with GNOME Keyring and without any secret service, type checks for Windows. The Windows credential calls are moved unchanged from webview and have not been run here.

Summary by CodeRabbit

  • New Features
    • Added secure secret storage through the operating system’s credential store on supported platforms, with file-based fallback when needed.
    • UDP relay servers can now select an available port and announce the bound port through a configured output channel.
  • Documentation
    • Added English and Persian guides for secret storage and UDP relay port announcements.

@BaseMax
BaseMax requested a review from a team as a code owner November 26, 2026 17:33
@coderabbitai

coderabbitai Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Explain Change →

Caution

Review failed

The pull request is closed.

Walkthrough

The change adds cross-platform secret storage and routes webview secret operations through it. It also lets UDP relay listeners select a free port and report the bound port through a file descriptor. Tests and English and Persian documentation cover both additions.

Changes: Secret storage

Layer / File(s) Summary
Secret API and platform backends
std/os/secret/secret.salam, docs/ai/stdlib-index.json, tests/*/stdlib/os_secret.salam, website/content/*/std/195-os-secret.txt
Adds public Available, Set, Get, and Delete functions with macOS Keychain, Linux libsecret, Windows Credential API, and fallback implementations. Adds tests and package documentation.
Webview secret integration
std/gui/webview/system.salam, std/gui/webview/os_linux.salam, std/gui/webview/os_macos.salam, std/gui/webview/os_windows.salam
Webview secret operations call os.secret. The file fallback remains, and platform-specific secret helpers are removed.

UDP relay port announcement

Layer / File(s) Summary
Port selection and announcement
std/net/udprelay/udprelay.salam, website/content/*/std/194-net-udprelay.txt
Adds announce_fd. When it is enabled, Listen accepts port 0 and writes the selected port as a RELAY-PORT line.
Announcement tests
tests/*/stdlib/net_udprelay.salam
English and Persian tests read the announced port from a pipe instead of reserving a TCP port and sleeping.

Standard library index

Layer / File(s) Summary
Collections index declaration
docs/ai/stdlib-index.json
Adds the _nan_slot(k: K): int declaration to the collections package index.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant Listen as udprelay.Listen
  participant FD as announce_fd
  participant Test as announced helper
  Listen->>FD: Write RELAY-PORT and bound port
  Test->>FD: Read announcement
Loading

Suggested reviewers: bdadmehr0

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@BaseMax
BaseMax merged commit 577ff9c into main Nov 26, 2026
23 of 25 checks passed
@BaseMax
BaseMax deleted the os-secret branch November 26, 2026 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant