Skip to content

Commit

Permalink
Merge branch 'multiplatform' into master
Browse files Browse the repository at this point in the history
* origin/multiplatform:
  Multiplatform support
  • Loading branch information
rocketraman committed Aug 24, 2022
2 parents f2ed659 + fb66208 commit ae0078c
Show file tree
Hide file tree
Showing 24 changed files with 1,583 additions and 373 deletions.
30 changes: 30 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,16 @@
*.war
*.ear

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

### Gradle template
.gradle
build/

# Ignore Gradle GUI config
gradle-app.setting

# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
!gradle-wrapper.jar

Expand All @@ -57,6 +63,30 @@ build/
# Linux trash folder which might appear on any partition or disk
.Trash-*


### Android template
# Built application files
*.apk
*.ap_
*.aab
output-metadata.json

# Files for the Dalvik VM
*.dex

# Generated files
gen/
shared/shared.podspec

# Gradle files
/*/build/

# Local configuration file (sdk path, etc)
local.properties

# Proguard folder generated by Eclipse
proguard/

# Log Files
*.log
*.hprof
Expand Down
8 changes: 0 additions & 8 deletions .idea/.gitignore

This file was deleted.

50 changes: 11 additions & 39 deletions .idea/codeStyles/Project.xml

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

3 changes: 3 additions & 0 deletions .idea/kotlinc.xml

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

13 changes: 11 additions & 2 deletions .idea/misc.xml

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

2 changes: 1 addition & 1 deletion .idea/vcs.xml

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

8 changes: 5 additions & 3 deletions README.adoc
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# Hawk(ish) Bewit — Signed Links

image:https://img.shields.io/github/v/tag/innertech/hawkish-bewit[GitHub tag (latest by date),link="https://github.com/innertech/hawkish-bewit/releases"]
image:https://img.shields.io/badge/kotlin-1.7.10-blue.svg?logo=kotlin[Kotlin,link="http://kotlinlang.org"]
image:https://img.shields.io/maven-central/v/tech.inner/hawkish-bewit[Maven Central,link="https://search.maven.org/search?q=g:tech.inner+a:hawkish-bewit"]
image:https://img.shields.io/github/license/innertech/hawkish-bewit["GitHub license",link="https://github.com/innertech/hawkish-bewit/blob/master/LICENSE"]

A loose implementation of https://github.com/mozilla/hawk/blob/main/API.md#single-uri-authorization[Hawk Bewit] in Kotlin.
A loose implementation of https://github.com/mozilla/hawk/blob/main/API.md#single-uri-authorization[Hawk Bewit] in Kotlin multi-platform, supporting JVM, Android, iOS, and JavaScript.

While https://github.com/mozilla/hawk[Hawk] never gained wide traction as an HTTP authentication scheme, we still find common need for an S3-style URI authorization scheme, in which a URI can be:

Expand All @@ -17,8 +19,8 @@ However, this is a single-purpose library inspired by Hawk, not a full hawk-comp
Bewits generated by this library are not compatible with bewits generated by other Hawk-compatible libraries:

* we *do not* implement the header-mode and the `dlg`, `app` and `ext` attributes
* we *do* validate the URL scheme
* the hawk version is set to `1a`, not `1`
* we *do* validate the URL scheme to protect against protocol downgrade attacks
* the hawk version is set to `1a`, not `1` to indicate incompatibility with Hawk
## Use Cases

Expand Down
100 changes: 25 additions & 75 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,84 +1,34 @@
plugins {
kotlin("jvm") version "1.7.10"
id("org.jetbrains.dokka") version "1.7.10"
signing
`maven-publish`
}

group = "tech.inner"
version = "1.2"

repositories {
mavenCentral()
}

dependencies {
implementation(kotlin("stdlib-jdk8"))
group = LibraryConstants.group
version = LibraryConstants.versionName

testApi("org.junit.jupiter:junit-jupiter-api:5.8.2")
testImplementation("com.mercateo:test-clock:1.0.2")
testImplementation("io.strikt:strikt-core:0.33.0")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.8.2")
}

val dokkaHtml by tasks.getting(org.jetbrains.dokka.gradle.DokkaTask::class)

val javadocJar: TaskProvider<Jar> by tasks.registering(Jar::class) {
dependsOn(dokkaHtml)
archiveClassifier.set("javadoc")
from(dokkaHtml.outputDirectory)
}

java {
withSourcesJar()
buildscript {
repositories {
google()
mavenCentral()
maven("https://repo.repsy.io/mvn/chrynan/public")
}
dependencies {
classpath("com.android.tools.build:gradle:7.2.2")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.10")
classpath("org.jetbrains.dokka:dokka-gradle-plugin:1.7.10")
}
}

tasks.named<Test>("test") {
useJUnitPlatform()
}
apply(plugin = "org.jetbrains.dokka")

publishing {
publications {
create<MavenPublication>("mavenCentral") {
artifact(javadocJar)
from(components["java"])
pom {
name.set(project.name)
description.set("Signed URLs loosely using Hawk Bewits")
url.set("https://github.com/innertech/hawk-bewit")
licenses {
license {
name.set("The Apache License, Version 2.0")
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
}
}
developers {
developer {
id.set("rocketraman")
name.set("Raman Gupta")
email.set("rocketraman@gmail.com")
}
}
scm {
connection.set("scm:git:git@github.com:rocketraman/bootable.git")
developerConnection.set("scm:git:ssh://github.com:rocketraman/bootable.git")
url.set("https://github.com/innertech/hawk-bewit")
}
}
}
}
allprojects {
repositories {
maven {
url = uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2")
credentials {
username = project.findProperty("sonatypeUser") as? String
password = project.findProperty("sonatypePassword") as? String
}
}
google()
mavenCentral()
maven("https://repo.repsy.io/mvn/chrynan/public")
}
}

signing {
useGpgCmd()
sign(publishing.publications["mavenCentral"])
rootProject.plugins.withType<org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootPlugin> {
rootProject.the<org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension>().nodeVersion = "16.0.0"
}

// Documentation
tasks.named<org.jetbrains.dokka.gradle.DokkaMultiModuleTask>("dokkaGfmMultiModule").configure {
outputDirectory.set(file("${projectDir.path}/docs"))
}
8 changes: 8 additions & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
plugins {
`kotlin-dsl`
`kotlin-dsl-precompiled-script-plugins`
}

repositories {
mavenCentral()
}
12 changes: 12 additions & 0 deletions buildSrc/src/main/kotlin/LibraryConstants.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
object LibraryConstants {
const val group = "tech.inner"
const val owner = "innertech"
const val versionName = "1.2"
const val versionCode = 1

object Android {
const val compileSdkVersion = 30
const val minSdkVersion = 23
const val targetSdkVersion = 29
}
}
7 changes: 6 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
kotlin.code.style=official
kotlin.code.style=official
kotlin.mpp.stability.nowarn=true
kotlin.native.distribution.type=prebuilt
#kotlin.native.binary.memoryModel=experimental
kotlin.native.ignoreDisabledTargets=true
android.useAndroidX=true
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit ae0078c

Please sign in to comment.