@contentauth/c2pa-web 0.13.3 → 0.14.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 +6 -4
- package/dist/c2pa-ClWjHDBi.js +597 -0
- package/dist/c2pa_worker.js +32 -0
- package/dist/common.d.ts +0 -1
- package/dist/common.d.ts.map +1 -1
- package/dist/index.d.ts +1 -13
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +23 -3
- package/dist/inline.js +5 -5
- package/dist/lib/builder.d.ts +19 -1
- package/dist/lib/builder.d.ts.map +1 -1
- package/dist/lib/c2pa.d.ts +14 -1
- package/dist/lib/c2pa.d.ts.map +1 -1
- package/dist/lib/error.d.ts +0 -3
- package/dist/lib/error.d.ts.map +1 -1
- package/dist/lib/reader.d.ts +1 -1
- package/dist/lib/reader.d.ts.map +1 -1
- package/dist/lib/signer.d.ts +2 -9
- package/dist/lib/signer.d.ts.map +1 -1
- package/dist/lib/worker/rpc.d.ts +2 -0
- package/dist/lib/worker/rpc.d.ts.map +1 -1
- package/dist/resources/c2pa_bg.wasm +0 -0
- package/package.json +29 -6
- package/LICENSE +0 -21
- package/dist/c2pa-0g6nuBRG.js +0 -480
- package/dist/lib/settings.d.ts +0 -106
- package/dist/lib/settings.d.ts.map +0 -1
package/dist/c2pa-0g6nuBRG.js
DELETED
|
@@ -1,480 +0,0 @@
|
|
|
1
|
-
import { channel as z, transfer as $ } from "highgain";
|
|
2
|
-
import { merge as p } from "ts-deepmerge";
|
|
3
|
-
const { createTx: D, rx: ae } = z(), { createTx: se, rx: P } = z("worker"), k = '(function(){"use strict";class p{static __wrap(e){const t=Object.create(p.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_wasmbuilder_free(e,0)}addAction(e){const t=o.wasmbuilder_addAction(this.__wbg_ptr,e);if(t[1])throw f(t[0])}addAssertion(e,t){const n=b(e,o.__wbindgen_malloc,o.__wbindgen_realloc),_=a,c=o.wasmbuilder_addAssertion(this.__wbg_ptr,n,_,t);if(c[1])throw f(c[0])}addIngredient(e){const t=b(e,o.__wbindgen_malloc,o.__wbindgen_realloc),n=a,_=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=a,i=b(t,o.__wbindgen_malloc,o.__wbindgen_realloc),s=a;return o.wasmbuilder_addIngredientFromBlob(this.__wbg_ptr,_,c,i,s,n)}addRedaction(e,t){const n=b(e,o.__wbindgen_malloc,o.__wbindgen_realloc),_=a,c=o.wasmbuilder_addRedaction(this.__wbg_ptr,n,_,t);if(c[1])throw f(c[0])}addResourceFromBlob(e,t){const n=b(e,o.__wbindgen_malloc,o.__wbindgen_realloc),_=a,c=o.wasmbuilder_addResourceFromBlob(this.__wbg_ptr,n,_,t);if(c[1])throw f(c[0])}filterActionsAndIngredientsAt(e,t){const n=E(e,o.__wbindgen_malloc),_=a,c=E(t,o.__wbindgen_malloc),i=a,s=o.wasmbuilder_filterActionsAndIngredientsAt(this.__wbg_ptr,n,_,c,i);if(s[1])throw f(s[0])}filterActionsAt(e){const t=E(e,o.__wbindgen_malloc),n=a,_=o.wasmbuilder_filterActionsAt(this.__wbg_ptr,t,n);if(_[1])throw f(_[0])}filterIngredientsAt(e){const t=E(e,o.__wbindgen_malloc),n=a,_=o.wasmbuilder_filterIngredientsAt(this.__wbg_ptr,t,n);if(_[1])throw f(_[0])}static fromArchive(e,t){var n=g(t)?0:b(t,o.__wbindgen_malloc,o.__wbindgen_realloc),_=a;const c=o.wasmbuilder_fromArchive(e,n,_);if(c[2])throw f(c[1]);return p.__wrap(c[0])}static fromJson(e,t){const n=b(e,o.__wbindgen_malloc,o.__wbindgen_realloc),_=a;var c=g(t)?0:b(t,o.__wbindgen_malloc,o.__wbindgen_realloc),i=a;const s=o.wasmbuilder_fromJson(n,_,c,i);if(s[2])throw f(s[1]);return p.__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=a;const _=o.wasmbuilder_new(t,n);if(_[2])throw f(_[1]);return p.__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=a;o.wasmbuilder_setRemoteUrl(this.__wbg_ptr,t,n)}setThumbnailFromBlob(e,t){const n=b(e,o.__wbindgen_malloc,o.__wbindgen_realloc),_=a,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=a;return o.wasmbuilder_sign(this.__wbg_ptr,e,_,c,n)}signAndGetManifestBytes(e,t,n){const _=b(t,o.__wbindgen_malloc,o.__wbindgen_realloc),c=a;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&&(p.prototype[Symbol.dispose]=p.prototype.free);class v{static __wrap(e){const t=Object.create(v.prototype);return t.__wbg_ptr=e,N.register(t,t.__wbg_ptr,t),t}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,N.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=y(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])}crJson(){let e,t;try{const n=o.wasmreader_crJson(this.__wbg_ptr);return e=n[0],t=n[1],y(n[0],n[1])}finally{o.__wbindgen_free(e,t,1)}}static fromBlob(e,t,n){const _=b(e,o.__wbindgen_malloc,o.__wbindgen_realloc),c=a;var i=g(n)?0:b(n,o.__wbindgen_malloc,o.__wbindgen_realloc),s=a;return o.wasmreader_fromBlob(_,c,t,i,s)}static fromBlobFragment(e,t,n,_){const c=b(e,o.__wbindgen_malloc,o.__wbindgen_realloc),i=a;var s=g(_)?0:b(_,o.__wbindgen_malloc,o.__wbindgen_realloc),u=a;return o.wasmreader_fromBlobFragment(c,i,t,n,s,u)}json(){let e,t;try{const n=o.wasmreader_json(this.__wbg_ptr);return e=n[0],t=n[1],y(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=a,_=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=a,n=o.loadSettings(e,t);if(n[1])throw f(n[0])}function P(){return{__proto__:null,"./c2pa_bg.js":{__proto__:null,__wbg_Error_ef53bc310eb298a0:function(e,t){return Error(y(e,t))},__wbg_Number_6b506e6536831eaa:function(e){return Number(e)},__wbg___wbindgen_bigint_get_as_i64_38130e98eecd467d: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_1a45e2c38d4d41b9:function(e){const t=e,n=typeof t=="boolean"?t:void 0;return g(n)?16777215:n?1:0},__wbg___wbindgen_debug_string_0accd80f45e5faa2:function(e,t){const n=U(t),_=b(n,o.__wbindgen_malloc,o.__wbindgen_realloc),c=a;m().setInt32(e+4,c,!0),m().setInt32(e+0,_,!0)},__wbg___wbindgen_in_70a403a56e771704:function(e,t){return e in t},__wbg___wbindgen_is_bigint_6ffd6468a9bc44b9:function(e){return typeof e=="bigint"},__wbg___wbindgen_is_function_754e9f305ff6029e:function(e){return typeof e=="function"},__wbg___wbindgen_is_object_56732c2bc353f41d:function(e){const t=e;return typeof t=="object"&&t!==null},__wbg___wbindgen_is_string_c236cabd84a4d769:function(e){return typeof e=="string"},__wbg___wbindgen_is_undefined_67b456be8673d3d7:function(e){return e===void 0},__wbg___wbindgen_jsval_eq_1068e624fa87f6ab:function(e,t){return e===t},__wbg___wbindgen_jsval_loose_eq_2c56564c75129511:function(e,t){return e==t},__wbg___wbindgen_number_get_9bb1761122181af2: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_72bdf95d3ae505b1:function(e,t){const n=t,_=typeof n=="string"?n:void 0;var c=g(_)?0:b(_,o.__wbindgen_malloc,o.__wbindgen_realloc),i=a;m().setInt32(e+4,i,!0),m().setInt32(e+0,c,!0)},__wbg___wbindgen_throw_1506f2235d1bdba0:function(e,t){throw new Error(y(e,t))},__wbg__wbg_cb_unref_61db23ac97f16c31:function(e){e._wbg_cb_unref()},__wbg_abort_2ec46222bf378517:function(e){e.abort()},__wbg_abort_b29d719932441c95:function(e,t){e.abort(t)},__wbg_append_e1746995edcb0170:function(){return l(function(e,t,n,_,c){e.append(y(t,n),y(_,c))},arguments)},__wbg_arrayBuffer_05927079aabe6d46:function(){return l(function(e){return e.arrayBuffer()},arguments)},__wbg_byteLength_2c6dc3b4b85d3547:function(e){return e.byteLength},__wbg_call_8a89609d89f6608a:function(){return l(function(e,t){return e.call(t)},arguments)},__wbg_call_9c758de292015997:function(){return l(function(e,t,n){return e.call(t,n)},arguments)},__wbg_clearTimeout_6b8d9a38b9263d65:function(e){return clearTimeout(e)},__wbg_crypto_38df2bab126b63dc:function(e){return e.crypto},__wbg_done_60cf307fcc680536:function(e){return e.done},__wbg_entries_04b37a02507f1713:function(e){return Object.entries(e)},__wbg_error_a6fa202b58aa1cd3:function(e,t){let n,_;try{n=e,_=t,console.error(y(e,t))}finally{o.__wbindgen_free(n,_,1)}},__wbg_fetch_344c8d3849002659:function(e,t){return e.fetch(t)},__wbg_fetch_9dad4fe911207b37:function(e){return fetch(e)},__wbg_from_d300fe49deab18f5:function(e){return Array.from(e)},__wbg_getRandomValues_3f44b700395062e5:function(){return l(function(e,t){globalThis.crypto.getRandomValues(A(e,t))},arguments)},__wbg_getRandomValues_76dfc69825c9c552:function(){return l(function(e,t){globalThis.crypto.getRandomValues(A(e,t))},arguments)},__wbg_getRandomValues_8aa3112c6615eef6:function(){return l(function(e,t){globalThis.crypto.getRandomValues(A(e,t))},arguments)},__wbg_getRandomValues_c44a50d8cfdaebeb:function(){return l(function(e,t){e.getRandomValues(t)},arguments)},__wbg_getTime_00b3f7db575e4ef5:function(e){return e.getTime()},__wbg_get_1f8f054ddbaa7db2:function(){return l(function(e,t){return Reflect.get(e,t)},arguments)},__wbg_get_2b48c7d0d006a781:function(e,t){return e[t>>>0]},__wbg_get_de6a0f7d4d18a304:function(){return l(function(e,t){return Reflect.get(e,t)},arguments)},__wbg_get_unchecked_33f6e5c9e2f2d6b2:function(e,t){return e[t>>>0]},__wbg_get_with_ref_key_6412cf3094599694:function(e,t){return e[t]},__wbg_has_73740b27f436fed3:function(){return l(function(e,t){return Reflect.has(e,t)},arguments)},__wbg_headers_0feb63d2d374b44a:function(e){return e.headers},__wbg_instanceof_ArrayBuffer_8f49811467741499:function(e){let t;try{t=e instanceof ArrayBuffer}catch{t=!1}return t},__wbg_instanceof_Map_9fc06d9a951bcee6:function(e){let t;try{t=e instanceof Map}catch{t=!1}return t},__wbg_instanceof_Promise_d0db99486956c8e8:function(e){let t;try{t=e instanceof Promise}catch{t=!1}return t},__wbg_instanceof_Response_cb984bd66d7bd408:function(e){let t;try{t=e instanceof Response}catch{t=!1}return t},__wbg_instanceof_Uint8Array_86f30649f63ef9c2:function(e){let t;try{t=e instanceof Uint8Array}catch{t=!1}return t},__wbg_isArray_67c2c9c4313f4448:function(e){return Array.isArray(e)},__wbg_isSafeInteger_66acec27e09e99a7:function(e){return Number.isSafeInteger(e)},__wbg_iterator_8732428d309e270e:function(){return Symbol.iterator},__wbg_length_4a591ecaa01354d9:function(e){return e.length},__wbg_length_66f1a4b2e9026940:function(e){return e.length},__wbg_msCrypto_bd5a034af96bcba6:function(e){return e.msCrypto},__wbg_new_0_445c13a750296eb6:function(){return new Date},__wbg_new_0d09705104e164af:function(){return l(function(){return new AbortController},arguments)},__wbg_new_227d7c05414eb861:function(){return new Error},__wbg_new_578aeef4b6b94378:function(e){return new Uint8Array(e)},__wbg_new_622fc80556be2e26:function(){return new Map},__wbg_new_a1b9f645bba64f0f:function(){return l(function(){return new FileReaderSync},arguments)},__wbg_new_ce1ab61c1c2b300d:function(){return new Object},__wbg_new_d90091b82fdf5b91:function(){return new Array},__wbg_new_e436d06bc8e77460:function(){return l(function(){return new Headers},arguments)},__wbg_new_from_slice_18fa1f71286d66b8:function(e,t){return new Uint8Array(A(e,t))},__wbg_new_typed_bf31d18f92484486:function(e,t){try{var n={a:e,b:t},_=(i,s)=>{const u=n.a;n.a=0;try{return H(u,n.b,i,s)}finally{n.a=u}};return new Promise(_)}finally{n.a=0}},__wbg_new_with_length_36a4998e27b014c5:function(e){return new Uint8Array(e>>>0)},__wbg_new_with_str_and_init_bcd02b79a793d27f:function(){return l(function(e,t,n){return new Request(y(e,t),n)},arguments)},__wbg_next_9e03acdf51c4960d:function(e){return e.next},__wbg_next_eb8ca7351fa27906:function(){return l(function(e){return e.next()},arguments)},__wbg_node_84ea875411254db1:function(e){return e.node},__wbg_now_190933fa139cc119:function(){return Date.now()},__wbg_process_44c7a14e11e9f69e:function(e){return e.process},__wbg_prototypesetcall_3249fc62a0fafa30:function(e,t,n){Uint8Array.prototype.set.call(A(e,t),n)},__wbg_queueMicrotask_35c611f4a14830b2:function(e){queueMicrotask(e)},__wbg_queueMicrotask_404ed0a58e0b63cc:function(e){return e.queueMicrotask},__wbg_randomFillSync_6c25eac9869eb53c:function(){return l(function(e,t){e.randomFillSync(t)},arguments)},__wbg_readAsArrayBuffer_f1b8da05559618d9:function(){return l(function(e,t){return e.readAsArrayBuffer(t)},arguments)},__wbg_require_b4edbdcf3e2a1ef0:function(){return l(function(){return module.require},arguments)},__wbg_resolve_25a7e548d5881dca:function(e){return Promise.resolve(e)},__wbg_setTimeout_f757f00851f76c42:function(e,t){return setTimeout(e,t)},__wbg_set_29c99a8aac1c01e5:function(e,t,n){e.set(A(t,n))},__wbg_set_52b1e1eb5bed906a:function(e,t,n){return e.set(t,n)},__wbg_set_6be42768c690e380:function(e,t,n){e[t]=n},__wbg_set_body_36614c7e61546809:function(e,t){e.body=t},__wbg_set_cache_488ea16c11cbf20d:function(e,t){e.cache=X[t]},__wbg_set_credentials_fa9c491a27c4bdf0:function(e,t){e.credentials=Y[t]},__wbg_set_dca99999bba88a9a:function(e,t,n){e[t>>>0]=n},__wbg_set_headers_7c1e39ece7826bec:function(e,t){e.headers=t},__wbg_set_method_7a6811dec7a4feff:function(e,t,n){e.method=y(t,n)},__wbg_set_mode_c90e3667002857d4:function(e,t){e.mode=K[t]},__wbg_set_signal_d9da62b3f215c821:function(e,t){e.signal=t},__wbg_signal_e03304a84df9ed09:function(e){return e.signal},__wbg_size_9970092b88b1094c:function(e){return e.size},__wbg_slice_02bb778501725738:function(){return l(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=a;m().setInt32(e+4,c,!0),m().setInt32(e+0,_,!0)},__wbg_static_accessor_GLOBAL_9d53f2689e622ca1:function(){const e=typeof global>"u"?null:global;return g(e)?0:R(e)},__wbg_static_accessor_GLOBAL_THIS_a1a35cec07001a8a:function(){const e=typeof globalThis>"u"?null:globalThis;return g(e)?0:R(e)},__wbg_static_accessor_SELF_4c59f6c7ea29a144:function(){const e=typeof self>"u"?null:self;return g(e)?0:R(e)},__wbg_static_accessor_WINDOW_e70ae9f2eb052253:function(){const e=typeof window>"u"?null:window;return g(e)?0:R(e)},__wbg_status_00549d55b78d949e:function(e){return e.status},__wbg_stringify_8286df6dcc591521:function(){return l(function(e){return JSON.stringify(e)},arguments)},__wbg_subarray_4aa221f6a4f5ab22:function(e,t,n){return e.subarray(t>>>0,n>>>0)},__wbg_then_18f476d590e58992:function(e,t,n){return e.then(t,n)},__wbg_then_ac7b025999b52837:function(e,t){return e.then(t)},__wbg_url_6808f1c468f2d0cd:function(e,t){const n=t.url,_=b(n,o.__wbindgen_malloc,o.__wbindgen_realloc),c=a;m().setInt32(e+4,c,!0),m().setInt32(e+0,_,!0)},__wbg_valueOf_41ae57308c1f031c:function(e){return e.valueOf()},__wbg_value_f3625092ee4b37f4: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 J(e,t,$)},__wbindgen_cast_0000000000000002:function(e,t){return J(e,t,G)},__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 y(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_304c265eb9e6f0af___convert__closures_____invoke_______true_(r,e)}function $(r,e,t){const n=o.wasm_bindgen_304c265eb9e6f0af___convert__closures_____invoke___wasm_bindgen_304c265eb9e6f0af___JsValue__core_9b3796e30d99ddb7___result__Result_____wasm_bindgen_304c265eb9e6f0af___JsError___true_(r,e,t);if(n[1])throw f(n[0])}function H(r,e,t,n){o.wasm_bindgen_304c265eb9e6f0af___convert__closures_____invoke___js_sys_74e7014fb12660c3___Function_fn_wasm_bindgen_304c265eb9e6f0af___JsValue_____wasm_bindgen_304c265eb9e6f0af___sys__Undefined___js_sys_74e7014fb12660c3___Function_fn_wasm_bindgen_304c265eb9e6f0af___JsValue_____wasm_bindgen_304c265eb9e6f0af___sys__Undefined_______true_(r,e,t,n)}const X=["default","no-store","reload","no-cache","force-cache","only-if-cached"],Y=["omit","same-origin","include"],K=["same-origin","no-cors","cors","navigate"],k=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(r=>o.__wbg_wasmbuilder_free(r,1)),N=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(r=>o.__wbg_wasmreader_free(r,1));typeof FinalizationRegistry>"u"||new FinalizationRegistry(r=>o.__wbg_wasmsigner_free(r,1));function R(r){const e=o.__externref_table_alloc();return o.__wbindgen_externrefs.set(e,r),e}const z=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(r=>o.__wbindgen_destroy_closure(r.a,r.b));function U(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+=U(r[0]));for(let i=1;i<_;i++)c+=", "+U(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,T().subarray(r/1,r/1+e)}let I=null;function m(){return(I===null||I.buffer.detached===!0||I.buffer.detached===void 0&&I.buffer!==o.memory.buffer)&&(I=new DataView(o.memory.buffer)),I}function y(r,e){return ee(r>>>0,e)}let S=null;function Q(){return(S===null||S.byteLength===0)&&(S=new Uint32Array(o.memory.buffer)),S}let B=null;function T(){return(B===null||B.byteLength===0)&&(B=new Uint8Array(o.memory.buffer)),B}function l(r,e){try{return r.apply(this,e)}catch(t){const n=R(t);o.__wbindgen_exn_store(n)}}function g(r){return r==null}function J(r,e,t){const n={a:r,b:e,cnt:1},_=(...c)=>{n.cnt++;const i=n.a;n.a=0;try{return t(i,n.b,...c)}finally{n.a=i,_._wbg_cb_unref()}};return _._wbg_cb_unref=()=>{--n.cnt===0&&(o.__wbindgen_destroy_closure(n.a,n.b),n.a=0,z.unregister(n))},z.register(_,n,n),_}function E(r,e){const t=e(r.length*4,4)>>>0;return Q().set(r,t/4),a=r.length,t}function b(r,e,t){if(t===void 0){const s=j.encode(r),u=e(s.length,1)>>>0;return T().subarray(u,u+s.length).set(s),a=s.length,u}let n=r.length,_=e(n,1)>>>0;const c=T();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=T().subarray(_+i,_+n),u=j.encodeInto(r,s);i+=u.written,_=t(_,n,i,1)>>>0}return a=i,_}function f(r){const e=o.__wbindgen_externrefs.get(r);return o.__externref_table_dealloc(r),e}let O=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});O.decode();const Z=2146435072;let x=0;function ee(r,e){return x+=e,x>=Z&&(O=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}),O.decode(),x=e),O.decode(T().subarray(r,r+e))}const j=new TextEncoder;"encodeInto"in j||(j.encodeInto=function(r,e){const t=j.encode(r);return e.set(t),{read:r.length,written:t.length}});let a=0,o;function te(r,e){return o=r.exports,I=null,S=null,B=null,o.__wbindgen_start(),o}function ne(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=P();r instanceof WebAssembly.Module||(r=new WebAssembly.Module(r));const t=new WebAssembly.Instance(r,e);return te(t)}function L(){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 V=Symbol("transfer");function F(r,e){return{type:V,value:r,transfer:e?Array.isArray(e)?e:[e]:[r]}}function D(r){return!!(r&&typeof r=="object"&&Reflect.get(r,"type")===V)}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:u}=c,w=t.get(i);w&&(u?w.reject(u):w.resolve(s),t.delete(i))}),new Proxy({},{get(_,c){return(...i)=>{const s=re(),u=[],w=[];return i.forEach(M=>{D(M)?(u.push(M.value),w.push(...M.transfer)):u.push(M)}),n.postMessage({method:c,args:u,id:s,channelName:r},{transfer:w}),new Promise((M,se)=>{t.set(s,{resolve:M,reject:se})})}}})},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:u}=c;try{const w=await e[i](...s);D(w)?n.postMessage({result:w.value,id:u,channelName:r},{transfer:w.transfer}):n.postMessage({result:w,id:u,channelName:r})}catch(w){n.postMessage({error:w,id:u,channelName:r})}})}}}function re(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}const{rx:_e}=q(),{createTx:oe}=q("worker");function ce(r){if(!(r!=null&&r.manifests))return r;const e=r.manifests,t=Object.assign(Object.create(null),e),n=Object.getPrototypeOf(e);return n!==null&&n!==Object.prototype&&r.active_manifest&&(t[r.active_manifest]=n),r.manifests=t,r}const h=L(),d=L(),W=oe();_e(ie({async initWorker(r,e){ne({module:r}),e&&C(e)},async reader_fromBlob(r,e,t){const n=await v.fromBlob(r,e,t);return h.add(n)},async reader_fromBlobFragment(r,e,t,n){const _=await v.fromBlobFragment(r,e,t,n);return h.add(_)},reader_activeLabel(r){return h.get(r).activeLabel()??null},reader_manifestStore(r){const e=h.get(r);return ce(e.manifestStore())},reader_activeManifest(r){return h.get(r).activeManifest()},reader_json(r){return h.get(r).json()},reader_crJson(r){return h.get(r).crJson()},reader_resourceToBytes(r,e){const n=h.get(r).resourceToBytes(e);return F(n,n.buffer)},reader_free(r){h.get(r).free(),h.remove(r)},builder_new(r){const e=p.new(r);return d.add(e)},builder_fromJson(r,e){const t=p.fromJson(r,e);return d.add(t)},builder_fromArchive(r,e){const t=p.fromArchive(r,e);return d.add(t)},builder_setIntent(r,e){d.get(r).setIntent(e)},builder_addAction(r,e){d.get(r).addAction(e)},builder_addAssertion(r,e,t){d.get(r).addAssertion(e,t)},builder_addRedaction(r,e,t){d.get(r).addRedaction(e,t)},builder_filterActionsAt(r,e){d.get(r).filterActionsAt(Uint32Array.from(e))},builder_filterIngredientsAt(r,e){d.get(r).filterIngredientsAt(Uint32Array.from(e))},builder_filterActionsAndIngredientsAt(r,e,t){d.get(r).filterActionsAndIngredientsAt(Uint32Array.from(e),Uint32Array.from(t))},builder_setRemoteUrl(r,e){d.get(r).setRemoteUrl(e)},builder_setNoEmbed(r,e){d.get(r).setNoEmbed(e)},builder_setThumbnailFromBlob(r,e,t){d.get(r).setThumbnailFromBlob(e,t)},builder_addIngredient(r,e){d.get(r).addIngredient(e)},async builder_addIngredientFromBlob(r,e,t,n){await d.get(r).addIngredientFromBlob(e,t,n)},builder_addResourceFromBlob(r,e,t){d.get(r).addResourceFromBlob(e,t)},builder_getDefinition(r){return d.get(r).getDefinition()},builder_toArchive(r){const t=d.get(r).toArchive();return F(t,t.buffer)},async builder_sign(r,e,t,n,_){const i=await d.get(r).sign({reserveSize:t.reserveSize,alg:t.alg,sign:async s=>await W.sign(e,F(s,s.buffer),t.reserveSize)},n,_);return F(i,i.buffer)},async builder_signAndGetManifestBytes(r,e,t,n,_){const c=d.get(r),{manifest:i,asset:s}=await c.signAndGetManifestBytes({reserveSize:t.reserveSize,alg:t.alg,sign:async u=>await W.sign(e,F(u,u.buffer),t.reserveSize)},n,_);return F({manifest:i,asset:s},[i.buffer,s.buffer])},builder_free(r){d.get(r).free(),d.remove(r)}}));function ie(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', A = typeof self < "u" && self.Blob && new Blob([k], { type: "text/javascript;charset=utf-8" });
|
|
4
|
-
function W(e) {
|
|
5
|
-
let t;
|
|
6
|
-
try {
|
|
7
|
-
if (t = A && (self.URL || self.webkitURL).createObjectURL(A), !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(k),
|
|
17
|
-
{
|
|
18
|
-
name: e == null ? void 0 : e.name
|
|
19
|
-
}
|
|
20
|
-
);
|
|
21
|
-
} finally {
|
|
22
|
-
t && (self.URL || self.webkitURL).revokeObjectURL(t);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
function q(e) {
|
|
26
|
-
if (e.protocol !== "https:")
|
|
27
|
-
throw new Error(
|
|
28
|
-
`Worker source URL must use https, but got ${e.protocol}`
|
|
29
|
-
);
|
|
30
|
-
return e.toString();
|
|
31
|
-
}
|
|
32
|
-
async function C(e) {
|
|
33
|
-
const { wasm: t, settingsString: _, workerSrc: r } = e;
|
|
34
|
-
let n = 0;
|
|
35
|
-
const i = r ? new Worker(q(r), { type: "module" }) : new W(), o = D(i), s = /* @__PURE__ */ new Map();
|
|
36
|
-
P(
|
|
37
|
-
{
|
|
38
|
-
sign: async (c, u, f) => {
|
|
39
|
-
const d = s.get(c);
|
|
40
|
-
if (s.delete(c), !d)
|
|
41
|
-
throw new Error("No signer registered for request");
|
|
42
|
-
const b = await d(u, f);
|
|
43
|
-
return $(b, b.buffer);
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
i
|
|
47
|
-
);
|
|
48
|
-
function a(c) {
|
|
49
|
-
const u = n++;
|
|
50
|
-
return s.set(u, c), u;
|
|
51
|
-
}
|
|
52
|
-
return await o.initWorker(t, _), {
|
|
53
|
-
tx: o,
|
|
54
|
-
registerSignReceiver: a,
|
|
55
|
-
terminate: () => i.terminate()
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
class v extends Error {
|
|
59
|
-
constructor(t) {
|
|
60
|
-
super(
|
|
61
|
-
`The provided asset was too large. Size: ${t} bytes. Maximum: ${h}.`
|
|
62
|
-
), this.name = "AssetTooLargeError";
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
class R extends Error {
|
|
66
|
-
constructor(t) {
|
|
67
|
-
super(`Unsupported format: ${t}.`), this.name = "UnsupportedFormatError";
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
const V = [
|
|
71
|
-
"jpg",
|
|
72
|
-
"video/mp4",
|
|
73
|
-
"image/heif",
|
|
74
|
-
"video/x-msvideo",
|
|
75
|
-
"pdf",
|
|
76
|
-
"image/png",
|
|
77
|
-
"application/c2pa",
|
|
78
|
-
"video/quicktime",
|
|
79
|
-
"video/avi",
|
|
80
|
-
"image/gif",
|
|
81
|
-
"application/xml",
|
|
82
|
-
"text/xml",
|
|
83
|
-
"application/xhtml+xml",
|
|
84
|
-
"tiff",
|
|
85
|
-
"audio/wave",
|
|
86
|
-
"mp4",
|
|
87
|
-
"image/avif",
|
|
88
|
-
"image/dng",
|
|
89
|
-
"png",
|
|
90
|
-
"dng",
|
|
91
|
-
"image/svg+xml",
|
|
92
|
-
"image/heic",
|
|
93
|
-
"application/mp4",
|
|
94
|
-
"image/x-nikon-nef",
|
|
95
|
-
"video/msvideo",
|
|
96
|
-
"tif",
|
|
97
|
-
"wav",
|
|
98
|
-
"xml",
|
|
99
|
-
"audio/vnd.wave",
|
|
100
|
-
"xhtml",
|
|
101
|
-
"gif",
|
|
102
|
-
"application/x-troff-msvideo",
|
|
103
|
-
"webp",
|
|
104
|
-
"heic",
|
|
105
|
-
"application/pdf",
|
|
106
|
-
"audio/mpeg",
|
|
107
|
-
"application/x-c2pa-manifest-store",
|
|
108
|
-
"jpeg",
|
|
109
|
-
"image/x-adobe-dng",
|
|
110
|
-
"audio/wav",
|
|
111
|
-
"mp3",
|
|
112
|
-
"mov",
|
|
113
|
-
"image/tiff",
|
|
114
|
-
"audio/mp4",
|
|
115
|
-
"application/svg+xml",
|
|
116
|
-
"arw",
|
|
117
|
-
"c2pa",
|
|
118
|
-
"svg",
|
|
119
|
-
"avi",
|
|
120
|
-
"audio/x-wav",
|
|
121
|
-
"m4a",
|
|
122
|
-
"image/x-sony-arw",
|
|
123
|
-
"image/jpeg",
|
|
124
|
-
"avif",
|
|
125
|
-
"image/webp",
|
|
126
|
-
"nef",
|
|
127
|
-
"heif",
|
|
128
|
-
"jxl",
|
|
129
|
-
"image/jxl"
|
|
130
|
-
];
|
|
131
|
-
function S(e) {
|
|
132
|
-
return V.includes(e);
|
|
133
|
-
}
|
|
134
|
-
const G = {
|
|
135
|
-
userAnchors: !0,
|
|
136
|
-
trustAnchors: !0,
|
|
137
|
-
trustConfig: !0,
|
|
138
|
-
allowedList: !0
|
|
139
|
-
}, Y = Object.keys(G), X = {
|
|
140
|
-
builder: {
|
|
141
|
-
generateC2paArchive: !0
|
|
142
|
-
}
|
|
143
|
-
}, I = 1 * 1024 * 1024;
|
|
144
|
-
async function l(e, t) {
|
|
145
|
-
const _ = t ? p(e ?? {}, t) : e;
|
|
146
|
-
if (!_)
|
|
147
|
-
return;
|
|
148
|
-
const r = p(X, _), n = [];
|
|
149
|
-
return r.trust && n.push(T(r.trust)), r.cawgTrust && n.push(T(r.cawgTrust)), await Promise.all(n), JSON.stringify(J(r));
|
|
150
|
-
}
|
|
151
|
-
function J(e) {
|
|
152
|
-
return Object.entries(e).reduce(
|
|
153
|
-
(_, [r, n]) => (_[Z(r)] = typeof n == "object" && n !== null ? J(n) : n, _),
|
|
154
|
-
{}
|
|
155
|
-
);
|
|
156
|
-
}
|
|
157
|
-
function Z(e) {
|
|
158
|
-
return e.replace(/[A-Z]/g, (t) => `_${t.toLowerCase()}`);
|
|
159
|
-
}
|
|
160
|
-
async function T(e) {
|
|
161
|
-
try {
|
|
162
|
-
const t = Object.entries(e).filter(([_]) => Y.includes(_)).map(async ([_, r]) => {
|
|
163
|
-
if (r && typeof r == "object" && Array.isArray(r)) {
|
|
164
|
-
const n = r.map(async (s) => {
|
|
165
|
-
if (typeof s != "string")
|
|
166
|
-
throw new Error("Expected a string value for array item");
|
|
167
|
-
const a = await j(s);
|
|
168
|
-
if (E(_) && !F(a))
|
|
169
|
-
throw new Error(`Error parsing PEM file at: ${s}`);
|
|
170
|
-
return a;
|
|
171
|
-
}), o = (await Promise.all(n)).join("");
|
|
172
|
-
e[_] = o;
|
|
173
|
-
} else if (r && typeof r == "string" && H(r)) {
|
|
174
|
-
const n = await j(r);
|
|
175
|
-
if (E(_) && !F(n))
|
|
176
|
-
throw new Error(`Error parsing PEM file at: ${r}`);
|
|
177
|
-
e[_] = n;
|
|
178
|
-
} else
|
|
179
|
-
return r;
|
|
180
|
-
});
|
|
181
|
-
await Promise.all(t);
|
|
182
|
-
} catch (t) {
|
|
183
|
-
const _ = t instanceof Error ? t.message : String(t);
|
|
184
|
-
throw new Error(`Failed to resolve trust settings. ${_}`, { cause: t });
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
const E = (e) => ["userAnchors", "trustAnchors"].includes(e), F = (e) => e.includes("-----BEGIN CERTIFICATE-----"), H = (e) => e.startsWith("http"), w = 2, K = 200, x = 2e3, B = 3e4;
|
|
188
|
-
function M(e) {
|
|
189
|
-
const t = Math.min(
|
|
190
|
-
K * 2 ** e,
|
|
191
|
-
x
|
|
192
|
-
), _ = Math.floor(Math.random() * 200);
|
|
193
|
-
return Math.min(t + _, x);
|
|
194
|
-
}
|
|
195
|
-
function Q(e) {
|
|
196
|
-
if (!e)
|
|
197
|
-
return null;
|
|
198
|
-
const t = Number(e);
|
|
199
|
-
if (!Number.isNaN(t))
|
|
200
|
-
return t * 1e3;
|
|
201
|
-
const _ = Date.parse(e);
|
|
202
|
-
return Number.isNaN(_) ? null : _ - Date.now();
|
|
203
|
-
}
|
|
204
|
-
async function j(e) {
|
|
205
|
-
for (let t = 0; ; t++) {
|
|
206
|
-
let _;
|
|
207
|
-
try {
|
|
208
|
-
_ = await fetch(e);
|
|
209
|
-
} catch (n) {
|
|
210
|
-
if (t < w) {
|
|
211
|
-
await new Promise((o) => setTimeout(o, M(t)));
|
|
212
|
-
continue;
|
|
213
|
-
}
|
|
214
|
-
const i = n instanceof Error ? n.message : String(n);
|
|
215
|
-
throw new Error(`Network error fetching ${e}: ${i}`, { cause: n });
|
|
216
|
-
}
|
|
217
|
-
if (!_.ok) {
|
|
218
|
-
if (_.status === 429 || _.status >= 500) {
|
|
219
|
-
if (_.status === 429) {
|
|
220
|
-
const i = Q(_.headers.get("retry-after"));
|
|
221
|
-
if (i !== null) {
|
|
222
|
-
if (i > B)
|
|
223
|
-
throw new Error(
|
|
224
|
-
`Failed to fetch ${e}: server requested a Retry-After delay of ${Math.ceil(i / 1e3)}s, which exceeds the maximum allowed delay of ${B / 1e3}s`
|
|
225
|
-
);
|
|
226
|
-
if (t < w) {
|
|
227
|
-
await new Promise((o) => setTimeout(o, Math.max(i, 0)));
|
|
228
|
-
continue;
|
|
229
|
-
}
|
|
230
|
-
throw new Error(`Failed to fetch ${e}: ${_.status} ${_.statusText}`);
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
if (t < w) {
|
|
234
|
-
await new Promise((i) => setTimeout(i, M(t)));
|
|
235
|
-
continue;
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
throw new Error(`Failed to fetch ${e}: ${_.status} ${_.statusText}`);
|
|
239
|
-
}
|
|
240
|
-
const r = await _.text();
|
|
241
|
-
if (r.length > I)
|
|
242
|
-
throw new Error(`Response from ${e} is too large. Max size is ${I} bytes.`);
|
|
243
|
-
return r;
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
const h = 10 ** 9;
|
|
247
|
-
function ee(e, t) {
|
|
248
|
-
const { tx: _ } = e, r = t, n = new FinalizationRegistry(async (i) => {
|
|
249
|
-
await _.reader_free(i);
|
|
250
|
-
});
|
|
251
|
-
return {
|
|
252
|
-
async fromBlob(i, o, s) {
|
|
253
|
-
if (!S(i))
|
|
254
|
-
throw new R(i);
|
|
255
|
-
if (o.size > h)
|
|
256
|
-
throw new v(o.size);
|
|
257
|
-
try {
|
|
258
|
-
const a = await l(r, s), c = await _.reader_fromBlob(i, o, a), u = U(e, c, () => {
|
|
259
|
-
n.unregister(u);
|
|
260
|
-
});
|
|
261
|
-
return n.register(u, c, u), u;
|
|
262
|
-
} catch (a) {
|
|
263
|
-
return N(a);
|
|
264
|
-
}
|
|
265
|
-
},
|
|
266
|
-
async fromBlobFragment(i, o, s, a) {
|
|
267
|
-
if (!S(i))
|
|
268
|
-
throw new R(i);
|
|
269
|
-
if (o.size > h)
|
|
270
|
-
throw new v(o.size);
|
|
271
|
-
try {
|
|
272
|
-
const c = await l(r, a), u = await _.reader_fromBlobFragment(
|
|
273
|
-
i,
|
|
274
|
-
o,
|
|
275
|
-
s,
|
|
276
|
-
c
|
|
277
|
-
), f = U(e, u, () => {
|
|
278
|
-
n.unregister(f);
|
|
279
|
-
});
|
|
280
|
-
return n.register(f, u, f), f;
|
|
281
|
-
} catch (c) {
|
|
282
|
-
return N(c);
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
};
|
|
286
|
-
}
|
|
287
|
-
function N(e) {
|
|
288
|
-
if (e instanceof Error && e.message === "C2pa(JumbfNotFound)")
|
|
289
|
-
return null;
|
|
290
|
-
throw e;
|
|
291
|
-
}
|
|
292
|
-
function U(e, t, _) {
|
|
293
|
-
const { tx: r } = e;
|
|
294
|
-
return {
|
|
295
|
-
async activeLabel() {
|
|
296
|
-
return await r.reader_activeLabel(t);
|
|
297
|
-
},
|
|
298
|
-
async manifestStore() {
|
|
299
|
-
return await r.reader_manifestStore(t);
|
|
300
|
-
},
|
|
301
|
-
async activeManifest() {
|
|
302
|
-
return await r.reader_activeManifest(t);
|
|
303
|
-
},
|
|
304
|
-
async json() {
|
|
305
|
-
const n = await r.reader_json(t);
|
|
306
|
-
return JSON.parse(n);
|
|
307
|
-
},
|
|
308
|
-
async crJson() {
|
|
309
|
-
const n = await r.reader_crJson(t);
|
|
310
|
-
return JSON.parse(n);
|
|
311
|
-
},
|
|
312
|
-
async resourceToBytes(n) {
|
|
313
|
-
return await r.reader_resourceToBytes(t, n);
|
|
314
|
-
},
|
|
315
|
-
async free() {
|
|
316
|
-
_(), await r.reader_free(t);
|
|
317
|
-
}
|
|
318
|
-
};
|
|
319
|
-
}
|
|
320
|
-
typeof FinalizationRegistry > "u" || new FinalizationRegistry((e) => g.__wbg_wasmbuilder_free(e, 1));
|
|
321
|
-
typeof FinalizationRegistry > "u" || new FinalizationRegistry((e) => g.__wbg_wasmreader_free(e, 1));
|
|
322
|
-
typeof FinalizationRegistry > "u" || new FinalizationRegistry((e) => g.__wbg_wasmsigner_free(e, 1));
|
|
323
|
-
typeof FinalizationRegistry > "u" || new FinalizationRegistry((e) => g.__wbindgen_destroy_closure(e.a, e.b));
|
|
324
|
-
let te = new TextDecoder("utf-8", { ignoreBOM: !0, fatal: !0 });
|
|
325
|
-
te.decode();
|
|
326
|
-
const m = new TextEncoder();
|
|
327
|
-
"encodeInto" in m || (m.encodeInto = function(e, t) {
|
|
328
|
-
const _ = m.encode(e);
|
|
329
|
-
return t.set(_), {
|
|
330
|
-
read: e.length,
|
|
331
|
-
written: _.length
|
|
332
|
-
};
|
|
333
|
-
});
|
|
334
|
-
let g;
|
|
335
|
-
const ne = "sha512-ci/pBxrYqsL0p3+ya20UYaRCvi3wNkkNBg1mqqjQFT9zfjiRcV3IYYvYZR+8rcuaRNPyRroumM7EQcm4wuy48A==";
|
|
336
|
-
async function O(e) {
|
|
337
|
-
const { alg: t } = e;
|
|
338
|
-
return {
|
|
339
|
-
reserveSize: await e.reserveSize(),
|
|
340
|
-
alg: t
|
|
341
|
-
};
|
|
342
|
-
}
|
|
343
|
-
function L(e) {
|
|
344
|
-
return (e.assertions ?? []).filter((t) => t.label.startsWith("c2pa.actions")).flatMap((t) => {
|
|
345
|
-
const _ = t.data;
|
|
346
|
-
return (_ == null ? void 0 : _.actions) ?? [];
|
|
347
|
-
});
|
|
348
|
-
}
|
|
349
|
-
function re(e, t) {
|
|
350
|
-
const _ = t, { tx: r } = e, n = new FinalizationRegistry((i) => {
|
|
351
|
-
r.builder_free(i);
|
|
352
|
-
});
|
|
353
|
-
return {
|
|
354
|
-
async new(i) {
|
|
355
|
-
const o = await l(_, i), s = await r.builder_new(o), a = y(e, s, () => {
|
|
356
|
-
n.unregister(a);
|
|
357
|
-
});
|
|
358
|
-
return n.register(a, s, a), a;
|
|
359
|
-
},
|
|
360
|
-
async fromDefinition(i, o) {
|
|
361
|
-
const s = JSON.stringify(i), a = await l(_, o), c = await r.builder_fromJson(s, a), u = y(e, c, () => {
|
|
362
|
-
n.unregister(u);
|
|
363
|
-
});
|
|
364
|
-
return n.register(u, c, u), u;
|
|
365
|
-
},
|
|
366
|
-
async fromArchive(i, o) {
|
|
367
|
-
const s = await l(_, o), a = await r.builder_fromArchive(i, s), c = y(e, a, () => {
|
|
368
|
-
n.unregister(c);
|
|
369
|
-
});
|
|
370
|
-
return n.register(c, a, c), c;
|
|
371
|
-
}
|
|
372
|
-
};
|
|
373
|
-
}
|
|
374
|
-
function y(e, t, _) {
|
|
375
|
-
const { tx: r } = e;
|
|
376
|
-
return {
|
|
377
|
-
async setIntent(n) {
|
|
378
|
-
await r.builder_setIntent(t, n);
|
|
379
|
-
},
|
|
380
|
-
async addAction(n) {
|
|
381
|
-
await r.builder_addAction(t, n);
|
|
382
|
-
},
|
|
383
|
-
async addAssertion(n, i) {
|
|
384
|
-
await r.builder_addAssertion(t, n, i);
|
|
385
|
-
},
|
|
386
|
-
async addRedaction(n, i) {
|
|
387
|
-
await r.builder_addRedaction(t, n, i);
|
|
388
|
-
},
|
|
389
|
-
async setRemoteUrl(n) {
|
|
390
|
-
await r.builder_setRemoteUrl(t, n);
|
|
391
|
-
},
|
|
392
|
-
async setNoEmbed(n) {
|
|
393
|
-
await r.builder_setNoEmbed(t, n);
|
|
394
|
-
},
|
|
395
|
-
async setThumbnailFromBlob(n, i) {
|
|
396
|
-
await r.builder_setThumbnailFromBlob(t, n, i);
|
|
397
|
-
},
|
|
398
|
-
// Unlike the Node binding, Neon, which can invoke the JS predicate synchronously from Rust,
|
|
399
|
-
// the WASM builder lives in a Web Worker. A predicate closure can't be called across the
|
|
400
|
-
// worker boundary, so we evaluate it here on the main thread and send the resulting indices
|
|
401
|
-
// to the worker, where WASM applies the equivalent index-based filter. The action/ingredient
|
|
402
|
-
// ordering here must match what WASM iterates. See `filterActionsAt` and `filterIngredientsAt`.
|
|
403
|
-
async filterActions(n) {
|
|
404
|
-
const i = await r.builder_getDefinition(t), s = L(i).reduce((a, c, u) => (n(c) && a.push(u), a), []);
|
|
405
|
-
await r.builder_filterActionsAt(t, s);
|
|
406
|
-
},
|
|
407
|
-
async filterIngredients(n) {
|
|
408
|
-
const s = ((await r.builder_getDefinition(t)).ingredients ?? []).reduce((a, c, u) => (n(c) && a.push(u), a), []);
|
|
409
|
-
await r.builder_filterIngredientsAt(t, s);
|
|
410
|
-
},
|
|
411
|
-
async filterActionsAndIngredients(n, i) {
|
|
412
|
-
const o = await r.builder_getDefinition(t), a = L(o).reduce((f, d, b) => (n(d) && f.push(b), f), []), u = (o.ingredients ?? []).reduce(
|
|
413
|
-
(f, d, b) => (i(d) && f.push(b), f),
|
|
414
|
-
[]
|
|
415
|
-
);
|
|
416
|
-
await r.builder_filterActionsAndIngredientsAt(
|
|
417
|
-
t,
|
|
418
|
-
a,
|
|
419
|
-
u
|
|
420
|
-
);
|
|
421
|
-
},
|
|
422
|
-
async addIngredient(n) {
|
|
423
|
-
const i = JSON.stringify(n);
|
|
424
|
-
await r.builder_addIngredient(t, i);
|
|
425
|
-
},
|
|
426
|
-
async addIngredientFromBlob(n, i, o) {
|
|
427
|
-
const s = JSON.stringify(n);
|
|
428
|
-
await r.builder_addIngredientFromBlob(t, s, i, o);
|
|
429
|
-
},
|
|
430
|
-
async addResourceFromBlob(n, i) {
|
|
431
|
-
await r.builder_addResourceFromBlob(t, n, i);
|
|
432
|
-
},
|
|
433
|
-
async getDefinition() {
|
|
434
|
-
return await r.builder_getDefinition(t);
|
|
435
|
-
},
|
|
436
|
-
async toArchive() {
|
|
437
|
-
return await r.builder_toArchive(t);
|
|
438
|
-
},
|
|
439
|
-
async sign(n, i, o) {
|
|
440
|
-
const s = await O(n), a = e.registerSignReceiver(n.sign);
|
|
441
|
-
return await r.builder_sign(
|
|
442
|
-
t,
|
|
443
|
-
a,
|
|
444
|
-
s,
|
|
445
|
-
i,
|
|
446
|
-
o
|
|
447
|
-
);
|
|
448
|
-
},
|
|
449
|
-
async signAndGetManifestBytes(n, i, o) {
|
|
450
|
-
const s = await O(n), a = e.registerSignReceiver(n.sign);
|
|
451
|
-
return await r.builder_signAndGetManifestBytes(
|
|
452
|
-
t,
|
|
453
|
-
a,
|
|
454
|
-
s,
|
|
455
|
-
i,
|
|
456
|
-
o
|
|
457
|
-
);
|
|
458
|
-
},
|
|
459
|
-
async free() {
|
|
460
|
-
_(), await r.builder_free(t);
|
|
461
|
-
}
|
|
462
|
-
};
|
|
463
|
-
}
|
|
464
|
-
async function ce(e) {
|
|
465
|
-
const { wasmSrc: t, workerSrc: _, settings: r } = e, n = typeof t == "string" ? await _e(t) : t, i = await l(r, void 0), o = await C({ wasm: n, workerSrc: _, settingsString: i });
|
|
466
|
-
return {
|
|
467
|
-
reader: ee(o, r),
|
|
468
|
-
builder: re(o, r),
|
|
469
|
-
dispose: o.terminate
|
|
470
|
-
};
|
|
471
|
-
}
|
|
472
|
-
async function _e(e) {
|
|
473
|
-
const t = await fetch(e, { integrity: ne });
|
|
474
|
-
return await WebAssembly.compileStreaming(t);
|
|
475
|
-
}
|
|
476
|
-
export {
|
|
477
|
-
V as R,
|
|
478
|
-
ce as c,
|
|
479
|
-
S as i
|
|
480
|
-
};
|
package/dist/lib/settings.d.ts
DELETED
|
@@ -1,106 +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
|
-
/**
|
|
10
|
-
* Settings configuration for C2PA operations.
|
|
11
|
-
*
|
|
12
|
-
* Encapsulates settings and configuration options for Reader and Builder operations.
|
|
13
|
-
* It provides a flexible way to configure SDK behavior including the verification configuration,
|
|
14
|
-
* trust configuration, and builder options.
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* ```typescript
|
|
18
|
-
* const context: Context = {
|
|
19
|
-
* verify: {
|
|
20
|
-
* verifyTrust: true,
|
|
21
|
-
* verifyAfterReading: true
|
|
22
|
-
* },
|
|
23
|
-
* trust: {
|
|
24
|
-
* trustAnchors: 'https://example.com/anchors.pem'
|
|
25
|
-
* }
|
|
26
|
-
* };
|
|
27
|
-
*
|
|
28
|
-
* const reader = await c2pa.reader.fromBlob(blob.type, blob, JSON.stringify(context));
|
|
29
|
-
* ```
|
|
30
|
-
*/
|
|
31
|
-
export interface Settings {
|
|
32
|
-
/**
|
|
33
|
-
* Trust configuration for C2PA claim validation.
|
|
34
|
-
*/
|
|
35
|
-
trust?: TrustSettings;
|
|
36
|
-
/**
|
|
37
|
-
* Trust configuration for CAWG identity validation.
|
|
38
|
-
*/
|
|
39
|
-
cawgTrust?: CawgTrustSettings;
|
|
40
|
-
/**
|
|
41
|
-
* Verification settings.
|
|
42
|
-
*/
|
|
43
|
-
verify?: VerifySettings;
|
|
44
|
-
/**
|
|
45
|
-
* Builder settings.
|
|
46
|
-
*/
|
|
47
|
-
builder?: BuilderSettings;
|
|
48
|
-
}
|
|
49
|
-
export interface TrustSettings {
|
|
50
|
-
/**
|
|
51
|
-
* "User" trust anchors. Any asset validated off of this trust list will will have a "signingCredential.trusted" result with an explanation noting the trust source is a "User" anchor.
|
|
52
|
-
*
|
|
53
|
-
* Possible values are: the text content of a .pem file, a URL to fetch a .pem file from, or an array of URLs that will be fetched and concatenated.
|
|
54
|
-
*/
|
|
55
|
-
userAnchors?: string | string[];
|
|
56
|
-
/**
|
|
57
|
-
* "System" trust anchors. Any asset validated off of this trust list will will have a "signingCredential.trusted" result with an explanation noting the trust source is a "System" anchor.
|
|
58
|
-
*
|
|
59
|
-
* Possible values are: the text content of a .pem file, a URL to fetch a .pem file from, or an array of URLs that will be fetched and concatenated.
|
|
60
|
-
*/
|
|
61
|
-
trustAnchors?: string | string[];
|
|
62
|
-
/**
|
|
63
|
-
* Trust store
|
|
64
|
-
*
|
|
65
|
-
* Possible values are: the text content of a .cfg file, a URL to fetch a .cfg file from, or an array of URLs that will be fetched and concatenated.
|
|
66
|
-
*/
|
|
67
|
-
trustConfig?: string | string[];
|
|
68
|
-
/**
|
|
69
|
-
* End-entity certificates.
|
|
70
|
-
*
|
|
71
|
-
* Possible values are: the text content of a end-entity cert file, a URL to fetch a end-entity cert file from, or an array of URLs that will be fetched and concatenated.
|
|
72
|
-
*/
|
|
73
|
-
allowedList?: string | string[];
|
|
74
|
-
}
|
|
75
|
-
export interface CawgTrustSettings extends TrustSettings {
|
|
76
|
-
/**
|
|
77
|
-
* Enable CAWG trust validation. The default value is "true."
|
|
78
|
-
*/
|
|
79
|
-
verifyTrustList?: boolean;
|
|
80
|
-
}
|
|
81
|
-
export interface VerifySettings {
|
|
82
|
-
/**
|
|
83
|
-
* Enable trust validation. The default value is "true."
|
|
84
|
-
*/
|
|
85
|
-
verifyTrust?: boolean;
|
|
86
|
-
verifyAfterReading?: boolean;
|
|
87
|
-
}
|
|
88
|
-
export interface BuilderSettings {
|
|
89
|
-
/**
|
|
90
|
-
* Whether to generate a C2PA archive (instead of zip) when writing the manifest builder.
|
|
91
|
-
*/
|
|
92
|
-
generateC2paArchive?: boolean;
|
|
93
|
-
}
|
|
94
|
-
export declare const MAX_RESPONSE_SIZE: number;
|
|
95
|
-
/**
|
|
96
|
-
* Resolves settings by merging override settings on top of base settings, resolving any embedded
|
|
97
|
-
* trust list URLs on top of those, and then finally serializing the result for consumption by c2pa-rs.
|
|
98
|
-
*
|
|
99
|
-
* @param baseSettings Settings established at SDK initialization time.
|
|
100
|
-
* @param overrideSettings Optional override settings. Keys present in overrideSettings win over keys in baseSettings.
|
|
101
|
-
* @returns A JSON-serialized string containing all resolved settings values, ready to be consumed by c2pa-rs.
|
|
102
|
-
* Returns undefined when neither argument is provided.
|
|
103
|
-
*/
|
|
104
|
-
export declare function resolveSettings(baseSettings: Settings | undefined, overrideSettings: Settings | undefined): Promise<string | undefined>;
|
|
105
|
-
export declare const TRUST_MAX_RETRY_AFTER_MS = 30000;
|
|
106
|
-
//# sourceMappingURL=settings.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../src/lib/settings.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,WAAW,QAAQ;IACvB;;OAEG;IACH,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB;;OAEG;IACH,SAAS,CAAC,EAAE,iBAAiB,CAAC;IAC9B;;OAEG;IACH,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB;;OAEG;IACH,OAAO,CAAC,EAAE,eAAe,CAAC;CAC3B;AAED,MAAM,WAAW,aAAa;IAC5B;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAChC;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACjC;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAChC;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CACjC;AAUD,MAAM,WAAW,iBAAkB,SAAQ,aAAa;IACtD;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IAItB,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAED,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAYD,eAAO,MAAM,iBAAiB,QAAkB,CAAC;AAEjD;;;;;;;;GAQG;AACH,wBAAsB,eAAe,CACnC,YAAY,EAAE,QAAQ,GAAG,SAAS,EAClC,gBAAgB,EAAE,QAAQ,GAAG,SAAS,GACrC,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAyB7B;AA8ED,eAAO,MAAM,wBAAwB,QAAS,CAAC"}
|