@contentauth/c2pa-js
    Preparing search index...

    Exposes methods for reading C2PA data out of an asset.

    const reader = await c2pa.reader.fromBlob(blob.type, blob);

    const activeManifest = await reader.activeManfiest();
    interface Reader {
        activeLabel: () => Promise<null | string>;
        activeManifest: () => Promise<Manifest>;
        free: () => Promise<void>;
        json: () => Promise<any>;
        manifestStore: () => Promise<ManifestStore>;
        resourceToBuffer: (uri: string) => Promise<ArrayBuffer>;
    }
    Index

    Properties

    activeLabel: () => Promise<null | string>

    Type Declaration

      • (): Promise<null | string>
      • Returns Promise<null | string>

        The label of the active manifest.

    activeManifest: () => Promise<Manifest>

    Type Declaration

      • (): Promise<Manifest>
      • Returns Promise<Manifest>

        The asset's active manifest.

        NOTE: At the moment, the manifest returned by this method will not include decoded CAWG data. Use Reader.json() if CAWG is a requirement.

    free: () => Promise<void>

    Dispose of this Reader, freeing the memory it occupied and preventing further use. Call this whenever the Reader is no longer needed.

    json: () => Promise<any>

    Type Declaration

      • (): Promise<any>
      • Returns Promise<any>

        The asset's full manifest store, including decoded CAWG data.

    manifestStore: () => Promise<ManifestStore>

    Type Declaration

      • (): Promise<ManifestStore>
      • Returns Promise<ManifestStore>

        The asset's full manifest store containing all its manifests, validation statuses, and the URI of the active manifest.

        NOTE: At the moment, the manifest store returned by this method will not include decoded CAWG data. Use Reader.json() if CAWG is a requirement.

    resourceToBuffer: (uri: string) => Promise<ArrayBuffer>

    Resolves a URI reference to a binary object (e.g. a thumbnail) in the resource store.

    Type Declaration

      • (uri: string): Promise<ArrayBuffer>
      • Parameters

        • uri: string

          URI of the binary object to resolve.

        Returns Promise<ArrayBuffer>

        An array buffer of the resource's bytes.

    const reader = await c2pa.reader.fromBlob(blob.type, blob);

    const activeManifest = await reader.activeManifest();

    const thumbnailBuffer = await reader.resourceToBuffer(activeManifest.thumbnail!.identifier);