Files
OmniRoute/scripts/dev
小妍儿 ✨ cb55651736 feat(api): import caller-supplied gateway API keys atomically (#18010)
## Summary

Add `POST /api/keys/import` so a management client can provision the same caller-supplied gateway key on multiple instances without invoking whole-database restore.

- Required `key`/`name`, optional UUID `id`; inherits every create-policy field and refinement through `createKeySchema.safeExtend`.
- Same management authentication as key creation, including `admin` access-token scope and the open-mode management-key credential requirement.
- One synchronous SQLite IMMEDIATE transaction checks identity and inserts the complete policy. Existing explicit id + same value is a read-only retry (200); conflicting id/value is 409 without another id or secret in the response; new import is 201.
- Existing crypto helpers supply encrypted-at-rest storage when configured, hash and prefix. Responses whitelist masked key + stored policy. Environment/self-loop credential collisions are rejected. New imports trigger best-effort asynchronous cloud sync.
- No rekey, settings/provider/combo/session import, or changes to `import-json` authorization. Existing creation remains server-generated.

Closes #18005

## Target branch and design

Thanks @xiaoyaner0201.
2026-11-08 18:33:03 -03:00
..
2026-06-29 16:51:03 -03:00
2026-07-07 13:14:06 -03:00
2026-07-13 09:12:40 -03:00