Skip to content

Commit

Permalink
feat: request asset enrollment
Browse files Browse the repository at this point in the history
  • Loading branch information
JGiter committed Apr 8, 2021
1 parent eaeb208 commit c65e883
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/iam.ts
Expand Up @@ -1284,12 +1284,14 @@ export class IAM extends IAMBase {

async createClaimRequest({
issuer,
claim
claim,
did = this._did
}: {
issuer: string[];
claim: { claimType: string; fields: { key: string; value: string | number }[] };
did?: string;
}) {
if (!this._did) {
if (!did) {
throw new Error(ERROR_MESSAGES.USER_NOT_LOGGED_IN);
}

Expand All @@ -1298,7 +1300,7 @@ export class IAM extends IAMBase {
type: ENSNamespaceTypes.Roles,
namespace: claim.claimType
}),
this.getDidDocument({ includeClaims: true })
this.getDidDocument({ did, includeClaims: true })
]);

if (!roleDefinition) {
Expand All @@ -1314,12 +1316,12 @@ export class IAM extends IAMBase {
id: uuid(),
token,
claimIssuer: issuer,
requester: this._did || ""
requester: did
};

if (!this._natsConnection) {
if (this._cacheClient) {
return this._cacheClient.requestClaim({ did: this._did, message });
return this._cacheClient.requestClaim({ did, message });
}
throw new NATSConnectionNotEstablishedError();
}
Expand Down

0 comments on commit c65e883

Please sign in to comment.