Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/kotlin-artifacts-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
LICENSE_NAME: 'MPL-2.0'
secrets:
OSSRH_USER: ${{ secrets.OSSRH_USER }}
OSSRH_URL: ${{secrets.OSSRH_SNAPSHOT_URL }}
OSSRH_URL: ${{secrets.RELEASE_URL }}
OSSRH_SECRET: ${{ secrets.OSSRH_SECRET }}
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }}
GPG_SECRET: ${{ secrets.GPG_SECRET }}
Expand Down
14 changes: 8 additions & 6 deletions js/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ Pixelpass is a library which can do multiple things which are listed below,
- Given a JSON String → `generateQRData` → Gives back CBOR encoded data.

- Given a CBOR encoded data as byte array → `decode` → Gives back JSON String.

- Given data as byteArray → `decodeBinary` → Gives back JSON String.

- Given a JSON and Mapper → `getMappedCborData` → Gives back CBOR encoded data.
- Given a JSON and Mapper → `getMappedData` → Gives back CBOR encoded data.

- Given a CBOR encoded data and Mapper → `decodeMappedCborData` → Gives back a JSON.
- Given a CBOR encoded data and Mapper → `decodeMappedData` → Gives back a JSON.

## Features

Expand All @@ -22,7 +24,7 @@ Pixelpass is a library which can do multiple things which are listed below,

- When JSON and a Mapper is given, it maps the JSON with Mapper and then does the CBOR encode/decode which further reduces the size of the data.

## Installation
## Usage
`npm i @mosip/pixelpass`

[npm](https://www.npmjs.com/package/@mosip/pixelpass)
Expand Down Expand Up @@ -91,7 +93,7 @@ const jsonString = decode(b45EncodedData);
```
The `decode` will take a `string` as parameter and gives us decoded JSON string which is Base45 `Decoded > CBOR Decoded > Decompressed`.

### decode( data )
### decodeBinary( data )

- `data` - Data needs to be decoded and decompressed without header.

Expand All @@ -101,7 +103,7 @@ import { decodeBinary } from '@mosip/pixelpass';
const zipdata = <zip-byte-array>;
const decompressedData = decodeBinary(zipdata);
```
The `decode` will take a `UInt8ByteArray` as parameter and gives us unzipped string. Currently only zip binary data is only supported.
The `decodeBinary` will take a `UInt8ByteArray` as parameter and gives us unzipped string. Currently only zip binary data is only supported.


### getMappedData( jsonData, mapper, cborEnable );
Expand Down Expand Up @@ -158,4 +160,4 @@ The example of the returned JSON would look like, `{"name": "Jhon", "id": "207",


## License
MIT
MPL-2.0
14 changes: 8 additions & 6 deletions kotlin/PixelPass/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
plugins {
alias(libs.plugins.androidLibrary)
alias(libs.plugins.jetbrainsKotlinAndroid)
alias(libs.plugins.dokka)
`maven-publish`
`signing`
signing
}
android {
namespace = "io.mosip.pixelpass"
Expand All @@ -22,11 +23,11 @@ android {
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = "21"
jvmTarget = "17"
}
}

Expand All @@ -49,6 +50,7 @@ tasks {

tasks.register<Jar>("jarRelease") {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
dependsOn("dokkaJavadoc")
dependsOn("assembleRelease")
from("build/intermediates/javac/release/classes") {
include("**/*.class")
Expand All @@ -58,10 +60,10 @@ tasks.register<Jar>("jarRelease") {
}
manifest {
attributes["Implementation-Title"] = project.name
attributes["Implementation-Version"] = "1.5-SNAPSHOT"
attributes["Implementation-Version"] = "0.5.0-SNAPSHOT"
}
archiveBaseName.set("${project.name}-release")
archiveVersion.set("1.5-SNAPSHOT")
archiveVersion.set("0.5.0-SNAPSHOT")
destinationDirectory.set(layout.buildDirectory.dir("libs"))
}
apply(from = "publish-artifact.gradle")
Expand Down
17 changes: 15 additions & 2 deletions kotlin/PixelPass/publish-artifact.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
def javadocJar = tasks.register('javadocJar', Jar) {
dependsOn "dokkaJavadoc"
archiveClassifier.set('javadoc')
from dokkaHtml.outputDirectory
}

def sourcesJar = tasks.register('sourcesJar', Jar) {
archiveClassifier.set('sources')
from(android.sourceSets.getByName("main").java.srcDirs)
}

publishing {
repositories {
maven {
Expand Down Expand Up @@ -90,7 +101,7 @@ publishing {
}
groupId = "io.mosip"
artifactId = "pixelpass-aar"
version = "0.5.0-SNAPSHOT"
version = "0.5.0"
if (project.gradle.startParameter.taskNames.any { it.contains('assembleRelease') }) {
artifacts {
aar {
Expand All @@ -104,7 +115,9 @@ publishing {
artifact(tasks.named("jarRelease").get())
groupId = "io.mosip"
artifactId = "pixelpass-jar"
version = "0.5.0-SNAPSHOT"
version = "0.5.0"
artifact(javadocJar)
artifact(sourcesJar)
pom {
withXml {
asNode().appendNode('name', "Pixelpass")
Expand Down
23 changes: 19 additions & 4 deletions kotlin/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,24 @@
- Uses zlib compression and base45 encoding
- Decode QR data encoded by PixelPass

## Installation
## Usage

Both Kotlin and Java packages are compiled from same Kotlin codebase. They are also deployed as aar and jar packages to maven. Below is how to use them.

### Kotlin

`implementation("io.mosip:pixelpass:0.5.0")`

### Java

```xml
<dependency>
<groupId>io.mosip</groupId>
<artifactId>pixelpass</artifactId>
<version>0.5.0</version>
</dependency>
```

todo :: add maven link

## APIs

Expand Down Expand Up @@ -51,12 +66,12 @@ returns a unzipped string

return a hex string which is a CBOR encoded JSON with given mapper if `cborEnable` is set to true. Or returns a JSON remapped string.

`decodeMappeData( data, mapper )`
`decodeMappedData( data, mapper )`

- `data` - A CBOR Encoded string or JSON string which needs to be re mapped.
- `mapper` - A Map which is used to map with the JSON.Which is a Map<String,String>

return a JSONObject which mapped with given mapper.

## License
MIT
MPL-2.0
1 change: 1 addition & 0 deletions kotlin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ plugins {
alias(libs.plugins.androidLibrary) apply false
alias(libs.plugins.jetbrainsKotlinAndroid) apply false
alias(libs.plugins.compose.compiler) apply false
alias(libs.plugins.dokka ) apply false
`maven-publish`
}
4 changes: 3 additions & 1 deletion kotlin/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ cbor = "0.9"
zxing = "3.5.3"
json = "20140107"
ztzip = "1.17"
dokka = "1.9.20"

[libraries]
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
Expand Down Expand Up @@ -44,4 +45,5 @@ ztzip = { group = "org.zeroturnaround", name = "zt-zip", version.ref = "ztzip" }
androidApplication = { id = "com.android.application", version.ref = "agp" }
androidLibrary = { id = "com.android.library", version.ref = "agp" }
jetbrainsKotlinAndroid = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" }
Loading