Skip to content

Commit

Permalink
chore: merge branch 'release/v8.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Manuthor committed Mar 8, 2023
2 parents 204449e + 39ac0dd commit 4c75cae
Show file tree
Hide file tree
Showing 18 changed files with 78 additions and 63 deletions.
18 changes: 9 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
subcommands: |
python3 scripts/download_wasm.py
npm install
kms-version: 4.2.0
kms-version: 4.3.3

lint:
needs: build
Expand All @@ -32,7 +32,7 @@ jobs:
with:
subcommands: |
npm test
kms-version: 4.2.0
kms-version: 4.3.3
regression_files: |
./node_modules/non_regression_vector.json
./node_modules/sqlite.db
Expand All @@ -46,7 +46,7 @@ jobs:
extension: so
destination: linux-x86-64
os: ubuntu-20.04
kms-version: 4.2.0
kms-version: 4.3.3
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 @@ -59,7 +59,7 @@ jobs:
with:
branch: develop
target: x86_64-unknown-linux-gnu
kms-version: 4.2.0
kms-version: 4.3.3
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 @@ -90,7 +90,7 @@ jobs:
sleep 5
cd ../test
node chrome.mjs http://localhost:8090 http://kms:9998
kms-version: 4.2.0
kms-version: 4.3.3

example_reactjs:
needs: build_in_docker
Expand All @@ -104,7 +104,7 @@ jobs:
sleep 5
cd ../test
node chrome.mjs http://localhost:8090 http://kms:9998
kms-version: 4.2.0
kms-version: 4.3.3

example_webpack:
needs: build
Expand All @@ -123,7 +123,7 @@ jobs:
cd examples/nodejs
npm install
node test.mjs 10
kms-version: 4.2.0
kms-version: 4.3.3

example_imdb:
needs: build
Expand Down Expand Up @@ -168,7 +168,7 @@ jobs:
needs:
- publish-dry-run
uses: ./.github/workflows/js.yml
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
if: startsWith(github.ref, 'refs/tags/')
with:
subcommands: |
echo "//registry.npmjs.org/:_authToken=$NPM_ACCESS_TOKEN" > ~/.npmrc
Expand All @@ -183,7 +183,7 @@ jobs:
steps:
- uses: actions/checkout@v1
- name: Release
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v1

cleanup:
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

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

## [8.0.0] - 2023-03-08

### Features

- Support of CoverCrypt 11.0 and Findex 3.0 (#106)

## [7.1.0] - 2023-03-01

### Features
Expand Down
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,9 @@ This table shows the minimum version correspondence between the various componen
| 6.0.0 | 8.0.0 | 1.0.0 | 4.0.0 |
| 6.0.1 | 8.0.0 | 2.0.0 | 4.0.0 |
| 7.0.0, 7.0.1 | 10.0.0 | 2.0.1 | 4.2.0 |
| 7.1.0 | 10.0.0 | 2.1.0 | 4.2.0 |

From the version 8.0.0, `cloudproof_js` depends on [cloudproof_rust](https://github.com/Cosmian/cloudproof_rust) which wraps the interfaces of `CoverCrypt` and `Findex`.

| `cloudproof_js` | Cloudproof Rust lib |
|-----------------|---------------------|
| 8.0.0 | 1.0.0 |
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ version: '3'
services:
kms:
container_name: kms
image: cosmian/kms:4.2.0
image: cosmian/kms:4.3.3
environment:
- KMS_HOSTNAME=0.0.0.0
- KMS_PUBLIC_PATH=/tmp
Expand Down
2 changes: 1 addition & 1 deletion examples/vuejs/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default defineConfig({
},
},
optimizeDeps: {
exclude: ["cosmian_findex", "cosmian_cover_crypt"],
exclude: ["cloudproof_findex", "cloudproof_cover_crypt"],
},
server: {
fs: {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cloudproof_js",
"version": "7.1.0",
"version": "8.0.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
64 changes: 34 additions & 30 deletions scripts/download_wasm.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,57 +7,61 @@
from os import path, remove, getenv


def download_wasm(name: str, version: str, destination: str) -> bool:
def files_to_be_copied(name: str):
"""List of files to be copied"""
source_dir = f'tmp/wasm32-unknown-unknown/{name}'
return {
f'{source_dir}/cloudproof_{name}.d.ts': f'src/pkg/{name}/cloudproof_{name}.d.ts',
f'{source_dir}/cloudproof_{name}_bg.wasm': f'src/pkg/{name}/cloudproof_{name}_bg.wasm',
f'{source_dir}/cloudproof_{name}.js': f'src/pkg/{name}/cloudproof_{name}.js',
f'{source_dir}/cloudproof_{name}_bg.wasm.d.ts': f'src/pkg/{name}/cloudproof_{name}_bg.wasm.d.ts',
}


def download_wasm(version: str) -> bool:
"""Download and extract wasm"""
ssl._create_default_https_context = ssl._create_unverified_context

to_be_copied = {
f'tmp/wasm32-unknown-unknown/cosmian_{name}.d.ts': f'{destination}/{name}/cosmian_{name}.d.ts',
f'tmp/wasm32-unknown-unknown/cosmian_{name}_bg.wasm': f'{destination}/{name}/cosmian_{name}_bg.wasm',
'tmp/wasm32-unknown-unknown/LICENSE.md': f'{destination}/{name}/LICENSE.md',
'tmp/wasm32-unknown-unknown/README.md': f'{destination}/{name}/README.md',
f'tmp/wasm32-unknown-unknown/cosmian_{name}.js': f'{destination}/{name}/cosmian_{name}.js',
f'tmp/wasm32-unknown-unknown/cosmian_{name}_bg.wasm.d.ts': f'{destination}/{name}/cosmian_{name}_bg.wasm.d.ts',
}
to_be_copied = files_to_be_copied('findex')
cover_crypt_files = files_to_be_copied('cover_crypt')
to_be_copied.update(cover_crypt_files)

missing_files = False
for key in to_be_copied:
if not path.exists(to_be_copied[key]):
for key, value in to_be_copied.items():
if not path.exists(value):
missing_files = True
break

if missing_files:
print(f'Missing {name} WASM. Copy {name} {version} to {destination}...')

url = f'https://package.cosmian.com/{name}/{version}/all.zip'
url = f'https://package.cosmian.com/cloudproof_rust/{version}/wasm.zip'
try:
r = urllib.request.urlopen(url)
if r.getcode() != 200:
print(f'Cannot get {name} {version} ({r.getcode()})')
print(f'Cannot get cloudproof_rust {version} ({r.getcode()})')
else:
if path.exists('tmp'):
shutil.rmtree('tmp')
if path.exists('all.zip'):
remove('all.zip')
if path.exists('wasm.zip'):
remove('wasm.zip')

open('all.zip', 'wb').write(r.read())
with zipfile.ZipFile('all.zip', 'r') as zip_ref:
open('wasm.zip', 'wb').write(r.read())
with zipfile.ZipFile('wasm.zip', 'r') as zip_ref:
zip_ref.extractall('tmp')
for key in to_be_copied:
shutil.copyfile(key, to_be_copied[key])
for key, value in to_be_copied.items():
print(f'OK: copy {key} to {value}...')

shutil.copyfile(key, value)

shutil.rmtree('tmp')
remove('all.zip')
except Exception as e:
print(f'Cannot get {name} {version} ({e})')
remove('wasm.zip')
# pylint: disable=broad-except
except Exception as exception:
print(f'Cannot get cloudproof_rust {version} ({exception})')
return False
return True


if __name__ == '__main__':
ret = download_wasm('findex', 'v2.1.0', 'src/pkg')
if ret is False and getenv('GITHUB_ACTIONS'):
download_wasm('findex', 'last_build', 'src/pkg')

ret = download_wasm('cover_crypt', 'v10.0.0', 'src/pkg')
ret = download_wasm('v1.0.0')
if ret is False and getenv('GITHUB_ACTIONS'):
download_wasm('cover_crypt', 'last_build', 'src/pkg')
download_wasm('last_build/feature/add_findex')
2 changes: 1 addition & 1 deletion src/cover_crypt/cover_crypt.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import init from "../pkg/cover_crypt/cosmian_cover_crypt"
import init from "../pkg/cover_crypt/cloudproof_cover_crypt"
import { Policy, PolicyAxis } from "./interfaces/policy"
import { CoverCryptHybridDecryption, decrypt } from "./decryption"
import { CoverCryptHybridEncryption, encrypt } from "./encryption"
Expand Down
2 changes: 1 addition & 1 deletion src/cover_crypt/decryption.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
webassembly_decrypt_hybrid_header,
webassembly_decrypt_symmetric_block,
webassembly_hybrid_decrypt,
} from "../pkg/cover_crypt/cosmian_cover_crypt"
} from "../pkg/cover_crypt/cloudproof_cover_crypt"
import { PrivateKey } from "../kms/structs/objects"
import { PlaintextHeader } from "./interfaces/plaintext_header"
import { decode } from "../utils/leb128"
Expand Down
2 changes: 1 addition & 1 deletion src/cover_crypt/encryption.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {
webassembly_encrypt_symmetric_block,
webassembly_encrypt_hybrid_header,
webassembly_hybrid_encrypt,
} from "../pkg/cover_crypt/cosmian_cover_crypt"
} from "../pkg/cover_crypt/cloudproof_cover_crypt"
import { Policy } from "./interfaces/policy"
import { PublicKey } from "../kms/structs/objects"
import { logger } from "../utils/logger"
Expand Down
2 changes: 1 addition & 1 deletion src/cover_crypt/interfaces/policy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
webassembly_policy,
webassembly_add_axis,
webassembly_policy_axis,
} from "../../pkg/cover_crypt/cosmian_cover_crypt"
} from "../../pkg/cover_crypt/cloudproof_cover_crypt"

/* tslint:disable:max-classes-per-file */
export class PolicyAxis {
Expand Down
2 changes: 1 addition & 1 deletion src/cover_crypt/key_generation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
webassembly_generate_master_keys,
webassembly_generate_user_secret_key,
webassembly_rotate_attributes,
} from "../pkg/cover_crypt/cosmian_cover_crypt"
} from "../pkg/cover_crypt/cloudproof_cover_crypt"
import { fromBeBytes } from "../utils/utils"
import { Policy } from "./interfaces/policy"

Expand Down
2 changes: 1 addition & 1 deletion src/findex/findex.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import init, {
webassembly_search,
webassembly_upsert,
} from "../pkg/findex/cosmian_findex"
} from "../pkg/findex/cloudproof_findex"

import { SymmetricKey } from "../kms/structs/objects"
import { parse as parseUuid, stringify as stringifyUuid } from "uuid"
Expand Down
2 changes: 1 addition & 1 deletion src/findex/findex_cloud.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
webassembly_upsert_cloud,
webassembly_derive_new_token,
webassembly_generate_new_token,
} from "../pkg/findex/cosmian_findex"
} from "../pkg/findex/cloudproof_findex"

/**
*/
Expand Down
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import cover_crypt_wasm from "./pkg/cover_crypt/cosmian_cover_crypt_bg.wasm"
import cover_crypt_wasm from "./pkg/cover_crypt/cloudproof_cover_crypt_bg.wasm"
import { setCoverCryptInit } from "./cover_crypt/cover_crypt"

import findex_wasm from "./pkg/findex/cosmian_findex_bg.wasm"
import findex_wasm from "./pkg/findex/cloudproof_findex_bg.wasm"
import { setFindexInit } from "./findex/findex"

export * from "./findex/findex"
Expand Down
Loading

0 comments on commit 4c75cae

Please sign in to comment.