Skip to content

Commit

Permalink
feat: add documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
whitneypurdum committed Jun 28, 2022
1 parent 9f7ea6e commit 543494f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
2 changes: 2 additions & 0 deletions docs/api/classes/modules_claims.ClaimsService.md
Expand Up @@ -745,6 +745,8 @@ ___

**verifyVc**(`vc`): `Promise`<`void`\>

Verify the issuer and and chain of trust for a Verifiable Credential

#### Parameters

| Name | Type |
Expand Down
24 changes: 18 additions & 6 deletions src/modules/claims/claims.service.ts
Expand Up @@ -74,9 +74,7 @@ import { compareDID, isValidDID } from '../../utils/did';
import { JWT } from '@ew-did-registry/jwt';
import { privToPem, KeyType } from '@ew-did-registry/keys';
import { readyToBeRegisteredOnchain } from './claims.types';
import {
VerifiableCredentialsServiceBase,
} from '../verifiable-credentials';
import { VerifiableCredentialsServiceBase } from '../verifiable-credentials';
import { NotAuthorizedIssuer } from '../../errors/not-authorized-issuer';

const {
Expand Down Expand Up @@ -456,6 +454,11 @@ export class ClaimsService {
await this._cacheClient.issueClaim(this._signerService.did, message);
}

/**
* Verify the issuer and and chain of trust for a Verifiable Credential
*
* @param {VerifiableCredential<RoleCredentialSubject} credential to be verified
*/
async verifyVc(vc: VerifiableCredential<RoleCredentialSubject>) {
const issuerDID = this._signerService.did;
const role = vc.credentialSubject.role.namespace;
Expand Down Expand Up @@ -1348,18 +1351,27 @@ export class ClaimsService {
);
}

/**
*
* Set the Verifier for Claim Issuance.
*
*/
private _setClaimIssuerVerifier() {
const credentialResolver: CredentialResolver = new IpfsCredentialResolver(
this._signerService.provider,
this._didRegistry.registrySettings,
this._didRegistry.ipfsStore
);
const domainReader = new DomainReader({ensRegistryAddress: chainConfigs()[this._signerService.chainId].ensRegistryAddress, provider: this._signerService.provider});
const domainReader = new DomainReader({
ensRegistryAddress:
chainConfigs()[this._signerService.chainId].ensRegistryAddress,
provider: this._signerService.provider,
});
domainReader.addKnownResolver({
chainId: this._signerService.chainId,
chainId: this._signerService.chainId,
address: chainConfigs()[this._signerService.chainId].ensResolverV2Address,
type: ResolverContractType.RoleDefinitionResolver_v2,
})
});
const issuerResolver = new EthersProviderIssuerResolver(domainReader);
// const issuerResolver = new EthersProviderIssuerResolver(
// this._signerService.provider,
Expand Down

0 comments on commit 543494f

Please sign in to comment.