Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,12 @@

Affected platforms: all

- We aligned cipher suite spelling to CipherSuite

- renamed `Ciphersuite` -> `CipherSuite`

Affected platforms: all

- Removed `WelcomeBundle` type that was returned from `processWelcomeMessage()` and `joinByExternalCommit()`. They
return a `ConversationId` now only.

Expand Down
4 changes: 4 additions & 0 deletions cc-book/src/cc10/migration-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ the sub-pages:
- renamed `removeKeypackage` → `removeKeyPackage`
- renamed `removeKeypackagesFor` → `removeKeyPackagesFor`

1. We aligned cipher suite spelling to `CipherSuite`:

- renamed `Ciphersuite` -> `CipherSuite`

## Higher-Level Newtypes

1. `GroupInfo.new()` and `Welcome.new()` are now **fallible** constructors. Previously, both accepted any byte sequence
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe("benchmark", () => {
});
for (const { userCount, cipherSuite } of parameters) {
window.bench.add(
`cipherSuite=${window.ccModule.Ciphersuite[cipherSuite]} userCount=${userCount}`,
`cipherSuite=${window.ccModule.CipherSuite[cipherSuite]} userCount=${userCount}`,
async () => {
const aliceCc = await window.helpers.ccInit({
withBasicCredential: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ describe("benchmark", () => {
await window.helpers.createConversation(cc);

window.bench.add(
`cipherSuite=${window.ccModule.Ciphersuite[cipherSuite]} size=${size}B count=${count}`,
`cipherSuite=${window.ccModule.CipherSuite[cipherSuite]} size=${size}B count=${count}`,
async () => {
await cc.transaction(async (ctx) => {
for (let i = 0; i < count; i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe("benchmark", () => {
});
for (const { userCount, cipherSuite } of parameters) {
window.bench.add(
`cipherSuite=${window.ccModule.Ciphersuite[cipherSuite]} userCount=${userCount}`,
`cipherSuite=${window.ccModule.CipherSuite[cipherSuite]} userCount=${userCount}`,
async () => {
const aliceCc = await window.helpers.ccInit({
withBasicCredential: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ describe("benchmark", () => {
// This means that we can't encrypt the messages beforehand as this would lead to bob decrypting
// the same messages over and over again.
window.bench.add(
`cipherSuite=${window.ccModule.Ciphersuite[cipherSuite]} size=${size}B count=${count}`,
`cipherSuite=${window.ccModule.CipherSuite[cipherSuite]} size=${size}B count=${count}`,
async () => {
const encryptedMessages = await aliceCc.transaction(
async (ctx) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe("benchmark", () => {
});
for (const { userCount, cipherSuite } of parameters) {
window.bench.add(
`cipherSuite=${window.ccModule.Ciphersuite[cipherSuite]} userCount=${userCount}`,
`cipherSuite=${window.ccModule.CipherSuite[cipherSuite]} userCount=${userCount}`,
async () => {
const aliceCc = await window.helpers.ccInit({
withBasicCredential: true,
Expand Down
36 changes: 18 additions & 18 deletions crypto-ffi/bindings/js/packages/browser/shared/utils.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import type {
Ciphersuite,
ClientId,
CommitBundle,
ConversationId,
CoreCrypto,
CoreCryptoLogLevel,
GroupInfoBundle,
HistorySecret,
KeyPackage,
MlsTransport,
MlsTransportData,
Database,
import {
CipherSuite,
type ClientId,
type CommitBundle,
type ConversationId,
type CoreCrypto,
type CoreCryptoLogLevel,
type Database,
type GroupInfoBundle,
type HistorySecret,
type KeyPackage,
type MlsTransport,
type MlsTransportData,
} from "@wireapp/core-crypto/browser";

import { browser } from "@wdio/globals";
Expand Down Expand Up @@ -105,7 +105,7 @@ export async function sharedSetup() {

static async generateKeyPackage(
cc: CoreCrypto,
cipherSuite?: Ciphersuite
cipherSuite?: CipherSuite
): Promise<KeyPackage> {
if (cipherSuite === undefined) {
cipherSuite = window.defaultCipherSuite;
Expand Down Expand Up @@ -237,7 +237,7 @@ export async function sharedSetup() {
cc1: CoreCrypto,
cc2: CoreCrypto,
conversationId: ConversationId,
cipherSuite?: Ciphersuite
cipherSuite?: CipherSuite
): Promise<GroupInfoBundle> {
const kp = await window.helpers.generateKeyPackage(
cc2,
Expand Down Expand Up @@ -506,7 +506,7 @@ type CcInitOptions =
}
| {
withBasicCredential?: true;
cipherSuite?: Ciphersuite;
cipherSuite?: CipherSuite;
clientId?: ClientId;
};

Expand All @@ -516,7 +516,7 @@ export interface Helpers {
newDatabase(): Promise<Database>;
generateKeyPackage(
cc: CoreCrypto,
cipherSuite?: Ciphersuite
cipherSuite?: CipherSuite
): Promise<KeyPackage>;
ccInit: (options?: CcInitOptions) => Promise<CoreCrypto>;
recordLogs(): Promise<void>;
Expand All @@ -526,7 +526,7 @@ export interface Helpers {
cc1: CoreCrypto,
cc2: CoreCrypto,
conversationId: ConversationId,
cipherSuite?: Ciphersuite
cipherSuite?: CipherSuite
): Promise<GroupInfoBundle>;
remove(
cc: CoreCrypto,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,12 @@ describe("key package", () => {
clientId,
});
const credential1 = window.ccModule.Credential.basic(
window.ccModule.Ciphersuite
window.ccModule.CipherSuite
.Mls128Dhkemx25519Aes128gcmSha256Ed25519,
clientId
);
const credential2 = window.ccModule.Credential.basic(
window.ccModule.Ciphersuite
window.ccModule.CipherSuite
.Mls128Dhkemp256Aes128gcmSha256P256,
clientId
);
Expand Down
12 changes: 6 additions & 6 deletions crypto-ffi/bindings/js/packages/browser/test/utils.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { browser } from "@wdio/globals";

import type {
Ciphersuite,
CommitBundle,
PkiEnvironmentHooks,
import {
CipherSuite,
type CommitBundle,
type PkiEnvironmentHooks,
HttpMethod,
HttpHeader,
} from "@wireapp/core-crypto/browser";
Expand All @@ -21,7 +21,7 @@ type ccModuleType = typeof import("@wireapp/core-crypto/browser");
declare global {
interface Window {
ccModule: ccModuleType;
defaultCipherSuite: Ciphersuite;
defaultCipherSuite: CipherSuite;
deliveryService: DeliveryService;
pkiEnvironmentHooks: PkiEnvironmentHooks;
_latestCommitBundle: CommitBundle;
Expand All @@ -34,7 +34,7 @@ export async function setup() {
await sharedSetup();
await browser.execute(async () => {
window.defaultCipherSuite =
window.ccModule.Ciphersuite.Mls128Dhkemx25519Aes128gcmSha256Ed25519;
window.ccModule.CipherSuite.Mls128Dhkemx25519Aes128gcmSha256Ed25519;

window.pkiEnvironmentHooks = {
async httpRequest(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
tinybenchSetup,
userBenchmarkParameters,
} from "../../shared/benches/utils";
import { Ciphersuite, type KeyPackage } from "@wireapp/core-crypto/native";
import { CipherSuite, type KeyPackage } from "@wireapp/core-crypto/native";
import { Bench } from "tinybench";
import {
setup,
Expand All @@ -27,7 +27,7 @@ async function run() {
});
for (const { userCount, cipherSuite } of parameters) {
bench.add(
`cipherSuite=${Ciphersuite[cipherSuite]} userCount=${userCount}`,
`cipherSuite=${CipherSuite[cipherSuite]} userCount=${userCount}`,
async () => {
const aliceCc = await ccInit({
withBasicCredential: true,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Bench } from "tinybench";
import { Ciphersuite } from "@wireapp/core-crypto/native";
import { CipherSuite } from "@wireapp/core-crypto/native";
import {
logResults,
messageBenchmarkParameters,
Expand All @@ -25,7 +25,7 @@ async function run() {
const conversationId = await createConversation(cc);

bench.add(
`cipherSuite=${Ciphersuite[cipherSuite]} size=${size}B count=${count}`,
`cipherSuite=${CipherSuite[cipherSuite]} size=${size}B count=${count}`,
async () => {
await cc.transaction(async (ctx) => {
for (let i = 0; i < count; i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
tinybenchSetup,
userBenchmarkParameters,
} from "../../shared/benches/utils";
import { Ciphersuite, type KeyPackage } from "@wireapp/core-crypto/native";
import { CipherSuite, type KeyPackage } from "@wireapp/core-crypto/native";
import { Bench } from "tinybench";
import {
setup,
Expand All @@ -28,7 +28,7 @@ async function run() {
});
for (const { userCount, cipherSuite } of parameters) {
bench.add(
`cipherSuite=${Ciphersuite[cipherSuite]} userCount=${userCount}`,
`cipherSuite=${CipherSuite[cipherSuite]} userCount=${userCount}`,
async () => {
const aliceCc = await ccInit({
withBasicCredential: true,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Bench } from "tinybench";
import { Ciphersuite } from "@wireapp/core-crypto/native";
import { CipherSuite } from "@wireapp/core-crypto/native";
import {
logResults,
messageBenchmarkParameters,
Expand Down Expand Up @@ -42,7 +42,7 @@ async function run() {
// This means that we can't encrypt the messages beforehand as this would lead to bob decrypting
// the same messages over and over again.
bench.add(
`cipherSuite=${Ciphersuite[cipherSuite]} size=${size}B count=${count}`,
`cipherSuite=${CipherSuite[cipherSuite]} size=${size}B count=${count}`,
async () => {
const encryptedMessages = await aliceCc.transaction(
async (ctx) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
userBenchmarkParameters,
} from "../../shared/benches/utils";
import {
Ciphersuite,
CipherSuite,
ClientId,
type KeyPackage,
} from "@wireapp/core-crypto/native";
Expand All @@ -31,7 +31,7 @@ async function run() {
});
for (const { userCount, cipherSuite } of parameters) {
bench.add(
`cipherSuite=${Ciphersuite[cipherSuite]} userCount=${userCount}`,
`cipherSuite=${CipherSuite[cipherSuite]} userCount=${userCount}`,
async () => {
const aliceCc = await ccInit({
withBasicCredential: true,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ccInit, setup, teardown } from "./utils";
import { test, beforeEach, describe, expect, afterAll } from "bun:test";
import {
Ciphersuite,
CipherSuite,
ciphersuiteDefault,
ClientId,
Credential,
Expand Down Expand Up @@ -59,11 +59,11 @@ describe("credentials", () => {

test("credentials can be searched", async () => {
const clientId = new ClientId(Buffer.from("any random client id here"));
const ciphersuite1 = Ciphersuite.Mls128Dhkemp256Aes128gcmSha256P256;
const ciphersuite1 = CipherSuite.Mls128Dhkemp256Aes128gcmSha256P256;
const credential1 = Credential.basic(ciphersuite1, clientId);

const ciphersuite2 =
Ciphersuite.Mls128Dhkemx25519Chacha20poly1305Sha256Ed25519;
CipherSuite.Mls128Dhkemx25519Chacha20poly1305Sha256Ed25519;
const credential2 = Credential.basic(ciphersuite2, clientId);

const cc = await ccInit({ withBasicCredential: false, clientId });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ccInit, generateKeyPackage, setup, teardown } from "./utils";
import { test, beforeEach, describe, expect, afterAll } from "bun:test";
import { ClientId } from "@wireapp/core-crypto/native";
import {
Ciphersuite,
CipherSuite,
Credential,
KeyPackage,
} from "@wireapp/core-crypto/native";
Expand Down Expand Up @@ -78,11 +78,11 @@ describe("key package", () => {
test("can be removed by credentialref", async () => {
const clientId = new ClientId(Buffer.from("any random client id here"));
const credential1 = Credential.basic(
Ciphersuite.Mls128Dhkemx25519Aes128gcmSha256Ed25519,
CipherSuite.Mls128Dhkemx25519Aes128gcmSha256Ed25519,
clientId
);
const credential2 = Credential.basic(
Ciphersuite.Mls128Dhkemp256Aes128gcmSha256P256,
CipherSuite.Mls128Dhkemp256Aes128gcmSha256P256,
clientId
);
const cc = await ccInit({ withBasicCredential: false, clientId });
Expand Down
10 changes: 5 additions & 5 deletions crypto-ffi/bindings/js/packages/native/test/utils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { rm } from "node:fs/promises";
import assert from "node:assert";
import {
Ciphersuite,
CipherSuite,
type CommitBundle,
ConversationId,
CoreCrypto,
Expand All @@ -28,7 +28,7 @@ import { Database } from "@wireapp/core-crypto/native";
const logLevel = Number(process.env["CC_TEST_LOG_LEVEL"] || "0");

const DEFAULT_CIPHERSUITE =
Ciphersuite.Mls128Dhkemx25519Chacha20poly1305Sha256Ed25519;
CipherSuite.Mls128Dhkemx25519Chacha20poly1305Sha256Ed25519;
const SQLITE_SIDE_CAR_SUFFIXES = ["", "-journal", "-shm", "-wal"] as const;
const DATABASE_LOCATIONS = new Set<string>();

Expand Down Expand Up @@ -109,7 +109,7 @@ type CcInitOptions =
}
| {
withBasicCredential?: true;
cipherSuite?: Ciphersuite;
cipherSuite?: CipherSuite;
clientId?: ClientId;
};

Expand Down Expand Up @@ -146,7 +146,7 @@ export async function ccInit(

export async function generateKeyPackage(
cc: CoreCrypto,
cipherSuite?: Ciphersuite
cipherSuite?: CipherSuite
): Promise<KeyPackage> {
if (cipherSuite === undefined) {
cipherSuite = DEFAULT_CIPHERSUITE;
Expand Down Expand Up @@ -207,7 +207,7 @@ export async function invite(
cc1: CoreCrypto,
cc2: CoreCrypto,
conversationId: ConversationId,
cipherSuite?: Ciphersuite
cipherSuite?: CipherSuite
): Promise<GroupInfoBundle> {
const kp = await generateKeyPackage(cc2, cipherSuite);
await cc1.transaction((ctx) =>
Expand Down
Loading
Loading