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:
@@ -341,7 +341,6 @@ import { Router } from "vue-router";
|
||||
import QuickNav from "../components/QuickNav.vue";
|
||||
import { AppString, NotificationIface } from "../constants/app";
|
||||
import * as databaseUtil from "../db/databaseUtil";
|
||||
import { db, retrieveSettingsForActiveAccount } from "../db/index";
|
||||
import * as vcLib from "../libs/crypto/vc";
|
||||
import * as cryptoLib from "../libs/crypto";
|
||||
|
||||
@@ -352,7 +351,6 @@ import {
|
||||
verifyJwtWebCrypto,
|
||||
} from "../libs/crypto/vc/passkeyDidPeer";
|
||||
import {
|
||||
AccountKeyInfo,
|
||||
blobToBase64,
|
||||
retrieveAccountMetadata,
|
||||
registerAndSavePasskey,
|
||||
@@ -361,6 +359,7 @@ import {
|
||||
import { logger } from "../utils/logger";
|
||||
import { PlatformServiceFactory } from "@/services/PlatformServiceFactory";
|
||||
import { Temp } from "@/db/tables/temp";
|
||||
import { Account } from "../db/tables/accounts";
|
||||
const inputFileNameRef = ref<Blob>();
|
||||
|
||||
const TEST_PAYLOAD = {
|
||||
@@ -498,7 +497,7 @@ export default class Help extends Vue {
|
||||
}
|
||||
|
||||
public async createJwtSimplewebauthn() {
|
||||
const account: AccountKeyInfo | undefined = await retrieveAccountMetadata(
|
||||
const account: Account | undefined = await retrieveAccountMetadata(
|
||||
this.activeDid || "",
|
||||
);
|
||||
if (!vcLib.isFromPasskey(account)) {
|
||||
@@ -515,7 +514,7 @@ export default class Help extends Vue {
|
||||
}
|
||||
|
||||
public async createJwtNavigator() {
|
||||
const account: AccountKeyInfo | undefined = await retrieveAccountMetadata(
|
||||
const account: Account | undefined = await retrieveAccountMetadata(
|
||||
this.activeDid || "",
|
||||
);
|
||||
if (!vcLib.isFromPasskey(account)) {
|
||||
@@ -533,11 +532,9 @@ export default class Help extends Vue {
|
||||
|
||||
public async verifyP256() {
|
||||
const decoded = await verifyJwtP256(
|
||||
this.credIdHex as string,
|
||||
this.activeDid as string,
|
||||
this.peerSetup?.authenticatorData as ArrayBuffer,
|
||||
this.peerSetup?.challenge as Uint8Array,
|
||||
this.peerSetup?.clientDataJsonBase64Url as Base64URLString,
|
||||
this.peerSetup?.signature as Base64URLString,
|
||||
);
|
||||
logger.log("decoded", decoded);
|
||||
@@ -557,11 +554,9 @@ export default class Help extends Vue {
|
||||
|
||||
public async verifyWebCrypto() {
|
||||
const decoded = await verifyJwtWebCrypto(
|
||||
this.credIdHex as string,
|
||||
this.activeDid as string,
|
||||
this.peerSetup?.authenticatorData as ArrayBuffer,
|
||||
this.peerSetup?.challenge as Uint8Array,
|
||||
this.peerSetup?.clientDataJsonBase64Url as Base64URLString,
|
||||
this.peerSetup?.signature as Base64URLString,
|
||||
);
|
||||
logger.log("decoded", decoded);
|
||||
@@ -583,11 +578,9 @@ export default class Help extends Vue {
|
||||
const challenge = clientData.challenge;
|
||||
const signatureB64URL = pieces[2];
|
||||
const decoded = await verifyJwtWebCrypto(
|
||||
this.credIdHex as string,
|
||||
did,
|
||||
authData,
|
||||
challenge,
|
||||
payload["ClientDataJSONB64URL"],
|
||||
signatureB64URL,
|
||||
);
|
||||
logger.log("decoded", decoded);
|
||||
|
||||
Reference in New Issue
Block a user