@contentauth/c2pa-web 0.2.3 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/dist/c2pa-B24NQuig.js +278 -0
- package/dist/common.d.ts +2 -0
- package/dist/common.d.ts.map +1 -1
- package/dist/index.js +4 -228
- package/dist/inline.js +4 -4
- package/dist/lib/builder.d.ts +77 -0
- package/dist/lib/builder.d.ts.map +1 -0
- package/dist/lib/c2pa.d.ts +5 -0
- package/dist/lib/c2pa.d.ts.map +1 -1
- package/dist/lib/reader.d.ts +16 -10
- package/dist/lib/reader.d.ts.map +1 -1
- package/dist/lib/signer.d.ts +20 -0
- package/dist/lib/signer.d.ts.map +1 -0
- package/dist/lib/worker/rpc.d.ts +47 -0
- package/dist/lib/worker/rpc.d.ts.map +1 -0
- package/dist/lib/worker/workerManager.d.ts +4 -3
- package/dist/lib/worker/workerManager.d.ts.map +1 -1
- package/dist/lib/worker/workerObjectMap.d.ts +3 -2
- package/dist/lib/worker/workerObjectMap.d.ts.map +1 -1
- package/dist/lib/worker.d.ts +8 -13
- package/dist/lib/worker.d.ts.map +1 -1
- package/dist/resources/c2pa_bg.wasm +0 -0
- package/package.json +4 -3
- package/dist/lib/worker/setupWorker.d.ts +0 -26
- package/dist/lib/worker/setupWorker.d.ts.map +0 -1
- package/dist/lib/worker/workerResponse.d.ts +0 -16
- package/dist/lib/worker/workerResponse.d.ts.map +0 -1
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { WorkerManager } from './worker/workerManager.js';
|
|
2
|
+
import { Signer } from './signer.js';
|
|
3
|
+
import { Ingredient, ManifestDefinition } from '@contentauth/c2pa-types';
|
|
4
|
+
/**
|
|
5
|
+
* Functions that permit the creation of Builder objects.
|
|
6
|
+
*/
|
|
7
|
+
export interface BuilderFactory {
|
|
8
|
+
/**
|
|
9
|
+
* Create a {@link Builder} from a {@link ManifestDefinition}.
|
|
10
|
+
*
|
|
11
|
+
* @param definition The {@link ManifestDefinition} to be used as the builder's initial state.
|
|
12
|
+
* @returns A {@link Builder} object.
|
|
13
|
+
*/
|
|
14
|
+
fromDefinition: (definition: ManifestDefinition) => Promise<Builder>;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Exposes methods for building C2PA manifests and signing assets.
|
|
18
|
+
*/
|
|
19
|
+
export interface Builder {
|
|
20
|
+
/**
|
|
21
|
+
* Sets the remote URL for a remote manifest. The manifest is expected to be available at this location.
|
|
22
|
+
*
|
|
23
|
+
* @param url URL pointing to the location the remote manifest will be stored.
|
|
24
|
+
*/
|
|
25
|
+
setRemoteUrl: (url: string) => Promise<void>;
|
|
26
|
+
/**
|
|
27
|
+
* Sets the state of the no_embed flag. To skip embedding a manifest (e.g. for the remote-only case) set this to `true`.
|
|
28
|
+
*
|
|
29
|
+
* @param noEmbed Value to set the no_embed flag.
|
|
30
|
+
* @returns
|
|
31
|
+
*/
|
|
32
|
+
setNoEmbed: (noEmbed: boolean) => Promise<void>;
|
|
33
|
+
/**
|
|
34
|
+
* Set a thumbnail from a blob to be included in the manifest. The blob should represent the asset being signed.
|
|
35
|
+
*
|
|
36
|
+
* @param format Format of the thumbnail
|
|
37
|
+
* @param blob Blob of the thumbnail bytes
|
|
38
|
+
*/
|
|
39
|
+
setThumbnailFromBlob: (format: string, blob: Blob) => Promise<void>;
|
|
40
|
+
/**
|
|
41
|
+
* Add an ingredient to the builder from a definition, format, and blob.
|
|
42
|
+
* Values specified in the ingredient definition will be merged with the ingredient, and these values take precendence.
|
|
43
|
+
*
|
|
44
|
+
* @param ingredientDefinition Ingredient definition.
|
|
45
|
+
* @param format Format of the ingredient.
|
|
46
|
+
* @param blob Blob of the ingredient's bytes.
|
|
47
|
+
*/
|
|
48
|
+
addIngredientFromBlob: (ingredientDefinition: Ingredient, format: string, blob: Blob) => Promise<void>;
|
|
49
|
+
/**
|
|
50
|
+
* Add a resource to the builder's resource store with an ID and blob of the resource's bytes.
|
|
51
|
+
* @param resourceId ID associated with the resource being added.
|
|
52
|
+
* @param blob Blob of the resource's bytes.
|
|
53
|
+
*/
|
|
54
|
+
addResourceFromBlob: (resourceId: string, blob: Blob) => Promise<void>;
|
|
55
|
+
/**
|
|
56
|
+
* Gets the current manifest definition held by the builder.
|
|
57
|
+
*
|
|
58
|
+
* @returns The {@link ManifestDefinition} held by the builder.
|
|
59
|
+
*/
|
|
60
|
+
getDefinition: () => Promise<ManifestDefinition>;
|
|
61
|
+
/**
|
|
62
|
+
* Sign an asset.
|
|
63
|
+
*
|
|
64
|
+
* @todo Docs coming soon
|
|
65
|
+
*/
|
|
66
|
+
sign: (signer: Signer, format: string, blob: Blob) => Promise<Uint8Array>;
|
|
67
|
+
/**
|
|
68
|
+
* Dispose of this Builder, freeing the memory it occupied and preventing further use. Call this whenever the Builder is no longer needed.
|
|
69
|
+
*/
|
|
70
|
+
free: () => Promise<void>;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* @param worker - Worker (via WorkerManager) to be associated with this reader factory.
|
|
74
|
+
* @returns A {@link BuilderFactory} object containing builder creation methods.
|
|
75
|
+
*/
|
|
76
|
+
export declare function createBuilderFactory(worker: WorkerManager): BuilderFactory;
|
|
77
|
+
//# sourceMappingURL=builder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builder.d.ts","sourceRoot":"","sources":["../../src/lib/builder.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAA0B,KAAK,MAAM,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,KAAK,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE9E;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;;OAKG;IACH,cAAc,EAAE,CAAC,UAAU,EAAE,kBAAkB,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;CACtE;AAED;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB;;;;OAIG;IACH,YAAY,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAE7C;;;;;OAKG;IACH,UAAU,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAEhD;;;;;OAKG;IACH,oBAAoB,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAEpE;;;;;;;OAOG;IACH,qBAAqB,EAAE,CACrB,oBAAoB,EAAE,UAAU,EAChC,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,IAAI,KACP,OAAO,CAAC,IAAI,CAAC,CAAC;IAEnB;;;;OAIG;IACH,mBAAmB,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAEvE;;;;OAIG;IACH,aAAa,EAAE,MAAM,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAEjD;;;;OAIG;IACH,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;IAE1E;;OAEG;IACH,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3B;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,aAAa,GAAG,cAAc,CAoB1E"}
|
package/dist/lib/c2pa.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ReaderFactory } from './reader.js';
|
|
2
2
|
import { Settings } from './settings.js';
|
|
3
|
+
import { BuilderFactory } from './builder.js';
|
|
3
4
|
export interface Config {
|
|
4
5
|
/**
|
|
5
6
|
* URL to fetch the WASM binary or an already-instantiated WASM module.
|
|
@@ -15,6 +16,10 @@ export interface C2paSdk {
|
|
|
15
16
|
* Contains methods for creating Reader objects.
|
|
16
17
|
*/
|
|
17
18
|
reader: ReaderFactory;
|
|
19
|
+
/**
|
|
20
|
+
* Contains methods for creating Builder objects.
|
|
21
|
+
*/
|
|
22
|
+
builder: BuilderFactory;
|
|
18
23
|
/**
|
|
19
24
|
* Terminates the SDK's underlying web worker.
|
|
20
25
|
*/
|
package/dist/lib/c2pa.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"c2pa.d.ts","sourceRoot":"","sources":["../../src/lib/c2pa.ts"],"names":[],"mappings":"AASA,OAAO,EAAuB,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjE,OAAO,EAAE,QAAQ,EAAsB,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"c2pa.d.ts","sourceRoot":"","sources":["../../src/lib/c2pa.ts"],"names":[],"mappings":"AASA,OAAO,EAAuB,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjE,OAAO,EAAE,QAAQ,EAAsB,MAAM,eAAe,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAwB,MAAM,cAAc,CAAC;AAEpE,MAAM,WAAW,MAAM;IACrB;;OAEG;IACH,OAAO,EAAE,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC;IAErC;;OAEG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED,MAAM,WAAW,OAAO;IACtB;;OAEG;IACH,MAAM,EAAE,aAAa,CAAC;IAEtB;;OAEG;IACH,OAAO,EAAE,cAAc,CAAC;IAExB;;OAEG;IACH,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,wBAAsB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAcjE"}
|
package/dist/lib/reader.d.ts
CHANGED
|
@@ -6,13 +6,20 @@ export declare const MAX_SIZE_IN_BYTES: number;
|
|
|
6
6
|
*/
|
|
7
7
|
export interface ReaderFactory {
|
|
8
8
|
/**
|
|
9
|
-
* Create a Reader from an asset's format and a blob of its bytes.
|
|
9
|
+
* Create a {@link Reader} from an asset's format and a blob of its bytes.
|
|
10
10
|
*
|
|
11
|
-
* @param format Asset format
|
|
12
|
-
* @param blob Blob of asset bytes
|
|
13
|
-
* @returns
|
|
11
|
+
* @param format Asset format.
|
|
12
|
+
* @param blob Blob of asset bytes.
|
|
13
|
+
* @returns A {@link Reader} object.
|
|
14
14
|
*/
|
|
15
15
|
fromBlob: (format: string, blob: Blob) => Promise<Reader>;
|
|
16
|
+
/**
|
|
17
|
+
*
|
|
18
|
+
* @param format Asset format.
|
|
19
|
+
* @param init Blob of initial fragment bytes.
|
|
20
|
+
* @param fragment Blob of fragment bytes.
|
|
21
|
+
* @returns A {@link Reader} object.
|
|
22
|
+
*/
|
|
16
23
|
fromBlobFragment: (format: string, init: Blob, fragment: Blob) => Promise<Reader>;
|
|
17
24
|
}
|
|
18
25
|
/**
|
|
@@ -31,19 +38,19 @@ export interface Reader {
|
|
|
31
38
|
*/
|
|
32
39
|
activeLabel: () => Promise<string | null>;
|
|
33
40
|
/**
|
|
34
|
-
* @returns The asset's full
|
|
41
|
+
* @returns The asset's full {@link ManifestStore} containing all its manifests, validation statuses, and the URI of the active manifest.
|
|
35
42
|
*
|
|
36
43
|
* 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.
|
|
37
44
|
*/
|
|
38
45
|
manifestStore: () => Promise<ManifestStore>;
|
|
39
46
|
/**
|
|
40
|
-
* @returns The asset's active
|
|
47
|
+
* @returns The asset's active {@link Manifest}.
|
|
41
48
|
*
|
|
42
49
|
* NOTE: At the moment, the manifest returned by this method will not include decoded CAWG data. Use Reader.json() if CAWG is a requirement.
|
|
43
50
|
*/
|
|
44
51
|
activeManifest: () => Promise<Manifest>;
|
|
45
52
|
/**
|
|
46
|
-
* @returns The asset's full
|
|
53
|
+
* @returns The asset's full {@link Manifest} store, including decoded CAWG data.
|
|
47
54
|
*/
|
|
48
55
|
json: () => Promise<any>;
|
|
49
56
|
/**
|
|
@@ -68,9 +75,8 @@ export interface Reader {
|
|
|
68
75
|
free: () => Promise<void>;
|
|
69
76
|
}
|
|
70
77
|
/**
|
|
71
|
-
*
|
|
72
|
-
* @
|
|
73
|
-
* @returns Object containing reader creation methods
|
|
78
|
+
* @param worker - Worker (via WorkerManager) to be associated with this reader factory.
|
|
79
|
+
* @returns A {@link ReaderFactory} object containing reader creation methods.
|
|
74
80
|
*/
|
|
75
81
|
export declare function createReaderFactory(worker: WorkerManager): ReaderFactory;
|
|
76
82
|
//# sourceMappingURL=reader.d.ts.map
|
package/dist/lib/reader.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reader.d.ts","sourceRoot":"","sources":["../../src/lib/reader.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAGlE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAG/D,eAAO,MAAM,iBAAiB,QAAU,CAAC;AAEzC;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B;;;;;;OAMG;IACH,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAE1D,gBAAgB,EAAE,CAChB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,IAAI,KACX,OAAO,CAAC,MAAM,CAAC,CAAC;CACtB;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,MAAM;IACrB;;OAEG;IACH,WAAW,EAAE,MAAM,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAE1C;;;;OAIG;IACH,aAAa,EAAE,MAAM,OAAO,CAAC,aAAa,CAAC,CAAC;IAE5C;;;;OAIG;IACH,cAAc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gB,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,WAAW,CAAC,CAAC;IAExD;;OAEG;IACH,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3B;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,aAAa,GAAG,aAAa,CA8CxE"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2025 Adobe
|
|
3
|
+
* All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* NOTICE: Adobe permits you to use, modify, and distribute this file in
|
|
6
|
+
* accordance with the terms of the Adobe license agreement accompanying
|
|
7
|
+
* it.
|
|
8
|
+
*/
|
|
9
|
+
export type SigningAlg = 'es256' | 'es384' | 'es512' | 'ps256' | 'ps384' | 'ps512' | 'ed25519';
|
|
10
|
+
export interface Signer {
|
|
11
|
+
sign: (data: Uint8Array, reserveSize: number) => Promise<Uint8Array>;
|
|
12
|
+
reserveSize: () => Promise<number>;
|
|
13
|
+
alg: SigningAlg;
|
|
14
|
+
}
|
|
15
|
+
export interface SerializableSigningPayload {
|
|
16
|
+
reserveSize: number;
|
|
17
|
+
alg: SigningAlg;
|
|
18
|
+
}
|
|
19
|
+
export declare function getSerializablePayload(signer: Signer): Promise<SerializableSigningPayload>;
|
|
20
|
+
//# sourceMappingURL=signer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signer.d.ts","sourceRoot":"","sources":["../../src/lib/signer.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,MAAM,UAAU,GAClB,OAAO,GACP,OAAO,GACP,OAAO,GACP,OAAO,GACP,OAAO,GACP,OAAO,GACP,SAAS,CAAC;AAEd,MAAM,WAAW,MAAM;IACrB,IAAI,EAAE,CAAC,IAAI,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;IACrE,WAAW,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;IACnC,GAAG,EAAE,UAAU,CAAC;CACjB;AAED,MAAM,WAAW,0BAA0B;IACzC,WAAW,EAAE,MAAM,CAAC;IACpB,GAAG,EAAE,UAAU,CAAC;CACjB;AAED,wBAAsB,sBAAsB,CAC1C,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,0BAA0B,CAAC,CAQrC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { SerializableSigningPayload } from '../signer.js';
|
|
2
|
+
declare const createTx: (worker?: Worker) => {
|
|
3
|
+
initWorker: (module: WebAssembly.Module, settings?: string | undefined) => Promise<void>;
|
|
4
|
+
reader_fromBlob: (format: string, blob: Blob) => Promise<number>;
|
|
5
|
+
reader_fromBlobFragment: (format: string, init: Blob, fragment: Blob) => Promise<number>;
|
|
6
|
+
reader_activeLabel: (readerId: number) => Promise<string | null>;
|
|
7
|
+
reader_manifestStore: (readerId: number) => Promise<any>;
|
|
8
|
+
reader_activeManifest: (readerId: number) => Promise<any>;
|
|
9
|
+
reader_json: (readerId: number) => Promise<string>;
|
|
10
|
+
reader_resourceToBuffer: (readerId: number, uri: string) => Promise<ArrayBuffer>;
|
|
11
|
+
reader_free: (readerId: number) => Promise<void>;
|
|
12
|
+
builder_fromJson: (json: string) => Promise<number>;
|
|
13
|
+
builder_setRemoteUrl: (builderId: number, url: string) => Promise<void>;
|
|
14
|
+
builder_setNoEmbed: (builderId: number, noEmbed: boolean) => Promise<void>;
|
|
15
|
+
builder_setThumbnailFromBlob: (builderId: number, format: string, blob: Blob) => Promise<void>;
|
|
16
|
+
builder_addIngredientFromBlob: (builderId: number, json: string, format: string, blob: Blob) => Promise<void>;
|
|
17
|
+
builder_addResourceFromBlob: (builderId: number, id: string, blob: Blob) => Promise<void>;
|
|
18
|
+
builder_getDefinition: (builderId: number) => Promise<any>;
|
|
19
|
+
builder_sign: (builderId: number, requestId: number, payload: SerializableSigningPayload, format: string, blob: Blob) => Promise<Uint8Array<ArrayBufferLike>>;
|
|
20
|
+
builder_free: (builderId: number) => Promise<void>;
|
|
21
|
+
}, rx: (receivers: {
|
|
22
|
+
initWorker: (module: WebAssembly.Module, settings?: string) => void;
|
|
23
|
+
reader_fromBlob: (format: string, blob: Blob) => Promise<number>;
|
|
24
|
+
reader_fromBlobFragment: (format: string, init: Blob, fragment: Blob) => Promise<number>;
|
|
25
|
+
reader_activeLabel: (readerId: number) => string | null;
|
|
26
|
+
reader_manifestStore: (readerId: number) => any;
|
|
27
|
+
reader_activeManifest: (readerId: number) => any;
|
|
28
|
+
reader_json: (readerId: number) => string;
|
|
29
|
+
reader_resourceToBuffer: (readerId: number, uri: string) => ArrayBuffer;
|
|
30
|
+
reader_free: (readerId: number) => void;
|
|
31
|
+
builder_fromJson: (json: string) => number;
|
|
32
|
+
builder_setRemoteUrl: (builderId: number, url: string) => void;
|
|
33
|
+
builder_setNoEmbed: (builderId: number, noEmbed: boolean) => void;
|
|
34
|
+
builder_setThumbnailFromBlob: (builderId: number, format: string, blob: Blob) => void;
|
|
35
|
+
builder_addIngredientFromBlob: (builderId: number, json: string, format: string, blob: Blob) => void;
|
|
36
|
+
builder_addResourceFromBlob: (builderId: number, id: string, blob: Blob) => void;
|
|
37
|
+
builder_getDefinition: (builderId: number) => any;
|
|
38
|
+
builder_sign: (builderId: number, requestId: number, payload: SerializableSigningPayload, format: string, blob: Blob) => Promise<Uint8Array>;
|
|
39
|
+
builder_free: (builderId: number) => void;
|
|
40
|
+
}, worker?: Worker) => void;
|
|
41
|
+
declare const createWorkerTx: (worker?: Worker) => {
|
|
42
|
+
sign: (requestId: number, bytes: Uint8Array<ArrayBufferLike>, reserveSize: number) => Promise<Uint8Array<ArrayBufferLike>>;
|
|
43
|
+
}, workerRx: (receivers: {
|
|
44
|
+
sign: (requestId: number, bytes: Uint8Array, reserveSize: number) => Promise<Uint8Array>;
|
|
45
|
+
}, worker?: Worker) => void;
|
|
46
|
+
export { createTx, rx, createWorkerTx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ACd,IAAI,EAAE,IAAI,KACP,IAAI;iCACoB,CAC3B,SAAS,EAAE,MAAM,EACjB,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,IAAI,KACP,IAAI;2BACc,CAAC,SAAS,EAAE,MAAM,KAAK,GAAG;kBACnC,CACZ,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,0BAA0B,EACnC,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,IAAI,KACP,OAAO,CAAC,UAAU,CAAC;kBACV,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI;2BACvC,CAAC;AAGL,QAAA,MAAkB,cAAc;;GAAM,QAAQ;UACtC,CACJ,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,UAAU,EACjB,WAAW,EAAE,MAAM,KAChB,OAAO,CAAC,UAAU,CAAC;2BACd,CAAC;AAEb,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,cAAc,EAAE,QAAQ,EAAE,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Signer } from '../signer.js';
|
|
2
|
+
import { createTx } from './rpc.js';
|
|
3
3
|
export interface WorkerManager {
|
|
4
|
-
|
|
4
|
+
tx: ReturnType<typeof createTx>;
|
|
5
|
+
registerSignReceiver: (signFn: Signer['sign']) => number;
|
|
5
6
|
terminate: () => void;
|
|
6
7
|
}
|
|
7
8
|
export interface CreateWorkerManagerConfig {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workerManager.d.ts","sourceRoot":"","sources":["../../../src/lib/worker/workerManager.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"workerManager.d.ts","sourceRoot":"","sources":["../../../src/lib/worker/workerManager.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAY,MAAM,UAAU,CAAC;AAI9C,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,UAAU,CAAC,OAAO,QAAQ,CAAC,CAAC;IAChC,oBAAoB,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK,MAAM,CAAC;IACzD,SAAS,EAAE,MAAM,IAAI,CAAC;CACvB;AAED,MAAM,WAAW,yBAAyB;IACxC,IAAI,EAAE,WAAW,CAAC,MAAM,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;;;;;GAOG;AACH,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,yBAAyB,GAChC,OAAO,CAAC,aAAa,CAAC,CAsCxB"}
|
|
@@ -6,9 +6,10 @@
|
|
|
6
6
|
* accordance with the terms of the Adobe license agreement accompanying
|
|
7
7
|
* it.
|
|
8
8
|
*/
|
|
9
|
-
export
|
|
9
|
+
export interface WorkerObjectMap<T> {
|
|
10
10
|
add(object: T): number;
|
|
11
11
|
get(id: number): T;
|
|
12
12
|
remove(id: number): boolean;
|
|
13
|
-
}
|
|
13
|
+
}
|
|
14
|
+
export declare function createWorkerObjectMap<T>(): WorkerObjectMap<T>;
|
|
14
15
|
//# sourceMappingURL=workerObjectMap.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workerObjectMap.d.ts","sourceRoot":"","sources":["../../../src/lib/worker/workerObjectMap.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,
|
|
1
|
+
{"version":3,"file":"workerObjectMap.d.ts","sourceRoot":"","sources":["../../../src/lib/worker/workerObjectMap.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,WAAW,eAAe,CAAC,CAAC;IAChC,GAAG,CAAC,MAAM,EAAE,CAAC,GAAG,MAAM,CAAC;IACvB,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,CAAC,CAAC;IACnB,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC;CAC7B;AAED,wBAAgB,qBAAqB,CAAC,CAAC,KAAK,eAAe,CAAC,CAAC,CAAC,CAyB7D"}
|
package/dist/lib/worker.d.ts
CHANGED
|
@@ -1,15 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
reader_json(readerId: number): WorkerResponse<string>;
|
|
10
|
-
reader_resourceToBuffer(readerId: number, uri: string): WorkerResponse<ArrayBuffer>;
|
|
11
|
-
reader_free(readerId: number): void;
|
|
12
|
-
};
|
|
13
|
-
export type WorkerDefinition = typeof workerFunctions;
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2025 Adobe
|
|
3
|
+
* All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* NOTICE: Adobe permits you to use, modify, and distribute this file in
|
|
6
|
+
* accordance with the terms of the Adobe license agreement accompanying
|
|
7
|
+
* it.
|
|
8
|
+
*/
|
|
14
9
|
export {};
|
|
15
10
|
//# sourceMappingURL=worker.d.ts.map
|
package/dist/lib/worker.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worker.d.ts","sourceRoot":"","sources":["../../src/lib/worker.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG
|
|
1
|
+
{"version":3,"file":"worker.d.ts","sourceRoot":"","sources":["../../src/lib/worker.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG"}
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentauth/c2pa-web",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -23,8 +23,9 @@
|
|
|
23
23
|
}
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"
|
|
27
|
-
"@contentauth/c2pa-
|
|
26
|
+
"highgain": "^0.1.0",
|
|
27
|
+
"@contentauth/c2pa-types": "0.3.0",
|
|
28
|
+
"@contentauth/c2pa-wasm": "0.3.1"
|
|
28
29
|
},
|
|
29
30
|
"devDependencies": {
|
|
30
31
|
"@playwright/test": "^1.55.0",
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2025 Adobe
|
|
3
|
-
* All Rights Reserved.
|
|
4
|
-
*
|
|
5
|
-
* NOTICE: Adobe permits you to use, modify, and distribute this file in
|
|
6
|
-
* accordance with the terms of the Adobe license agreement accompanying
|
|
7
|
-
* it.
|
|
8
|
-
*/
|
|
9
|
-
export interface WorkerRequest<T, K> {
|
|
10
|
-
method: T;
|
|
11
|
-
args: K;
|
|
12
|
-
transfer?: Transferable[];
|
|
13
|
-
}
|
|
14
|
-
export interface WorkerResponse<T> {
|
|
15
|
-
data: T;
|
|
16
|
-
transfer?: Transferable[];
|
|
17
|
-
}
|
|
18
|
-
export type WorkerFunctions = Record<string, (...args: any[]) => void | Promise<void> | WorkerResponse<any> | Promise<WorkerResponse<any>>>;
|
|
19
|
-
/**
|
|
20
|
-
* Prepares a worker with a list of functions to expose via postMessage and an initialization function
|
|
21
|
-
*
|
|
22
|
-
* @param functions Map of functions keyed by name
|
|
23
|
-
* @param init Initialization function to be called once when the worker is set up
|
|
24
|
-
*/
|
|
25
|
-
export declare function setupWorker(functions: WorkerFunctions): void;
|
|
26
|
-
//# sourceMappingURL=setupWorker.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"setupWorker.d.ts","sourceRoot":"","sources":["../../../src/lib/worker/setupWorker.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,MAAM,WAAW,aAAa,CAAC,CAAC,EAAE,CAAC;IACjC,MAAM,EAAE,CAAC,CAAC;IACV,IAAI,EAAE,CAAC,CAAC;IACR,QAAQ,CAAC,EAAE,YAAY,EAAE,CAAC;CAC3B;AAID,MAAM,WAAW,cAAc,CAAC,CAAC;IAC/B,IAAI,EAAE,CAAC,CAAC;IACR,QAAQ,CAAC,EAAE,YAAY,EAAE,CAAC;CAC3B;AAED,MAAM,MAAM,eAAe,GAAG,MAAM,CAClC,MAAM,EACN,CACE,GAAG,IAAI,EAAE,GAAG,EAAE,KACX,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,cAAc,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAC/E,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,SAAS,EAAE,eAAe,QAerD"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2025 Adobe
|
|
3
|
-
* All Rights Reserved.
|
|
4
|
-
*
|
|
5
|
-
* NOTICE: Adobe permits you to use, modify, and distribute this file in
|
|
6
|
-
* accordance with the terms of the Adobe license agreement accompanying
|
|
7
|
-
* it.
|
|
8
|
-
*/
|
|
9
|
-
export declare function postSuccess(payload?: any, transfer?: Transferable[]): void;
|
|
10
|
-
export declare function postError(error: unknown): void;
|
|
11
|
-
export interface ResponseHandlers {
|
|
12
|
-
onSuccess: (data?: any) => void;
|
|
13
|
-
onError: (error?: any) => void;
|
|
14
|
-
}
|
|
15
|
-
export declare function handleWorkerResponse(worker: Worker, responseHandlers: ResponseHandlers): void;
|
|
16
|
-
//# sourceMappingURL=workerResponse.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"workerResponse.d.ts","sourceRoot":"","sources":["../../../src/lib/worker/workerResponse.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,wBAAgB,WAAW,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,QAAQ,CAAC,EAAE,YAAY,EAAE,GAAG,IAAI,CAO1E;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAE9C;AAED,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,CAAC,IAAI,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;IAChC,OAAO,EAAE,CAAC,KAAK,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;CAChC;AAED,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,MAAM,EACd,gBAAgB,EAAE,gBAAgB,QAoBnC"}
|