@@ -21,14 +21,13 @@ import { DialogOutput } from './Output';
2121export class ContractNegotiator extends BaseNegotiator {
2222 protected readonly logger = getLoggerFor ( this ) ;
2323
24- // protected readonly operationLogger = getOperationLogger();
2524 protected readonly contractManager = new ContractManager ( ) ;
2625
2726 /**
2827 * Construct a new Negotiator
2928 * @param verifier - The Verifier used to verify Claims of incoming Credentials.
3029 * @param ticketStore - A KeyValueStore to track Tickets.
31- * @param ticketManager - The strategy describing the life cycle of a Ticket.
30+ * @param ticketingStrategy - The strategy describing the life cycle of a Ticket.
3231 * @param tokenFactory - A factory for minting Access Tokens.
3332 */
3433 public constructor (
@@ -43,15 +42,15 @@ export class ContractNegotiator extends BaseNegotiator {
4342
4443 /**
4544 * Performs UMA grant negotiation.
46- *
47- * @param {TokenRequest } body - request body
48- * @param {HttpHandlerContext } context - request context
49- * @return {Promise<TokenResponse> } tokens - yielded tokens
5045 */
5146 public async negotiate ( input : DialogInput ) : Promise < DialogOutput > {
5247 reType ( input , DialogInput ) ;
53- if ( ! input . permissions && input . permission ?. length )
54- input . permissions = input . permission . map ( p => processRequestPermission ( p ) )
48+ if ( ! input . permissions && input . permission ?. length ) {
49+ input = {
50+ ...input ,
51+ permissions : input . permission . map ( p => processRequestPermission ( p ) ) ,
52+ } ;
53+ }
5554 this . logger . debug ( `Input. ${ JSON . stringify ( input ) } ` ) ;
5655 // Create or retrieve ticket
5756 const ticket = await this . getTicket ( input ) ;
@@ -170,7 +169,7 @@ export class ContractNegotiator extends BaseNegotiator {
170169 const policyCreationResponse = await fetch ( instantiatedPolicyContainer , {
171170 method : 'POST' ,
172171 headers : { 'content-type' : 'application/ld+json' } ,
173- body : JSON . stringify ( contract , null , 2 )
172+ body : JSON . stringify ( contract ) ,
174173 } ) ;
175174
176175 if ( policyCreationResponse . status !== 201 ) {
0 commit comments