mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-11-16 17:09:09 +00:00
## 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.