Skip to content

Commit

Permalink
fix: comms handshake (#6252)
Browse files Browse the repository at this point in the history
  • Loading branch information
aleortega authored Oct 4, 2024
1 parent 43725c8 commit ced5032
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ export class WebSocketAdapter implements MinimumCommunicationsAdapter {
return this.handleWelcomeMessage(message.welcomeMessage, ws)
}
case 'challengeMessage': {
if (!message.challengeMessage.challengeToSign.match(/^dcl-[^:]*$/)) {
throw new Error('Protocol error: invalid challenge')
}

const authChainJson = JSON.stringify(
Authenticator.signPayload(this.identity, message.challengeMessage.challengeToSign)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ export async function createArchipelagoConnection(

switch (message.$case) {
case 'challengeResponse': {
if (!message.challengeResponse.challengeToSign.match(/^dcl-[^:]*$/)) {
throw new Error('Protocol error: invalid challenge')
}

const authChainJson = JSON.stringify(
Authenticator.signPayload(identity, message.challengeResponse.challengeToSign)
)
Expand Down

0 comments on commit ced5032

Please sign in to comment.