Skip to content

Commit

Permalink
chore: revert to keyUri on callbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
rflechtner authored and lukeg90 committed Jan 16, 2024
1 parent cb49b05 commit 29bf035
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/messaging/MessageEnvelope.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export async function decrypt(
peerPublicKey,
data: hexToU8a(ciphertext),
nonce: hexToU8a(nonce),
verificationMethod: receiverKeyUri,
keyUri: receiverKeyUri,
})
).data
} catch (cause) {
Expand Down Expand Up @@ -174,7 +174,7 @@ export async function encrypt(
receivedAt: message.receivedAt,
ciphertext,
nonce,
senderKeyUri: encrypted.verificationMethod,
senderKeyUri: encrypted.keyUri,
receiverKeyUri,
}
}
2 changes: 1 addition & 1 deletion src/messaging/interface/session/Session.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ describe('Session', () => {
data: encryptedChallenge,
nonce: nonce,
peerPublicKey: bobEncKey.keyAgreement[0].publicKey,
verificationMethod: sessionRequest.encryptionKeyUri,
keyUri: sessionRequest.encryptionKeyUri,
})
const decryptedChallenge = u8aToString(decryptedChallengeBytes.data)
expect(decryptedChallenge).toBe(challenge)
Expand Down
2 changes: 1 addition & 1 deletion src/messaging/interface/session/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export async function verifySession(
data: encryptedChallenge,
nonce,
peerPublicKey: Did.multibaseKeyToDidKey((encryptionKey as VerificationMethod).publicKeyMultibase).publicKey,
verificationMethod: encryptionKeyUri,
keyUri: encryptionKeyUri,
})

const decryptedChallenge = u8aToString(decryptedBytes.data)
Expand Down
2 changes: 1 addition & 1 deletion src/tests/messageUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ export function makeEncryptCallback({ secretKey }: KiltEncryptionKeypair): Encry
// encrypted data
data: box,
// used did key uri for encryption.
verificationMethod: `${didDocument.id}${keyId}`,
keyUri: `${didDocument.id}${keyId}`,
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/types/Message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ export interface EncryptResponseData {
/**
* The DID verification method used for the encryption.
*/
verificationMethod: DidUrl
keyUri: DidUrl
}

/**
Expand Down Expand Up @@ -283,7 +283,7 @@ export interface DecryptRequestData {
/**
* The DID verification method, which should be used for decryption.
*/
verificationMethod: DidUrl
keyUri: DidUrl
}

export interface DecryptResponseData {
Expand Down

0 comments on commit 29bf035

Please sign in to comment.