simple-c2pa

This is a fork of https://gitlab.com/guardianproject/proofmode/simple-c2pa
git clone git://archive.git.mtrnord.blog/mtrnords-photography-manager/simple-c2pa.git
Log | Files | Refs | README | LICENSE

README.md (2670B)


      1 # Simple-C2PA Rust Library
      2 
      3 This project builds upon the C2PA Rust library (https://github.com/contentauth/c2pa-rs) to provide an easy solution for mobile apps to add signed C2PA actions, claims, and attestations to media files. It also includes support for generating a private key and self-signed x509 certificate entirely locally on the device.
      4 
      5 ## DISCLAIMER
      6 
      7 This is still very much "alpha" work, and is it the process of being reorganized a bit on the interface front. However, it does function as expected, and can be used on Android via Maven (https://gitlab.com/guardianproject/proofmode/simple-c2pa/-/packages) and iOS via Swift Package Manager.
      8 
      9 ## How To Use This
     10 
     11 See the tests/examples.rs file for the current set of capabilities we have implemented.
     12 
     13 ## Installing the Android Library
     14 
     15 First, add our Maven repository to your project
     16 
     17 ```
     18     allprojects {
     19     	repositories {
     20         	...
     21     		maven {
     22     			url = uri("https://gitlab.com/api/v4/projects/51891540/packages/maven")
     23     		}
     24            	...
     25         }
     26     }
     27 ```
     28 
     29 Then, import the simple-c2pa library, currently at version 0.0.13.
     30 
     31 `implementation("info.guardianproject:simple-c2pa:0.0.13")`
     32 
     33 ## Sample Kotlin code
     34 
     35 ```
     36 val rootCert = createRootCertificate(null, null)
     37 val contentCert = createContentCredentialsCertificate(rootCert, null, null)
     38 val fileData = FileData(imagePath, null, fileName)
     39 val cc = ContentCredentials(contentCert, fileData, null)
     40 cc.addCreatedAssertion()
     41 cc.embedManifest(outputPath)
     42 ```
     43 
     44 ## Installing the iOS Library
     45 
     46 Add the SimpleC2PA Swift package in Xcode with the repository URL https://gitlab.com/guardianproject/proofmode/simple-c2pa. The current version is 0.0.13.
     47 
     48 ## Sample Swift code
     49 
     50 ```
     51 let rootCert = try! createRootCertificate(organization: nil, validityDays: nil);
     52 let contentCert = try! createContentCredentialsCertificate(rootCertificate: rootCert, organization: nil, validityDays: nil)
     53 let fileData = FileData(path: imagePath, bytes: nil, fileName: filename)
     54 let cc = ContentCredentials(certificate: contentCert, file: fileData, applicationInfo: nil)
     55 try! cc.addCreatedAssertion()
     56 try! cc.embedManifest(outputPath: outputPath)
     57 ```
     58 
     59 ## Build Android library
     60 
     61 Build the native Android library yourself using [cargo-make](https://github.com/sagiegurari/cargo-make) with the command `cargo make android-build`. You will also need Docker installed and the latest version of [cross](https://github.com/cross-rs/cross).
     62 
     63 ## Build Apple library
     64 
     65 Build the native Apple library yourself using [cargo-make](https://github.com/sagiegurari/cargo-make) with the command `cargo make apple-build`. You will need to run the command on a Mac with Xcode installed.