You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This website is built using [Docusaurus 2](https://docusaurus.io/), a modern static website generator, and deployed
6
-
on [Netlify](https://www.netlify.com/).
5
+
## Overview
6
+
7
+
This repo contains the source code and content to generate the <https://opensource.contentauthenticity.org/> website. This site is built using [Docusaurus 2](https://docusaurus.io/), a modern static site generator, and deployed on [Netlify](https://www.netlify.com/).
8
+
9
+
### Directory structure
10
+
11
+
The `docs` sub-directory contains documentation content (in markdown or `.mdx` format) in the following sub-directories:
12
+
-[`js-sdk/api`](./docs/js-sdk/api): [API documentation](https://opensource.contentauthenticity.org/docs/js-sdk/api/) for the JavaScript library generated from the source code; see [Generating JavaScript API docs](#generating-javascript-sdk-api-docs).
13
+
-[`js-sdk`](./docs/js-sdk/): [Other documentation](https://opensource.contentauthenticity.org/docs/js-sdk/getting-started/overview) for the JavaScript library.
14
+
(./scripts/generate-api-docs/index.js)
15
+
-`includes`: Markdown content imported (transcluded) into other files.
16
+
-`manifest`: Content for the [Understanding manifests](https://opensource.contentauthenticity.org/docs/manifest/understanding-manifest) section.
17
+
-`static`: Additional assets such as images.
18
+
19
+
Additionally, the [scripts/fetch-readme.js](./scripts/fetch-readme.js) script dynamically downloads documentation files (sometimes just the `README.md` but often other markdown files, too) from other repos in the SDK. See [Running the fetch script](#running-fetch-script).
20
+
21
+
This table summarizes the content that this script fetches from other repos.
The [Manifest store reference](https://opensource.contentauthenticity.org/docs/manifest/manifest-ref) is an HTML file generated by the [json-manifest-reference](https://github.com/contentauth/json-manifest-reference) repository and imported manually.
7
37
8
38
## Installation
9
39
@@ -16,7 +46,7 @@ $ npm install
16
46
17
47
## Local development
18
48
19
-
**Prerequisite**: To build the site locally, you must first check out the JavaScript library in a sibling directory and build the API docs there. In the parent directory of `opensource.contentauth.org`, enter these commands:
49
+
**Prerequisite**: To build the site locally, you must first check out the JavaScript library in a sibling directory and build the API docs there. In the parent directory of the `opensource.contentauth.org` directory, enter these commands:
@@ -34,23 +64,23 @@ This command starts a local development server and opens up a browser window. Mo
34
64
35
65
### Running fetch script
36
66
37
-
The `/scripts/fetch-readme.js` script pulls markdown files from other repos (e.g. `c2patool`). To rerun this script for local build, enter this command:
67
+
The `/scripts/fetch-readme.js` script pulls markdown files from other repos (e.g. `c2pa-rs`). To rerun this script for local build, enter this command:
38
68
39
69
```
40
70
npm run docs:fetch-readme
41
71
```
42
72
43
-
NOTE: If you added a **new** repo to get .md files from, then you need to manually add the directory, add a `.gitkeep` file to it, and then commit it to Git.
73
+
NOTE: If you need to get markdown files from a **new** repo that you added, then you need to manually add the sub-directory, add a `.gitkeep` file to it, and then commit it to this repository.
44
74
45
-
### Generate JavaScript SDK API docs
75
+
### Generating JavaScript SDK API docs
46
76
47
-
The `/scripts/generate-api-docs/index.js` script generates API docs for the JS SDK. To run this script for local build, enter this command:
77
+
The `/scripts/generate-api-docs/index.js` script generates API docs for the JS SDK (assuming you've checked it out in a sibling directory). To run this script for local build, enter this command:
48
78
49
79
```
50
80
npm run docs:generate-api-docs
51
81
```
52
82
53
-
##Build
83
+
### Building
54
84
55
85
```
56
86
$ npm run build
@@ -60,8 +90,7 @@ This command generates static content into the `build` directory and can be serv
60
90
61
91
### Deployment
62
92
63
-
Deployments are handled automatically by Netlify. Please open up a pull request with any changes and a preview site
64
-
should be created automatically so that the preview can be shared before merging.
93
+
Deployments are handled automatically by Netlify. Please open up a pull request with any changes and a preview site will be created automatically so you can share what the rendered site will look like before merging.
Copy file name to clipboardExpand all lines: docs/js-sdk/getting-started/overview.mdx
+3-4Lines changed: 3 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,8 +25,7 @@ The JavaScript library uses several modern browser technologies, including:
25
25
26
26
The JavaScript library is a monorepo containing the following packages intended for client use:
27
27
28
-
-[**c2pa**](https://opensource.contentauthenticity.org/docs/js-sdk/api/c2pa) is the main package used for loading and verifying manifests. This package runs all of the processing
29
-
logic on the client using a [WebAssembly](https://webassembly.org/) module and exposes a [TypeScript](https://www.typescriptlang.org/)-compatible API for easy integration.
28
+
-[**c2pa**](https://opensource.contentauthenticity.org/docs/js-sdk/api/c2pa) is the main package used for loading and verifying manifests. This package runs all of the processing logic on the client using a [WebAssembly](https://webassembly.org/) module and exposes a [TypeScript](https://www.typescriptlang.org/)-compatible API for easy integration.
30
29
-**c2pa-wc** provides UI components designed with input from the C2PA UX working group. It enables users to get up and running with standard UI patterns quickly and easily in any front-end environment.
31
30
-**@contentauth/react** provides a hooks interface for React components to quickly get manifest and thumbnail data in your React app.
32
31
@@ -59,7 +58,7 @@ Because of these requirements, **the library is not supported on any version of
This chart is accurate as of June, 2024. For the most up-to-date browser support information, see [caniuse.com](https://caniuse.com/wasm,webworkers,cryptography,typedarrays,fetch).
61
+
This chart is accurate as of December, 2024. For the most up-to-date browser support information, see [caniuse.com](https://caniuse.com/wasm,webworkers,cryptography,typedarrays,fetch).
63
62
:::
64
63
65
64
## Debugging
@@ -72,7 +71,7 @@ To view debug messages in the console, use your browser's inspector, go to the C
72
71
localStorage.debug='c2pa:*';
73
72
```
74
73
75
-
The debuging information includes millisecond timing differences so you can get an idea of how long different events take.
74
+
The debugging information includes millisecond timing differences so you can get an idea of how long different events take.
76
75
77
76
:::note
78
77
Debug calls and statements are stripped out of minified production builds to reduce file size.
The version numbers provided in the CDN URLs _must_ match in all of the places you reference the
48
-
library. To make it easy, use a variable that provides the version as shown in the example.
47
+
The version numbers provided in the CDN URLs _must_ be the same in all of the places you reference the library. To make it easy, use a variable that provides the version as shown in the example.
You can also bring in the library with a package manager, such as `npm`, `pnpm`, or `yarn`. This way, all of the client side code is hosted with your app and there are no external dependencies. For example, using `npm`:
@@ -71,24 +68,30 @@ Be sure to configure your server to send proper `Content-Type` headers for these
71
68
72
69
Examples for common build systems are shown below. They are also available in the [c2pa-js-examples repository](https://github.com/contentauth/c2pa-js-examples).
73
70
74
-
exportconst ExampleLink = ({ example }) => {
75
-
const linkText =`examples/${example}`;
76
-
const link =`https://github.com/contentauth/c2pa-js/tree/main/${linkText}`;
77
-
return (
78
-
<divclassName="example-link">
79
-
An example project is available here: <ahref={link}>{linkText}</a>
This example is from [c2pa-js-examples/minimal-ts-vite/](https://github.com/contentauth/c2pa-js-examples/blob/main/minimal-ts-vite/). To view and execute this example in a live [code sandbox](https://codesandbox.io/docs/learn/legacy-sandboxes/overview), see [Code Sandbox: Vite example](../guides/sandbox-qs-vite.mdx).
80
+
81
+
<CodeBlocklanguage="ts">{ViteExample}</CodeBlock>
82
+
</TabItem>
83
+
84
+
<TabItemvalue="rollup"label="Rollup">
85
+
86
+
This example is from [c2pa-js-examples/minimal-ts-rollup/](https://github.com/contentauth/c2pa-js-examples/blob/main/minimal-ts-rollup/). To view and execute this example in a live [code sandbox](https://codesandbox.io/docs/learn/legacy-sandboxes/overview), see [Code Sandbox: Rollup example](../guides/sandbox-qs-rollup.mdx).
This example is from [c2pa-js-examples/minimal-ts-webpack/](https://github.com/contentauth/c2pa-js-examples/blob/main/minimal-ts-webpack/). To view and execute this example in a live [code sandbox](https://codesandbox.io/docs/learn/legacy-sandboxes/overview), see [Code Sandbox: Webpack example](../guides/sandbox-qs-webpack.mdx).
0 commit comments