Skip to content

Commit

Permalink
chore: Merge branch 'release/v9.2.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Manuthor committed Aug 29, 2023
2 parents 609d6f6 + 9cce723 commit c99d226
Show file tree
Hide file tree
Showing 37 changed files with 634 additions and 134 deletions.
2 changes: 2 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
},
"plugins": ["jsdoc"],
"rules": {
"@typescript-eslint/strict-boolean-expressions": "warn",
"@typescript-eslint/prefer-nullish-coalescing": "warn",
"@typescript-eslint/no-empty-interface": 0,
"no-labels": 0,
"no-unused-vars": [
Expand Down
34 changes: 18 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ jobs:
subcommands: |
python3 scripts/download_wasm.py
npm install
kms-version: 4.4.3
findex-cloud-version: 0.1.0
kms-version: 4.5.0
findex-cloud-version: 0.3.1

lint:
needs: build
Expand All @@ -33,8 +33,10 @@ jobs:
with:
subcommands: |
npm test
kms-version: 4.4.3
findex-cloud-version: 0.1.0
kms-version: 4.5.0
kms-jwe-key: '{"kty": "OKP","d": "MPEVJwdRqGM_qhJOUb5hR0Xr9EvwMLZGnkf-eDj5fU8","use": "enc","crv": "X25519","kid": "DX3GC+Fx3etxfRJValQNbqaB0gs=","x":
"gdF-1TtAjsFqNWr9nwhGUlFG38qrDUqYgcILgtYrpTY","alg": "ECDH-ES"}'
findex-cloud-version: 0.3.1
regression_files: |
./node_modules/non_regression_vector.json
./node_modules/sqlite.db
Expand All @@ -48,8 +50,8 @@ jobs:
extension: so
destination: linux-x86-64
os: ubuntu-20.04
kms-version: 4.4.3
findex-cloud-version: 0.1.0
kms-version: 4.5.0
findex-cloud-version: 0.3.1
copy_fresh_build: false
copy_regression_files: |
cp ./cloudproof_js/non_regression_vector.json src/test/resources/cover_crypt/non_regression/js_non_regression_vector.json
Expand All @@ -60,9 +62,9 @@ jobs:
- test
uses: Cosmian/reusable_workflows/.github/workflows/cloudproof_python.yml@develop
with:
branch: v4.0.2
branch: develop
target: x86_64-unknown-linux-gnu
kms-version: 4.4.3
kms-version: 4.5.0
copy_fresh_build: false
copy_regression_files: |
cp ./cloudproof_js/non_regression_vector.json tests/data/cover_crypt/non_regression/js_non_regression_vector.json
Expand Down Expand Up @@ -93,8 +95,8 @@ jobs:
sleep 5
cd ../test
node chrome.mjs http://localhost:8090 http://kms:9998
kms-version: 4.4.3
findex-cloud-version: 0.1.0
kms-version: 4.5.0
findex-cloud-version: 0.3.1

example_reactjs:
needs: build_in_docker
Expand All @@ -108,8 +110,8 @@ jobs:
sleep 5
cd ../test
node chrome.mjs http://localhost:8090 http://kms:9998
kms-version: 4.4.3
findex-cloud-version: 0.1.0
kms-version: 4.5.0
findex-cloud-version: 0.3.1

example_browser:
needs: build_in_docker
Expand All @@ -121,8 +123,8 @@ jobs:
python3 -m http.server &
sleep 3
node test.mjs
kms-version: 4.4.3
findex-cloud-version: 0.1.0
kms-version: 4.5.0
findex-cloud-version: 0.3.1

example_webpack:
needs: build
Expand All @@ -141,8 +143,8 @@ jobs:
cd examples/nodejs
npm install
node test.mjs 10
kms-version: 4.4.3
findex-cloud-version: 0.1.0
kms-version: 4.5.0
findex-cloud-version: 0.3.1

example_imdb:
needs: build
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/github_cache_cleanup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
name: Github cache cleanup

on: workflow_dispatch

jobs:
cleanup:
uses: Cosmian/reusable_workflows/.github/workflows/cleanup_cache.yml@develop
secrets: inherit
5 changes: 5 additions & 0 deletions .github/workflows/js_in_docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ on:
kms-version:
required: true
type: string
kms-jwe-key:
required: false
type: string
default: ''
findex-cloud-version:
required: true
type: string
Expand All @@ -31,6 +35,7 @@ jobs:
KMS_PUBLIC_PATH: /tmp
KMS_PRIVATE_PATH: /tmp
KMS_SHARED_PATH: /tmp
JWK_PRIVATE_KEY: ${{ inputs.kms-jwe-key }}

findex_cloud:
image: ghcr.io/cosmian/findex_cloud:${{ inputs.findex-cloud-version }}
Expand Down
12 changes: 12 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"[python]": {
"editor.defaultFormatter": "ms-python.autopep8"
},
"python.formatting.provider": "none",
"cSpell.words": ["Findex", "uids", "Uids"],
"workbench.colorCustomizations": {
"activityBar.background": "#02342B",
"titleBar.activeBackground": "#03493C",
"titleBar.activeForeground": "#E9FEFA"
}
}
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@

All notable changes to this project will be documented in this file.

## [9.2.0] - 2023-08-22

### Features

- Kms JWE encryption (#124)
- Upgrade to cloudproof 2.2.1
- Add KMS tags support (for creation and searching objects)

### Testing

- KMS Locate several keys with same tag
- Locate by tags and object type

## [9.1.1] - 2023-08-09

### Bug Fixes
Expand Down
5 changes: 4 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@ version: '3'
services:
kms:
container_name: kms
image: ghcr.io/cosmian/kms:4.4.3
image: ghcr.io/cosmian/kms:4.5.0
ports:
- 9998:9998
environment:
JWK_PRIVATE_KEY: '{"kty": "OKP","d": "MPEVJwdRqGM_qhJOUb5hR0Xr9EvwMLZGnkf-eDj5fU8","use": "enc","crv": "X25519","kid": "DX3GC+Fx3etxfRJValQNbqaB0gs=","x":
"gdF-1TtAjsFqNWr9nwhGUlFG38qrDUqYgcILgtYrpTY","alg": "ECDH-ES"}'
findex_cloud:
image: ghcr.io/cosmian/findex_cloud:0.1.0
ports:
Expand Down
14 changes: 5 additions & 9 deletions examples/reactjs/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import {
CoverCrypt,
Findex,
FindexKey,
type UidsAndValues,
KmsClient,
Label,
Location,
CoverCrypt,
KmsClient,
UidsAndValuesToUpsert,
generateAliases,
type UidsAndValues,
} from "cloudproof_js"
import { FormEvent, useEffect, useState } from "react"

Expand Down Expand Up @@ -814,19 +814,15 @@ function App() {
<button
className="btn btn-outline-secondary"
type="button"
onClick={() =>
setKmsServerUrl("http://localhost:9998")
}
onClick={() => setKmsServerUrl("http://localhost:9998")}
>
Localhost
</button>
<button
className="btn btn-outline-secondary"
type="button"
onClick={() =>
setKmsServerUrl(
"https://demo-cloudproof.cosmian.com/kms",
)
setKmsServerUrl("https://demo-cloudproof.cosmian.com/kms")
}
>
Demo
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cloudproof_js",
"version": "9.1.1",
"version": "9.2.0",
"license": "MIT",
"description": "Cosmian Cloudproof javascript client library",
"author": "Bruno Grieder<[email protected]>, Pauline Hochard<[email protected]>, Emmanuel Coste<[email protected]>, Thibaud Dauce<[email protected]>",
Expand Down Expand Up @@ -41,12 +41,12 @@
"dependencies": {
"base64-js": "^1.5.1",
"better-sqlite3": "^8.0.1",
"jose": "^4.14.4",
"process": "^0.11.10",
"stream-browserify": "^3.0.0"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^24.0.1",
"@rollup/plugin-node-resolve": "^15.0.1",
"@rollup/plugin-typescript": "^9.0.2",
"@rollup/plugin-wasm": "^6.0.1",
"@types/better-sqlite3": "^7.6.3",
Expand Down
3 changes: 1 addition & 2 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import typescript from "@rollup/plugin-typescript"
import { wasm } from "@rollup/plugin-wasm"
import { nodeResolve } from "@rollup/plugin-node-resolve"
import commonjs from "@rollup/plugin-commonjs"

const production = !process.env.ROLLUP_WATCH
Expand All @@ -21,9 +20,9 @@ const rolls = (fmt, env) => ({
entryFileNames: `[name].${fmt === "cjs" ? "cjs" : "js"}`,
name: "cloudproof_js",
},
external: ["jose", "uuid", "base64-js"],
plugins: [
commonjs(),
nodeResolve(),
// We want to inline our wasm bundle as base64. Not needing browser users
// to fetch an additional asset is a boon as there's less room for errors
env !== "slim" &&
Expand Down
4 changes: 2 additions & 2 deletions scripts/download_wasm.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,6 @@ def download_wasm(version: str) -> bool:


if __name__ == '__main__':
RET = download_wasm('v2.1.0')
RET = download_wasm('v2.2.1')
if RET is False and getenv('GITHUB_ACTIONS'):
download_wasm('last_build/update_cover_crypt_12')
download_wasm('last_build/feature/findex_5_0_0')
2 changes: 2 additions & 0 deletions src/anonymization/hash.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export class Hasher {

/**
* Creates a Hasher instance with the specified hash function and salt.
*
* @param {string} hasherMethod - The name of the hash function to use.
* @param {Iterable<number>|undefined} [salt] - The optional salt to use in the hash function.
*/
Expand Down Expand Up @@ -36,6 +37,7 @@ export class Hasher {

/**
* Applies the hash function to the specified elements and returns the resulting hash value.
*
* @param {string|Iterable<number>} data - The elements to apply the hash function to.
* @returns {string} The resulting hash value as a string.
*/
Expand Down
13 changes: 13 additions & 0 deletions src/anonymization/noise.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,31 @@ import {
interface NoiseGenerator {
/**
* Apply noise to a floating point number.
*
* @param data - The input number to apply noise to.
* @returns The result of applying noise to the input number.
*/
apply_on_float: (data: number) => number

/**
* Apply noise to a BigInt.
*
* @param data - The input BigInt to apply noise to.
* @returns The result of applying noise to the input BigInt.
*/
apply_on_int: (data: bigint) => bigint

/**
* Apply noise to a date string.
*
* @param data - The input date string to apply noise to.
* @returns The result of applying noise to the input date string.
*/
apply_on_date: (data: string) => string

/**
* Apply correlated noise to an array of floating point numbers.
*
* @param data - The input array of floating point numbers to apply correlated noise to.
* @param factors - The array of correlation factors to use.
* @returns The result of applying correlated noise to the input array of floating point numbers.
Expand All @@ -41,6 +45,7 @@ interface NoiseGenerator {

/**
* Apply correlated noise to an array of BigInts.
*
* @param data - The input array of BigInts to apply correlated noise to.
* @param factors - The array of correlation factors to use.
* @returns The result of applying correlated noise to the input array of BigInts.
Expand All @@ -52,6 +57,7 @@ interface NoiseGenerator {

/**
* Apply correlated noise to an array of date strings.
*
* @param data - The input array of date strings to apply correlated noise to.
* @param factors - The array of correlation factors to use.
* @returns The result of applying correlated noise to the input array of date strings.
Expand All @@ -73,6 +79,7 @@ class Noise {

/**
* Creates a new instance of `Noise`.
*
* @param noise - The noise generator to use.
*/
constructor(noise: NoiseGenerator) {
Expand All @@ -81,6 +88,7 @@ class Noise {

/**
* Applies noise to the input data.
*
* @param data - The input data to apply noise to.
* @returns The input data with noise applied.
* @throws An error if the type of `data` is not supported.
Expand All @@ -99,6 +107,7 @@ class Noise {

/**
* Applies correlated noise to the input data.
*
* @param data - The input data to apply noise to.
* @param factors - The factors to use for applying noise.
* @returns The input data with noise applied.
Expand Down Expand Up @@ -152,11 +161,13 @@ class Noise {

/**
* A class representing a noise generator with parameters.
*
* @augments Noise
*/
export class NoiseWithParameters extends Noise {
/**
* Creates a new instance of `NoiseWithParameters`.
*
* @param methodName - the noise distribution to use ("Gaussian" or "Laplace")
* @param mean - The mean value for generating noise.
* @param stdDev - The standard deviation value for generating noise.
Expand All @@ -168,11 +179,13 @@ export class NoiseWithParameters extends Noise {

/**
* A class representing a noise generator with bounds.
*
* @augments Noise
*/
export class NoiseWithBounds extends Noise {
/**
* Creates a new instance of `NoiseWithBounds`.
*
* @param methodName - the noise distribution to use ("Gaussian", "Laplace" or "Uniform")
* @param minBound - The minimum bound for generating noise.
* @param maxBound - The maximum bound for generating noise.
Expand Down
Loading

0 comments on commit c99d226

Please sign in to comment.