@contentauth/c2pa-wasm 0.3.1 → 0.4.0
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 +1 -1
- package/package.json +1 -1
- package/pkg/c2pa.d.ts +74 -41
- package/pkg/c2pa.js +468 -329
- package/pkg/c2pa_bg.wasm +0 -0
- package/pkg/c2pa_bg.wasm.d.ts +23 -16
package/README.md
CHANGED
package/package.json
CHANGED
package/pkg/c2pa.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
-
/**
|
|
4
|
-
* Accepts a JSON-serialized string to be loaded as c2pa-rs settings.
|
|
5
|
-
*/
|
|
6
|
-
export function loadSettings(settings: string): void;
|
|
7
3
|
/**
|
|
8
4
|
* Called when the WASM binary is initialized.
|
|
9
5
|
*/
|
|
10
6
|
export function run(): void;
|
|
7
|
+
/**
|
|
8
|
+
* Accepts a JSON-serialized string to be loaded as c2pa-rs settings.
|
|
9
|
+
*/
|
|
10
|
+
export function loadSettings(settings: string): void;
|
|
11
11
|
|
|
12
12
|
interface SignerDefinition {
|
|
13
|
-
sign: (bytes: Uint8Array) => Promise<Uint8Array
|
|
13
|
+
sign: (bytes: Uint8Array<ArrayBuffer>) => Promise<Uint8Array<ArrayBuffer>>;
|
|
14
14
|
reserveSize: number;
|
|
15
15
|
alg: string;
|
|
16
16
|
|
|
@@ -21,10 +21,31 @@ interface SignerDefinition {
|
|
|
21
21
|
export class WasmBuilder {
|
|
22
22
|
private constructor();
|
|
23
23
|
free(): void;
|
|
24
|
+
[Symbol.dispose](): void;
|
|
24
25
|
/**
|
|
25
|
-
*
|
|
26
|
+
* Add an action to the manifest's `Actions` assertion.
|
|
26
27
|
*/
|
|
27
|
-
|
|
28
|
+
addAction(action: any): void;
|
|
29
|
+
/**
|
|
30
|
+
* Sets the builder "intent."
|
|
31
|
+
*/
|
|
32
|
+
setIntent(json_intent: any): void;
|
|
33
|
+
/**
|
|
34
|
+
* "Save" a builder to an archive.
|
|
35
|
+
*/
|
|
36
|
+
toArchive(): Uint8Array;
|
|
37
|
+
/**
|
|
38
|
+
* Attempts to create a new `WasmBuilder` from a builder archive.
|
|
39
|
+
*/
|
|
40
|
+
static fromArchive(archive: Blob): WasmBuilder;
|
|
41
|
+
/**
|
|
42
|
+
* Sets the state of the no_embed flag.
|
|
43
|
+
*/
|
|
44
|
+
setNoEmbed(no_embed: boolean): void;
|
|
45
|
+
/**
|
|
46
|
+
* Get the current manifest definition.
|
|
47
|
+
*/
|
|
48
|
+
getDefinition(): string;
|
|
28
49
|
/**
|
|
29
50
|
* Sets the remote_url for a remote manifest.
|
|
30
51
|
*
|
|
@@ -33,9 +54,9 @@ export class WasmBuilder {
|
|
|
33
54
|
*/
|
|
34
55
|
setRemoteUrl(url: string): void;
|
|
35
56
|
/**
|
|
36
|
-
*
|
|
57
|
+
* Add a [`Blob`] to the manifest as a resource. The ID must match an identifier in the manifest.
|
|
37
58
|
*/
|
|
38
|
-
|
|
59
|
+
addResourceFromBlob(id: string, blob: Blob): void;
|
|
39
60
|
/**
|
|
40
61
|
* Sets a thumbnail from a [`Blob`] to be included in the manifest. The thumbnail should represent the asset being signed.
|
|
41
62
|
*/
|
|
@@ -50,17 +71,22 @@ export class WasmBuilder {
|
|
|
50
71
|
*/
|
|
51
72
|
addIngredientFromBlob(json: string, format: string, blob: Blob): void;
|
|
52
73
|
/**
|
|
53
|
-
*
|
|
74
|
+
* Sign an asset using the provided SignerDefinition, format, and source Blob.
|
|
75
|
+
* Use this method to get both the manifest bytes and the bytes of the signed asset.
|
|
54
76
|
*/
|
|
55
|
-
|
|
77
|
+
signAndGetManifestBytes(signer_definition: SignerDefinition, format: string, source: Blob): Promise<any>;
|
|
56
78
|
/**
|
|
57
|
-
*
|
|
79
|
+
* Creates a new `WasmBuilder` with a minimal manifest definition.
|
|
58
80
|
*/
|
|
59
|
-
|
|
81
|
+
static new(): WasmBuilder;
|
|
60
82
|
/**
|
|
61
83
|
* Sign an asset using the provided SignerDefinition, format, and source Blob.
|
|
62
84
|
*/
|
|
63
85
|
sign(signer_definition: SignerDefinition, format: string, source: Blob): Promise<Uint8Array>;
|
|
86
|
+
/**
|
|
87
|
+
* Attempts to create a new `WasmBuilder` from a JSON ManifestDefinition string.
|
|
88
|
+
*/
|
|
89
|
+
static fromJson(json: string): WasmBuilder;
|
|
64
90
|
}
|
|
65
91
|
/**
|
|
66
92
|
* Wraps a `c2pa::Reader`.
|
|
@@ -68,40 +94,40 @@ export class WasmBuilder {
|
|
|
68
94
|
export class WasmReader {
|
|
69
95
|
private constructor();
|
|
70
96
|
free(): void;
|
|
71
|
-
|
|
72
|
-
* Attempts to create a new `WasmReader` from an asset format and `Blob` of the asset's bytes.
|
|
73
|
-
*/
|
|
74
|
-
static fromBlob(format: string, blob: Blob): Promise<WasmReader>;
|
|
75
|
-
/**
|
|
76
|
-
* Attempts to create a new `WasmReader` from an asset format, a `Blob` of the bytes of the initial segment, and a fragment `Blob`.
|
|
77
|
-
*/
|
|
78
|
-
static fromBlobFragment(format: string, init: Blob, fragment: Blob): Promise<WasmReader>;
|
|
97
|
+
[Symbol.dispose](): void;
|
|
79
98
|
/**
|
|
80
99
|
* Returns the label of the asset's active manifest.
|
|
81
100
|
*/
|
|
82
101
|
activeLabel(): string | undefined;
|
|
83
102
|
/**
|
|
84
103
|
* Returns the asset's manifest store.
|
|
85
|
-
* NOTE: at the moment, CAWG data is not decoded via this function. Use WasmReader::json() if CAWG is a requirement.
|
|
86
104
|
*/
|
|
87
105
|
manifestStore(): any;
|
|
88
106
|
/**
|
|
89
107
|
* Returns the asset's active manifest.
|
|
90
|
-
* NOTE: at the moment, CAWG data is not decoded via this function. Use WasmReader::json() if CAWG is a requirement.
|
|
91
108
|
*/
|
|
92
109
|
activeManifest(): any;
|
|
110
|
+
/**
|
|
111
|
+
* Accepts a URI reference to a binary object in the resource store and returns a `js_sys::Uint8Array` containing the resource's bytes.
|
|
112
|
+
*/
|
|
113
|
+
resourceToBytes(uri: string): Uint8Array;
|
|
114
|
+
/**
|
|
115
|
+
* Attempts to create a new `WasmReader` from an asset format, a `Blob` of the bytes of the initial segment, and a fragment `Blob`.
|
|
116
|
+
*/
|
|
117
|
+
static fromBlobFragment(format: string, init: Blob, fragment: Blob): Promise<WasmReader>;
|
|
93
118
|
/**
|
|
94
119
|
* Returns a JSON representation of the asset's manifest store.
|
|
95
120
|
*/
|
|
96
121
|
json(): string;
|
|
97
122
|
/**
|
|
98
|
-
*
|
|
123
|
+
* Attempts to create a new `WasmReader` from an asset format and `Blob` of the asset's bytes.
|
|
99
124
|
*/
|
|
100
|
-
|
|
125
|
+
static fromBlob(format: string, blob: Blob): Promise<WasmReader>;
|
|
101
126
|
}
|
|
102
127
|
export class WasmSigner {
|
|
103
128
|
private constructor();
|
|
104
129
|
free(): void;
|
|
130
|
+
[Symbol.dispose](): void;
|
|
105
131
|
/**
|
|
106
132
|
* Attempt to create a new [`WasmSigner`] from a SignerDefinition.
|
|
107
133
|
*/
|
|
@@ -113,38 +139,45 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
|
|
|
113
139
|
export interface InitOutput {
|
|
114
140
|
readonly memory: WebAssembly.Memory;
|
|
115
141
|
readonly __wbg_wasmbuilder_free: (a: number, b: number) => void;
|
|
116
|
-
readonly
|
|
117
|
-
readonly wasmbuilder_setRemoteUrl: (a: number, b: number, c: number) => void;
|
|
118
|
-
readonly wasmbuilder_setNoEmbed: (a: number, b: number) => void;
|
|
119
|
-
readonly wasmbuilder_setThumbnailFromBlob: (a: number, b: number, c: number, d: any) => [number, number];
|
|
142
|
+
readonly wasmbuilder_addAction: (a: number, b: any) => [number, number];
|
|
120
143
|
readonly wasmbuilder_addIngredientFromBlob: (a: number, b: number, c: number, d: number, e: number, f: any) => [number, number];
|
|
121
144
|
readonly wasmbuilder_addResourceFromBlob: (a: number, b: number, c: number, d: any) => [number, number];
|
|
145
|
+
readonly wasmbuilder_fromArchive: (a: any) => [number, number, number];
|
|
146
|
+
readonly wasmbuilder_fromJson: (a: number, b: number) => [number, number, number];
|
|
122
147
|
readonly wasmbuilder_getDefinition: (a: number) => [number, number, number];
|
|
148
|
+
readonly wasmbuilder_new: () => [number, number, number];
|
|
149
|
+
readonly wasmbuilder_setIntent: (a: number, b: any) => [number, number];
|
|
150
|
+
readonly wasmbuilder_setNoEmbed: (a: number, b: number) => void;
|
|
151
|
+
readonly wasmbuilder_setRemoteUrl: (a: number, b: number, c: number) => void;
|
|
152
|
+
readonly wasmbuilder_setThumbnailFromBlob: (a: number, b: number, c: number, d: any) => [number, number];
|
|
123
153
|
readonly wasmbuilder_sign: (a: number, b: any, c: number, d: number, e: any) => any;
|
|
154
|
+
readonly wasmbuilder_signAndGetManifestBytes: (a: number, b: any, c: number, d: number, e: any) => any;
|
|
155
|
+
readonly wasmbuilder_toArchive: (a: number) => [number, number, number];
|
|
124
156
|
readonly loadSettings: (a: number, b: number) => [number, number];
|
|
157
|
+
readonly run: () => void;
|
|
125
158
|
readonly __wbg_wasmsigner_free: (a: number, b: number) => void;
|
|
126
159
|
readonly wasmsigner_fromDefinition: (a: any) => [number, number, number];
|
|
127
|
-
readonly run: () => void;
|
|
128
160
|
readonly __wbg_wasmreader_free: (a: number, b: number) => void;
|
|
129
|
-
readonly wasmreader_fromBlob: (a: number, b: number, c: any) => any;
|
|
130
|
-
readonly wasmreader_fromBlobFragment: (a: number, b: number, c: any, d: any) => any;
|
|
131
161
|
readonly wasmreader_activeLabel: (a: number) => [number, number];
|
|
132
|
-
readonly wasmreader_manifestStore: (a: number) => [number, number, number];
|
|
133
162
|
readonly wasmreader_activeManifest: (a: number) => [number, number, number];
|
|
163
|
+
readonly wasmreader_fromBlob: (a: number, b: number, c: any) => any;
|
|
164
|
+
readonly wasmreader_fromBlobFragment: (a: number, b: number, c: any, d: any) => any;
|
|
134
165
|
readonly wasmreader_json: (a: number) => [number, number];
|
|
135
|
-
readonly
|
|
166
|
+
readonly wasmreader_manifestStore: (a: number) => [number, number, number];
|
|
167
|
+
readonly wasmreader_resourceToBytes: (a: number, b: number, c: number) => [number, number, number];
|
|
136
168
|
readonly ring_core_0_17_14__bn_mul_mont: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
169
|
+
readonly wasm_bindgen__convert__closures_____invoke__hbb73f02d9cb5eeb0: (a: number, b: number) => void;
|
|
170
|
+
readonly wasm_bindgen__closure__destroy__h3685db4568587cc8: (a: number, b: number) => void;
|
|
171
|
+
readonly wasm_bindgen__convert__closures_____invoke__hedbe22ff1e6181ec: (a: number, b: number, c: any) => void;
|
|
172
|
+
readonly wasm_bindgen__closure__destroy__h4e2af4dd32e0f9a7: (a: number, b: number) => void;
|
|
173
|
+
readonly wasm_bindgen__convert__closures_____invoke__h1fd2c9ff95892b8d: (a: number, b: number, c: any, d: any) => void;
|
|
174
|
+
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
175
|
+
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
137
176
|
readonly __wbindgen_exn_store: (a: number) => void;
|
|
138
177
|
readonly __externref_table_alloc: () => number;
|
|
139
|
-
readonly
|
|
178
|
+
readonly __wbindgen_externrefs: WebAssembly.Table;
|
|
140
179
|
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
141
|
-
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
142
|
-
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
143
|
-
readonly __wbindgen_export_6: WebAssembly.Table;
|
|
144
180
|
readonly __externref_table_dealloc: (a: number) => void;
|
|
145
|
-
readonly wasm_bindgen__convert__closures_____invoke__h09e04d5375df482d: (a: number, b: number) => void;
|
|
146
|
-
readonly closure1669_externref_shim: (a: number, b: number, c: any) => void;
|
|
147
|
-
readonly closure2615_externref_shim: (a: number, b: number, c: any, d: any) => void;
|
|
148
181
|
readonly __wbindgen_start: () => void;
|
|
149
182
|
}
|
|
150
183
|
|