@hpke/hybridkem-x25519-kyber768
Advanced tools
Comparing version 1.5.0 to 1.6.0
@@ -9,9 +9,9 @@ import { Hybridkem, KemId } from "@hpke/common"; | ||
* The instance of this class can be specified to the | ||
* {@link https://deno.land/x/hpke/core/mod.ts?s=CipherSuiteParams | CipherSuiteParams} as follows: | ||
* {@link https://jsr.io/@hpke/core/doc/~/CipherSuiteParams | CipherSuiteParams} as follows: | ||
* | ||
* @example | ||
* @example Use with `@hpke/core`: | ||
* | ||
* ```ts | ||
* import { Aes128Gcm, CipherSuite, HkdfSha256 } from "http://deno.land/x/hpke/core/mod.ts"; | ||
* import { HybridkemX25519Kyber768 } from "https://deno.land/x/hpke/x/hybridkem-x25519-kyber768/mod.ts"; | ||
* import { Aes128Gcm, CipherSuite, HkdfSha256 } from "@hpke/core"; | ||
* import { HybridkemX25519Kyber768 } from "@hpke/hybridkem-x25519-kyber768"; | ||
* const suite = new CipherSuite({ | ||
@@ -18,0 +18,0 @@ * kem: new HybridkemX25519Kyber768(), |
@@ -50,9 +50,9 @@ import { Dhkem, Hybridkem, KemId } from "@hpke/common"; | ||
* The instance of this class can be specified to the | ||
* {@link https://deno.land/x/hpke/core/mod.ts?s=CipherSuiteParams | CipherSuiteParams} as follows: | ||
* {@link https://jsr.io/@hpke/core/doc/~/CipherSuiteParams | CipherSuiteParams} as follows: | ||
* | ||
* @example | ||
* @example Use with `@hpke/core`: | ||
* | ||
* ```ts | ||
* import { Aes128Gcm, CipherSuite, HkdfSha256 } from "http://deno.land/x/hpke/core/mod.ts"; | ||
* import { HybridkemX25519Kyber768 } from "https://deno.land/x/hpke/x/hybridkem-x25519-kyber768/mod.ts"; | ||
* import { Aes128Gcm, CipherSuite, HkdfSha256 } from "@hpke/core"; | ||
* import { HybridkemX25519Kyber768 } from "@hpke/hybridkem-x25519-kyber768"; | ||
* const suite = new CipherSuite({ | ||
@@ -59,0 +59,0 @@ * kem: new HybridkemX25519Kyber768(), |
@@ -1,7 +0,7 @@ | ||
import { BaseError } from "@hpke/core"; | ||
/** | ||
* The base error class of kyber. | ||
*/ | ||
export declare class KyberError extends BaseError { | ||
export declare class KyberError extends Error { | ||
constructor(e: unknown); | ||
} | ||
//# sourceMappingURL=errors.d.ts.map |
@@ -1,6 +0,19 @@ | ||
import { BaseError } from "@hpke/core"; | ||
/** | ||
* The base error class of kyber. | ||
*/ | ||
export class KyberError extends BaseError { | ||
export class KyberError extends Error { | ||
constructor(e) { | ||
let message; | ||
if (e instanceof Error) { | ||
message = e.message; | ||
} | ||
else if (typeof e === "string") { | ||
message = e; | ||
} | ||
else { | ||
message = ""; | ||
} | ||
super(message); | ||
this.name = this.constructor.name; | ||
} | ||
} |
{ | ||
"name": "@hpke/hybridkem-x25519-kyber768", | ||
"version": "1.5.0", | ||
"version": "1.6.0", | ||
"description": "A Hybrid Public Key Encryption (HPKE) module extension for a hybrid post-quantum KEM, X25519Kyber768Draft00", | ||
@@ -44,5 +44,4 @@ "keywords": [ | ||
"@hpke/common": "^1.4.3", | ||
"@hpke/core": "^1.4.3", | ||
"@hpke/dhkem-x25519": "^1.4.3", | ||
"@noble/hashes": "^1.4.0" | ||
"@noble/hashes": "^1.5.0" | ||
}, | ||
@@ -52,2 +51,3 @@ "devDependencies": { | ||
"picocolors": "^1.0.0", | ||
"@hpke/core": "^1.4.3", | ||
"@deno/shim-deno": "~0.18.0" | ||
@@ -54,0 +54,0 @@ }, |
@@ -25,3 +25,2 @@ <h1 align="center">@hpke/hybridkem-x25519-kyber768</h1> | ||
- [Web Browsers](#web-browsers) | ||
- [Cloudflare Workers](#cloudflare-workers) | ||
- [Usage](#usage) | ||
@@ -32,33 +31,24 @@ - [Contributing](#contributing) | ||
`@hpke/hybridkem-x25519-kyber768` need to be used with | ||
[@hpke/core](https://github.com/dajiaji/hpke-js/blob/main/packages/core/README.md), | ||
which can be installed in the same manner as desribed below. | ||
### Node.js | ||
Using npm: | ||
You can install the package with npm, yarn or pnpm. | ||
```sh | ||
# Using npm: | ||
npm install @hpke/hybridkem-x25519-kyber768 | ||
``` | ||
Using yarn: | ||
```sh | ||
yarn add @hpke/hybridkem-x25519-kyber768 | ||
pnpm install @hpke/hybridkem-x25519-kyber768 | ||
# Using jsr: | ||
npx jsr add @hpke/hybridkem-x25519-kyber768 | ||
yarn dlx jsr add @hpke/hybridkem-x25519-kyber768 | ||
pnpm dlx jsr add @hpke/hybridkem-x25519-kyber768 | ||
``` | ||
### Deno | ||
The above manner can be used with other JavaScript runtimes that support npm, | ||
such as Cloudflare Workers and Bun. | ||
### Deno | ||
Starting from version 1.3.0, hpke-js packages are available from the JSR | ||
registry. From this version onwards, please use JSR import instead of HTTPS | ||
import in Deno. | ||
**JSR imoprt (recommended on `>=1.3.0`):** | ||
Add hpke-js packages using the commands below: | ||
```sh | ||
deno add @hpke/core | ||
deno add @hpke/hybridkem-x25519-kyber768 | ||
``` | ||
Then, you can use the module from code like this: | ||
@@ -71,11 +61,8 @@ | ||
**HTTPS imoprt (deprecated):** | ||
### Deno | ||
```ts | ||
import { | ||
Aes128Gcm, | ||
CipherSuite, | ||
HkdfSha256, | ||
} from "https://deno.land/x/hpke/core/mod.ts"; | ||
import { HybridkemX25519Kyber768 } from "https://deno.land/x/hpke/x/hybridkem-x25519-kyber768/mod.ts"; | ||
For Deno, it is recommended to use the jsr.io registry. | ||
```sh | ||
deno add jsr:@hpke/hybridkem-x25519-kyber768 | ||
``` | ||
@@ -93,4 +80,10 @@ | ||
<script type="module"> | ||
import * as hpke from "https://esm.sh/@hpke/core@<SEMVER>"; | ||
import * as kyber from "https://esm.sh/@hpke/hybridkem-x25519-kyber768@<SEMVER>"; | ||
import { | ||
Aes128Gcm, | ||
CipherSuite, | ||
HkdfSha256, | ||
} from "https://esm.sh/@hpke/core@<SEMVER>"; | ||
import { | ||
HybridkemX25519Kyber768, | ||
} from "https://esm.sh/@hpke/hybridkem-x25519-kyber768@<SEMVER>"; | ||
// ... | ||
@@ -101,4 +94,10 @@ </script> | ||
<script type="module"> | ||
import * as hpke from "https://esm.sh/@hpke/core"; | ||
import * as kyber from "https://esm.sh/@hpke/hybridkem-x25519-kyber768"; | ||
import { | ||
Aes128Gcm, | ||
CipherSuite, | ||
HkdfSha256, | ||
} from "https://esm.sh/@hpke/core"; | ||
import { | ||
HybridkemX25519Kyber768, | ||
} from "https://esm.sh/@hpke/hybridkem-x25519-kyber768"; | ||
// ... | ||
@@ -113,4 +112,10 @@ </script> | ||
<script type="module"> | ||
import * as hpke from "https://unpkg.com/@hpke/core@<SEMVER>/esm/mod.js"; | ||
import * as kyber from "https://unpkg.com/@hpke/hybridkem-x25519-kyber768@<SEMVER>/esm/mod.js"; | ||
import { | ||
Aes128Gcm, | ||
CipherSuite, | ||
HkdfSha256, | ||
} from "https://unpkg.com/@hpke/core@<SEMVER>/esm/mod.js"; | ||
import { | ||
HybridkemX25519Kyber768, | ||
} from "https://unpkg.com/@hpke/hybridkem-x25519-kyber768@<SEMVER>/esm/mod.js"; | ||
// ... | ||
@@ -120,12 +125,2 @@ </script> | ||
### Cloudflare Workers | ||
```sh | ||
git clone git@github.com:dajiaji/hpke-js.git | ||
cd hpke-js/x/hybridkem-x25519-kyber768 | ||
npm install -g esbuild | ||
deno task dnt | ||
deno task minify > $YOUR_SRC_PATH/hpke-hybridkem-x25519-kyber768.js | ||
``` | ||
## Usage | ||
@@ -140,3 +135,2 @@ | ||
import { HybridkemX25519Kyber768 } from "@hpke/hybridkem-x25519-kyber768"; | ||
// const { HybridkemX25519Kyber768 } = require("@hpke/hybridkem-x25519-kyber768"); | ||
@@ -221,3 +215,3 @@ async function doHpke() { | ||
### Browsers | ||
### Web Browsers | ||
@@ -233,4 +227,4 @@ ```html | ||
HkdfSha256, | ||
} from "https://esm.sh/@hpke/core@<SEMVER>"; | ||
import { HybridkemX25519Kyber768 } from "https://esm.sh/@hpke/hybridkem-x25519-kyber768@<SEMVER>"; | ||
} from "https://esm.sh/@hpke/core"; | ||
import { HybridkemX25519Kyber768 } from "https://esm.sh/@hpke/hybridkem-x25519-kyber768@"; | ||
@@ -237,0 +231,0 @@ globalThis.doHpke = async () => { |
@@ -9,9 +9,9 @@ import { Hybridkem, KemId } from "@hpke/common"; | ||
* The instance of this class can be specified to the | ||
* {@link https://deno.land/x/hpke/core/mod.ts?s=CipherSuiteParams | CipherSuiteParams} as follows: | ||
* {@link https://jsr.io/@hpke/core/doc/~/CipherSuiteParams | CipherSuiteParams} as follows: | ||
* | ||
* @example | ||
* @example Use with `@hpke/core`: | ||
* | ||
* ```ts | ||
* import { Aes128Gcm, CipherSuite, HkdfSha256 } from "http://deno.land/x/hpke/core/mod.ts"; | ||
* import { HybridkemX25519Kyber768 } from "https://deno.land/x/hpke/x/hybridkem-x25519-kyber768/mod.ts"; | ||
* import { Aes128Gcm, CipherSuite, HkdfSha256 } from "@hpke/core"; | ||
* import { HybridkemX25519Kyber768 } from "@hpke/hybridkem-x25519-kyber768"; | ||
* const suite = new CipherSuite({ | ||
@@ -18,0 +18,0 @@ * kem: new HybridkemX25519Kyber768(), |
@@ -62,9 +62,9 @@ (function (factory) { | ||
* The instance of this class can be specified to the | ||
* {@link https://deno.land/x/hpke/core/mod.ts?s=CipherSuiteParams | CipherSuiteParams} as follows: | ||
* {@link https://jsr.io/@hpke/core/doc/~/CipherSuiteParams | CipherSuiteParams} as follows: | ||
* | ||
* @example | ||
* @example Use with `@hpke/core`: | ||
* | ||
* ```ts | ||
* import { Aes128Gcm, CipherSuite, HkdfSha256 } from "http://deno.land/x/hpke/core/mod.ts"; | ||
* import { HybridkemX25519Kyber768 } from "https://deno.land/x/hpke/x/hybridkem-x25519-kyber768/mod.ts"; | ||
* import { Aes128Gcm, CipherSuite, HkdfSha256 } from "@hpke/core"; | ||
* import { HybridkemX25519Kyber768 } from "@hpke/hybridkem-x25519-kyber768"; | ||
* const suite = new CipherSuite({ | ||
@@ -71,0 +71,0 @@ * kem: new HybridkemX25519Kyber768(), |
@@ -1,7 +0,7 @@ | ||
import { BaseError } from "@hpke/core"; | ||
/** | ||
* The base error class of kyber. | ||
*/ | ||
export declare class KyberError extends BaseError { | ||
export declare class KyberError extends Error { | ||
constructor(e: unknown); | ||
} | ||
//# sourceMappingURL=errors.d.ts.map |
@@ -7,3 +7,3 @@ (function (factory) { | ||
else if (typeof define === "function" && define.amd) { | ||
define(["require", "exports", "@hpke/core"], factory); | ||
define(["require", "exports"], factory); | ||
} | ||
@@ -14,9 +14,22 @@ })(function (require, exports) { | ||
exports.KyberError = void 0; | ||
const core_1 = require("@hpke/core"); | ||
/** | ||
* The base error class of kyber. | ||
*/ | ||
class KyberError extends core_1.BaseError { | ||
class KyberError extends Error { | ||
constructor(e) { | ||
let message; | ||
if (e instanceof Error) { | ||
message = e.message; | ||
} | ||
else if (typeof e === "string") { | ||
message = e; | ||
} | ||
else { | ||
message = ""; | ||
} | ||
super(message); | ||
this.name = this.constructor.name; | ||
} | ||
} | ||
exports.KyberError = KyberError; | ||
}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3
2890
179884
4
143
261
- Removed@hpke/core@^1.4.3
- Removed@hpke/core@1.7.1(transitive)
Updated@noble/hashes@^1.5.0