Skip to content

Commit a93d668

Browse files
committed
chore: cleaned up code
1 parent cec241f commit a93d668

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

src/client/handlers/AuthSignToken.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import { UnaryHandler } from '@matrixai/rpc';
1212
import Token from '../../tokens/Token.js';
1313
import * as clientErrors from '../errors.js';
1414
import * as nodesUtils from '../../nodes/utils.js';
15-
import * as tokensUtils from '../../tokens/utils.js';
1615

1716
class AuthSignToken extends UnaryHandler<
1817
{
@@ -28,17 +27,14 @@ class AuthSignToken extends UnaryHandler<
2827

2928
// Get and verify incoming node
3029
const inputToken = { payload: input.payload, signatures: input.signatures };
31-
const incomingToken = Token.fromEncoded<TokenIdentityRequest>(inputToken);
32-
const inputPayload = tokensUtils.parseTokenPayload<IdentityRequestData>(
33-
inputToken.payload,
34-
);
35-
if (!('publicKey' in inputPayload)) {
30+
const incomingToken = Token.fromEncoded<IdentityRequestData>(inputToken);
31+
if (!('publicKey' in incomingToken.payload)) {
3632
throw new clientErrors.ErrorAuthenticationInvalidToken(
3733
'Input token does not contain public key',
3834
);
3935
}
4036
const incomingPublicKey = Buffer.from(
41-
inputPayload.publicKey,
37+
incomingToken.payload.publicKey,
4238
'base64url',
4339
) as PublicKey;
4440
if (!incomingToken.verifyWithPublicKey(incomingPublicKey)) {

src/client/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ type TokenMessage = {
111111
// Return URL must be present on the token, otherwise token contents is decided
112112
// by the client.
113113
type IdentityRequestData = TokenPayload & {
114-
returnUrl: string;
114+
returnURL: string;
115115
publicKey: string;
116116
};
117117

0 commit comments

Comments
 (0)