feat: enhance GenericVerifiableCredential interface with explicit optional properties

- Add name, description, and agent as optional properties to GenericVerifiableCredential
- Improve type safety and IntelliSense for common claim properties
- Maintain backward compatibility with existing code
- Reduce need for type assertions when accessing claim properties
This commit is contained in:
Matthew Raymer
2025-06-23 10:30:08 +00:00
parent e2fab0a3ac
commit 2b0e60dfc2
48 changed files with 141 additions and 205 deletions

View File

@@ -262,30 +262,21 @@ import { Component, Vue } from "vue-facing-decorator";
import VuePictureCropper, { cropper } from "vue-picture-cropper";
import { Capacitor } from "@capacitor/core";
import { DEFAULT_IMAGE_API_SERVER, NotificationIface } from "../constants/app";
import { retrieveSettingsForActiveAccount } from "../db/index";
import { accessToken } from "../libs/crypto";
import { logger } from "../utils/logger";
import { PlatformServiceFactory } from "../services/PlatformServiceFactory";
import * as databaseUtil from "../db/databaseUtil";
import { Prop } from "vue-facing-decorator";
import { Router } from "vue-router";
const inputImageFileNameRef = ref<Blob>();
@Component({
components: { VuePictureCropper },
props: {
isRegistered: {
type: Boolean,
default: true,
},
defaultCameraMode: {
type: String,
default: "environment",
validator: (value: string) => ["environment", "user"].includes(value),
},
},
})
export default class ImageMethodDialog extends Vue {
$notify!: (notification: NotificationIface, timeout?: number) => void;
$router!: Router;
/** Active DID for user authentication */
activeDid = "";
@@ -303,7 +294,7 @@ export default class ImageMethodDialog extends Vue {
fileName?: string;
/** Callback function to set image URL after upload */
imageCallback: (imageUrl?: string) => void = () => {};
imageCallback: (imageUrl: string) => void = () => {};
/** URL for image input */
imageUrl?: string;
@@ -351,6 +342,14 @@ export default class ImageMethodDialog extends Vue {
cameraStateMessage?: string;
error: string | null = null;
// Props
@Prop({ default: true }) isRegistered!: boolean;
@Prop({
default: "environment",
validator: (value: string) => ["environment", "user"].includes(value),
})
defaultCameraMode!: string;
/**
* Lifecycle hook: Initializes component and retrieves user settings
* @throws {Error} When settings retrieval fails
@@ -411,7 +410,7 @@ export default class ImageMethodDialog extends Vue {
type: file.type,
});
this.blob = blob;
this.fileName = file.name;
this.fileName = (file as File).name;
this.showRetry = false;
}
};
@@ -442,7 +441,7 @@ export default class ImageMethodDialog extends Vue {
);
}
} else {
this.imageCallback(this.imageUrl);
this.imageCallback(this.imageUrl as string);
this.close();
}
}