C2PAContext

class C2PAContext(var ptr: Long) : Closeable

C2PA Context for creating readers and builders with shared configuration.

C2PAContext wraps the native C2PAContext struct and provides an immutable, shareable configuration context. Once created, a context can be used to create multiple Reader and Builder instances that share the same settings.

Usage

Default context

val context = C2PAContext.create()
val builder = Builder.fromContext(context)
val reader = Reader.fromContext(context)
context.close()

Custom settings

val settings = C2PASettings.create()
.updateFromString(settingsJson, "json")

val context = C2PAContext.fromSettings(settings)
settings.close()

val builder = Builder.fromContext(context)
.withDefinition(manifestJson)

Resource Management

C2PAContext implements Closeable and must be closed when done to free native resources. The context can be closed after creating readers/builders from it.

Since

1.0.0

See also

Constructors

Link copied to clipboard
internal constructor(ptr: Long)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
internal var ptr: Long

Internal pointer to the native C2PAContext instance

Functions

Link copied to clipboard
open override fun close()