@contentauth/c2pa-web 0.1.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/CHANGELOG.md +12 -0
- package/README.md +11 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +220 -0
- package/dist/lib/c2pa.d.ts +32 -0
- package/dist/lib/c2pa.d.ts.map +1 -0
- package/dist/lib/error.d.ts +15 -0
- package/dist/lib/error.d.ts.map +1 -0
- package/dist/lib/reader.d.ts +41 -0
- package/dist/lib/reader.d.ts.map +1 -0
- package/dist/lib/settings.d.ts +27 -0
- package/dist/lib/settings.d.ts.map +1 -0
- package/dist/lib/supportedFormats.d.ts +11 -0
- package/dist/lib/supportedFormats.d.ts.map +1 -0
- package/dist/lib/worker/setupWorker.d.ts +26 -0
- package/dist/lib/worker/setupWorker.d.ts.map +1 -0
- package/dist/lib/worker/workerManager.d.ts +20 -0
- package/dist/lib/worker/workerManager.d.ts.map +1 -0
- package/dist/lib/worker/workerObjectMap.d.ts +14 -0
- package/dist/lib/worker/workerObjectMap.d.ts.map +1 -0
- package/dist/lib/worker/workerResponse.d.ts +16 -0
- package/dist/lib/worker/workerResponse.d.ts.map +1 -0
- package/dist/lib/worker.d.ts +13 -0
- package/dist/lib/worker.d.ts.map +1 -0
- package/dist/resources/c2pa_bg.wasm +0 -0
- package/eslint.config.mjs +30 -0
- package/package.json +26 -0
- package/project.json +7 -0
- package/src/index.ts +15 -0
- package/src/lib/c2pa.spec.ts +166 -0
- package/src/lib/c2pa.ts +65 -0
- package/src/lib/error.ts +26 -0
- package/src/lib/reader.ts +150 -0
- package/src/lib/settings.ts +52 -0
- package/src/lib/supportedFormats.ts +72 -0
- package/src/lib/worker/setupWorker.ts +53 -0
- package/src/lib/worker/workerManager.ts +64 -0
- package/src/lib/worker/workerObjectMap.ts +35 -0
- package/src/lib/worker/workerResponse.ts +50 -0
- package/src/lib/worker.ts +77 -0
- package/test/fixtures/assets/C_with_CAWG_data.jpg +0 -0
- package/test/fixtures/assets/C_with_CAWG_data.json +144 -0
- package/test/fixtures/assets/C_with_CAWG_data_thumbnail.jpg +0 -0
- package/test/fixtures/assets/C_with_CAWG_data_trusted.json +149 -0
- package/test/fixtures/assets/C_with_CAWG_data_untrusted.json +157 -0
- package/test/fixtures/assets/dash1.m4s +0 -0
- package/test/fixtures/assets/dashinit.json +184 -0
- package/test/fixtures/assets/dashinit.mp4 +0 -0
- package/test/fixtures/assets/no_alg.jpg +0 -0
- package/test/fixtures/trust/anchor-correct.pem +15 -0
- package/test/fixtures/trust/anchor-incorrect.pem +16 -0
- package/tsconfig.json +13 -0
- package/tsconfig.lib.json +29 -0
- package/tsconfig.spec.json +36 -0
- package/vite.config.ts +91 -0
package/CHANGELOG.md
ADDED
package/README.md
ADDED
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2025 Adobe
|
|
3
|
+
* All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* NOTICE: Adobe permits you to use, modify, and distribute this file in
|
|
6
|
+
* accordance with the terms of the Adobe license agreement accompanying
|
|
7
|
+
* it.
|
|
8
|
+
*/
|
|
9
|
+
export * from './lib/c2pa.js';
|
|
10
|
+
export { isSupportedReaderFormat, READER_SUPPORTED_FORMATS, } from './lib/supportedFormats.js';
|
|
11
|
+
export { type Settings } from './lib/settings.js';
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,cAAc,eAAe,CAAC;AAC9B,OAAO,EACL,uBAAuB,EACvB,wBAAwB,GACzB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
const l = '(function(){"use strict";let o;const S=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&S.decode();let m=null;function x(){return(m===null||m.byteLength===0)&&(m=new Uint8Array(o.memory.buffer)),m}function a(t,e){return t=t>>>0,S.decode(x().subarray(t,t+e))}function y(t){const e=o.__externref_table_alloc();return o.__wbindgen_export_2.set(e,t),e}function u(t,e){try{return t.apply(this,e)}catch(n){const r=y(n);o.__wbindgen_exn_store(r)}}let f=0;const T=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},E=typeof T.encodeInto=="function"?function(t,e){return T.encodeInto(t,e)}:function(t,e){const n=T.encode(t);return e.set(n),{read:t.length,written:n.length}};function b(t,e,n){if(n===void 0){const s=T.encode(t),d=e(s.length,1)>>>0;return x().subarray(d,d+s.length).set(s),f=s.length,d}let r=t.length,_=e(r,1)>>>0;const c=x();let i=0;for(;i<r;i++){const s=t.charCodeAt(i);if(s>127)break;c[_+i]=s}if(i!==r){i!==0&&(t=t.slice(i)),_=n(_,r,r=i+t.length*3,1)>>>0;const s=x().subarray(_+i,_+r),d=E(t,s);i+=d.written,_=n(_,r,i,1)>>>0}return f=i,_}let w=null;function g(){return(w===null||w.buffer.detached===!0||w.buffer.detached===void 0&&w.buffer!==o.memory.buffer)&&(w=new DataView(o.memory.buffer)),w}function p(t){return t==null}const A=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>{o.__wbindgen_export_6.get(t.dtor)(t.a,t.b)});function O(t,e,n,r){const _={a:t,b:e,cnt:1,dtor:n},c=(...i)=>{_.cnt++;const s=_.a;_.a=0;try{return r(s,_.b,...i)}finally{--_.cnt===0?(o.__wbindgen_export_6.get(_.dtor)(s,_.b),A.unregister(_)):_.a=s}};return c.original=_,A.register(c,_,_),c}function j(t){const e=typeof t;if(e=="number"||e=="boolean"||t==null)return`${t}`;if(e=="string")return`"${t}"`;if(e=="symbol"){const _=t.description;return _==null?"Symbol":`Symbol(${_})`}if(e=="function"){const _=t.name;return typeof _=="string"&&_.length>0?`Function(${_})`:"Function"}if(Array.isArray(t)){const _=t.length;let c="[";_>0&&(c+=j(t[0]));for(let i=1;i<_;i++)c+=", "+j(t[i]);return c+="]",c}const n=/\\[object ([^\\]]+)\\]/.exec(toString.call(t));let r;if(n&&n.length>1)r=n[1];else return toString.call(t);if(r=="Object")try{return"Object("+JSON.stringify(t)+")"}catch{return"Object"}return t instanceof Error?`${t.name}: ${t.message}\n${t.stack}`:r}function M(t){const e=o.__wbindgen_export_2.get(t);return o.__externref_table_dealloc(t),e}function I(t){const e=b(t,o.__wbindgen_malloc,o.__wbindgen_realloc),n=f,r=o.loadSettings(e,n);if(r[1])throw M(r[0])}function k(t,e){o._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__ha1953f27c342761b(t,e)}function R(t,e,n){o.closure1391_externref_shim(t,e,n)}function L(t,e,n,r){o.closure2380_externref_shim(t,e,n,r)}const W=["omit","same-origin","include"],D=["same-origin","no-cors","cors","navigate"],F=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>o.__wbg_wasmreader_free(t>>>0,1));class h{static __wrap(e){e=e>>>0;const n=Object.create(h.prototype);return n.__wbg_ptr=e,F.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,F.unregister(this),e}free(){const e=this.__destroy_into_raw();o.__wbg_wasmreader_free(e,0)}static fromBlob(e,n){const r=b(e,o.__wbindgen_malloc,o.__wbindgen_realloc),_=f;return o.wasmreader_fromBlob(r,_,n)}static fromBlobFragment(e,n,r){const _=b(e,o.__wbindgen_malloc,o.__wbindgen_realloc),c=f;return o.wasmreader_fromBlobFragment(_,c,n,r)}json(){let e,n;try{const r=o.wasmreader_json(this.__wbg_ptr);return e=r[0],n=r[1],a(r[0],r[1])}finally{o.__wbindgen_free(e,n,1)}}activeLabel(){const e=o.wasmreader_activeLabel(this.__wbg_ptr);let n;return e[0]!==0&&(n=a(e[0],e[1]).slice(),o.__wbindgen_free(e[0],e[1]*1,1)),n}resourceToBuffer(e){const n=b(e,o.__wbindgen_malloc,o.__wbindgen_realloc),r=f,_=o.wasmreader_resourceToBuffer(this.__wbg_ptr,n,r);if(_[2])throw M(_[1]);return M(_[0])}}function v(){const t={};return t.wbg={},t.wbg.__wbg_abort_410ec47a64ac6117=function(e,n){e.abort(n)},t.wbg.__wbg_abort_775ef1d17fc65868=function(e){e.abort()},t.wbg.__wbg_append_8c7dd8d641a5f01b=function(){return u(function(e,n,r,_,c){e.append(a(n,r),a(_,c))},arguments)},t.wbg.__wbg_arrayBuffer_d1b44c4390db422f=function(){return u(function(e){return e.arrayBuffer()},arguments)},t.wbg.__wbg_buffer_09165b52af8c5237=function(e){return e.buffer},t.wbg.__wbg_buffer_609cc3eee51ed158=function(e){return e.buffer},t.wbg.__wbg_byteLength_e674b853d9c77e1d=function(e){return e.byteLength},t.wbg.__wbg_call_672a4d21634d4a24=function(){return u(function(e,n){return e.call(n)},arguments)},t.wbg.__wbg_call_7cccdd69e0791ae2=function(){return u(function(e,n,r){return e.call(n,r)},arguments)},t.wbg.__wbg_clearTimeout_0b53d391c1b94dda=function(e){return clearTimeout(e)},t.wbg.__wbg_done_769e5ede4b31c67b=function(e){return e.done},t.wbg.__wbg_error_7534b8e9a36f1ab4=function(e,n){let r,_;try{r=e,_=n,console.error(a(e,n))}finally{o.__wbindgen_free(r,_,1)}},t.wbg.__wbg_fetch_11bff8299d0ecd2b=function(e){return fetch(e)},t.wbg.__wbg_fetch_509096533071c657=function(e,n){return e.fetch(n)},t.wbg.__wbg_get_67b2ba62fc30de12=function(){return u(function(e,n){return Reflect.get(e,n)},arguments)},t.wbg.__wbg_has_a5ea9117f258a0ec=function(){return u(function(e,n){return Reflect.has(e,n)},arguments)},t.wbg.__wbg_headers_9cb51cfd2ac780a4=function(e){return e.headers},t.wbg.__wbg_instanceof_Response_f2cc20d9f7dfd644=function(e){let n;try{n=e instanceof Response}catch{n=!1}return n},t.wbg.__wbg_iterator_9a24c88df860dc65=function(){return Symbol.iterator},t.wbg.__wbg_length_a446193dc22c12f8=function(e){return e.length},t.wbg.__wbg_new_018dcc2d6c8c2f6a=function(){return u(function(){return new Headers},arguments)},t.wbg.__wbg_new_16004015965f986e=function(){return u(function(){return new FileReaderSync},arguments)},t.wbg.__wbg_new_23a2665fac83c611=function(e,n){try{var r={a:e,b:n},_=(i,s)=>{const d=r.a;r.a=0;try{return L(d,r.b,i,s)}finally{r.a=d}};return new Promise(_)}finally{r.a=r.b=0}},t.wbg.__wbg_new_405e22f390576ce2=function(){return new Object},t.wbg.__wbg_new_8a6f238a6ece86ea=function(){return new Error},t.wbg.__wbg_new_a12002a7f91c75be=function(e){return new Uint8Array(e)},t.wbg.__wbg_new_c68d7209be747379=function(e,n){return new Error(a(e,n))},t.wbg.__wbg_new_e25e5aab09ff45db=function(){return u(function(){return new AbortController},arguments)},t.wbg.__wbg_newnoargs_105ed471475aaf50=function(e,n){return new Function(a(e,n))},t.wbg.__wbg_newwithbyteoffsetandlength_d97e637ebe145a9a=function(e,n,r){return new Uint8Array(e,n>>>0,r>>>0)},t.wbg.__wbg_newwithlength_a381634e90c276d4=function(e){return new Uint8Array(e>>>0)},t.wbg.__wbg_newwithstrandinit_06c535e0a867c635=function(){return u(function(e,n,r){return new Request(a(e,n),r)},arguments)},t.wbg.__wbg_next_25feadfc0913fea9=function(e){return e.next},t.wbg.__wbg_next_6574e1a8a62d1055=function(){return u(function(e){return e.next()},arguments)},t.wbg.__wbg_now_807e54c39636c349=function(){return Date.now()},t.wbg.__wbg_queueMicrotask_97d92b4fcc8a61c5=function(e){queueMicrotask(e)},t.wbg.__wbg_queueMicrotask_d3219def82552485=function(e){return e.queueMicrotask},t.wbg.__wbg_readAsArrayBuffer_560aeb9fce36c5c8=function(){return u(function(e,n){return e.readAsArrayBuffer(n)},arguments)},t.wbg.__wbg_resolve_4851785c9c5f573d=function(e){return Promise.resolve(e)},t.wbg.__wbg_setTimeout_73ce8df12de4f2f2=function(e,n){return setTimeout(e,n)},t.wbg.__wbg_set_65595bdd868b3009=function(e,n,r){e.set(n,r>>>0)},t.wbg.__wbg_setbody_5923b78a95eedf29=function(e,n){e.body=n},t.wbg.__wbg_setcredentials_c3a22f1cd105a2c6=function(e,n){e.credentials=W[n]},t.wbg.__wbg_setheaders_834c0bdb6a8949ad=function(e,n){e.headers=n},t.wbg.__wbg_setmethod_3c5280fe5d890842=function(e,n,r){e.method=a(n,r)},t.wbg.__wbg_setmode_5dc300b865044b65=function(e,n){e.mode=D[n]},t.wbg.__wbg_setsignal_75b21ef3a81de905=function(e,n){e.signal=n},t.wbg.__wbg_signal_aaf9ad74119f20a4=function(e){return e.signal},t.wbg.__wbg_size_3808d41635a9c259=function(e){return e.size},t.wbg.__wbg_slice_bd4c84b64bdfe01f=function(){return u(function(e,n,r){return e.slice(n,r)},arguments)},t.wbg.__wbg_stack_0ed75d68575b0f3c=function(e,n){const r=n.stack,_=b(r,o.__wbindgen_malloc,o.__wbindgen_realloc),c=f;g().setInt32(e+4,c,!0),g().setInt32(e+0,_,!0)},t.wbg.__wbg_static_accessor_GLOBAL_88a902d13a557d07=function(){const e=typeof global>"u"?null:global;return p(e)?0:y(e)},t.wbg.__wbg_static_accessor_GLOBAL_THIS_56578be7e9f832b0=function(){const e=typeof globalThis>"u"?null:globalThis;return p(e)?0:y(e)},t.wbg.__wbg_static_accessor_SELF_37c5d418e4bf5819=function(){const e=typeof self>"u"?null:self;return p(e)?0:y(e)},t.wbg.__wbg_static_accessor_WINDOW_5de37043a91a9c40=function(){const e=typeof window>"u"?null:window;return p(e)?0:y(e)},t.wbg.__wbg_status_f6360336ca686bf0=function(e){return e.status},t.wbg.__wbg_stringify_f7ed6987935b4a24=function(){return u(function(e){return JSON.stringify(e)},arguments)},t.wbg.__wbg_then_44b73946d2fb3e7d=function(e,n){return e.then(n)},t.wbg.__wbg_then_48b406749878a531=function(e,n,r){return e.then(n,r)},t.wbg.__wbg_url_ae10c34ca209681d=function(e,n){const r=n.url,_=b(r,o.__wbindgen_malloc,o.__wbindgen_realloc),c=f;g().setInt32(e+4,c,!0),g().setInt32(e+0,_,!0)},t.wbg.__wbg_value_cd1ffa7b1ab794f1=function(e){return e.value},t.wbg.__wbg_wasmreader_new=function(e){return h.__wrap(e)},t.wbg.__wbindgen_cb_drop=function(e){const n=e.original;return n.cnt--==1?(n.a=0,!0):!1},t.wbg.__wbindgen_closure_wrapper9193=function(e,n,r){return O(e,n,1337,k)},t.wbg.__wbindgen_closure_wrapper9303=function(e,n,r){return O(e,n,1392,R)},t.wbg.__wbindgen_debug_string=function(e,n){const r=j(n),_=b(r,o.__wbindgen_malloc,o.__wbindgen_realloc),c=f;g().setInt32(e+4,c,!0),g().setInt32(e+0,_,!0)},t.wbg.__wbindgen_init_externref_table=function(){const e=o.__wbindgen_export_2,n=e.grow(4);e.set(0,void 0),e.set(n+0,void 0),e.set(n+1,null),e.set(n+2,!0),e.set(n+3,!1)},t.wbg.__wbindgen_is_function=function(e){return typeof e=="function"},t.wbg.__wbindgen_is_object=function(e){const n=e;return typeof n=="object"&&n!==null},t.wbg.__wbindgen_is_undefined=function(e){return e===void 0},t.wbg.__wbindgen_memory=function(){return o.memory},t.wbg.__wbindgen_string_get=function(e,n){const r=n,_=typeof r=="string"?r:void 0;var c=p(_)?0:b(_,o.__wbindgen_malloc,o.__wbindgen_realloc),i=f;g().setInt32(e+4,i,!0),g().setInt32(e+0,c,!0)},t.wbg.__wbindgen_string_new=function(e,n){return a(e,n)},t.wbg.__wbindgen_throw=function(e,n){throw new Error(a(e,n))},t}function z(t,e){return o=t.exports,w=null,m=null,o.__wbindgen_start(),o}function q(t){if(o!==void 0)return o;typeof t<"u"&&(Object.getPrototypeOf(t)===Object.prototype?{module:t}=t:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));const e=v();t instanceof WebAssembly.Module||(t=new WebAssembly.Module(t));const n=new WebAssembly.Instance(t,e);return z(n)}function B(t,e){const n={type:"success",...t!==void 0?{payload:t}:{}};postMessage(n,e??[])}function C(t){postMessage({type:"error",error:t})}function U(t){onmessage=async e=>{try{const{args:n,method:r}=e.data,_=await t[r](...n);(_==null?void 0:_.data)!==void 0?B(_.data,_.transfer):B()}catch(n){C(n)}}}function $(){let t=0;const e=new Map;return{add(n){const r=t++;return e.set(r,n),r},get(n){const r=e.get(n);if(!r)throw new Error("Attempted to use an object that has been freed");return r},remove(n){return e.delete(n)}}}const l=$();U({async initWorker(t,e){q(t),e&&I(e)},async reader_fromBlob(t,e){const n=await h.fromBlob(t,e);return{data:l.add(n)}},async reader_fromBlobFragment(t,e,n){const r=await h.fromBlobFragment(t,e,n);return{data:l.add(r)}},reader_json(t){return{data:l.get(t).json()}},reader_activeLabel(t){return{data:l.get(t).activeLabel()??null}},reader_resourceToBuffer(t,e){const r=l.get(t).resourceToBuffer(e);return{data:r,transfer:[r]}},reader_free(t){l.get(t).free(),l.remove(t)}})})();\n', f = typeof self < "u" && self.Blob && new Blob([l], { type: "text/javascript;charset=utf-8" });
|
|
2
|
+
function v(e) {
|
|
3
|
+
let t;
|
|
4
|
+
try {
|
|
5
|
+
if (t = f && (self.URL || self.webkitURL).createObjectURL(f), !t) throw "";
|
|
6
|
+
const n = new Worker(t, {
|
|
7
|
+
name: e == null ? void 0 : e.name
|
|
8
|
+
});
|
|
9
|
+
return n.addEventListener("error", () => {
|
|
10
|
+
(self.URL || self.webkitURL).revokeObjectURL(t);
|
|
11
|
+
}), n;
|
|
12
|
+
} catch {
|
|
13
|
+
return new Worker(
|
|
14
|
+
"data:text/javascript;charset=utf-8," + encodeURIComponent(l),
|
|
15
|
+
{
|
|
16
|
+
name: e == null ? void 0 : e.name
|
|
17
|
+
}
|
|
18
|
+
);
|
|
19
|
+
} finally {
|
|
20
|
+
t && (self.URL || self.webkitURL).revokeObjectURL(t);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
function T(e, t) {
|
|
24
|
+
e.onmessage = (n) => {
|
|
25
|
+
const { data: r } = n;
|
|
26
|
+
r.type === "success" ? t.onSuccess(r == null ? void 0 : r.payload) : t.onError(r == null ? void 0 : r.error);
|
|
27
|
+
}, e.onerror = (n) => {
|
|
28
|
+
t.onError(n.error);
|
|
29
|
+
}, e.onmessageerror = (n) => {
|
|
30
|
+
t.onError(n.data);
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
async function R(e) {
|
|
34
|
+
const { wasm: t, settingsString: n } = e, r = new v(), o = (_) => new Promise((c, a) => {
|
|
35
|
+
T(r, {
|
|
36
|
+
onSuccess: (i) => c(i),
|
|
37
|
+
onError: (i) => a(i)
|
|
38
|
+
});
|
|
39
|
+
const { method: p, args: h, transfer: x } = _;
|
|
40
|
+
r.postMessage({ method: p, args: h }, x ?? []);
|
|
41
|
+
});
|
|
42
|
+
return await o({ method: "initWorker", args: [t, n] }), {
|
|
43
|
+
execute: o,
|
|
44
|
+
terminate: () => r.terminate()
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
class g extends Error {
|
|
48
|
+
constructor(t) {
|
|
49
|
+
super(
|
|
50
|
+
`The provided asset was too large. Size: ${t} bytes. Maximum: ${u}.`
|
|
51
|
+
), this.name = "AssetTooLargeError";
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
class b extends Error {
|
|
55
|
+
constructor(t) {
|
|
56
|
+
super(`Unsupported format: ${t}.`), this.name = "UnsupportedFormatError";
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
const S = [
|
|
60
|
+
"jpg",
|
|
61
|
+
"video/mp4",
|
|
62
|
+
"image/heif",
|
|
63
|
+
"video/x-msvideo",
|
|
64
|
+
"pdf",
|
|
65
|
+
"image/png",
|
|
66
|
+
"application/c2pa",
|
|
67
|
+
"video/quicktime",
|
|
68
|
+
"video/avi",
|
|
69
|
+
"image/gif",
|
|
70
|
+
"application/xml",
|
|
71
|
+
"text/xml",
|
|
72
|
+
"application/xhtml+xml",
|
|
73
|
+
"tiff",
|
|
74
|
+
"audio/wave",
|
|
75
|
+
"mp4",
|
|
76
|
+
"image/avif",
|
|
77
|
+
"image/dng",
|
|
78
|
+
"png",
|
|
79
|
+
"dng",
|
|
80
|
+
"image/svg+xml",
|
|
81
|
+
"image/heic",
|
|
82
|
+
"application/mp4",
|
|
83
|
+
"image/x-nikon-nef",
|
|
84
|
+
"video/msvideo",
|
|
85
|
+
"tif",
|
|
86
|
+
"wav",
|
|
87
|
+
"xml",
|
|
88
|
+
"audio/vnd.wave",
|
|
89
|
+
"xhtml",
|
|
90
|
+
"gif",
|
|
91
|
+
"application/x-troff-msvideo",
|
|
92
|
+
"webp",
|
|
93
|
+
"heic",
|
|
94
|
+
"application/pdf",
|
|
95
|
+
"audio/mpeg",
|
|
96
|
+
"application/x-c2pa-manifest-store",
|
|
97
|
+
"jpeg",
|
|
98
|
+
"image/x-adobe-dng",
|
|
99
|
+
"audio/wav",
|
|
100
|
+
"mp3",
|
|
101
|
+
"mov",
|
|
102
|
+
"image/tiff",
|
|
103
|
+
"audio/mp4",
|
|
104
|
+
"application/svg+xml",
|
|
105
|
+
"arw",
|
|
106
|
+
"c2pa",
|
|
107
|
+
"svg",
|
|
108
|
+
"avi",
|
|
109
|
+
"audio/x-wav",
|
|
110
|
+
"m4a",
|
|
111
|
+
"image/x-sony-arw",
|
|
112
|
+
"image/jpeg",
|
|
113
|
+
"avif",
|
|
114
|
+
"image/webp",
|
|
115
|
+
"nef",
|
|
116
|
+
"heif"
|
|
117
|
+
];
|
|
118
|
+
function d(e) {
|
|
119
|
+
return S.includes(e);
|
|
120
|
+
}
|
|
121
|
+
const u = 10 ** 9;
|
|
122
|
+
function E(e) {
|
|
123
|
+
const t = new FinalizationRegistry((n) => {
|
|
124
|
+
e.execute({ method: "reader_free", args: [n] });
|
|
125
|
+
});
|
|
126
|
+
return {
|
|
127
|
+
async fromBlob(n, r) {
|
|
128
|
+
if (!d(n))
|
|
129
|
+
throw new b(n);
|
|
130
|
+
if (r.size > u)
|
|
131
|
+
throw new g(r.size);
|
|
132
|
+
const o = await e.execute({
|
|
133
|
+
method: "reader_fromBlob",
|
|
134
|
+
args: [n, r]
|
|
135
|
+
}), _ = Symbol(o), c = w(e, o, () => {
|
|
136
|
+
t.unregister(_);
|
|
137
|
+
});
|
|
138
|
+
return t.register(c, o, _), c;
|
|
139
|
+
},
|
|
140
|
+
async fromBlobFragment(n, r, o) {
|
|
141
|
+
if (!d(n))
|
|
142
|
+
throw new b(n);
|
|
143
|
+
if (r.size > u)
|
|
144
|
+
throw new g(r.size);
|
|
145
|
+
const _ = await e.execute({
|
|
146
|
+
method: "reader_fromBlobFragment",
|
|
147
|
+
args: [n, r, o]
|
|
148
|
+
}), c = Symbol(_), a = w(e, _, () => {
|
|
149
|
+
t.unregister(c);
|
|
150
|
+
});
|
|
151
|
+
return t.register(a, _, c), a;
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
function w(e, t, n) {
|
|
156
|
+
return {
|
|
157
|
+
// TODO: manifest type
|
|
158
|
+
async manifestStore() {
|
|
159
|
+
const r = await e.execute({ method: "reader_json", args: [t] });
|
|
160
|
+
return JSON.parse(r);
|
|
161
|
+
},
|
|
162
|
+
async activeLabel() {
|
|
163
|
+
return await e.execute({
|
|
164
|
+
method: "reader_activeLabel",
|
|
165
|
+
args: [t]
|
|
166
|
+
});
|
|
167
|
+
},
|
|
168
|
+
async resourceToBuffer(r) {
|
|
169
|
+
return e.execute({
|
|
170
|
+
method: "reader_resourceToBuffer",
|
|
171
|
+
args: [t, r]
|
|
172
|
+
});
|
|
173
|
+
},
|
|
174
|
+
async free() {
|
|
175
|
+
return n(), e.execute({ method: "reader_free", args: [t] });
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
let m;
|
|
180
|
+
const j = typeof TextDecoder < "u" ? new TextDecoder("utf-8", { ignoreBOM: !0, fatal: !0 }) : { decode: () => {
|
|
181
|
+
throw Error("TextDecoder not available");
|
|
182
|
+
} };
|
|
183
|
+
typeof TextDecoder < "u" && j.decode();
|
|
184
|
+
const s = typeof TextEncoder < "u" ? new TextEncoder("utf-8") : { encode: () => {
|
|
185
|
+
throw Error("TextEncoder not available");
|
|
186
|
+
} };
|
|
187
|
+
s.encodeInto;
|
|
188
|
+
typeof FinalizationRegistry > "u" || new FinalizationRegistry((e) => {
|
|
189
|
+
m.__wbindgen_export_6.get(e.dtor)(e.a, e.b);
|
|
190
|
+
});
|
|
191
|
+
typeof FinalizationRegistry > "u" || new FinalizationRegistry((e) => m.__wbg_wasmreader_free(e >>> 0, 1));
|
|
192
|
+
const B = "sha512-fQMTO3HLS7dtGFRg+QIUqpyyCX5XlwlaFKDhcsIycpdCmb9I5uKk4ATvKIkYyqLZxWdk63gmGEUB3/U4LyT3fQ==";
|
|
193
|
+
function L(e) {
|
|
194
|
+
return JSON.stringify(y(e));
|
|
195
|
+
}
|
|
196
|
+
function y(e) {
|
|
197
|
+
return Object.entries(e).reduce(
|
|
198
|
+
(n, [r, o]) => (n[A(r)] = typeof o == "object" ? y(o) : o, n),
|
|
199
|
+
{}
|
|
200
|
+
);
|
|
201
|
+
}
|
|
202
|
+
function A(e) {
|
|
203
|
+
return e.replace(/[A-Z]/g, (t) => `_${t.toLowerCase()}`);
|
|
204
|
+
}
|
|
205
|
+
async function O(e) {
|
|
206
|
+
const { wasmSrc: t, settings: n } = e, r = typeof t == "string" ? await F(t) : t, o = n ? L(n) : void 0, _ = await R({ wasm: r, settingsString: o });
|
|
207
|
+
return {
|
|
208
|
+
reader: E(_),
|
|
209
|
+
dispose: _.terminate
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
async function F(e) {
|
|
213
|
+
const t = await fetch(e, { integrity: B });
|
|
214
|
+
return await WebAssembly.compileStreaming(t);
|
|
215
|
+
}
|
|
216
|
+
export {
|
|
217
|
+
S as READER_SUPPORTED_FORMATS,
|
|
218
|
+
O as createC2pa,
|
|
219
|
+
d as isSupportedReaderFormat
|
|
220
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ReaderFactory } from './reader.js';
|
|
2
|
+
import { Settings } from './settings.js';
|
|
3
|
+
export interface Config {
|
|
4
|
+
/**
|
|
5
|
+
* URL to fetch the WASM binary or an already-instantiated WASM module.
|
|
6
|
+
*/
|
|
7
|
+
wasmSrc: string | WebAssembly.Module;
|
|
8
|
+
/**
|
|
9
|
+
* Settings for the SDK.
|
|
10
|
+
*/
|
|
11
|
+
settings?: Settings;
|
|
12
|
+
}
|
|
13
|
+
interface C2paSdk {
|
|
14
|
+
reader: ReaderFactory;
|
|
15
|
+
dispose: () => void;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Creates a new instance of c2pa-web by setting up a web worker and preparing a WASM binary.
|
|
19
|
+
*
|
|
20
|
+
* @param config - SDK configuration object.
|
|
21
|
+
* @returns An object providing access to factory methods for creating new reader objects.
|
|
22
|
+
*
|
|
23
|
+
* @example Creating a new SDK instance and reader:
|
|
24
|
+
* ```
|
|
25
|
+
* const c2pa = await createC2pa({ wasmSrc: 'url/hosting/wasm/binary' });
|
|
26
|
+
*
|
|
27
|
+
* const reader = await c2pa.reader.fromBlob(imageBlob.type, imageBlob);
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export declare function createC2pa(config: Config): Promise<C2paSdk>;
|
|
31
|
+
export {};
|
|
32
|
+
//# sourceMappingURL=c2pa.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"c2pa.d.ts","sourceRoot":"","sources":["../../src/lib/c2pa.ts"],"names":[],"mappings":"AASA,OAAO,EAAuB,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjE,OAAO,EAAE,QAAQ,EAAsB,MAAM,eAAe,CAAC;AAE7D,MAAM,WAAW,MAAM;IACrB;;OAEG;IACH,OAAO,EAAE,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC;IAErC;;OAEG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED,UAAU,OAAO;IACf,MAAM,EAAE,aAAa,CAAC;IACtB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAcjE"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2025 Adobe
|
|
3
|
+
* All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* NOTICE: Adobe permits you to use, modify, and distribute this file in
|
|
6
|
+
* accordance with the terms of the Adobe license agreement accompanying
|
|
7
|
+
* it.
|
|
8
|
+
*/
|
|
9
|
+
export declare class AssetTooLargeError extends Error {
|
|
10
|
+
constructor(size: number);
|
|
11
|
+
}
|
|
12
|
+
export declare class UnsupportedFormatError extends Error {
|
|
13
|
+
constructor(format: string);
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../src/lib/error.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,qBAAa,kBAAmB,SAAQ,KAAK;gBAC/B,IAAI,EAAE,MAAM;CAMzB;AAED,qBAAa,sBAAuB,SAAQ,KAAK;gBACnC,MAAM,EAAE,MAAM;CAI3B"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { WorkerManager } from './worker/workerManager.js';
|
|
2
|
+
export declare const MAX_SIZE_IN_BYTES: number;
|
|
3
|
+
export interface ReaderFactory {
|
|
4
|
+
/**
|
|
5
|
+
* Create a Reader from an asset's format and a blob of its bytes.
|
|
6
|
+
*
|
|
7
|
+
* @param format Asset format
|
|
8
|
+
* @param blob Blob of asset bytes
|
|
9
|
+
* @returns An object that provides methods for reading C2PA data from the provided asset.
|
|
10
|
+
*/
|
|
11
|
+
fromBlob: (format: string, blob: Blob) => Promise<Reader>;
|
|
12
|
+
fromBlobFragment: (format: string, init: Blob, fragment: Blob) => Promise<Reader>;
|
|
13
|
+
}
|
|
14
|
+
export interface Reader {
|
|
15
|
+
/**
|
|
16
|
+
* @returns The asset's full manifest store containing all its manifests, validation statuses, and the URI of the active manifest.
|
|
17
|
+
*/
|
|
18
|
+
manifestStore: () => Promise<any>;
|
|
19
|
+
/**
|
|
20
|
+
* @returns The label of the active manifest.
|
|
21
|
+
*/
|
|
22
|
+
activeLabel: () => Promise<string | null>;
|
|
23
|
+
/**
|
|
24
|
+
* Resolves a URI reference to a binary object (e.g. a thumbnail) in the resource store.
|
|
25
|
+
*
|
|
26
|
+
* @param uri URI of the binary object to resolve.
|
|
27
|
+
* @returns An array buffer of the resource's bytes.
|
|
28
|
+
*/
|
|
29
|
+
resourceToBuffer: (uri: string) => Promise<ArrayBuffer>;
|
|
30
|
+
/**
|
|
31
|
+
* Dispose of this Reader, freeing the memory it occupied and preventing further use. Call this whenever the Reader is no longer needed.
|
|
32
|
+
*/
|
|
33
|
+
free: () => Promise<void>;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
*
|
|
37
|
+
* @param worker - Worker (via WorkerManager) to be associated with this reader factory
|
|
38
|
+
* @returns Object containing reader creation methods
|
|
39
|
+
*/
|
|
40
|
+
export declare function createReaderFactory(worker: WorkerManager): ReaderFactory;
|
|
41
|
+
//# sourceMappingURL=reader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reader.d.ts","sourceRoot":"","sources":["../../src/lib/reader.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAG/D,eAAO,MAAM,iBAAiB,QAAU,CAAC;AAEzC,MAAM,WAAW,aAAa;IAC5B;;;;;;OAMG;IACH,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAE1D,gBAAgB,EAAE,CAChB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,IAAI,KACX,OAAO,CAAC,MAAM,CAAC,CAAC;CACtB;AAED,MAAM,WAAW,MAAM;IACrB;;OAEG;IACH,aAAa,EAAE,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC;IAElC;;OAEG;IACH,WAAW,EAAE,MAAM,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAE1C;;;;;OAKG;IACH,gBAAgB,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,WAAW,CAAC,CAAC;IAExD;;OAEG;IACH,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3B;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,aAAa,GAAG,aAAa,CAoDxE"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2025 Adobe
|
|
3
|
+
* All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* NOTICE: Adobe permits you to use, modify, and distribute this file in
|
|
6
|
+
* accordance with the terms of the Adobe license agreement accompanying
|
|
7
|
+
* it.
|
|
8
|
+
*/
|
|
9
|
+
export interface Settings {
|
|
10
|
+
trust?: TrustSettings;
|
|
11
|
+
verify?: VerifySettings;
|
|
12
|
+
}
|
|
13
|
+
interface TrustSettings {
|
|
14
|
+
userAnchors?: string;
|
|
15
|
+
trustAnchors?: string;
|
|
16
|
+
trustConfig?: string;
|
|
17
|
+
allowedList?: string;
|
|
18
|
+
}
|
|
19
|
+
interface VerifySettings {
|
|
20
|
+
verifyTrust?: boolean;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Converts a settings object to a JSON string of the structure expected by c2pa-rs.
|
|
24
|
+
*/
|
|
25
|
+
export declare function settingsToWasmJson(settings: Settings): string;
|
|
26
|
+
export {};
|
|
27
|
+
//# sourceMappingURL=settings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../src/lib/settings.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,WAAW,QAAQ;IACvB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,MAAM,CAAC,EAAE,cAAc,CAAC;CACzB;AAED,UAAU,aAAa;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,UAAU,cAAc;IACtB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAMD;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,QAAQ,UAEpD"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2025 Adobe
|
|
3
|
+
* All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* NOTICE: Adobe permits you to use, modify, and distribute this file in
|
|
6
|
+
* accordance with the terms of the Adobe license agreement accompanying
|
|
7
|
+
* it.
|
|
8
|
+
*/
|
|
9
|
+
export declare const READER_SUPPORTED_FORMATS: string[];
|
|
10
|
+
export declare function isSupportedReaderFormat(format: string): boolean;
|
|
11
|
+
//# sourceMappingURL=supportedFormats.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"supportedFormats.d.ts","sourceRoot":"","sources":["../../src/lib/supportedFormats.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,eAAO,MAAM,wBAAwB,UA0DpC,CAAC;AAEF,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAE/D"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2025 Adobe
|
|
3
|
+
* All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* NOTICE: Adobe permits you to use, modify, and distribute this file in
|
|
6
|
+
* accordance with the terms of the Adobe license agreement accompanying
|
|
7
|
+
* it.
|
|
8
|
+
*/
|
|
9
|
+
export interface WorkerRequest<T, K> {
|
|
10
|
+
method: T;
|
|
11
|
+
args: K;
|
|
12
|
+
transfer?: Transferable[];
|
|
13
|
+
}
|
|
14
|
+
export interface WorkerResponse<T> {
|
|
15
|
+
data: T;
|
|
16
|
+
transfer?: Transferable[];
|
|
17
|
+
}
|
|
18
|
+
export type WorkerFunctions = Record<string, (...args: any[]) => void | Promise<void> | WorkerResponse<any> | Promise<WorkerResponse<any>>>;
|
|
19
|
+
/**
|
|
20
|
+
* Prepares a worker with a list of functions to expose via postMessage and an initialization function
|
|
21
|
+
*
|
|
22
|
+
* @param functions Map of functions keyed by name
|
|
23
|
+
* @param init Initialization function to be called once when the worker is set up
|
|
24
|
+
*/
|
|
25
|
+
export declare function setupWorker(functions: WorkerFunctions): void;
|
|
26
|
+
//# sourceMappingURL=setupWorker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setupWorker.d.ts","sourceRoot":"","sources":["../../../src/lib/worker/setupWorker.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,MAAM,WAAW,aAAa,CAAC,CAAC,EAAE,CAAC;IACjC,MAAM,EAAE,CAAC,CAAC;IACV,IAAI,EAAE,CAAC,CAAC;IACR,QAAQ,CAAC,EAAE,YAAY,EAAE,CAAC;CAC3B;AAID,MAAM,WAAW,cAAc,CAAC,CAAC;IAC/B,IAAI,EAAE,CAAC,CAAC;IACR,QAAQ,CAAC,EAAE,YAAY,EAAE,CAAC;CAC3B;AAED,MAAM,MAAM,eAAe,GAAG,MAAM,CAClC,MAAM,EACN,CACE,GAAG,IAAI,EAAE,GAAG,EAAE,KACX,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,cAAc,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAC/E,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,SAAS,EAAE,eAAe,QAerD"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { WorkerDefinition } from '../worker.js';
|
|
2
|
+
import { WorkerRequest, WorkerResponse } from './setupWorker.js';
|
|
3
|
+
export interface WorkerManager {
|
|
4
|
+
execute: <T extends keyof WorkerDefinition, K extends WorkerDefinition[T]>(request: WorkerRequest<T, Parameters<K>>) => Promise<Awaited<ReturnType<K>> extends WorkerResponse<infer Data> ? Data : Awaited<ReturnType<K>>>;
|
|
5
|
+
terminate: () => void;
|
|
6
|
+
}
|
|
7
|
+
export interface CreateWorkerManagerConfig {
|
|
8
|
+
wasm: WebAssembly.Module;
|
|
9
|
+
settingsString?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Creates a new web worker and performs initialization steps:
|
|
13
|
+
* - Compile WASM
|
|
14
|
+
* - Load settings (if provided)
|
|
15
|
+
*
|
|
16
|
+
* @param config - configuration object
|
|
17
|
+
* @returns Facade providing convenient control over worker functions
|
|
18
|
+
*/
|
|
19
|
+
export declare function createWorkerManager(config: CreateWorkerManagerConfig): Promise<WorkerManager>;
|
|
20
|
+
//# sourceMappingURL=workerManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workerManager.d.ts","sourceRoot":"","sources":["../../../src/lib/worker/workerManager.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGjE,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,CAAC,CAAC,SAAS,MAAM,gBAAgB,EAAE,CAAC,SAAS,gBAAgB,CAAC,CAAC,CAAC,EACvE,OAAO,EAAE,aAAa,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,KACrC,OAAO,CACV,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS,cAAc,CAAC,MAAM,IAAI,CAAC,GACrD,IAAI,GACJ,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAC3B,CAAC;IACF,SAAS,EAAE,MAAM,IAAI,CAAC;CACvB;AAED,MAAM,WAAW,yBAAyB;IACxC,IAAI,EAAE,WAAW,CAAC,MAAM,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;;;;;GAOG;AACH,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,yBAAyB,GAChC,OAAO,CAAC,aAAa,CAAC,CAuBxB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2025 Adobe
|
|
3
|
+
* All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* NOTICE: Adobe permits you to use, modify, and distribute this file in
|
|
6
|
+
* accordance with the terms of the Adobe license agreement accompanying
|
|
7
|
+
* it.
|
|
8
|
+
*/
|
|
9
|
+
export declare function createWorkerObjectMap<T>(): {
|
|
10
|
+
add(object: T): number;
|
|
11
|
+
get(id: number): T;
|
|
12
|
+
remove(id: number): boolean;
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=workerObjectMap.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workerObjectMap.d.ts","sourceRoot":"","sources":["../../../src/lib/worker/workerObjectMap.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,wBAAgB,qBAAqB,CAAC,CAAC;gBAKvB,CAAC,GAAG,MAAM;YAMd,MAAM,GAAG,CAAC;eAUP,MAAM,GAAG,OAAO;EAI9B"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2025 Adobe
|
|
3
|
+
* All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* NOTICE: Adobe permits you to use, modify, and distribute this file in
|
|
6
|
+
* accordance with the terms of the Adobe license agreement accompanying
|
|
7
|
+
* it.
|
|
8
|
+
*/
|
|
9
|
+
export declare function postSuccess(payload?: any, transfer?: Transferable[]): void;
|
|
10
|
+
export declare function postError(error: unknown): void;
|
|
11
|
+
export interface ResponseHandlers {
|
|
12
|
+
onSuccess: (data?: any) => void;
|
|
13
|
+
onError: (error?: any) => void;
|
|
14
|
+
}
|
|
15
|
+
export declare function handleWorkerResponse(worker: Worker, responseHandlers: ResponseHandlers): void;
|
|
16
|
+
//# sourceMappingURL=workerResponse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workerResponse.d.ts","sourceRoot":"","sources":["../../../src/lib/worker/workerResponse.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,wBAAgB,WAAW,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,QAAQ,CAAC,EAAE,YAAY,EAAE,GAAG,IAAI,CAO1E;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAE9C;AAED,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,CAAC,IAAI,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;IAChC,OAAO,EAAE,CAAC,KAAK,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;CAChC;AAED,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,MAAM,EACd,gBAAgB,EAAE,gBAAgB,QAoBnC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { WorkerResponse } from './worker/setupWorker.js';
|
|
2
|
+
declare const workerFunctions: {
|
|
3
|
+
initWorker(module: WebAssembly.Module, settings?: string): Promise<void>;
|
|
4
|
+
reader_fromBlob(format: string, blob: Blob): Promise<WorkerResponse<number>>;
|
|
5
|
+
reader_fromBlobFragment(format: string, init: Blob, fragment: Blob): Promise<WorkerResponse<number>>;
|
|
6
|
+
reader_json(readerId: number): WorkerResponse<string>;
|
|
7
|
+
reader_activeLabel(readerId: number): WorkerResponse<string | null>;
|
|
8
|
+
reader_resourceToBuffer(readerId: number, uri: string): WorkerResponse<ArrayBuffer>;
|
|
9
|
+
reader_free(readerId: number): void;
|
|
10
|
+
};
|
|
11
|
+
export type WorkerDefinition = typeof workerFunctions;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=worker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker.d.ts","sourceRoot":"","sources":["../../src/lib/worker.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH,OAAO,EAGL,cAAc,EACf,MAAM,yBAAyB,CAAC;AAKjC,QAAA,MAAM,eAAe;uBACM,WAAW,CAAC,MAAM,aAAa,MAAM;4BAUpD,MAAM,QACR,IAAI,GACT,OAAO,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;oCAOxB,MAAM,QACR,IAAI,YACA,IAAI,GACb,OAAO,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;0BAOZ,MAAM,GAAG,cAAc,CAAC,MAAM,CAAC;iCAIxB,MAAM,GAAG,cAAc,CAAC,MAAM,GAAG,IAAI,CAAC;sCAKvD,MAAM,OACX,MAAM,GACV,cAAc,CAAC,WAAW,CAAC;0BAKR,MAAM;CAKH,CAAC;AAE5B,MAAM,MAAM,gBAAgB,GAAG,OAAO,eAAe,CAAC"}
|
|
Binary file
|
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
import baseConfig from '../../eslint.config.mjs';
|
|
10
|
+
|
|
11
|
+
export default [
|
|
12
|
+
...baseConfig,
|
|
13
|
+
{
|
|
14
|
+
files: ['**/*.json'],
|
|
15
|
+
rules: {
|
|
16
|
+
'@nx/dependency-checks': [
|
|
17
|
+
'error',
|
|
18
|
+
{
|
|
19
|
+
ignoredFiles: [
|
|
20
|
+
'{projectRoot}/eslint.config.{js,cjs,mjs,ts,cts,mts}',
|
|
21
|
+
'{projectRoot}/vite.config.{js,ts,mjs,mts}',
|
|
22
|
+
],
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
},
|
|
26
|
+
languageOptions: {
|
|
27
|
+
parser: await import('jsonc-eslint-parser'),
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
];
|
package/package.json
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@contentauth/c2pa-web",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"module": "./dist/index.js",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
"./package.json": "./package.json",
|
|
9
|
+
".": {
|
|
10
|
+
"development": "./src/index.ts",
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js",
|
|
13
|
+
"default": "./dist/index.js"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@contentauth/c2pa-wasm": "workspace:*"
|
|
18
|
+
},
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"@playwright/test": "^1.55.0",
|
|
21
|
+
"@types/ssri": "^7.1.5",
|
|
22
|
+
"@vitest/browser": "^3.2.4",
|
|
23
|
+
"rimraf": "^6.0.1"
|
|
24
|
+
},
|
|
25
|
+
"scripts": {}
|
|
26
|
+
}
|
package/project.json
ADDED
package/src/index.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
export * from './lib/c2pa.js';
|
|
11
|
+
export {
|
|
12
|
+
isSupportedReaderFormat,
|
|
13
|
+
READER_SUPPORTED_FORMATS,
|
|
14
|
+
} from './lib/supportedFormats.js';
|
|
15
|
+
export { type Settings } from './lib/settings.js';
|