Files
inji-wallet/types/vc.ts
Tilak Puli ec9fd9f6d9 Inji-344: Refactoring VC Key (#798)
* feat(inji-344): Use VC Key class instead of separate functions for managing vc key

* feat(inji-344): Use properties from VcKey Class instead of reading from vckey string

* feat(inji-344): Rename vcKey to vcMetadata

* feat(inji-344): Use vc's unique id or vckey instead of joined string of vc metadata

* feat(inji-344): Use vc key instead of unique id to avoid confusion. Fix issues reg parsing vc metadata

* feat(inji-344):fix redownloading issue

Co-authored-by: Tilak <tilakpuli15@gmail.com>

* feat(inji-344): Remove vc getting stored on update of pin status

* feat(inji-344): update other vc's pin status to false when any vc is pinned

* feat(inji-344): remove hash ID for UIN

* feat(inji-344): revert google services json

* feat(inji-344): remove mmkv logs added for debugging

* feat(inji-344): fix received vcs not getting displayed on reopen of app

* feat(inji-344): fix id not shown in revoke component

---------

Co-authored-by: Sri Kanth Kola <srikanthsri7447@gmail.com>
2023-09-20 16:51:59 +05:30

117 lines
2.6 KiB
TypeScript

import {WalletBindingResponse} from '../shared/cryptoutil/cryptoUtil';
export interface VC {
id: string;
idType: VcIdType;
tag: string;
credential: DecodedCredential;
verifiableCredential: VerifiableCredential;
verifiablePresentation?: VerifiablePresentation;
generatedOn: Date;
requestId: string;
isVerified: boolean;
lastVerifiedOn: number;
locked: boolean;
reason?: VCSharingReason[];
shouldVerifyPresence?: boolean;
walletBindingResponse?: WalletBindingResponse;
credentialRegistry?: string;
isPinned?: boolean;
}
export interface VCSharingReason {
timestamp: number;
message: string;
}
export type VcIdType = 'UIN' | 'VID';
export interface DecodedCredential {
biometrics: {
face: string;
finger: {
left_thumb: string;
right_thumb: string;
};
};
}
export interface CredentialSubject {
UIN: string;
VID: string;
addressLine1: LocalizedField[] | string;
addressLine2: LocalizedField[] | string;
addressLine3: LocalizedField[] | string;
biometrics: string; // Encrypted Base64Encoded Biometrics
city: LocalizedField[] | string;
dateOfBirth: string;
email: string;
fullName: string;
gender: LocalizedField[] | string;
id: string;
phone: string;
postalCode: string;
province: LocalizedField[] | string;
region: LocalizedField[] | string;
vcVer: 'VC-V1' | string;
}
type VCContext = (string | Record<string, unknown>)[];
export interface VerifiableCredential {
'@context': VCContext;
credentialSubject: CredentialSubject;
id: string;
issuanceDate: string;
issuer: string;
proof: {
created: string;
jws: string;
proofPurpose: 'assertionMethod' | string;
type: 'RsaSignature2018' | string;
verificationMethod: string;
};
type: VerifiableCredentialType[];
}
export interface VerifiablePresentation {
'@context': VCContext;
verifiableCredential: VerifiableCredential[];
type: 'VerifiablePresentation';
proof: {
created: string;
jws: string;
proofPurpose: 'authentication' | string;
type: 'RsaSignature2018' | string;
verificationMethod: string;
challenge: string;
domain: string;
};
}
export type VerifiableCredentialType =
| 'VerifiableCredential'
| 'MOSIPVerfiableCredential'
| string;
export interface VCLabel {
singular: string;
plural: string;
}
export interface LocalizedField {
language: string;
value: string;
}
export interface linkTransactionResponse {
authFactors: Object[];
authorizeScopes: null;
clientName: string;
configs: {};
essentialClaims: string[];
linkTransactionId: string;
logoUrl: string;
voluntaryClaims: string[];
}