mirror of
https://github.com/mosip/inji-wallet.git
synced 2026-01-09 21:48:04 -05:00
* [INJIMOB-2471] make identifier of Vc as random UUID Previously, we were relying on the id feild of the Vc to construct the unique identifier for VC component and file name for storing VC, this identifier in now replaced with random generated UUID. This was made since id property of VC is optional field as per w3c data-model 1.1. We are using UUID version 4 to ensure randomness and collision-resistance. Signed-off-by: KiruthikaJeyashankar <kiruthikavjshankar@gmail.com> * [INJIMOB-2471] maintain consistency in setting VCMetadata ID Signed-off-by: KiruthikaJeyashankar <kiruthikavjshankar@gmail.com> * [INJICERT-2471] use VC metadata id as VC key This VC key will be used for storing file name, component key & other identifier for VCs Signed-off-by: KiruthikaJeyashankar <kiruthikavjshankar@gmail.com> * [INJIMOB-2471] remove setting identifier field in credential wrapper The identitifier in credentialWrapper having the value "$issuer:$protocol:$UUID" was used to construct VC metadata id, issuer and protocol field which is already available in context param. This is now replaced with constructing VC metadata with the required fields available in machine context. Signed-off-by: KiruthikaJeyashankar <kiruthikavjshankar@gmail.com> * [INJIMOB-2471] use context VCMetadata instead of calling function for accessing in issuersMachine Signed-off-by: KiruthikaJeyashankar <kiruthikavjshankar@gmail.com> * [INJIMOB-2471] optimize import Signed-off-by: KiruthikaJeyashankar <kiruthikavjshankar@gmail.com> --------- Signed-off-by: KiruthikaJeyashankar <kiruthikavjshankar@gmail.com>
150 lines
3.3 KiB
TypeScript
150 lines
3.3 KiB
TypeScript
import {displayType, logoType} from '../../Issuers/IssuersMachine';
|
|
import {VCMetadata} from '../../../shared/VCMetadata';
|
|
|
|
export interface VC {
|
|
id?: string;
|
|
idType?: VcIdType;
|
|
credential?: DecodedCredential;
|
|
verifiableCredential: VerifiableCredential | Credential;
|
|
requestId?: string;
|
|
isVerified?: boolean;
|
|
lastVerifiedOn: number;
|
|
walletBindingResponse?: WalletBindingResponse;
|
|
hashedId?: string;
|
|
vcMetadata: VCMetadata;
|
|
}
|
|
|
|
export type VcIdType = 'UIN' | 'VID';
|
|
|
|
export interface DecodedCredential {
|
|
biometrics: {
|
|
face: string;
|
|
finger: {
|
|
left_thumb: string;
|
|
right_thumb: string;
|
|
};
|
|
};
|
|
}
|
|
|
|
export interface CredentialSubject {
|
|
//TODO: This should change to mandatory field if uin is also issued
|
|
UIN?: string;
|
|
VID?: string;
|
|
addressLine1: LocalizedField[] | string;
|
|
city: LocalizedField[] | string;
|
|
dateOfBirth: string;
|
|
email: string;
|
|
fullName: LocalizedField[] | string;
|
|
gender: LocalizedField[] | string;
|
|
id: string;
|
|
phone: string;
|
|
face: string;
|
|
}
|
|
|
|
type VCContext = (string | Record<string, unknown>)[];
|
|
|
|
export type Credential =
|
|
| {
|
|
credentialConfigurationId: any;
|
|
'@context': VCContext;
|
|
credentialSubject: CredentialSubject;
|
|
id: string;
|
|
issuanceDate: string;
|
|
issuer: string;
|
|
proof: {
|
|
created: string;
|
|
jws: string;
|
|
proofPurpose: 'assertionMethod' | string;
|
|
type: 'RsaSignature2018' | string;
|
|
verificationMethod: string;
|
|
};
|
|
type: string[];
|
|
}
|
|
| string;
|
|
|
|
export interface VerifiableCredential {
|
|
issuerLogo: logoType;
|
|
credential: Credential;
|
|
processedCredential?: object;
|
|
wellKnown: string;
|
|
credentialConfigurationId: string;
|
|
}
|
|
|
|
export interface VerifiableCredentialData {
|
|
vcMetadata: VCMetadata;
|
|
format: string;
|
|
face: string;
|
|
issuerLogo: logoType;
|
|
wellKnown?: string;
|
|
credentialConfigurationId: string;
|
|
issuer?: string;
|
|
}
|
|
|
|
export interface CredentialWrapper {
|
|
verifiableCredential: VerifiableCredential;
|
|
format: string;
|
|
generatedOn: Date;
|
|
vcMetadata: VCMetadata;
|
|
}
|
|
|
|
export interface CredentialTypes {
|
|
format: string;
|
|
id: string;
|
|
scope: string;
|
|
display: [displayType];
|
|
proof_types_supported: Object;
|
|
credential_definition: {
|
|
type: Object[];
|
|
credentialSubject: CredentialSubject;
|
|
};
|
|
doctype: string;
|
|
claims: Object;
|
|
}
|
|
|
|
export interface IssuerWellknownResponse {
|
|
credential_issuer: string;
|
|
credential_endpoint: string;
|
|
credential_configurations_supported: Object;
|
|
}
|
|
|
|
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[];
|
|
}
|
|
|
|
export interface WalletBindingResponse {
|
|
walletBindingId: string;
|
|
keyId: string;
|
|
thumbprint: string;
|
|
expireDateTime: string;
|
|
}
|
|
|
|
//TODO: Check if Type word is needed in the naming
|
|
export interface VCMetadataType {
|
|
//TODO: requestId is not null at any point as its used for file names and all
|
|
isPinned: boolean;
|
|
requestId: string | null;
|
|
issuer: string;
|
|
protocol: string;
|
|
id: string;
|
|
timestamp: string;
|
|
isVerified: boolean;
|
|
credentialType: string;
|
|
}
|