Skip to content

Commit

Permalink
fix(createClaimRequest): use subjectAgreement
Browse files Browse the repository at this point in the history
SWTCH-1061
Rename agreement to subjectAgreement in IClaimRequest to align with cache-server
  • Loading branch information
jrhender committed Jun 21, 2021
1 parent eb6bfd4 commit 427f4a8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/iam.ts
Expand Up @@ -84,7 +84,7 @@ export interface IMessage {
export interface IClaimRequest extends IMessage {
token: string;
registrationTypes: RegistrationTypes[];
agreement?: string;
subjectAgreement?: string;
}

export interface IClaimIssuance extends IMessage {
Expand Down Expand Up @@ -1500,7 +1500,7 @@ export class IAM extends IAMBase {
if (!version) {
throw new Error(ERROR_MESSAGES.ONCHAIN_ROLE_VERSION_NOT_SPECIFIED);
}
message.agreement = await this.approveRolePublishing({ subject, role, version });
message.subjectAgreement = await this.approveRolePublishing({ subject, role, version });
}

if (this._natsConnection) {
Expand Down
6 changes: 3 additions & 3 deletions test/claimsTests/enrollmentClaimsTests.ts
Expand Up @@ -113,7 +113,7 @@ export function enrollmentClaimsTests() {
expect(message).toHaveProperty("token");
expect(message).toMatchObject({ requester: subjectDID, registrationTypes });

const { id, agreement: subjectAgreement, token } = message;
const { id, subjectAgreement, token } = message;
await staticIssuerIam.issueClaimRequest({
id,
registrationTypes,
Expand Down Expand Up @@ -148,7 +148,7 @@ export function enrollmentClaimsTests() {
});
let [, encodedMsg] = publish.mock.calls.pop();
let message = jsonCodec.decode(encodedMsg);
let { agreement: subjectAgreement, token, id } = message;
let { subjectAgreement, token, id } = message;
await staticIssuerIam.issueClaimRequest({ id, requester: dynamicIssuerDID, token, registrationTypes, subjectAgreement });

expect(await claimManager.hasRole(addressOf(dynamicIssuerDID), namehash(`${roleName1}.${root}`), version));
Expand All @@ -160,7 +160,7 @@ export function enrollmentClaimsTests() {
});
([, encodedMsg] = publish.mock.calls.pop());
message = jsonCodec.decode(encodedMsg);
({ agreement: subjectAgreement, token, id } = message);
({ subjectAgreement, token, id } = message);
await dynamicIssuerIam.issueClaimRequest({ id, requester: subjectDID, token, registrationTypes, subjectAgreement });

expect(await claimManager.hasRole(addressOf(subjectDID), namehash(`${roleName2}.${root}`), version));
Expand Down

0 comments on commit 427f4a8

Please sign in to comment.