DefaultSudoProfilesClient

class DefaultSudoProfilesClient(context: Context, sudoUserClient: SudoUserClient, blobContainerURI: Uri, logger: Logger = DefaultLogger.instance, config: JSONObject? = null, maxSudos: Int = 10, graphQLClient: GraphQLClient? = null, s3Client: S3Client? = null, idGenerator: IdGenerator = DefaultIdGenerator(), cryptoProvider: CryptoProvider? = null, namespace: String = DEFAULT_KEY_NAMESPACE, databaseName: String = AndroidSQLiteStore.DEFAULT_DATABASE_NAME) : SudoProfilesClient

Default implementation of SudoProfilesClient interface.

Parameters

context

Android app context.

sudoUserClient

SudoUserClient instance required to issue authentication tokens and perform cryptographic operations.

blobContainerURI

container URI to which large binary objects will be stored.

logger

logger used for logging messages.

config

configuration parameters.

maxSudos

maximum number of Sudos to cap the queries to. Defaults to 10.

graphQLClient

optional GraphQL client to use. Mainly used for unit testing.

s3Client

optional S3 client to use. Mainly used for unit testing.

idGenerator

optional GUID generator to use. Mainly used for unit testing.

namespace

namespace to use for internal data and cryptographic keys. This should be unique

databaseName

database name to use for the exportable key store database.

Constructors

Link copied to clipboard
constructor(context: Context, sudoUserClient: SudoUserClient, blobContainerURI: Uri, logger: Logger = DefaultLogger.instance, config: JSONObject? = null, maxSudos: Int = 10, graphQLClient: GraphQLClient? = null, s3Client: S3Client? = null, idGenerator: IdGenerator = DefaultIdGenerator(), cryptoProvider: CryptoProvider? = null, namespace: String = DEFAULT_KEY_NAMESPACE, databaseName: String = AndroidSQLiteStore.DEFAULT_DATABASE_NAME)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
open override val version: String

Client version.

Functions

Link copied to clipboard
open suspend override fun createSudo(sudo: Sudo): Sudo

Creates a new Sudo

Link copied to clipboard
open suspend override fun deleteSudo(sudo: Sudo)

Deletes a Sudo.

Link copied to clipboard

Export encryption keys used for encrypting and decrypting Sudo claims.

Link copied to clipboard
open override fun generateEncryptionKey(): String

Generate an encryption key to use for encrypting Sudo claims. Any existing keys are not removed to be able to decrypt existing claims but new claims will be encrypted using the newly generated key.

Link copied to clipboard
open suspend override fun getOwnershipProof(sudo: Sudo, audience: String): String

Retrieves a signed ownership proof for the specified owner. The ownership proof JWT has the following payload. { "jti": "DBEEF4EB-F84A-4AB7-A45E-02B05B93F5A3", "owner": "cd73a478-23bd-4c70-8c2b-1403e2085845", "iss": "sudoplatform.sudoservice", "aud": "sudoplatform.virtualcardservice", "exp": 1578986266, "sub": "da17f346-cf49-4db4-98c2-862f85515fc4", "iat": 1578982666 }

Link copied to clipboard
open override fun getSymmetricKeyId(): String?

Get the current (most recently generated) symmetric key ID used for encryption.

Link copied to clipboard
open override fun importEncryptionKeys(keys: List<EncryptionKey>, currentKeyId: String)

Import encryption keys to use for encrypting and decrypting Sudo claims. All existing keys will be removed before the new keys are imported.

Link copied to clipboard
open suspend override fun listSudos(option: ListOption): List<Sudo>

Retrieves all Sudos owned by the signed in user.

Link copied to clipboard
open override fun reset()

Reset any internal state and cached content.

Link copied to clipboard
open suspend override fun subscribeAsync(id: String, subscriber: SudoSubscriber)

Subscribes to be notified of new, updated and deleted Sudos. Blob data is not downloaded automatically so the caller is expected to use listSudos API if they need to access any associated blobs.

open suspend override fun subscribeAsync(id: String, changeType: SudoSubscriber.ChangeType, subscriber: SudoSubscriber)

Subscribes to be notified of new, updated or deleted Sudos. Blob data is not downloaded automatically so the caller is expected to use listSudos API if they need to access any associated blobs.

Link copied to clipboard
open override fun unsubscribe(id: String)

Unsubscribes the specified subscriber so that it no longer receives change notifications.

open override fun unsubscribe(id: String, changeType: SudoSubscriber.ChangeType)

Unsubscribes the specified subscriber so that it no longer receives notifications about new, updated or deleted Sudos.

Link copied to clipboard
open override fun unsubscribeAll()

Unsubscribe all subscribers from receiving notifications about new, updated or deleted Sudos.

Link copied to clipboard
open suspend override fun updateSudo(sudo: Sudo): Sudo

Updates a Sudo.