fix(core): update
This commit is contained in:
parent
ff9cb9132c
commit
8a8277ae9f
@ -135,10 +135,15 @@ export class Universe {
|
||||
universeConnectionInstance
|
||||
);
|
||||
}
|
||||
await UniverseChannel.authorizeAMessageForAChannel(
|
||||
const unauthenticatedMessage = UniverseMessage.createMessageFromPayload(dataArg);
|
||||
const foundChannel = await UniverseChannel.authorizeAMessageForAChannel(
|
||||
this.universeCache,
|
||||
UniverseMessage.createMessageFromPayload(dataArg)
|
||||
unauthenticatedMessage
|
||||
);
|
||||
if (foundChannel) {
|
||||
const authenticatedMessage = unauthenticatedMessage;
|
||||
await this.universeCache.addMessage(authenticatedMessage);
|
||||
}
|
||||
})();
|
||||
}
|
||||
});
|
||||
|
@ -50,7 +50,7 @@ export class UniverseChannel {
|
||||
public static authorizeAMessageForAChannel(
|
||||
universeCacheArg: UniverseCache,
|
||||
universeMessageArg: UniverseMessage
|
||||
) {
|
||||
): UniverseChannel {
|
||||
const foundChannel = universeCacheArg.channelMap.find(universeChannel => {
|
||||
const result = universeChannel.authenticate(universeMessageArg);
|
||||
return result;
|
||||
@ -58,11 +58,13 @@ export class UniverseChannel {
|
||||
if (foundChannel) {
|
||||
universeMessageArg.authenticated = true;
|
||||
universeMessageArg.universeChannelList.add(foundChannel);
|
||||
console.log('message authorized');
|
||||
return foundChannel;
|
||||
} else {
|
||||
universeMessageArg.authenticated = false;
|
||||
universeMessageArg.universeChannelList.add(universeCacheArg.blackListChannel);
|
||||
console.log('message not valid');
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user