Skip to content

Commit

Permalink
Merge pull request #3120 from numbersprotocol/milestone-v231017
Browse files Browse the repository at this point in the history
  • Loading branch information
shc261392 authored Nov 30, 2023
2 parents 1d5a372 + df8b55a commit d0edc61
Show file tree
Hide file tree
Showing 13 changed files with 333 additions and 71 deletions.
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.87.0] - 2023-11-30

### Added

1. Feature add integrity sha on asset creation (#3094)
1. Feature Add the API key to the header in the API that creates an asset to record the service_name of assets (#3117)

## [0.86.4] - 2023-11-11

### Added
Expand Down Expand Up @@ -2213,7 +2220,8 @@ This is the first release! _Capture Lite_ is a cross-platform app adapted from [
- Web - see the demo [here](https://github.com/numbersprotocol/capture-lite#demo-app)
- Android - the APK file `app-debug.apk` is attached to this release

[unreleased]: https://github.com/numbersprotocol/capture-lite/compare/0.86.4...HEAD
[unreleased]: https://github.com/numbersprotocol/capture-lite/compare/0.87.0...HEAD
[0.87.0]: https://github.com/numbersprotocol/capture-lite/compare/0.86.4...0.87.0
[0.86.4]: https://github.com/numbersprotocol/capture-lite/compare/0.83.2...0.86.4
[0.83.2]: https://github.com/numbersprotocol/capture-lite/compare/0.82.4...0.85.2
[0.82.4]: https://github.com/numbersprotocol/capture-lite/compare/0.82.4...0.83.2
Expand Down
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ android {
applicationId "io.numbersprotocol.capturelite"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 864
versionName "0.86.4"
versionCode 870
versionName "0.87.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildFeatures {
Expand Down
8 changes: 4 additions & 4 deletions ios/App/App.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -368,13 +368,13 @@
CODE_SIGN_ENTITLEMENTS = App/App.entitlements;
CODE_SIGN_IDENTITY = "iPhone Distribution";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 864;
CURRENT_PROJECT_VERSION = 870;
DEVELOPMENT_TEAM = G7NB5YCKAP;
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = G7NB5YCKAP;
INFOPLIST_FILE = App/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 15.6;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 0.86.4;
MARKETING_VERSION = 0.87.0;
OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" \"-DDEBUG\"";
PRODUCT_BUNDLE_IDENTIFIER = io.numbersprotocol.capturelite;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -395,13 +395,13 @@
CODE_SIGN_ENTITLEMENTS = App/App.entitlements;
CODE_SIGN_IDENTITY = "iPhone Distribution";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 864;
CURRENT_PROJECT_VERSION = 870;
DEVELOPMENT_TEAM = G7NB5YCKAP;
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = G7NB5YCKAP;
INFOPLIST_FILE = App/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 15.6;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 0.86.4;
MARKETING_VERSION = 0.87.0;
PRODUCT_BUNDLE_IDENTIFIER = io.numbersprotocol.capturelite;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = NumbersAppDistributionV4;
Expand Down
139 changes: 137 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "capture-lite",
"version": "0.86.4",
"version": "0.87.0",
"author": "numbersprotocol",
"homepage": "https://numbersprotocol.io/",
"scripts": {
Expand Down Expand Up @@ -75,6 +75,7 @@
"capacitor-native-settings": "^4.0.3",
"compressorjs": "^1.0.7",
"cordova-plugin-purchase": "^11.0.0",
"ethers": "^6.8.1",
"hammerjs": "^2.0.8",
"immutable": "^4.0.0-rc.14",
"lodash-es": "^4.17.21",
Expand Down
38 changes: 23 additions & 15 deletions src/app/shared/collector/collector.service.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { Injectable } from '@angular/core';
import { CameraSource } from '@capacitor/camera';
import { generateIntegritySha } from '../../utils/nit/nit';
import { MediaStore } from '../media/media-store/media-store.service';
import {
Assets,
getSerializedSortedSignedMessage,
Proof,
Signatures,
SignedMessage,
ProofMetadata,
SignResult,
Truth,
} from '../repositories/proof/proof';
import { FactsProvider } from './facts/facts-provider';
Expand All @@ -25,17 +25,25 @@ export class CollectorService {
async run(assets: Assets, capturedTimestamp: number, source: CameraSource) {
const truth = await this.collectTruth(assets, capturedTimestamp);
const proof = await Proof.from(this.mediaStore, assets, truth);
await this.generateSignature(proof, source);
proof.cameraSource = source;
await this.generateSignature(proof, proof.cameraSource);
proof.isCollected = true;
return proof;
}

// FIXME: @sultanmyrza get cameraSource from proof.cameraSource instead of passing separately
// TODO: @sultanmyrza remove 2nd parameter and make sure all other places get called accordinglyt
async generateSignature(proof: Proof, source: CameraSource) {
const recorder =
CaptureAppWebCryptoApiSignatureProvider.recorderFor(source);
const signedMessage = await proof.generateSignedMessage(recorder);
const signatures = await this.signMessage(signedMessage, source);
const recorder = CaptureAppWebCryptoApiSignatureProvider.recorderFor(
proof.cameraSource
);
const proofMetadata = await proof.generateProofMetadata(recorder);
const { signatures, integritySha } = await this.signProofMetadata(
proofMetadata,
source
);
proof.setSignatures(signatures);
proof.setIntegritySha(integritySha);
return proof;
}

Expand All @@ -56,20 +64,20 @@ export class CollectorService {
};
}

private async signMessage(
message: SignedMessage,
private async signProofMetadata(
proofMetadata: ProofMetadata,
source: CameraSource
): Promise<Signatures> {
const serializedSortedSignedMessage =
getSerializedSortedSignedMessage(message);
return Object.fromEntries(
): Promise<SignResult> {
const integritySha = await generateIntegritySha(proofMetadata);
const signatures = Object.fromEntries(
await Promise.all(
[...this.signatureProviders].map(async provider => [
provider.idFor(source),
await provider.provide(serializedSortedSignedMessage),
await provider.provide(integritySha),
])
)
);
return { signatures, integritySha };
}

addFactsProvider(provider: FactsProvider) {
Expand Down
Loading

0 comments on commit d0edc61

Please sign in to comment.