@@ -7,17 +7,17 @@ import Logger, { formatting, LogLevel, StreamHandler } from '@matrixai/logger';
77import { RPCClient } from '@matrixai/rpc' ;
88import { WebSocketClient } from '@matrixai/ws' ;
99import * as testsUtils from '../../utils/index.js' ;
10- import { AuthSignToken } from '#client/handlers/index.js' ;
11- import { authSignToken } from '#client/callers/index.js' ;
10+ import { AuthIdentityToken } from '#client/handlers/index.js' ;
11+ import { authIdentityToken } from '#client/callers/index.js' ;
1212import KeyRing from '#keys/KeyRing.js' ;
1313import Token from '#tokens/Token.js' ;
1414import ClientService from '#client/ClientService.js' ;
1515import * as keysUtils from '#keys/utils/index.js' ;
1616import * as networkUtils from '#network/utils.js' ;
1717import * as nodesUtils from '#nodes/utils.js' ;
1818
19- describe ( 'authSignToken ' , ( ) => {
20- const logger = new Logger ( 'authSignToken test' , LogLevel . WARN , [
19+ describe ( 'authIdentityToken ' , ( ) => {
20+ const logger = new Logger ( 'authIdentityToken test' , LogLevel . WARN , [
2121 new StreamHandler (
2222 formatting . format `${ formatting . level } :${ formatting . keys } :${ formatting . msg } ` ,
2323 ) ,
@@ -30,7 +30,7 @@ describe('authSignToken', () => {
3030 let clientService : ClientService ;
3131 let webSocketClient : WebSocketClient ;
3232 let rpcClient : RPCClient < {
33- authSignToken : typeof authSignToken ;
33+ authIdentityToken : typeof authIdentityToken ;
3434 } > ;
3535
3636 beforeEach ( async ( ) => {
@@ -53,7 +53,7 @@ describe('authSignToken', () => {
5353 } ) ;
5454 await clientService . start ( {
5555 manifest : {
56- authSignToken : new AuthSignToken ( {
56+ authIdentityToken : new AuthIdentityToken ( {
5757 keyRing,
5858 } ) ,
5959 } ,
@@ -69,7 +69,7 @@ describe('authSignToken', () => {
6969 } ) ;
7070 rpcClient = new RPCClient ( {
7171 manifest : {
72- authSignToken ,
72+ authIdentityToken ,
7373 } ,
7474 streamFactory : ( ) => webSocketClient . connection . newStream ( ) ,
7575 toError : networkUtils . toError ,
@@ -89,11 +89,13 @@ describe('authSignToken', () => {
8989 } ) ;
9090
9191 test ( 'should return a signed token' , async ( ) => {
92- const identityToken = await rpcClient . methods . authSignToken ( { } ) ;
92+ const identityToken = await rpcClient . methods . authIdentityToken ( { } ) ;
9393 const decodedToken = Token . fromEncoded < IdentityResponseData > ( identityToken ) ;
9494 const decodedPublicKey = keysUtils . publicKeyFromNodeId ( keyRing . getNodeId ( ) ) ;
9595 expect ( decodedToken . verifyWithPublicKey ( decodedPublicKey ) ) . toBeTrue ( ) ;
9696 const encodedNodeId = nodesUtils . encodeNodeId ( keyRing . getNodeId ( ) ) ;
97- expect ( decodedToken . payload . nodeId ) . toBe ( encodedNodeId ) ;
97+ expect ( decodedToken . payload . iss ) . toBe ( encodedNodeId ) ;
98+ expect ( decodedToken . payload . exp ) . toBeDefined ( ) ;
99+ expect ( decodedToken . payload . jti ) . toBeDefined ( ) ;
98100 } ) ;
99101} ) ;
0 commit comments