@airgap/beacon-transport-matrix
Advanced tools
Comparing version 4.3.2 to 4.3.3
@@ -67,2 +67,3 @@ import { MatrixClientEvent, MatrixClientEventType, MatrixClientEventMessageContent } from '../matrix-client/models/MatrixClientEvent'; | ||
isSender(event: MatrixClientEvent<MatrixClientEventType.MESSAGE>, senderPublicKey: string): Promise<boolean>; | ||
private generateNewKeyPair; | ||
private getRelevantRoom; | ||
@@ -69,0 +70,0 @@ private getRelevantJoinedRoom; |
@@ -289,3 +289,8 @@ "use strict"; | ||
catch (error) { | ||
logger.error('start', 'Could not log in, retrying'); | ||
logger.error('start', 'Could not log in, retrying', error); | ||
if (error.errcode === 'M_USER_DEACTIVATED') { | ||
yield this.generateNewKeyPair(); | ||
yield this.reset(); | ||
throw new Error('The account is deactivated.'); | ||
} | ||
yield this.reset(); // If we can't log in, let's reset | ||
@@ -599,2 +604,10 @@ if (!this.selectedRegion) { | ||
} | ||
generateNewKeyPair() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const newSeed = yield (0, beacon_utils_2.generateGUID)(); | ||
console.warn(`The current user ID has been deactivated. Generating new ID: ${newSeed}`); | ||
this.storage.set(beacon_types_1.StorageKey.BEACON_SDK_SECRET_SEED, newSeed); | ||
this.keyPair = yield (0, beacon_utils_1.getKeypairFromSeed)(newSeed); | ||
}); | ||
} | ||
getRelevantRoom(recipient) { | ||
@@ -601,0 +614,0 @@ return __awaiter(this, void 0, void 0, function* () { |
@@ -67,2 +67,3 @@ import { MatrixClientEvent, MatrixClientEventType, MatrixClientEventMessageContent } from '../matrix-client/models/MatrixClientEvent'; | ||
isSender(event: MatrixClientEvent<MatrixClientEventType.MESSAGE>, senderPublicKey: string): Promise<boolean>; | ||
private generateNewKeyPair; | ||
private getRelevantRoom; | ||
@@ -69,0 +70,0 @@ private getRelevantJoinedRoom; |
import { sign } from '@stablelib/ed25519'; | ||
import axios from 'axios'; | ||
import { getHexHash, toHex, recipientString, openCryptobox, encryptCryptoboxPayload, decryptCryptoboxPayload, secretbox_NONCEBYTES, secretbox_MACBYTES } from '@airgap/beacon-utils'; | ||
import { getHexHash, toHex, recipientString, openCryptobox, encryptCryptoboxPayload, decryptCryptoboxPayload, secretbox_NONCEBYTES, secretbox_MACBYTES, getKeypairFromSeed } from '@airgap/beacon-utils'; | ||
import { MatrixClient } from '../matrix-client/MatrixClient'; | ||
@@ -274,3 +274,8 @@ import { MatrixClientEventType } from '../matrix-client/models/MatrixClientEvent'; | ||
catch (error) { | ||
logger.error('start', 'Could not log in, retrying'); | ||
logger.error('start', 'Could not log in, retrying', error); | ||
if (error.errcode === 'M_USER_DEACTIVATED') { | ||
await this.generateNewKeyPair(); | ||
await this.reset(); | ||
throw new Error('The account is deactivated.'); | ||
} | ||
await this.reset(); // If we can't log in, let's reset | ||
@@ -558,2 +563,8 @@ if (!this.selectedRegion) { | ||
} | ||
async generateNewKeyPair() { | ||
const newSeed = await generateGUID(); | ||
console.warn(`The current user ID has been deactivated. Generating new ID: ${newSeed}`); | ||
this.storage.set(StorageKey.BEACON_SDK_SECRET_SEED, newSeed); | ||
this.keyPair = await getKeypairFromSeed(newSeed); | ||
} | ||
async getRelevantRoom(recipient) { | ||
@@ -560,0 +571,0 @@ const roomIds = await this.storage.get(StorageKey.MATRIX_PEER_ROOM_IDS); |
{ | ||
"name": "@airgap/beacon-transport-matrix", | ||
"version": "4.3.2", | ||
"version": "4.3.3", | ||
"description": "This package contains methods to facilitate communication over the Beacon network, a decentralised P2P network that is based on the matrix protocol.", | ||
@@ -37,7 +37,7 @@ "author": "Andreas Gassmann <a.gassmann@papers.ch>", | ||
"dependencies": { | ||
"@airgap/beacon-core": "4.3.2", | ||
"@airgap/beacon-utils": "4.3.2", | ||
"@airgap/beacon-core": "4.3.3", | ||
"@airgap/beacon-utils": "4.3.3", | ||
"axios": "^1.6.2" | ||
}, | ||
"gitHead": "8a3069998242a51dc089c3b9d980fd56e115c848" | ||
"gitHead": "c4484992d3538190b6693629002c8f1aaf5664cc" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
321868
5464
+ Added@airgap/beacon-core@4.3.3(transitive)
+ Added@airgap/beacon-types@4.3.3(transitive)
+ Added@airgap/beacon-utils@4.3.3(transitive)
- Removed@airgap/beacon-core@4.3.2(transitive)
- Removed@airgap/beacon-types@4.3.2(transitive)
- Removed@airgap/beacon-utils@4.3.2(transitive)
Updated@airgap/beacon-core@4.3.3
Updated@airgap/beacon-utils@4.3.3