Skip to content

Commit

Permalink
update example with simple and complex tables.
Browse files Browse the repository at this point in the history
  • Loading branch information
michelp committed Aug 8, 2022
1 parent 7d38a12 commit 31b518b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion example/tce.sql
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ CREATE TABLE test2 (

CREATE ROLE bob with login password 'foo';

SECURITY LABEL FOR pgsodium ON ROLE bob is 'ACCESS public.test2';
SECURITY LABEL FOR pgsodium ON ROLE bob is 'ACCESS public.test, public.test2';

SELECT format('ENCRYPT WITH KEY ID %s', (pgsodium.create_key('Optional Comment for Secret Key')).id) AS seclabel \gset

Expand All @@ -34,6 +34,8 @@ SECURITY LABEL FOR pgsodium ON COLUMN test2.secret2 IS 'ENCRYPT WITH KEY COLUMN
SELECT pgsodium.crypto_aead_det_noncegen() aead_nonce \gset
SELECT pgsodium.crypto_aead_det_noncegen() aead_nonce2 \gset

\c postgres bob

INSERT INTO public.test (secret) VALUES ('noice');

INSERT INTO public.test2 (secret, associated, nonce, secret2, associated2, nonce2, secret2_key_id) VALUES ('sssh', 'bob was here', :'aead_nonce', 'aaahh', 'alice association', :'aead_nonce2', :'secret2_key_id'::uuid);
Expand Down

0 comments on commit 31b518b

Please sign in to comment.