ts-mls
Version:
[](https://github.com/LukaJCB/ts-mls/actions/workflows/ci.yml) [](https://badge.fury.io/js/ts-mls) [ => {
const roundtrip = createRoundtripTest(encodeKeyPackageTBS, decodeKeyPackageTBS);
test("roundtrips minimal", () => {
const tbs = {
version: "mls10",
cipherSuite: "MLS_256_XWING_AES256GCM_SHA512_Ed25519",
initKey: new Uint8Array([1, 2, 3]),
leafNode: {
hpkePublicKey: new Uint8Array([4, 5, 6]),
signaturePublicKey: new Uint8Array([7, 8, 9]),
credential: { credentialType: "basic", identity: new Uint8Array([10, 11, 12]) },
capabilities: {
versions: [],
ciphersuites: [],
extensions: [],
proposals: [],
credentials: [],
},
leafNodeSource: "key_package",
lifetime: { notBefore: 0n, notAfter: 0n },
extensions: [],
signature: new Uint8Array([13, 14, 15]),
},
extensions: [],
};
roundtrip(tbs);
});
test("roundtrips nontrivial", () => {
const tbs = {
version: "mls10",
cipherSuite: "MLS_256_XWING_AES256GCM_SHA512_Ed25519",
initKey: new Uint8Array([16, 17, 18, 19, 20]),
leafNode: {
hpkePublicKey: new Uint8Array([21, 22, 23, 24, 25]),
signaturePublicKey: new Uint8Array([26, 27, 28, 29, 30]),
credential: {
credentialType: "x509",
certificates: [new Uint8Array([31, 32]), new Uint8Array([33, 34, 35])],
},
capabilities: {
versions: ["mls10"],
ciphersuites: ["MLS_256_XWING_AES256GCM_SHA512_Ed25519"],
extensions: [7, 8, 9],
proposals: [9, 10, 11],
credentials: ["basic", "x509"],
},
leafNodeSource: "key_package",
lifetime: { notBefore: 1000n, notAfter: 2000n },
extensions: [{ extensionType: "application_id", extensionData: new Uint8Array([36, 37, 38]) }],
signature: new Uint8Array([39, 40, 41, 42, 43]),
},
extensions: [{ extensionType: "application_id", extensionData: new Uint8Array([44, 45, 46]) }],
};
roundtrip(tbs);
});
});
//# sourceMappingURL=keyPackageTBS.test.js.map