From 370ee39963c1e86bebca273686d7e55922c295e5 Mon Sep 17 00:00:00 2001 From: vbasiuk Date: Thu, 28 Nov 2024 17:00:38 +0200 Subject: [PATCH] resolve comments --- src/iden3comm/types/protocol/auth.ts | 4 ++-- .../blockchain/did-resolver-readonly-storage.ts | 3 +++ src/storage/entities/state.ts | 11 +---------- 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/src/iden3comm/types/protocol/auth.ts b/src/iden3comm/types/protocol/auth.ts index c3085734..48080219 100644 --- a/src/iden3comm/types/protocol/auth.ts +++ b/src/iden3comm/types/protocol/auth.ts @@ -7,7 +7,7 @@ import { DIDDocument as DidResolverDidDocument, VerificationMethod as DidResolverVerificationMethod } from 'did-resolver'; -import { RootInfoWithProof, StateInfo } from '../../../storage'; +import { RootInfo, StateInfo } from '../../../storage'; /** AuthorizationResponseMessage is struct the represents iden3message authorization response */ export type AuthorizationResponseMessage = BasicMessage & { @@ -89,5 +89,5 @@ export type DIDDocument = DidResolverDidDocument & { export type VerificationMethod = DidResolverVerificationMethod & { published?: boolean; info?: StateInfo; - global?: RootInfoWithProof; + global?: RootInfo; }; diff --git a/src/storage/blockchain/did-resolver-readonly-storage.ts b/src/storage/blockchain/did-resolver-readonly-storage.ts index 0a931a32..2e96bdad 100644 --- a/src/storage/blockchain/did-resolver-readonly-storage.ts +++ b/src/storage/blockchain/did-resolver-readonly-storage.ts @@ -31,6 +31,9 @@ export class DidResolverStateReadonlyStorage implements IStateStorage { throw new Error('GIST root not found'); } const { proof } = global; + if (!proof) { + throw new Error('GIST proof not found'); + } return { root: global.root, existence: proof.existence, diff --git a/src/storage/entities/state.ts b/src/storage/entities/state.ts index b8b7020f..0d1d28e0 100644 --- a/src/storage/entities/state.ts +++ b/src/storage/entities/state.ts @@ -45,16 +45,7 @@ export interface RootInfo { replacedAtTimestamp: bigint; createdAtBlock: bigint; replacedAtBlock: bigint; -} - -/** - * global identity state root info from DID resolver document - * - * @public - * @interface RootInfoWithProof - */ -export interface RootInfoWithProof extends RootInfo { - proof: ProofJSON; + proof?: ProofJSON; } /**