@contentauth/c2pa-web 0.6.0 → 0.6.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 +14 -11
- package/dist/c2pa-BoAoHcQo.js +365 -0
- package/dist/common.d.ts +3 -3
- package/dist/common.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/inline.js +3 -3
- package/dist/lib/worker/rpc.d.ts.map +1 -1
- package/dist/resources/c2pa_bg.wasm +0 -0
- package/package.json +3 -3
- package/dist/c2pa-CDISz-AM.js +0 -365
package/README.md
CHANGED
|
@@ -12,13 +12,14 @@ npm install @contentauth/c2pa-web
|
|
|
12
12
|
|
|
13
13
|
## Importing the library
|
|
14
14
|
|
|
15
|
-
There are two ways to import the library, due to [specific requirements](https://developer.mozilla.org/en-US/docs/WebAssembly/Guides/Loading_and_running) for handling Wasm modules:
|
|
15
|
+
There are two ways to import the library, due to [specific requirements](https://developer.mozilla.org/en-US/docs/WebAssembly/Guides/Loading_and_running) for handling Wasm modules:
|
|
16
|
+
|
|
16
17
|
- Using a separate Wasm binary, which provides better performance.
|
|
17
|
-
- Using an inline Wasm binary, which is more convenient.
|
|
18
|
+
- Using an inline Wasm binary, which is more convenient.
|
|
18
19
|
|
|
19
20
|
### Using a separate Wasm binary
|
|
20
21
|
|
|
21
|
-
The recommended way to import the library is to fetch the Wasm binary over the network at runtime.
|
|
22
|
+
The recommended way to import the library is to fetch the Wasm binary over the network at runtime.
|
|
22
23
|
This requires that the Wasm binary be hosted separately.
|
|
23
24
|
|
|
24
25
|
With Vite:
|
|
@@ -39,13 +40,13 @@ import { createC2pa } from '@contentauth/c2pa-web';
|
|
|
39
40
|
// Ensure that [PACKAGE VERSION] matches the currently-installed version of @contentauth/c2pa-web.
|
|
40
41
|
const c2pa = await createC2pa({
|
|
41
42
|
wasmSrc:
|
|
42
|
-
'https://cdn.jsdelivr.net/npm/@contentauth/c2pa-web@[PACKAGE VERSION]/dist/resources/c2pa_bg.wasm'
|
|
43
|
+
'https://cdn.jsdelivr.net/npm/@contentauth/c2pa-web@[PACKAGE VERSION]/dist/resources/c2pa_bg.wasm'
|
|
43
44
|
});
|
|
44
45
|
```
|
|
45
46
|
|
|
46
47
|
### Using an inline Wasm binary
|
|
47
48
|
|
|
48
|
-
Where it is not possible or convenient to request a separate resource over the network, use the `@contentauth/c2pa-web/inline` package, which has the Wasm binary encoded as a base64 string in the JavaScript file.
|
|
49
|
+
Where it is not possible or convenient to request a separate resource over the network, use the `@contentauth/c2pa-web/inline` package, which has the Wasm binary encoded as a base64 string in the JavaScript file.
|
|
49
50
|
|
|
50
51
|
Using this package does not require an additional network request. However, it adds _significant_ size to the JavaScript bundle, and cannot take advantage of the higher-performance
|
|
51
52
|
[`WebAssembly.compileStreaming()`](https://developer.mozilla.org/en-US/docs/WebAssembly/Reference/JavaScript_interface/compileStreaming_static) API.
|
|
@@ -86,7 +87,8 @@ Use the `Builder` API to create C2PA manifests and add ingredients (source asset
|
|
|
86
87
|
|
|
87
88
|
#### Setting builder intent
|
|
88
89
|
|
|
89
|
-
The builder intent describes the type of operation being performed on the asset. This influences how the manifest is structured and what assertions are automatically added.
|
|
90
|
+
The builder intent describes the type of operation being performed on the asset. This influences how the manifest is structured and what assertions are automatically added. Use one of these intents:
|
|
91
|
+
|
|
90
92
|
- `create`: Indicates the asset is a new digital creation, a DigitalSourceType is required. The Manifest must not have have a parent ingredient. A `c2pa.created` action will be added if not provided.
|
|
91
93
|
- `edit`: Indicates the asset is an edit of a pre-existing parent asset. The Manifest must have a parent ingredient. A parent ingredient will be generated from the source stream if not otherwise provided. A `c2pa.opened action will be tied to the parent ingredient.
|
|
92
94
|
- `update`: A restricted version of `edit` for non-editorial changes. There must be only one ingredient, as a parent. No changes can be made to the hashed content of the parent. There are additional restrictions on the types of changes that can be made.
|
|
@@ -95,7 +97,8 @@ The builder intent describes the type of operation being performed on the asset.
|
|
|
95
97
|
const builder = await c2pa.builder.new();
|
|
96
98
|
|
|
97
99
|
await builder.setIntent({
|
|
98
|
-
create:
|
|
100
|
+
create:
|
|
101
|
+
'http://cv.iptc.org/newscodes/digitalsourcetype/trainedAlgorithmicMedia'
|
|
99
102
|
});
|
|
100
103
|
|
|
101
104
|
await builder.setIntent('edit');
|
|
@@ -131,7 +134,7 @@ await builder.addIngredientFromBlob(
|
|
|
131
134
|
title: 'source-image.jpg',
|
|
132
135
|
format: 'image/jpeg',
|
|
133
136
|
instance_id: 'ingredient-123',
|
|
134
|
-
relationship: 'parentOf'
|
|
137
|
+
relationship: 'parentOf'
|
|
135
138
|
},
|
|
136
139
|
'image/jpeg', // Format
|
|
137
140
|
ingredientBlob // The actual asset bytes
|
|
@@ -160,7 +163,7 @@ await builder.addIngredientFromBlob(
|
|
|
160
163
|
title: 'background.jpg',
|
|
161
164
|
format: 'image/jpeg',
|
|
162
165
|
instance_id: 'background-001',
|
|
163
|
-
relationship: 'componentOf'
|
|
166
|
+
relationship: 'componentOf'
|
|
164
167
|
},
|
|
165
168
|
'image/jpeg',
|
|
166
169
|
background
|
|
@@ -172,7 +175,7 @@ await builder.addIngredientFromBlob(
|
|
|
172
175
|
title: 'overlay.png',
|
|
173
176
|
format: 'image/png',
|
|
174
177
|
instance_id: 'overlay-002',
|
|
175
|
-
relationship: 'componentOf'
|
|
178
|
+
relationship: 'componentOf'
|
|
176
179
|
},
|
|
177
180
|
'image/png',
|
|
178
181
|
overlay
|
|
@@ -197,7 +200,7 @@ await builder.addIngredientFromBlob(
|
|
|
197
200
|
{
|
|
198
201
|
title: 'source.jpg',
|
|
199
202
|
format: 'image/jpeg',
|
|
200
|
-
instance_id: 'source-123'
|
|
203
|
+
instance_id: 'source-123'
|
|
201
204
|
},
|
|
202
205
|
'image/jpeg',
|
|
203
206
|
ingredientBlob
|
|
@@ -0,0 +1,365 @@
|
|
|
1
|
+
import { channel as I, transfer as j } from "highgain";
|
|
2
|
+
import { merge as z } from "ts-deepmerge";
|
|
3
|
+
const { createTx: O, rx: Z } = I(), { createTx: H, rx: U } = I("worker"), T = '(function(){"use strict";class y{static __wrap(e){e=e>>>0;const t=Object.create(y.prototype);return t.__wbg_ptr=e,x.register(t,t.__wbg_ptr,t),t}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,x.unregister(this),e}free(){const e=this.__destroy_into_raw();o.__wbg_wasmbuilder_free(e,0)}addAction(e){const t=o.wasmbuilder_addAction(this.__wbg_ptr,e);if(t[1])throw f(t[0])}addIngredient(e){const t=b(e,o.__wbindgen_malloc,o.__wbindgen_realloc),n=u,_=o.wasmbuilder_addIngredient(this.__wbg_ptr,t,n);if(_[1])throw f(_[0])}addIngredientFromBlob(e,t,n){const _=b(e,o.__wbindgen_malloc,o.__wbindgen_realloc),c=u,i=b(t,o.__wbindgen_malloc,o.__wbindgen_realloc),s=u,a=o.wasmbuilder_addIngredientFromBlob(this.__wbg_ptr,_,c,i,s,n);if(a[1])throw f(a[0])}addResourceFromBlob(e,t){const n=b(e,o.__wbindgen_malloc,o.__wbindgen_realloc),_=u,c=o.wasmbuilder_addResourceFromBlob(this.__wbg_ptr,n,_,t);if(c[1])throw f(c[0])}static fromArchive(e,t){var n=g(t)?0:b(t,o.__wbindgen_malloc,o.__wbindgen_realloc),_=u;const c=o.wasmbuilder_fromArchive(e,n,_);if(c[2])throw f(c[1]);return y.__wrap(c[0])}static fromJson(e,t){const n=b(e,o.__wbindgen_malloc,o.__wbindgen_realloc),_=u;var c=g(t)?0:b(t,o.__wbindgen_malloc,o.__wbindgen_realloc),i=u;const s=o.wasmbuilder_fromJson(n,_,c,i);if(s[2])throw f(s[1]);return y.__wrap(s[0])}getDefinition(){const e=o.wasmbuilder_getDefinition(this.__wbg_ptr);if(e[2])throw f(e[1]);return f(e[0])}static new(e){var t=g(e)?0:b(e,o.__wbindgen_malloc,o.__wbindgen_realloc),n=u;const _=o.wasmbuilder_new(t,n);if(_[2])throw f(_[1]);return y.__wrap(_[0])}setIntent(e){const t=o.wasmbuilder_setIntent(this.__wbg_ptr,e);if(t[1])throw f(t[0])}setNoEmbed(e){o.wasmbuilder_setNoEmbed(this.__wbg_ptr,e)}setRemoteUrl(e){const t=b(e,o.__wbindgen_malloc,o.__wbindgen_realloc),n=u;o.wasmbuilder_setRemoteUrl(this.__wbg_ptr,t,n)}setThumbnailFromBlob(e,t){const n=b(e,o.__wbindgen_malloc,o.__wbindgen_realloc),_=u,c=o.wasmbuilder_setThumbnailFromBlob(this.__wbg_ptr,n,_,t);if(c[1])throw f(c[0])}sign(e,t,n){const _=b(t,o.__wbindgen_malloc,o.__wbindgen_realloc),c=u;return o.wasmbuilder_sign(this.__wbg_ptr,e,_,c,n)}signAndGetManifestBytes(e,t,n){const _=b(t,o.__wbindgen_malloc,o.__wbindgen_realloc),c=u;return o.wasmbuilder_signAndGetManifestBytes(this.__wbg_ptr,e,_,c,n)}toArchive(){const e=o.wasmbuilder_toArchive(this.__wbg_ptr);if(e[2])throw f(e[1]);return f(e[0])}}Symbol.dispose&&(y.prototype[Symbol.dispose]=y.prototype.free);class v{static __wrap(e){e=e>>>0;const t=Object.create(v.prototype);return t.__wbg_ptr=e,k.register(t,t.__wbg_ptr,t),t}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,k.unregister(this),e}free(){const e=this.__destroy_into_raw();o.__wbg_wasmreader_free(e,0)}activeLabel(){const e=o.wasmreader_activeLabel(this.__wbg_ptr);let t;return e[0]!==0&&(t=h(e[0],e[1]).slice(),o.__wbindgen_free(e[0],e[1]*1,1)),t}activeManifest(){const e=o.wasmreader_activeManifest(this.__wbg_ptr);if(e[2])throw f(e[1]);return f(e[0])}static fromBlob(e,t,n){const _=b(e,o.__wbindgen_malloc,o.__wbindgen_realloc),c=u;var i=g(n)?0:b(n,o.__wbindgen_malloc,o.__wbindgen_realloc),s=u;return o.wasmreader_fromBlob(_,c,t,i,s)}static fromBlobFragment(e,t,n,_){const c=b(e,o.__wbindgen_malloc,o.__wbindgen_realloc),i=u;var s=g(_)?0:b(_,o.__wbindgen_malloc,o.__wbindgen_realloc),a=u;return o.wasmreader_fromBlobFragment(c,i,t,n,s,a)}json(){let e,t;try{const n=o.wasmreader_json(this.__wbg_ptr);return e=n[0],t=n[1],h(n[0],n[1])}finally{o.__wbindgen_free(e,t,1)}}manifestStore(){const e=o.wasmreader_manifestStore(this.__wbg_ptr);if(e[2])throw f(e[1]);return f(e[0])}resourceToBytes(e){const t=b(e,o.__wbindgen_malloc,o.__wbindgen_realloc),n=u,_=o.wasmreader_resourceToBytes(this.__wbg_ptr,t,n);if(_[2])throw f(_[1]);return f(_[0])}}Symbol.dispose&&(v.prototype[Symbol.dispose]=v.prototype.free);function C(r){const e=b(r,o.__wbindgen_malloc,o.__wbindgen_realloc),t=u,n=o.loadSettings(e,t);if(n[1])throw f(n[0])}function V(){return{__proto__:null,"./c2pa_bg.js":{__proto__:null,__wbg_Error_83742b46f01ce22d:function(e,t){return Error(h(e,t))},__wbg_Number_a5a435bd7bbec835:function(e){return Number(e)},__wbg___wbindgen_bigint_get_as_i64_447a76b5c6ef7bda:function(e,t){const n=t,_=typeof n=="bigint"?n:void 0;m().setBigInt64(e+8,g(_)?BigInt(0):_,!0),m().setInt32(e+0,!g(_),!0)},__wbg___wbindgen_boolean_get_c0f3f60bac5a78d1:function(e){const t=e,n=typeof t=="boolean"?t:void 0;return g(n)?16777215:n?1:0},__wbg___wbindgen_debug_string_5398f5bb970e0daa:function(e,t){const n=j(t),_=b(n,o.__wbindgen_malloc,o.__wbindgen_realloc),c=u;m().setInt32(e+4,c,!0),m().setInt32(e+0,_,!0)},__wbg___wbindgen_in_41dbb8413020e076:function(e,t){return e in t},__wbg___wbindgen_is_bigint_e2141d4f045b7eda:function(e){return typeof e=="bigint"},__wbg___wbindgen_is_function_3c846841762788c1:function(e){return typeof e=="function"},__wbg___wbindgen_is_object_781bc9f159099513:function(e){const t=e;return typeof t=="object"&&t!==null},__wbg___wbindgen_is_string_7ef6b97b02428fae:function(e){return typeof e=="string"},__wbg___wbindgen_is_undefined_52709e72fb9f179c:function(e){return e===void 0},__wbg___wbindgen_jsval_eq_ee31bfad3e536463:function(e,t){return e===t},__wbg___wbindgen_jsval_loose_eq_5bcc3bed3c69e72b:function(e,t){return e==t},__wbg___wbindgen_number_get_34bb9d9dcfa21373:function(e,t){const n=t,_=typeof n=="number"?n:void 0;m().setFloat64(e+8,g(_)?0:_,!0),m().setInt32(e+0,!g(_),!0)},__wbg___wbindgen_string_get_395e606bd0ee4427:function(e,t){const n=t,_=typeof n=="string"?n:void 0;var c=g(_)?0:b(_,o.__wbindgen_malloc,o.__wbindgen_realloc),i=u;m().setInt32(e+4,i,!0),m().setInt32(e+0,c,!0)},__wbg___wbindgen_throw_6ddd609b62940d55:function(e,t){throw new Error(h(e,t))},__wbg__wbg_cb_unref_6b5b6b8576d35cb1:function(e){e._wbg_cb_unref()},__wbg_abort_5ef96933660780b7:function(e){e.abort()},__wbg_abort_6479c2d794ebf2ee:function(e,t){e.abort(t)},__wbg_append_608dfb635ee8998f:function(){return d(function(e,t,n,_,c){e.append(h(t,n),h(_,c))},arguments)},__wbg_arrayBuffer_eb8e9ca620af2a19:function(){return d(function(e){return e.arrayBuffer()},arguments)},__wbg_byteLength_607b856aa6c5a508:function(e){return e.byteLength},__wbg_call_2d781c1f4d5c0ef8:function(){return d(function(e,t,n){return e.call(t,n)},arguments)},__wbg_call_e133b57c9155d22c:function(){return d(function(e,t){return e.call(t)},arguments)},__wbg_clearTimeout_6b8d9a38b9263d65:function(e){return clearTimeout(e)},__wbg_crypto_38df2bab126b63dc:function(e){return e.crypto},__wbg_done_08ce71ee07e3bd17:function(e){return e.done},__wbg_entries_e8a20ff8c9757101:function(e){return Object.entries(e)},__wbg_error_a6fa202b58aa1cd3:function(e,t){let n,_;try{n=e,_=t,console.error(h(e,t))}finally{o.__wbindgen_free(n,_,1)}},__wbg_fetch_5550a88cf343aaa9:function(e,t){return e.fetch(t)},__wbg_fetch_9dad4fe911207b37:function(e){return fetch(e)},__wbg_from_4bdf88943703fd48:function(e){return Array.from(e)},__wbg_getRandomValues_3dda8830c2565714:function(){return d(function(e,t){globalThis.crypto.getRandomValues(A(e,t))},arguments)},__wbg_getRandomValues_3f44b700395062e5:function(){return d(function(e,t){globalThis.crypto.getRandomValues(A(e,t))},arguments)},__wbg_getRandomValues_c44a50d8cfdaebeb:function(){return d(function(e,t){e.getRandomValues(t)},arguments)},__wbg_getTime_1dad7b5386ddd2d9:function(e){return e.getTime()},__wbg_get_326e41e095fb2575:function(){return d(function(e,t){return Reflect.get(e,t)},arguments)},__wbg_get_3ef1eba1850ade27:function(){return d(function(e,t){return Reflect.get(e,t)},arguments)},__wbg_get_a8ee5c45dabc1b3b:function(e,t){return e[t>>>0]},__wbg_get_unchecked_329cfe50afab7352:function(e,t){return e[t>>>0]},__wbg_get_with_ref_key_6412cf3094599694:function(e,t){return e[t]},__wbg_has_926ef2ff40b308cf:function(){return d(function(e,t){return Reflect.has(e,t)},arguments)},__wbg_headers_eb2234545f9ff993:function(e){return e.headers},__wbg_instanceof_ArrayBuffer_101e2bf31071a9f6:function(e){let t;try{t=e instanceof ArrayBuffer}catch{t=!1}return t},__wbg_instanceof_Map_f194b366846aca0c:function(e){let t;try{t=e instanceof Map}catch{t=!1}return t},__wbg_instanceof_Promise_7c3bdd7805c2c6e6:function(e){let t;try{t=e instanceof Promise}catch{t=!1}return t},__wbg_instanceof_Response_9b4d9fd451e051b1:function(e){let t;try{t=e instanceof Response}catch{t=!1}return t},__wbg_instanceof_Uint8Array_740438561a5b956d:function(e){let t;try{t=e instanceof Uint8Array}catch{t=!1}return t},__wbg_isArray_33b91feb269ff46e:function(e){return Array.isArray(e)},__wbg_isSafeInteger_ecd6a7f9c3e053cd:function(e){return Number.isSafeInteger(e)},__wbg_iterator_d8f549ec8fb061b1:function(){return Symbol.iterator},__wbg_length_b3416cf66a5452c8:function(e){return e.length},__wbg_length_ea16607d7b61445b:function(e){return e.length},__wbg_msCrypto_bd5a034af96bcba6:function(e){return e.msCrypto},__wbg_new_0837727332ac86ba:function(){return d(function(){return new Headers},arguments)},__wbg_new_0_1dcafdf5e786e876:function(){return new Date},__wbg_new_227d7c05414eb861:function(){return new Error},__wbg_new_338f3b13aa93419b:function(){return d(function(){return new FileReaderSync},arguments)},__wbg_new_49d5571bd3f0c4d4:function(){return new Map},__wbg_new_5f486cdf45a04d78:function(e){return new Uint8Array(e)},__wbg_new_a70fbab9066b301f:function(){return new Array},__wbg_new_ab79df5bd7c26067:function(){return new Object},__wbg_new_c518c60af666645b:function(){return d(function(){return new AbortController},arguments)},__wbg_new_from_slice_22da9388ac046e50:function(e,t){return new Uint8Array(A(e,t))},__wbg_new_typed_aaaeaf29cf802876:function(e,t){try{var n={a:e,b:t},_=(i,s)=>{const a=n.a;n.a=0;try{return $(a,n.b,i,s)}finally{n.a=a}};return new Promise(_)}finally{n.a=n.b=0}},__wbg_new_with_length_825018a1616e9e55:function(e){return new Uint8Array(e>>>0)},__wbg_new_with_str_and_init_b4b54d1a819bc724:function(){return d(function(e,t,n){return new Request(h(e,t),n)},arguments)},__wbg_next_11b99ee6237339e3:function(){return d(function(e){return e.next()},arguments)},__wbg_next_e01a967809d1aa68:function(e){return e.next},__wbg_node_84ea875411254db1:function(e){return e.node},__wbg_now_16f0c993d5dd6c27:function(){return Date.now()},__wbg_process_44c7a14e11e9f69e:function(e){return e.process},__wbg_prototypesetcall_d62e5099504357e6:function(e,t,n){Uint8Array.prototype.set.call(A(e,t),n)},__wbg_queueMicrotask_0c399741342fb10f:function(e){return e.queueMicrotask},__wbg_queueMicrotask_a082d78ce798393e:function(e){queueMicrotask(e)},__wbg_randomFillSync_6c25eac9869eb53c:function(){return d(function(e,t){e.randomFillSync(t)},arguments)},__wbg_readAsArrayBuffer_762e6372375b4632:function(){return d(function(e,t){return e.readAsArrayBuffer(t)},arguments)},__wbg_require_b4edbdcf3e2a1ef0:function(){return d(function(){return module.require},arguments)},__wbg_resolve_ae8d83246e5bcc12:function(e){return Promise.resolve(e)},__wbg_setTimeout_f757f00851f76c42:function(e,t){return setTimeout(e,t)},__wbg_set_282384002438957f:function(e,t,n){e[t>>>0]=n},__wbg_set_6be42768c690e380:function(e,t,n){e[t]=n},__wbg_set_8c0b3ffcf05d61c2:function(e,t,n){e.set(A(t,n))},__wbg_set_bf7251625df30a02:function(e,t,n){return e.set(t,n)},__wbg_set_body_a3d856b097dfda04:function(e,t){e.body=t},__wbg_set_cache_ec7e430c6056ebda:function(e,t){e.cache=J[t]},__wbg_set_credentials_ed63183445882c65:function(e,t){e.credentials=H[t]},__wbg_set_headers_3c8fecc693b75327:function(e,t){e.headers=t},__wbg_set_method_8c015e8bcafd7be1:function(e,t,n){e.method=h(t,n)},__wbg_set_mode_5a87f2c809cf37c2:function(e,t){e.mode=X[t]},__wbg_set_signal_0cebecb698f25d21:function(e,t){e.signal=t},__wbg_signal_166e1da31adcac18:function(e){return e.signal},__wbg_size_819df95195daae81:function(e){return e.size},__wbg_slice_f55d290dcc799204:function(){return d(function(e,t,n){return e.slice(t,n)},arguments)},__wbg_stack_3b0d974bbf31e44f:function(e,t){const n=t.stack,_=b(n,o.__wbindgen_malloc,o.__wbindgen_realloc),c=u;m().setInt32(e+4,c,!0),m().setInt32(e+0,_,!0)},__wbg_static_accessor_GLOBAL_8adb955bd33fac2f:function(){const e=typeof global>"u"?null:global;return g(e)?0:B(e)},__wbg_static_accessor_GLOBAL_THIS_ad356e0db91c7913:function(){const e=typeof globalThis>"u"?null:globalThis;return g(e)?0:B(e)},__wbg_static_accessor_SELF_f207c857566db248:function(){const e=typeof self>"u"?null:self;return g(e)?0:B(e)},__wbg_static_accessor_WINDOW_bb9f1ba69d61b386:function(){const e=typeof window>"u"?null:window;return g(e)?0:B(e)},__wbg_status_318629ab93a22955:function(e){return e.status},__wbg_stringify_5ae93966a84901ac:function(){return d(function(e){return JSON.stringify(e)},arguments)},__wbg_subarray_a068d24e39478a8a:function(e,t,n){return e.subarray(t>>>0,n>>>0)},__wbg_then_098abe61755d12f6:function(e,t){return e.then(t)},__wbg_then_9e335f6dd892bc11:function(e,t,n){return e.then(t,n)},__wbg_url_7fefc1820fba4e0c:function(e,t){const n=t.url,_=b(n,o.__wbindgen_malloc,o.__wbindgen_realloc),c=u;m().setInt32(e+4,c,!0),m().setInt32(e+0,_,!0)},__wbg_valueOf_3dcf9bcf2e496cb2:function(e){return e.valueOf()},__wbg_value_21fc78aab0322612:function(e){return e.value},__wbg_versions_276b2795b1c6a219:function(e){return e.versions},__wbg_wasmreader_new:function(e){return v.__wrap(e)},__wbindgen_cast_0000000000000001:function(e,t){return z(e,t,o.wasm_bindgen__closure__destroy__h65b3b0e0904996a4,G)},__wbindgen_cast_0000000000000002:function(e,t){return z(e,t,o.wasm_bindgen__closure__destroy__hc0a5e156ad330742,P)},__wbindgen_cast_0000000000000003:function(e){return e},__wbindgen_cast_0000000000000004:function(e){return e},__wbindgen_cast_0000000000000005:function(e,t){return A(e,t)},__wbindgen_cast_0000000000000006:function(e,t){return h(e,t)},__wbindgen_cast_0000000000000007:function(e){return BigInt.asUintN(64,e)},__wbindgen_cast_0000000000000008:function(e,t){var n=A(e,t).slice();return o.__wbindgen_free(e,t*1,1),n},__wbindgen_init_externref_table:function(){const e=o.__wbindgen_externrefs,t=e.grow(4);e.set(0,void 0),e.set(t+0,void 0),e.set(t+1,null),e.set(t+2,!0),e.set(t+3,!1)}}}}function G(r,e){o.wasm_bindgen__convert__closures_____invoke__h11a8a009ad66a767(r,e)}function P(r,e,t){const n=o.wasm_bindgen__convert__closures_____invoke__h21611001dce0af13(r,e,t);if(n[1])throw f(n[0])}function $(r,e,t,n){o.wasm_bindgen__convert__closures_____invoke__h27acc2ed1032081e(r,e,t,n)}const J=["default","no-store","reload","no-cache","force-cache","only-if-cached"],H=["omit","same-origin","include"],X=["same-origin","no-cors","cors","navigate"],x=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(r=>o.__wbg_wasmbuilder_free(r>>>0,1)),k=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(r=>o.__wbg_wasmreader_free(r>>>0,1));typeof FinalizationRegistry>"u"||new FinalizationRegistry(r=>o.__wbg_wasmsigner_free(r>>>0,1));function B(r){const e=o.__externref_table_alloc();return o.__wbindgen_externrefs.set(e,r),e}const N=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(r=>r.dtor(r.a,r.b));function j(r){const e=typeof r;if(e=="number"||e=="boolean"||r==null)return`${r}`;if(e=="string")return`"${r}"`;if(e=="symbol"){const _=r.description;return _==null?"Symbol":`Symbol(${_})`}if(e=="function"){const _=r.name;return typeof _=="string"&&_.length>0?`Function(${_})`:"Function"}if(Array.isArray(r)){const _=r.length;let c="[";_>0&&(c+=j(r[0]));for(let i=1;i<_;i++)c+=", "+j(r[i]);return c+="]",c}const t=/\\[object ([^\\]]+)\\]/.exec(toString.call(r));let n;if(t&&t.length>1)n=t[1];else return toString.call(r);if(n=="Object")try{return"Object("+JSON.stringify(r)+")"}catch{return"Object"}return r instanceof Error?`${r.name}: ${r.message}\n${r.stack}`:n}function A(r,e){return r=r>>>0,R().subarray(r/1,r/1+e)}let F=null;function m(){return(F===null||F.buffer.detached===!0||F.buffer.detached===void 0&&F.buffer!==o.memory.buffer)&&(F=new DataView(o.memory.buffer)),F}function h(r,e){return r=r>>>0,K(r,e)}let M=null;function R(){return(M===null||M.byteLength===0)&&(M=new Uint8Array(o.memory.buffer)),M}function d(r,e){try{return r.apply(this,e)}catch(t){const n=B(t);o.__wbindgen_exn_store(n)}}function g(r){return r==null}function z(r,e,t,n){const _={a:r,b:e,cnt:1,dtor:t},c=(...i)=>{_.cnt++;const s=_.a;_.a=0;try{return n(s,_.b,...i)}finally{_.a=s,c._wbg_cb_unref()}};return c._wbg_cb_unref=()=>{--_.cnt===0&&(_.dtor(_.a,_.b),_.a=0,N.unregister(_))},N.register(c,_,_),c}function b(r,e,t){if(t===void 0){const s=T.encode(r),a=e(s.length,1)>>>0;return R().subarray(a,a+s.length).set(s),u=s.length,a}let n=r.length,_=e(n,1)>>>0;const c=R();let i=0;for(;i<n;i++){const s=r.charCodeAt(i);if(s>127)break;c[_+i]=s}if(i!==n){i!==0&&(r=r.slice(i)),_=t(_,n,n=i+r.length*3,1)>>>0;const s=R().subarray(_+i,_+n),a=T.encodeInto(r,s);i+=a.written,_=t(_,n,i,1)>>>0}return u=i,_}function f(r){const e=o.__wbindgen_externrefs.get(r);return o.__externref_table_dealloc(r),e}let E=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});E.decode();const Y=2146435072;let O=0;function K(r,e){return O+=e,O>=Y&&(E=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),E.decode(),O=e),E.decode(R().subarray(r,r+e))}const T=new TextEncoder;"encodeInto"in T||(T.encodeInto=function(r,e){const t=T.encode(r);return e.set(t),{read:r.length,written:t.length}});let u=0,o;function Q(r,e){return o=r.exports,F=null,M=null,o.__wbindgen_start(),o}function Z(r){if(o!==void 0)return o;r!==void 0&&(Object.getPrototypeOf(r)===Object.prototype?{module:r}=r:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));const e=V();r instanceof WebAssembly.Module||(r=new WebAssembly.Module(r));const t=new WebAssembly.Instance(r,e);return Q(t)}function D(){let r=0;const e=new Map;return{add(t){const n=r++;return e.set(n,t),n},get(t){const n=e.get(t);if(!n)throw new Error("Attempted to use an object that has been freed");return n},remove(t){return e.delete(t)}}}const L=Symbol("transfer");function I(r,e){return{type:L,value:r,transfer:e?Array.isArray(e)?e:[e]:[r]}}function U(r){return!!(r&&typeof r=="object"&&Reflect.get(r,"type")===L)}function q(r="default"){return{createTx(e){const t=new Map,n=e??self;return n.addEventListener("message",_=>{const{data:c}=_;if(c.channelName!==r)return;const{id:i,result:s,error:a}=c,w=t.get(i);w&&(a?w.reject(a):w.resolve(s),t.delete(i))}),new Proxy({},{get(_,c){return(...i)=>{const s=ee(),a=[],w=[];return i.forEach(S=>{U(S)?(a.push(S.value),w.push(...S.transfer)):a.push(S)}),n.postMessage({method:c,args:a,id:s,channelName:r},{transfer:w}),new Promise((S,_e)=>{t.set(s,{resolve:S,reject:_e})})}}})},rx(e,t){const n=t??self;n.addEventListener("message",async _=>{const{data:c}=_;if(c.channelName!==r)return;const{method:i,args:s,id:a}=c;try{const w=await e[i](...s);U(w)?n.postMessage({result:w.value,id:a,channelName:r},{transfer:w.transfer}):n.postMessage({result:w,id:a,channelName:r})}catch(w){n.postMessage({error:w,id:a,channelName:r})}})}}}function ee(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}const{rx:te}=q(),{createTx:ne}=q("worker"),p=D(),l=D(),W=ne();te(re({async initWorker(r,e){Z({module:r}),e&&C(e)},async reader_fromBlob(r,e,t){const n=await v.fromBlob(r,e,t);return p.add(n)},async reader_fromBlobFragment(r,e,t,n){const _=await v.fromBlobFragment(r,e,t,n);return p.add(_)},reader_activeLabel(r){return p.get(r).activeLabel()??null},reader_manifestStore(r){return p.get(r).manifestStore()},reader_activeManifest(r){return p.get(r).activeManifest()},reader_json(r){return p.get(r).json()},reader_resourceToBytes(r,e){const n=p.get(r).resourceToBytes(e);return I(n,n.buffer)},reader_free(r){p.get(r).free(),p.remove(r)},builder_new(r){const e=y.new(r);return l.add(e)},builder_fromJson(r,e){const t=y.fromJson(r,e);return l.add(t)},builder_fromArchive(r,e){const t=y.fromArchive(r,e);return l.add(t)},builder_setIntent(r,e){l.get(r).setIntent(e)},builder_addAction(r,e){l.get(r).addAction(e)},builder_setRemoteUrl(r,e){l.get(r).setRemoteUrl(e)},builder_setNoEmbed(r,e){l.get(r).setNoEmbed(e)},builder_setThumbnailFromBlob(r,e,t){l.get(r).setThumbnailFromBlob(e,t)},builder_addIngredient(r,e){l.get(r).addIngredient(e)},builder_addIngredientFromBlob(r,e,t,n){l.get(r).addIngredientFromBlob(e,t,n)},builder_addResourceFromBlob(r,e,t){l.get(r).addResourceFromBlob(e,t)},builder_getDefinition(r){return l.get(r).getDefinition()},builder_toArchive(r){const t=l.get(r).toArchive();return I(t,t.buffer)},async builder_sign(r,e,t,n,_){const i=await l.get(r).sign({reserveSize:t.reserveSize,alg:t.alg,sign:async s=>await W.sign(e,I(s,s.buffer),t.reserveSize)},n,_);return I(i,i.buffer)},async builder_signAndGetManifestBytes(r,e,t,n,_){const c=l.get(r),{manifest:i,asset:s}=await c.signAndGetManifestBytes({reserveSize:t.reserveSize,alg:t.alg,sign:async a=>await W.sign(e,I(a,a.buffer),t.reserveSize)},n,_);return I({manifest:i,asset:s},[i.buffer,s.buffer])},builder_free(r){l.get(r).free(),l.remove(r)}}));function re(r){const e={};for(const[t,n]of Object.entries(r))e[t]=async(..._)=>{try{return await n(..._)}catch(c){throw typeof c=="string"?new Error(c):c}};return e}})();\n', m = typeof self < "u" && self.Blob && new Blob([T], { type: "text/javascript;charset=utf-8" });
|
|
4
|
+
function N(e) {
|
|
5
|
+
let t;
|
|
6
|
+
try {
|
|
7
|
+
if (t = m && (self.URL || self.webkitURL).createObjectURL(m), !t) throw "";
|
|
8
|
+
const _ = new Worker(t, {
|
|
9
|
+
name: e == null ? void 0 : e.name
|
|
10
|
+
});
|
|
11
|
+
return _.addEventListener("error", () => {
|
|
12
|
+
(self.URL || self.webkitURL).revokeObjectURL(t);
|
|
13
|
+
}), _;
|
|
14
|
+
} catch {
|
|
15
|
+
return new Worker(
|
|
16
|
+
"data:text/javascript;charset=utf-8," + encodeURIComponent(T),
|
|
17
|
+
{
|
|
18
|
+
name: e == null ? void 0 : e.name
|
|
19
|
+
}
|
|
20
|
+
);
|
|
21
|
+
} finally {
|
|
22
|
+
t && (self.URL || self.webkitURL).revokeObjectURL(t);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
async function L(e) {
|
|
26
|
+
const { wasm: t, settingsString: _ } = e;
|
|
27
|
+
let r = 0;
|
|
28
|
+
const n = new N(), o = O(n), i = /* @__PURE__ */ new Map();
|
|
29
|
+
U(
|
|
30
|
+
{
|
|
31
|
+
sign: async (c, s, M) => {
|
|
32
|
+
const l = i.get(c);
|
|
33
|
+
if (i.delete(c), !l)
|
|
34
|
+
throw new Error("No signer registered for request");
|
|
35
|
+
const w = await l(s, M);
|
|
36
|
+
return j(w, w.buffer);
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
n
|
|
40
|
+
);
|
|
41
|
+
function a(c) {
|
|
42
|
+
const s = r++;
|
|
43
|
+
return i.set(s, c), s;
|
|
44
|
+
}
|
|
45
|
+
return await o.initWorker(t, _), {
|
|
46
|
+
tx: o,
|
|
47
|
+
registerSignReceiver: a,
|
|
48
|
+
terminate: () => n.terminate()
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
class y extends Error {
|
|
52
|
+
constructor(t) {
|
|
53
|
+
super(
|
|
54
|
+
`The provided asset was too large. Size: ${t} bytes. Maximum: ${d}.`
|
|
55
|
+
), this.name = "AssetTooLargeError";
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
class h extends Error {
|
|
59
|
+
constructor(t) {
|
|
60
|
+
super(`Unsupported format: ${t}.`), this.name = "UnsupportedFormatError";
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
const k = [
|
|
64
|
+
"jpg",
|
|
65
|
+
"video/mp4",
|
|
66
|
+
"image/heif",
|
|
67
|
+
"video/x-msvideo",
|
|
68
|
+
"pdf",
|
|
69
|
+
"image/png",
|
|
70
|
+
"application/c2pa",
|
|
71
|
+
"video/quicktime",
|
|
72
|
+
"video/avi",
|
|
73
|
+
"image/gif",
|
|
74
|
+
"application/xml",
|
|
75
|
+
"text/xml",
|
|
76
|
+
"application/xhtml+xml",
|
|
77
|
+
"tiff",
|
|
78
|
+
"audio/wave",
|
|
79
|
+
"mp4",
|
|
80
|
+
"image/avif",
|
|
81
|
+
"image/dng",
|
|
82
|
+
"png",
|
|
83
|
+
"dng",
|
|
84
|
+
"image/svg+xml",
|
|
85
|
+
"image/heic",
|
|
86
|
+
"application/mp4",
|
|
87
|
+
"image/x-nikon-nef",
|
|
88
|
+
"video/msvideo",
|
|
89
|
+
"tif",
|
|
90
|
+
"wav",
|
|
91
|
+
"xml",
|
|
92
|
+
"audio/vnd.wave",
|
|
93
|
+
"xhtml",
|
|
94
|
+
"gif",
|
|
95
|
+
"application/x-troff-msvideo",
|
|
96
|
+
"webp",
|
|
97
|
+
"heic",
|
|
98
|
+
"application/pdf",
|
|
99
|
+
"audio/mpeg",
|
|
100
|
+
"application/x-c2pa-manifest-store",
|
|
101
|
+
"jpeg",
|
|
102
|
+
"image/x-adobe-dng",
|
|
103
|
+
"audio/wav",
|
|
104
|
+
"mp3",
|
|
105
|
+
"mov",
|
|
106
|
+
"image/tiff",
|
|
107
|
+
"audio/mp4",
|
|
108
|
+
"application/svg+xml",
|
|
109
|
+
"arw",
|
|
110
|
+
"c2pa",
|
|
111
|
+
"svg",
|
|
112
|
+
"avi",
|
|
113
|
+
"audio/x-wav",
|
|
114
|
+
"m4a",
|
|
115
|
+
"image/x-sony-arw",
|
|
116
|
+
"image/jpeg",
|
|
117
|
+
"avif",
|
|
118
|
+
"image/webp",
|
|
119
|
+
"nef",
|
|
120
|
+
"heif"
|
|
121
|
+
];
|
|
122
|
+
function p(e) {
|
|
123
|
+
return k.includes(e);
|
|
124
|
+
}
|
|
125
|
+
const C = {
|
|
126
|
+
builder: {
|
|
127
|
+
generateC2paArchive: !0
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
async function u(e) {
|
|
131
|
+
const t = z(C, e), _ = [];
|
|
132
|
+
return t.trust && _.push(v(t.trust)), t.cawgTrust && _.push(v(t.cawgTrust)), await Promise.all(_), JSON.stringify(E(t));
|
|
133
|
+
}
|
|
134
|
+
function E(e) {
|
|
135
|
+
return Object.entries(e).reduce(
|
|
136
|
+
(_, [r, n]) => (_[J(r)] = typeof n == "object" ? E(n) : n, _),
|
|
137
|
+
{}
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
function J(e) {
|
|
141
|
+
return e.replace(/[A-Z]/g, (t) => `_${t.toLowerCase()}`);
|
|
142
|
+
}
|
|
143
|
+
async function v(e) {
|
|
144
|
+
try {
|
|
145
|
+
const t = Object.entries(e).map(async ([_, r]) => {
|
|
146
|
+
if (Array.isArray(r)) {
|
|
147
|
+
const n = r.map(async (a) => {
|
|
148
|
+
const c = await S(a);
|
|
149
|
+
if (A(_) && !R(c))
|
|
150
|
+
throw new Error(`Error parsing PEM file at: ${a}`);
|
|
151
|
+
return c;
|
|
152
|
+
}), i = (await Promise.all(n)).join("");
|
|
153
|
+
e[_] = i;
|
|
154
|
+
} else if (r && W(r)) {
|
|
155
|
+
const n = await S(r);
|
|
156
|
+
if (A(_) && !R(n))
|
|
157
|
+
throw new Error(`Error parsing PEM file at: ${r}`);
|
|
158
|
+
e[_] = n;
|
|
159
|
+
} else
|
|
160
|
+
return r;
|
|
161
|
+
});
|
|
162
|
+
await Promise.all(t);
|
|
163
|
+
} catch (t) {
|
|
164
|
+
throw new Error("Failed to resolve trust settings.", { cause: t });
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
const A = (e) => ["userAnchors", "trustAnchors"].includes(e), R = (e) => e.includes("-----BEGIN CERTIFICATE-----"), W = (e) => e.startsWith("http");
|
|
168
|
+
async function S(e) {
|
|
169
|
+
return await (await fetch(e)).text();
|
|
170
|
+
}
|
|
171
|
+
const d = 10 ** 9;
|
|
172
|
+
function D(e) {
|
|
173
|
+
const { tx: t } = e, _ = new FinalizationRegistry(async (r) => {
|
|
174
|
+
await t.reader_free(r);
|
|
175
|
+
});
|
|
176
|
+
return {
|
|
177
|
+
async fromBlob(r, n, o) {
|
|
178
|
+
if (!p(r))
|
|
179
|
+
throw new h(r);
|
|
180
|
+
if (n.size > d)
|
|
181
|
+
throw new y(n.size);
|
|
182
|
+
try {
|
|
183
|
+
const i = o && await u(o), a = await t.reader_fromBlob(r, n, i), c = F(e, a, () => {
|
|
184
|
+
_.unregister(c);
|
|
185
|
+
});
|
|
186
|
+
return _.register(c, a, c), c;
|
|
187
|
+
} catch (i) {
|
|
188
|
+
return B(i);
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
async fromBlobFragment(r, n, o, i) {
|
|
192
|
+
if (!p(r))
|
|
193
|
+
throw new h(r);
|
|
194
|
+
if (n.size > d)
|
|
195
|
+
throw new y(n.size);
|
|
196
|
+
try {
|
|
197
|
+
const a = i && await u(i), c = await t.reader_fromBlobFragment(
|
|
198
|
+
r,
|
|
199
|
+
n,
|
|
200
|
+
o,
|
|
201
|
+
a
|
|
202
|
+
), s = F(e, c, () => {
|
|
203
|
+
_.unregister(s);
|
|
204
|
+
});
|
|
205
|
+
return _.register(s, c, s), s;
|
|
206
|
+
} catch (a) {
|
|
207
|
+
return B(a);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
function B(e) {
|
|
213
|
+
if (e instanceof Error && e.message === "C2pa(JumbfNotFound)")
|
|
214
|
+
return null;
|
|
215
|
+
throw e;
|
|
216
|
+
}
|
|
217
|
+
function F(e, t, _) {
|
|
218
|
+
const { tx: r } = e;
|
|
219
|
+
return {
|
|
220
|
+
async activeLabel() {
|
|
221
|
+
return await r.reader_activeLabel(t);
|
|
222
|
+
},
|
|
223
|
+
async manifestStore() {
|
|
224
|
+
return await r.reader_manifestStore(t);
|
|
225
|
+
},
|
|
226
|
+
async activeManifest() {
|
|
227
|
+
return await r.reader_activeManifest(t);
|
|
228
|
+
},
|
|
229
|
+
async json() {
|
|
230
|
+
const n = await r.reader_json(t);
|
|
231
|
+
return JSON.parse(n);
|
|
232
|
+
},
|
|
233
|
+
async resourceToBytes(n) {
|
|
234
|
+
return await r.reader_resourceToBytes(t, n);
|
|
235
|
+
},
|
|
236
|
+
async free() {
|
|
237
|
+
_(), await r.reader_free(t);
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
typeof FinalizationRegistry > "u" || new FinalizationRegistry((e) => g.__wbg_wasmbuilder_free(e >>> 0, 1));
|
|
242
|
+
typeof FinalizationRegistry > "u" || new FinalizationRegistry((e) => g.__wbg_wasmreader_free(e >>> 0, 1));
|
|
243
|
+
typeof FinalizationRegistry > "u" || new FinalizationRegistry((e) => g.__wbg_wasmsigner_free(e >>> 0, 1));
|
|
244
|
+
typeof FinalizationRegistry > "u" || new FinalizationRegistry((e) => e.dtor(e.a, e.b));
|
|
245
|
+
let q = new TextDecoder("utf-8", { ignoreBOM: !0, fatal: !0 });
|
|
246
|
+
q.decode();
|
|
247
|
+
const f = new TextEncoder();
|
|
248
|
+
"encodeInto" in f || (f.encodeInto = function(e, t) {
|
|
249
|
+
const _ = f.encode(e);
|
|
250
|
+
return t.set(_), {
|
|
251
|
+
read: e.length,
|
|
252
|
+
written: _.length
|
|
253
|
+
};
|
|
254
|
+
});
|
|
255
|
+
let g;
|
|
256
|
+
const P = "sha512-C4pp0ebkfSxUgWcCNLI63fbUFlxX3TEviCAwM+2qm/TNRzJf6l2BNqZwktlUrG6bthan8VOeBuMb411BUChb2Q==";
|
|
257
|
+
async function x(e) {
|
|
258
|
+
const { alg: t } = e;
|
|
259
|
+
return {
|
|
260
|
+
reserveSize: await e.reserveSize(),
|
|
261
|
+
alg: t
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
function $(e) {
|
|
265
|
+
const { tx: t } = e, _ = new FinalizationRegistry((r) => {
|
|
266
|
+
t.builder_free(r);
|
|
267
|
+
});
|
|
268
|
+
return {
|
|
269
|
+
async new(r) {
|
|
270
|
+
const n = r && await u(r), o = await t.builder_new(n), i = b(e, o, () => {
|
|
271
|
+
_.unregister(i);
|
|
272
|
+
});
|
|
273
|
+
return _.register(i, o, i), i;
|
|
274
|
+
},
|
|
275
|
+
async fromDefinition(r, n) {
|
|
276
|
+
const o = JSON.stringify(r), i = n && await u(n), a = await t.builder_fromJson(o, i), c = b(e, a, () => {
|
|
277
|
+
_.unregister(c);
|
|
278
|
+
});
|
|
279
|
+
return _.register(c, a, c), c;
|
|
280
|
+
},
|
|
281
|
+
async fromArchive(r, n) {
|
|
282
|
+
const o = n && await u(n), i = await t.builder_fromArchive(r, o), a = b(e, i, () => {
|
|
283
|
+
_.unregister(a);
|
|
284
|
+
});
|
|
285
|
+
return _.register(a, i, a), a;
|
|
286
|
+
}
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
function b(e, t, _) {
|
|
290
|
+
const { tx: r } = e;
|
|
291
|
+
return {
|
|
292
|
+
async setIntent(n) {
|
|
293
|
+
await r.builder_setIntent(t, n);
|
|
294
|
+
},
|
|
295
|
+
async addAction(n) {
|
|
296
|
+
await r.builder_addAction(t, n);
|
|
297
|
+
},
|
|
298
|
+
async setRemoteUrl(n) {
|
|
299
|
+
await r.builder_setRemoteUrl(t, n);
|
|
300
|
+
},
|
|
301
|
+
async setNoEmbed(n) {
|
|
302
|
+
await r.builder_setNoEmbed(t, n);
|
|
303
|
+
},
|
|
304
|
+
async setThumbnailFromBlob(n, o) {
|
|
305
|
+
await r.builder_setThumbnailFromBlob(t, n, o);
|
|
306
|
+
},
|
|
307
|
+
async addIngredient(n) {
|
|
308
|
+
const o = JSON.stringify(n);
|
|
309
|
+
await r.builder_addIngredient(t, o);
|
|
310
|
+
},
|
|
311
|
+
async addIngredientFromBlob(n, o, i) {
|
|
312
|
+
const a = JSON.stringify(n);
|
|
313
|
+
await r.builder_addIngredientFromBlob(t, a, o, i);
|
|
314
|
+
},
|
|
315
|
+
async addResourceFromBlob(n, o) {
|
|
316
|
+
await r.builder_addResourceFromBlob(t, n, o);
|
|
317
|
+
},
|
|
318
|
+
async getDefinition() {
|
|
319
|
+
return await r.builder_getDefinition(t);
|
|
320
|
+
},
|
|
321
|
+
async toArchive() {
|
|
322
|
+
return await r.builder_toArchive(t);
|
|
323
|
+
},
|
|
324
|
+
async sign(n, o, i) {
|
|
325
|
+
const a = await x(n), c = e.registerSignReceiver(n.sign);
|
|
326
|
+
return await r.builder_sign(
|
|
327
|
+
t,
|
|
328
|
+
c,
|
|
329
|
+
a,
|
|
330
|
+
o,
|
|
331
|
+
i
|
|
332
|
+
);
|
|
333
|
+
},
|
|
334
|
+
async signAndGetManifestBytes(n, o, i) {
|
|
335
|
+
const a = await x(n), c = e.registerSignReceiver(n.sign);
|
|
336
|
+
return await r.builder_signAndGetManifestBytes(
|
|
337
|
+
t,
|
|
338
|
+
c,
|
|
339
|
+
a,
|
|
340
|
+
o,
|
|
341
|
+
i
|
|
342
|
+
);
|
|
343
|
+
},
|
|
344
|
+
async free() {
|
|
345
|
+
_(), await r.builder_free(t);
|
|
346
|
+
}
|
|
347
|
+
};
|
|
348
|
+
}
|
|
349
|
+
async function K(e) {
|
|
350
|
+
const { wasmSrc: t, settings: _ } = e, r = typeof t == "string" ? await G(t) : t, n = _ ? await u(_) : void 0, o = await L({ wasm: r, settingsString: n });
|
|
351
|
+
return {
|
|
352
|
+
reader: D(o),
|
|
353
|
+
builder: $(o),
|
|
354
|
+
dispose: o.terminate
|
|
355
|
+
};
|
|
356
|
+
}
|
|
357
|
+
async function G(e) {
|
|
358
|
+
const t = await fetch(e, { integrity: P });
|
|
359
|
+
return await WebAssembly.compileStreaming(t);
|
|
360
|
+
}
|
|
361
|
+
export {
|
|
362
|
+
k as R,
|
|
363
|
+
K as c,
|
|
364
|
+
p as i
|
|
365
|
+
};
|
package/dist/common.d.ts
CHANGED
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
*/
|
|
9
9
|
export type * from './lib/c2pa.js';
|
|
10
10
|
export type { Reader, ReaderFactory } from './lib/reader.js';
|
|
11
|
-
export type { Builder, BuilderFactory, ManifestAndAssetBytes
|
|
11
|
+
export type { Builder, BuilderFactory, ManifestAndAssetBytes } from './lib/builder.js';
|
|
12
12
|
export type { Signer, SigningAlg } from './lib/signer.js';
|
|
13
|
-
export { isSupportedReaderFormat, READER_SUPPORTED_FORMATS
|
|
14
|
-
export type { Settings, VerifySettings, TrustSettings, BuilderSettings,
|
|
13
|
+
export { isSupportedReaderFormat, READER_SUPPORTED_FORMATS } from './lib/supportedFormats.js';
|
|
14
|
+
export type { Settings, VerifySettings, TrustSettings, BuilderSettings, CawgTrustSettings } from './lib/settings.js';
|
|
15
15
|
export type * from '@contentauth/c2pa-types';
|
|
16
16
|
//# sourceMappingURL=common.d.ts.map
|
package/dist/common.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,mBAAmB,eAAe,CAAC;AAEnC,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAE7D,YAAY,EACV,OAAO,EACP,cAAc,EACd,qBAAqB,
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,mBAAmB,eAAe,CAAC;AAEnC,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAE7D,YAAY,EACV,OAAO,EACP,cAAc,EACd,qBAAqB,EACtB,MAAM,kBAAkB,CAAC;AAE1B,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE1D,OAAO,EACL,uBAAuB,EACvB,wBAAwB,EACzB,MAAM,2BAA2B,CAAC;AAEnC,YAAY,EACV,QAAQ,EACR,cAAc,EACd,aAAa,EACb,eAAe,EACf,iBAAiB,EAClB,MAAM,mBAAmB,CAAC;AAG3B,mBAAmB,yBAAyB,CAAC"}
|
package/dist/index.js
CHANGED