Credentials are typed (machine, age), write-only through the API and sealed to the age identity in the bootstrap config. A field holds a value or names a secret engine key; connectors and engines are accepted with credential slots that resolve into their Configure secrets. The secret engine contract gains secrets so an engine can receive its own key.
22 lines
880 B
SQL
22 lines
880 B
SQL
-- +goose Up
|
|
-- A credential's fields are sealed with age: each holds a value or names the
|
|
-- secret engine key it is resolved from.
|
|
CREATE TABLE connectors.credentials (
|
|
org_id text NOT NULL,
|
|
name text NOT NULL,
|
|
kind text NOT NULL CHECK (kind IN ('machine', 'age')),
|
|
sealed bytea NOT NULL,
|
|
updated_at timestamptz NOT NULL DEFAULT now(),
|
|
PRIMARY KEY (org_id, name)
|
|
);
|
|
|
|
-- contract says which extension contract an accepted package serves; its
|
|
-- credentials map each slot it declares to a credential by name.
|
|
ALTER TABLE connectors.accepted
|
|
ADD COLUMN contract text NOT NULL DEFAULT 'connector' CHECK (contract IN ('connector', 'secretengine')),
|
|
ADD COLUMN credentials jsonb NOT NULL DEFAULT '{}';
|
|
|
|
-- +goose Down
|
|
ALTER TABLE connectors.accepted DROP COLUMN credentials, DROP COLUMN contract;
|
|
DROP TABLE connectors.credentials;
|