File tree Expand file tree Collapse file tree 2 files changed +15
-3
lines changed
Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ import { CommonAccessTokenRenewal } from './catr';
1616import { CommonAccessTokenHeader } from './cath' ;
1717import { CommonAccessTokenIf } from './catif' ;
1818import { toBase64 , toHex } from './util' ;
19+ import { Log } from './log' ;
1920
2021export const claimsToLabels : { [ key : string ] : number } = {
2122 iss : 1 , // 3
@@ -361,14 +362,16 @@ export class CommonAccessToken {
361362 ) : Promise < void > {
362363 const decoder = new cbor . Decoder ( { mapsAsObjects : false } ) ;
363364 const coseMessage = decoder . decode ( token ) ;
364- if ( process . env . DEBUG ) {
365- console . dir ( coseMessage , { depth : null } ) ;
366- }
365+ Log ( coseMessage , { depth : null } ) ;
367366 if ( opts ?. expectCwtTag && coseMessage . tag !== 61 ) {
368367 throw new Error ( 'Expected CWT tag' ) ;
369368 }
370369 if ( coseMessage . tag === CWT_TAG ) {
371370 const cborCoseMessage = cbor . encode ( coseMessage . value ) ;
371+ Log ( {
372+ kid : key . kid ,
373+ key : key . k . toString ( 'hex' )
374+ } ) ;
372375 const buf = await cose . mac . read ( cborCoseMessage , key . k ) ;
373376 const json = await decoder . decode ( buf ) ;
374377 this . payload = updateMapFromClaims ( json ) ;
Original file line number Diff line number Diff line change 1+ export function Log ( obj : any , opts ?: any ) {
2+ if ( process . env . DEBUG ) {
3+ if ( opts ) {
4+ console . dir ( obj , opts ) ;
5+ } else {
6+ console . log ( obj ) ;
7+ }
8+ }
9+ }
You can’t perform that action at this time.
0 commit comments