def main(): """ This example demonstrates the basics of creating identities, storing and sharing secrets. You will need to have a folder called "keystore" in your home directory or will be created as a result of running this example. """ key_store = FileSystemKeyStore("~/keystore/", "passPhrase") api_client = ApiClient(key_store) config = {"key_store": key_store, "api_client": api_client} client = Client(config) identity_a = client.create_identity() print("Identity A created; identity id = {}".format(identity_a.id)) secret = identity_a.create_secret("Hello World!".encode("utf-8")) print("Identity A: Created a base secret; secret id = {}; content = {}". format(secret.id, secret.get_content().decode('utf-8'))) identity_b = client.create_identity() print("Identity B created; identity id = {}".format(identity_b.id)) derived_secret_id = secret.share_with(identity_b.id).id print("Identity A: Shared a derived secret with Identity B; " "derived secret id = {}".format(derived_secret_id)) derived_secret = identity_b.retrieve_secret(derived_secret_id) print( "Identity B: Retrieved a derived secret; secret id = {}; content = {}". format(derived_secret.id, derived_secret.get_content().decode('utf-8')))
# Copyright 2017 Covata Limited or its affiliates # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from covata.delta import Client, FileSystemKeyStore key_store = FileSystemKeyStore("~/keystore/", "passPhrase") client = Client(key_store)
# Copyright 2017 Covata Limited or its affiliates # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from covata.delta import Client, FileSystemKeyStore key_store = FileSystemKeyStore("~/keystore/", "passPhrase") client = Client(key_store) # option 1: via secret object identity = client.get_identity("8e91cb8c-1ea5-4b69-bedf-9a14940cce44") identity.delete_secret("a9724dd3-8fa1-4ecd-bbda-331748410cf8") # option 2: via client object secret = client.delete_secret("8e91cb8c-1ea5-4b69-bedf-9a14940cce44", "cb684cfe-11d1-47da-8433-436ca5e6efb0")
def client(api_client, key_store): return Client(dict(api_client=api_client, key_store=key_store))
# Copyright 2017 Covata Limited or its affiliates # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from covata.delta import Client, FileSystemKeyStore key_store = FileSystemKeyStore("~/keystore/", "passPhrase") client = Client(key_store) # option 1: via identity object identity = client.get_identity("8e91cb8c-1ea5-4b69-bedf-9a14940cce44") secret_1 = identity.create_secret("here is my secret") # option 2: via client object secret_2 = client.create_secret("8e91cb8c-1ea5-4b69-bedf-9a14940cce44", "here is my secret")
def client(api_client, key_store): return Client(key_store=key_store, api_client_factory=lambda x: api_client)
# Copyright 2017 Covata Limited or its affiliates # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from covata.delta import Client, FileSystemKeyStore key_store = FileSystemKeyStore("~/keystore/", "passPhrase") client = Client(key_store) identity = client.get_identity("8e91cb8c-1ea5-4b69-bedf-9a14940cce44", "1cb9375f-329c-405a-9b0c-b1659d9c66a4")
# Copyright 2017 Covata Limited or its affiliates # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from covata.delta import Client, FileSystemKeyStore key_store = FileSystemKeyStore("~/keystore/", "passPhrase") client = Client(key_store) identity = client.get_identity("8e91cb8c-1ea5-4b69-bedf-9a14940cce44")
# Copyright 2017 Covata Limited or its affiliates # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from covata.delta import Client, FileSystemKeyStore key_store = FileSystemKeyStore("~/keystore/", "passPhrase") client = Client(key_store) # option 1: via identity object identity = client.get_identity("8e91cb8c-1ea5-4b69-bedf-9a14940cce44") secret = identity.get_secret("a9724dd3-8fa1-4ecd-bbda-331748410cf8") # option 2: via client object secret = client.get_secret("8e91cb8c-1ea5-4b69-bedf-9a14940cce44", "a9724dd3-8fa1-4ecd-bbda-331748410cf8") # it's all the same secret content = secret.get_content()
# Copyright 2017 Covata Limited or its affiliates # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from covata.delta import Client, FileSystemKeyStore key_store = FileSystemKeyStore("~/keystore/", "passPhrase") client = Client(key_store) client.create_identity()