fix: Track device Ids as integers

This commit is contained in:
2022-08-04 16:57:12 +02:00
parent 31ee61a5cd
commit 08ec093675
7 changed files with 51 additions and 46 deletions

View File

@@ -41,16 +41,16 @@ void main() {
final spkBob = await OmemoKeyPair.generateNewPair(KeyPairType.x25519);
final opkBob = await OmemoKeyPair.generateNewPair(KeyPairType.x25519);
final bundleBob = OmemoBundle(
'1',
1,
await spkBob.pk.asBase64(),
'3',
3,
base64Encode(
await sig(ikBob, await spkBob.pk.getBytes()),
),
//'Q5in+/L4kJixEX692h6mJkPMyp4I3SlQ84L0E7ipPzqfPHOMiraUlqG2vG/O8wvFjLsKYZpPBraga9IvwhqVDA==',
await ikBob.pk.asBase64(),
{
'2': await opkBob.pk.asBase64(),
2: await opkBob.pk.asBase64(),
},
);
@@ -65,7 +65,7 @@ void main() {
X3DHMessage(
ikAlice.pk,
resultAlice.ek.pk,
'2',
2,
),
spkBob,
opkBob,

View File

@@ -12,7 +12,7 @@ void main() {
final bobSession = await OmemoSessionManager.generateNewIdentity(opkAmount: 1);
// Perform the X3DH
final x3dhAliceResult = await aliceSession.addSessionFromBundle(
final kex = await aliceSession.addSessionFromBundle(
bobJid,
bobSession.device.id,
await bobSession.device.toBundle(),
@@ -20,11 +20,7 @@ void main() {
await bobSession.addSessionFromKeyExchange(
aliceJid,
aliceSession.device.id,
X3DHMessage(
aliceSession.device.ik.pk,
x3dhAliceResult.ek.pk,
'2',
),
kex,
);
// Alice encrypts a message for Bob

View File

@@ -11,16 +11,16 @@ void main() {
final spkBob = await OmemoKeyPair.generateNewPair(KeyPairType.x25519);
final opkBob = await OmemoKeyPair.generateNewPair(KeyPairType.x25519);
final bundleBob = OmemoBundle(
'1',
1,
await spkBob.pk.asBase64(),
'3',
3,
base64Encode(
await sig(ikBob, await spkBob.pk.getBytes()),
),
//'Q5in+/L4kJixEX692h6mJkPMyp4I3SlQ84L0E7ipPzqfPHOMiraUlqG2vG/O8wvFjLsKYZpPBraga9IvwhqVDA==',
await ikBob.pk.asBase64(),
{
'2': await opkBob.pk.asBase64(),
2: await opkBob.pk.asBase64(),
},
);
@@ -35,7 +35,7 @@ void main() {
X3DHMessage(
ikAlice.pk,
resultAlice.ek.pk,
'2',
2,
),
spkBob,
opkBob,
@@ -53,15 +53,15 @@ void main() {
final spkBob = await OmemoKeyPair.generateNewPair(KeyPairType.x25519);
final opkBob = await OmemoKeyPair.generateNewPair(KeyPairType.x25519);
final bundleBob = OmemoBundle(
'1',
1,
await spkBob.pk.asBase64(),
'3',
3,
// NOTE: A bit flakey, but it is highly unlikely that the same keypair as this one
// gets generated.
'Q5in+/L4kJixEX692h6mJkPMyp4I3SlQ84L0E7ipPzqfPHOMiraUlqG2vG/O8wvFjLsKYZpPBraga9IvwhqVDA==',
await ikBob.pk.asBase64(),
{
'2': await opkBob.pk.asBase64(),
2: await opkBob.pk.asBase64(),
},
);