@contentauth/c2pa-node 0.2.0 → 0.2.2
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/Cargo.lock +4901 -0
- package/Cargo.toml +38 -0
- package/dist/index.node +0 -0
- package/package.json +17 -5
- package/scripts/postinstall.js +212 -0
- package/src/asset.rs +114 -0
- package/src/error.rs +104 -0
- package/src/lib.rs +185 -0
- package/src/neon_builder.rs +562 -0
- package/src/neon_credential_holder.rs +149 -0
- package/src/neon_identity_assertion_builder.rs +211 -0
- package/src/neon_identity_assertion_signer.rs +191 -0
- package/src/neon_reader.rs +197 -0
- package/src/neon_signer.rs +509 -0
- package/src/neon_trustmark.rs +241 -0
- package/src/runtime.rs +47 -0
- package/src/settings.rs +487 -0
- package/src/utils.rs +30 -0
package/src/lib.rs
ADDED
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
// Copyright 2025 Adobe. All rights reserved.
|
|
2
|
+
// This file is licensed to you under the Apache License,
|
|
3
|
+
// Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
|
|
4
|
+
// or the MIT license (http://opensource.org/licenses/MIT),
|
|
5
|
+
// at your option.
|
|
6
|
+
|
|
7
|
+
// Unless required by applicable law or agreed to in writing,
|
|
8
|
+
// this software is distributed on an "AS IS" BASIS, WITHOUT
|
|
9
|
+
// WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or
|
|
10
|
+
// implied. See the LICENSE-MIT and LICENSE-APACHE files for the
|
|
11
|
+
// specific language governing permissions and limitations under
|
|
12
|
+
// each license.
|
|
13
|
+
|
|
14
|
+
use neon::prelude::*;
|
|
15
|
+
|
|
16
|
+
mod asset;
|
|
17
|
+
mod error;
|
|
18
|
+
mod runtime;
|
|
19
|
+
mod settings;
|
|
20
|
+
mod utils;
|
|
21
|
+
|
|
22
|
+
pub mod neon_builder;
|
|
23
|
+
pub mod neon_credential_holder;
|
|
24
|
+
pub mod neon_identity_assertion_builder;
|
|
25
|
+
pub mod neon_identity_assertion_signer;
|
|
26
|
+
pub mod neon_reader;
|
|
27
|
+
pub mod neon_signer;
|
|
28
|
+
pub mod neon_trustmark;
|
|
29
|
+
|
|
30
|
+
#[neon::main]
|
|
31
|
+
fn main(mut cx: ModuleContext) -> NeonResult<()> {
|
|
32
|
+
// Builder
|
|
33
|
+
cx.export_function("builderNew", neon_builder::NeonBuilder::new)?;
|
|
34
|
+
cx.export_function("builderWithJson", neon_builder::NeonBuilder::with_json)?;
|
|
35
|
+
cx.export_function("builderSetNoEmbed", neon_builder::NeonBuilder::set_no_embed)?;
|
|
36
|
+
cx.export_function(
|
|
37
|
+
"builderSetRemote_url",
|
|
38
|
+
neon_builder::NeonBuilder::set_remote_url,
|
|
39
|
+
)?;
|
|
40
|
+
cx.export_function(
|
|
41
|
+
"builderAddAssertion",
|
|
42
|
+
neon_builder::NeonBuilder::add_assertion,
|
|
43
|
+
)?;
|
|
44
|
+
cx.export_function(
|
|
45
|
+
"builderAddResource",
|
|
46
|
+
neon_builder::NeonBuilder::add_resource,
|
|
47
|
+
)?;
|
|
48
|
+
cx.export_function(
|
|
49
|
+
"builderAddIngredient",
|
|
50
|
+
neon_builder::NeonBuilder::add_ingredient,
|
|
51
|
+
)?;
|
|
52
|
+
cx.export_function("builderToArchive", neon_builder::NeonBuilder::to_archive)?;
|
|
53
|
+
cx.export_function(
|
|
54
|
+
"builderFromArchive",
|
|
55
|
+
neon_builder::NeonBuilder::from_archive,
|
|
56
|
+
)?;
|
|
57
|
+
cx.export_function("builderSign", neon_builder::NeonBuilder::sign)?;
|
|
58
|
+
cx.export_function(
|
|
59
|
+
"builderSignConfigAsync",
|
|
60
|
+
neon_builder::NeonBuilder::sign_config_async,
|
|
61
|
+
)?;
|
|
62
|
+
cx.export_function("builderSignAsync", neon_builder::NeonBuilder::sign_async)?;
|
|
63
|
+
cx.export_function(
|
|
64
|
+
"builderIdentitySignAsync",
|
|
65
|
+
neon_builder::NeonBuilder::identity_sign_async,
|
|
66
|
+
)?;
|
|
67
|
+
cx.export_function(
|
|
68
|
+
"builderManifestDefinition",
|
|
69
|
+
neon_builder::NeonBuilder::manifest_definition,
|
|
70
|
+
)?;
|
|
71
|
+
cx.export_function(
|
|
72
|
+
"builderUpdateManifestProperty",
|
|
73
|
+
neon_builder::NeonBuilder::update_manifest_property,
|
|
74
|
+
)?;
|
|
75
|
+
|
|
76
|
+
// Reader
|
|
77
|
+
cx.export_function("readerNew", neon_reader::NeonReader::new)?;
|
|
78
|
+
cx.export_function("readerFromAsset", neon_reader::NeonReader::from_stream)?;
|
|
79
|
+
cx.export_function(
|
|
80
|
+
"readerFromManifestDataAndAsset",
|
|
81
|
+
neon_reader::NeonReader::from_manifest_data_and_asset,
|
|
82
|
+
)?;
|
|
83
|
+
cx.export_function(
|
|
84
|
+
"readerFromManifestDataAndFile",
|
|
85
|
+
neon_reader::NeonReader::from_manifest_data_and_asset,
|
|
86
|
+
)?;
|
|
87
|
+
cx.export_function("readerJson", neon_reader::NeonReader::json)?;
|
|
88
|
+
cx.export_function("readerRemoteUrl", neon_reader::NeonReader::remote_url)?;
|
|
89
|
+
cx.export_function("readerIsEmbedded", neon_reader::NeonReader::is_embedded)?;
|
|
90
|
+
cx.export_function(
|
|
91
|
+
"readerResourceToAsset",
|
|
92
|
+
neon_reader::NeonReader::resource_to_asset,
|
|
93
|
+
)?;
|
|
94
|
+
cx.export_function(
|
|
95
|
+
"readerPostValidateCawg",
|
|
96
|
+
neon_reader::NeonReader::post_validate_cawg,
|
|
97
|
+
)?;
|
|
98
|
+
|
|
99
|
+
// Signers
|
|
100
|
+
cx.export_function("localSignerNew", neon_signer::NeonLocalSigner::new)?;
|
|
101
|
+
cx.export_function("localSignerSign", neon_signer::NeonLocalSigner::sign)?;
|
|
102
|
+
cx.export_function("localSignerAlg", neon_signer::NeonLocalSigner::alg)?;
|
|
103
|
+
cx.export_function("localSignerCerts", neon_signer::NeonLocalSigner::certs)?;
|
|
104
|
+
cx.export_function(
|
|
105
|
+
"localSignerReserveSize",
|
|
106
|
+
neon_signer::NeonLocalSigner::reserve_size,
|
|
107
|
+
)?;
|
|
108
|
+
cx.export_function(
|
|
109
|
+
"localSignerTimeAuthorityUrl",
|
|
110
|
+
neon_signer::NeonLocalSigner::time_authority_url,
|
|
111
|
+
)?;
|
|
112
|
+
cx.export_function(
|
|
113
|
+
"callbackSignerFromConfig",
|
|
114
|
+
neon_signer::NeonCallbackSigner::from_config,
|
|
115
|
+
)?;
|
|
116
|
+
cx.export_function(
|
|
117
|
+
"callbackSignerConfigFromJs",
|
|
118
|
+
neon_signer::callback_signer_config_from_js,
|
|
119
|
+
)?;
|
|
120
|
+
cx.export_function("callbackSignerSign", neon_signer::NeonCallbackSigner::sign)?;
|
|
121
|
+
cx.export_function("callbackSignerAlg", neon_signer::NeonCallbackSigner::alg)?;
|
|
122
|
+
cx.export_function(
|
|
123
|
+
"callbackSignerCerts",
|
|
124
|
+
neon_signer::NeonCallbackSigner::certs,
|
|
125
|
+
)?;
|
|
126
|
+
cx.export_function(
|
|
127
|
+
"callbackSignerReserveSize",
|
|
128
|
+
neon_signer::NeonCallbackSigner::reserve_size,
|
|
129
|
+
)?;
|
|
130
|
+
cx.export_function(
|
|
131
|
+
"callbackSignerTimeAuthorityUrl",
|
|
132
|
+
neon_signer::NeonCallbackSigner::time_authority_url,
|
|
133
|
+
)?;
|
|
134
|
+
|
|
135
|
+
// Identity Assertions
|
|
136
|
+
cx.export_function(
|
|
137
|
+
"identitySignerNew",
|
|
138
|
+
neon_identity_assertion_signer::NeonIdentityAssertionSigner::new,
|
|
139
|
+
)?;
|
|
140
|
+
cx.export_function(
|
|
141
|
+
"identitySignerAddIdentityAssertion",
|
|
142
|
+
neon_identity_assertion_signer::NeonIdentityAssertionSigner::add_identity_assertion,
|
|
143
|
+
)?;
|
|
144
|
+
cx.export_function(
|
|
145
|
+
"identityBuilderForCredentialHolder",
|
|
146
|
+
neon_identity_assertion_builder::NeonIdentityAssertionBuilder::for_credential_holder,
|
|
147
|
+
)?;
|
|
148
|
+
cx.export_function(
|
|
149
|
+
"identityBuilderAddReferencedAssertions",
|
|
150
|
+
neon_identity_assertion_builder::NeonIdentityAssertionBuilder::add_referenced_assertions,
|
|
151
|
+
)?;
|
|
152
|
+
cx.export_function(
|
|
153
|
+
"identityBuilderAddRoles",
|
|
154
|
+
neon_identity_assertion_builder::NeonIdentityAssertionBuilder::add_roles,
|
|
155
|
+
)?;
|
|
156
|
+
cx.export_function(
|
|
157
|
+
"newCallbackCredentialHolder",
|
|
158
|
+
neon_credential_holder::NeonCallbackCredentialHolder::from_js,
|
|
159
|
+
)?;
|
|
160
|
+
|
|
161
|
+
// Trustmark
|
|
162
|
+
cx.export_function(
|
|
163
|
+
"trustmarkNew",
|
|
164
|
+
neon_trustmark::NeonTrustmark::new_from_config,
|
|
165
|
+
)?;
|
|
166
|
+
cx.export_function("trustmarkEncode", neon_trustmark::NeonTrustmark::encode)?;
|
|
167
|
+
cx.export_function("trustmarkDecode", neon_trustmark::NeonTrustmark::decode)?;
|
|
168
|
+
|
|
169
|
+
// Settings
|
|
170
|
+
cx.export_function("loadSettings", settings::load_settings)?;
|
|
171
|
+
cx.export_function("loadSettingsToml", settings::load_settings_toml)?;
|
|
172
|
+
cx.export_function("getSettingsJson", settings::get_settings_json)?;
|
|
173
|
+
|
|
174
|
+
// Trust Settings
|
|
175
|
+
cx.export_function("loadTrustConfig", settings::load_trust_config)?;
|
|
176
|
+
cx.export_function("loadCawgTrustConfig", settings::load_cawg_trust_config)?;
|
|
177
|
+
cx.export_function("getTrustConfig", settings::get_trust_config)?;
|
|
178
|
+
cx.export_function("getCawgTrustConfig", settings::get_cawg_trust_config)?;
|
|
179
|
+
|
|
180
|
+
// Verify Settings
|
|
181
|
+
cx.export_function("loadVerifyConfig", settings::load_verify_config)?;
|
|
182
|
+
cx.export_function("getVerifyConfig", settings::get_verify_config)?;
|
|
183
|
+
|
|
184
|
+
Ok(())
|
|
185
|
+
}
|