-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
11 changed files
with
1,541 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>com.kohlschutter.jacline</groupId> | ||
<artifactId>jacline-elemental2</artifactId> | ||
<version>1.0.2-SNAPSHOT</version> | ||
<relativePath>../pom.xml</relativePath> | ||
</parent> | ||
|
||
<artifactId>jacline-elemental2-webcrypto</artifactId> | ||
<packaging>jar</packaging> | ||
|
||
<description>Thin Java abstractions for the native Web Crypto APIs.</description> | ||
|
||
<properties> | ||
<kohlschutter.project.notice.file> | ||
${project.parent.basedir}/NOTICE</kohlschutter.project.notice.file> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>com.kohlschutter.jacline</groupId> | ||
<artifactId>jacline-elemental2-core</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.kohlschutter.jacline</groupId> | ||
<artifactId>jacline-elemental2-dom</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.kohlschutter.jacline</groupId> | ||
<artifactId>jacline-elemental2-promise</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
</dependencies> | ||
</project> |
12 changes: 12 additions & 0 deletions
12
jacline-elemental2/webcrypto/src/main/java/elemental2/webcrypto/CryptoKey.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package elemental2.webcrypto; | ||
import java.lang.String; | ||
import jsinterop.annotations.JsType; | ||
import jsinterop.annotations.JsPackage; | ||
import elemental2.core.JsObject; | ||
@JsType(isNative = true,namespace = JsPackage.GLOBAL) | ||
public class CryptoKey{ | ||
public JsObject algorithm; | ||
public boolean extractable; | ||
public String type; | ||
public JsObject usages; | ||
} |
9 changes: 9 additions & 0 deletions
9
jacline-elemental2/webcrypto/src/main/java/elemental2/webcrypto/CryptoKeyPair.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package elemental2.webcrypto; | ||
import jsinterop.annotations.JsType; | ||
import jsinterop.annotations.JsPackage; | ||
import elemental2.webcrypto.CryptoKey; | ||
@JsType(isNative = true,namespace = JsPackage.GLOBAL) | ||
public class CryptoKeyPair{ | ||
public CryptoKey privateKey; | ||
public CryptoKey publicKey; | ||
} |
8 changes: 8 additions & 0 deletions
8
jacline-elemental2/webcrypto/src/main/java/elemental2/webcrypto/WebCryptoGlobal.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package elemental2.webcrypto; | ||
import elemental2.webcrypto.webcrypto.Crypto; | ||
import jsinterop.annotations.JsType; | ||
import jsinterop.annotations.JsPackage; | ||
@JsType(isNative = true,name = "goog.global",namespace = JsPackage.GLOBAL) | ||
public class WebCryptoGlobal{ | ||
public static Crypto crypto; | ||
} |
19 changes: 19 additions & 0 deletions
19
...e-elemental2/webcrypto/src/main/java/elemental2/webcrypto/WebCryptoWorkerGlobalScope.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package elemental2.webcrypto; | ||
import jsinterop.annotations.JsProperty; | ||
import jsinterop.base.Js; | ||
import elemental2.webcrypto.webcrypto.Crypto; | ||
import elemental2.dom.WorkerGlobalScope; | ||
import jsinterop.annotations.JsOverlay; | ||
import jsinterop.annotations.JsType; | ||
import jsinterop.annotations.JsPackage; | ||
@JsType(isNative = true,name = "WorkerGlobalScope",namespace = JsPackage.GLOBAL) | ||
public interface WebCryptoWorkerGlobalScope extends WorkerGlobalScope{ | ||
@JsOverlay | ||
static WebCryptoWorkerGlobalScope of(WorkerGlobalScope o){ | ||
return Js.cast(o); | ||
} | ||
@JsProperty | ||
Crypto getCrypto(); | ||
@JsProperty | ||
void setCrypto(Crypto crypto); | ||
} |
221 changes: 221 additions & 0 deletions
221
jacline-elemental2/webcrypto/src/main/java/elemental2/webcrypto/webcrypto/Crypto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,221 @@ | ||
package elemental2.webcrypto.webcrypto; | ||
import elemental2.core.Uint32Array; | ||
import elemental2.core.BigUint64Array; | ||
import elemental2.core.Int16Array; | ||
import elemental2.core.BigInt64Array; | ||
import elemental2.webcrypto.webcrypto.SubtleCrypto; | ||
import jsinterop.annotations.JsProperty; | ||
import elemental2.core.Uint8Array; | ||
import elemental2.core.Uint8ClampedArray; | ||
import elemental2.core.Uint16Array; | ||
import jsinterop.base.Js; | ||
import jsinterop.annotations.JsOverlay; | ||
import elemental2.core.Int32Array; | ||
import java.lang.Object; | ||
import java.lang.String; | ||
import jsinterop.annotations.JsType; | ||
import elemental2.core.Int8Array; | ||
import jsinterop.annotations.JsPackage; | ||
@JsType(isNative = true,name = "webCrypto.Crypto",namespace = JsPackage.GLOBAL) | ||
public interface Crypto{ | ||
@JsType(isNative = true,name = "?",namespace = JsPackage.GLOBAL) | ||
public interface GetRandomValuesTypedArrayUnionType{ | ||
@JsOverlay | ||
static Crypto.GetRandomValuesTypedArrayUnionType of(Object o){ | ||
return Js.cast(o); | ||
} | ||
@JsOverlay | ||
default BigInt64Array asBigInt64Array(){ | ||
return Js.cast(this); | ||
} | ||
@JsOverlay | ||
default BigUint64Array asBigUint64Array(){ | ||
return Js.cast(this); | ||
} | ||
@JsOverlay | ||
default Int16Array asInt16Array(){ | ||
return Js.cast(this); | ||
} | ||
@JsOverlay | ||
default Int32Array asInt32Array(){ | ||
return Js.cast(this); | ||
} | ||
@JsOverlay | ||
default Int8Array asInt8Array(){ | ||
return Js.cast(this); | ||
} | ||
@JsOverlay | ||
default Uint16Array asUint16Array(){ | ||
return Js.cast(this); | ||
} | ||
@JsOverlay | ||
default Uint32Array asUint32Array(){ | ||
return Js.cast(this); | ||
} | ||
@JsOverlay | ||
default Uint8Array asUint8Array(){ | ||
return Js.cast(this); | ||
} | ||
@JsOverlay | ||
default Uint8ClampedArray asUint8ClampedArray(){ | ||
return Js.cast(this); | ||
} | ||
@JsOverlay | ||
default boolean isBigInt64Array(){ | ||
return (Object)this instanceof BigInt64Array; | ||
} | ||
@JsOverlay | ||
default boolean isBigUint64Array(){ | ||
return (Object)this instanceof BigUint64Array; | ||
} | ||
@JsOverlay | ||
default boolean isInt16Array(){ | ||
return (Object)this instanceof Int16Array; | ||
} | ||
@JsOverlay | ||
default boolean isInt32Array(){ | ||
return (Object)this instanceof Int32Array; | ||
} | ||
@JsOverlay | ||
default boolean isInt8Array(){ | ||
return (Object)this instanceof Int8Array; | ||
} | ||
@JsOverlay | ||
default boolean isUint16Array(){ | ||
return (Object)this instanceof Uint16Array; | ||
} | ||
@JsOverlay | ||
default boolean isUint32Array(){ | ||
return (Object)this instanceof Uint32Array; | ||
} | ||
@JsOverlay | ||
default boolean isUint8Array(){ | ||
return (Object)this instanceof Uint8Array; | ||
} | ||
@JsOverlay | ||
default boolean isUint8ClampedArray(){ | ||
return (Object)this instanceof Uint8ClampedArray; | ||
} | ||
} | ||
@JsType(isNative = true,name = "?",namespace = JsPackage.GLOBAL) | ||
public interface GetRandomValuesUnionType{ | ||
@JsOverlay | ||
static Crypto.GetRandomValuesUnionType of(Object o){ | ||
return Js.cast(o); | ||
} | ||
@JsOverlay | ||
default BigInt64Array asBigInt64Array(){ | ||
return Js.cast(this); | ||
} | ||
@JsOverlay | ||
default BigUint64Array asBigUint64Array(){ | ||
return Js.cast(this); | ||
} | ||
@JsOverlay | ||
default Int16Array asInt16Array(){ | ||
return Js.cast(this); | ||
} | ||
@JsOverlay | ||
default Int32Array asInt32Array(){ | ||
return Js.cast(this); | ||
} | ||
@JsOverlay | ||
default Int8Array asInt8Array(){ | ||
return Js.cast(this); | ||
} | ||
@JsOverlay | ||
default Uint16Array asUint16Array(){ | ||
return Js.cast(this); | ||
} | ||
@JsOverlay | ||
default Uint32Array asUint32Array(){ | ||
return Js.cast(this); | ||
} | ||
@JsOverlay | ||
default Uint8Array asUint8Array(){ | ||
return Js.cast(this); | ||
} | ||
@JsOverlay | ||
default Uint8ClampedArray asUint8ClampedArray(){ | ||
return Js.cast(this); | ||
} | ||
@JsOverlay | ||
default boolean isBigInt64Array(){ | ||
return (Object)this instanceof BigInt64Array; | ||
} | ||
@JsOverlay | ||
default boolean isBigUint64Array(){ | ||
return (Object)this instanceof BigUint64Array; | ||
} | ||
@JsOverlay | ||
default boolean isInt16Array(){ | ||
return (Object)this instanceof Int16Array; | ||
} | ||
@JsOverlay | ||
default boolean isInt32Array(){ | ||
return (Object)this instanceof Int32Array; | ||
} | ||
@JsOverlay | ||
default boolean isInt8Array(){ | ||
return (Object)this instanceof Int8Array; | ||
} | ||
@JsOverlay | ||
default boolean isUint16Array(){ | ||
return (Object)this instanceof Uint16Array; | ||
} | ||
@JsOverlay | ||
default boolean isUint32Array(){ | ||
return (Object)this instanceof Uint32Array; | ||
} | ||
@JsOverlay | ||
default boolean isUint8Array(){ | ||
return (Object)this instanceof Uint8Array; | ||
} | ||
@JsOverlay | ||
default boolean isUint8ClampedArray(){ | ||
return (Object)this instanceof Uint8ClampedArray; | ||
} | ||
} | ||
@JsOverlay | ||
default Crypto.GetRandomValuesUnionType getRandomValues(BigInt64Array typedArray){ | ||
return getRandomValues(Js.<Crypto.GetRandomValuesTypedArrayUnionType>uncheckedCast(typedArray)); | ||
} | ||
@JsOverlay | ||
default Crypto.GetRandomValuesUnionType getRandomValues(BigUint64Array typedArray){ | ||
return getRandomValues(Js.<Crypto.GetRandomValuesTypedArrayUnionType>uncheckedCast(typedArray)); | ||
} | ||
Crypto.GetRandomValuesUnionType getRandomValues(Crypto.GetRandomValuesTypedArrayUnionType typedArray); | ||
@JsOverlay | ||
default Crypto.GetRandomValuesUnionType getRandomValues(Int16Array typedArray){ | ||
return getRandomValues(Js.<Crypto.GetRandomValuesTypedArrayUnionType>uncheckedCast(typedArray)); | ||
} | ||
@JsOverlay | ||
default Crypto.GetRandomValuesUnionType getRandomValues(Int32Array typedArray){ | ||
return getRandomValues(Js.<Crypto.GetRandomValuesTypedArrayUnionType>uncheckedCast(typedArray)); | ||
} | ||
@JsOverlay | ||
default Crypto.GetRandomValuesUnionType getRandomValues(Int8Array typedArray){ | ||
return getRandomValues(Js.<Crypto.GetRandomValuesTypedArrayUnionType>uncheckedCast(typedArray)); | ||
} | ||
@JsOverlay | ||
default Crypto.GetRandomValuesUnionType getRandomValues(Uint16Array typedArray){ | ||
return getRandomValues(Js.<Crypto.GetRandomValuesTypedArrayUnionType>uncheckedCast(typedArray)); | ||
} | ||
@JsOverlay | ||
default Crypto.GetRandomValuesUnionType getRandomValues(Uint32Array typedArray){ | ||
return getRandomValues(Js.<Crypto.GetRandomValuesTypedArrayUnionType>uncheckedCast(typedArray)); | ||
} | ||
@JsOverlay | ||
default Crypto.GetRandomValuesUnionType getRandomValues(Uint8Array typedArray){ | ||
return getRandomValues(Js.<Crypto.GetRandomValuesTypedArrayUnionType>uncheckedCast(typedArray)); | ||
} | ||
@JsOverlay | ||
default Crypto.GetRandomValuesUnionType getRandomValues(Uint8ClampedArray typedArray){ | ||
return getRandomValues(Js.<Crypto.GetRandomValuesTypedArrayUnionType>uncheckedCast(typedArray)); | ||
} | ||
@JsProperty | ||
SubtleCrypto getSubtle(); | ||
String randomUUID(); | ||
@JsProperty | ||
void setSubtle(SubtleCrypto subtle); | ||
} |
27 changes: 27 additions & 0 deletions
27
jacline-elemental2/webcrypto/src/main/java/elemental2/webcrypto/webcrypto/JsonWebKey.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package elemental2.webcrypto.webcrypto; | ||
import elemental2.webcrypto.webcrypto.RsaOtherPrimesInfo; | ||
import java.lang.String; | ||
import jsinterop.annotations.JsType; | ||
import jsinterop.annotations.JsPackage; | ||
import elemental2.core.JsArray; | ||
@JsType(isNative = true,name = "webCrypto.JsonWebKey",namespace = JsPackage.GLOBAL) | ||
public class JsonWebKey{ | ||
public String alg; | ||
public String crv; | ||
public String d; | ||
public String dp; | ||
public String dq; | ||
public String e; | ||
public boolean ext; | ||
public String k; | ||
public JsArray<String> key_ops; | ||
public String kty; | ||
public String n; | ||
public JsArray<RsaOtherPrimesInfo> oth; | ||
public String p; | ||
public String q; | ||
public String qi; | ||
public String use; | ||
public String x; | ||
public String y; | ||
} |
10 changes: 10 additions & 0 deletions
10
...elemental2/webcrypto/src/main/java/elemental2/webcrypto/webcrypto/RsaOtherPrimesInfo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package elemental2.webcrypto.webcrypto; | ||
import java.lang.String; | ||
import jsinterop.annotations.JsType; | ||
import jsinterop.annotations.JsPackage; | ||
@JsType(isNative = true,name = "webCrypto.RsaOtherPrimesInfo",namespace = JsPackage.GLOBAL) | ||
public class RsaOtherPrimesInfo{ | ||
public String d; | ||
public String r; | ||
public String t; | ||
} |
Oops, something went wrong.