Skip to content

Instantly share code, notes, and snippets.

@diurivj
Created October 4, 2021 20:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save diurivj/c6b0014432c399c546f0d09be8640c97 to your computer and use it in GitHub Desktop.
Save diurivj/c6b0014432c399c546f0d09be8640c97 to your computer and use it in GitHub Desktop.

Content Authenticity Initiative


Example of payload using js-sdk library, using React hooks

Implementation

    const sampleImage = 'https://js-sdk.contentauthenticity.org/c2pa-samples/CAICAI.jpg';
    const imageProvenance = useProvenance(sampleImage);
    console.log(imageProvenance)

Payload shape / structure

    ImageProvenance {
        claims: Map
        activeClaim: Claim
        data: Object
        exists: boolean
    }

Example of payload

    {
        claims: [
            0: {
                key: "adobetest:urn:uuid:2d226f83-2c4f-4adb-8aa6-455cdd740e13",
                value: {
                    assertions: Map // huuuugeee,
                    asset: {
                        document_id: "xmp:iid:c2375873-049e-40af-bf01-04c50c8da83f",
                        format: "image/jpeg",
                        instance_id: "xmp:iid:c2375873-049e-40af-bf01-04c50c8da83f",
                        title: "CA.jpg",
                        thumbnail: {
                            format: "image/jpeg",
                            image: Unknown // Array of coordinates ??
                        }
                    },
                    ingredients: {
                        ...sameAsAsset
                    },
                    recorder: "C2PA Testing",
                    // I think this is the most important thing of the payload
                    signature: {
                        issuer: "Adobe, Inc.",
                        time: "2021-09-14T22:30:10.389206+00:00"
                    },
                    id: "adobetest:urn:uuid:8bc472b1-b0bb-4cf0-8936-d283bbb8b030",
                }
            }
        ],
        // there are more fields but they repeat the same fields I described above
    }

Dev notes

We are going to introduce craco for adding support for WebAssembly and Create React App

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment