oneid.service

Provides useful functions for interacting with the Neustar TDI Core API, including creation of keys, etc.

oneid.service.create_secret_key(output=None)[source]

Create a secret key and save it to a secure location

Parameters:output – Path to save the secret key
Returns:oneid.keychain.Keypair
oneid.service.create_aes_key()[source]

Create an AES256 key for symmetric encryption

Returns:Encryption key bytes
oneid.service.encrypt_attr_value(attr_value, aes_key, legacy_support=True)[source]

Convenience method to encrypt attribute properties

Parameters:
  • attr_value – plain text (string or bytes) that you want encrypted
  • aes_key – symmetric key to encrypt attribute value with
Returns:

Dictionary (Flattened JWE) with base64-encoded ciphertext and base64-encoded iv

oneid.service.decrypt_attr_value(attr_ct, aes_key)[source]

Convenience method to decrypt attribute properties

Parameters:
  • attr_ct – Dictionary (may be a Flattened JWE) with base64-encoded ciphertext and base64-encoded iv
  • aes_key – symmetric key to decrypt attribute value with
Returns:

plaintext bytes