remove remaining getIdentity calls & fix QR code for did:peer
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
import {Buffer} from "buffer/";
|
||||
import {decode as cborDecode} from "cbor-x";
|
||||
import {bytesToMultibase, multibaseToBytes} from "did-jwt";
|
||||
import { Buffer } from "buffer/";
|
||||
import { decode as cborDecode } from "cbor-x";
|
||||
import { bytesToMultibase, multibaseToBytes } from "did-jwt";
|
||||
|
||||
import {getWebCrypto} from "@/libs/crypto/vc/passkeyHelpers";
|
||||
import { getWebCrypto } from "@/libs/crypto/vc/passkeyHelpers";
|
||||
|
||||
const PEER_DID_PREFIX = "did:peer:";
|
||||
export const PEER_DID_PREFIX = "did:peer:";
|
||||
const PEER_DID_MULTIBASE_PREFIX = PEER_DID_PREFIX + "0";
|
||||
|
||||
/**
|
||||
@@ -93,4 +93,4 @@ export function createPeerDid(publicKeyBytes: Uint8Array) {
|
||||
"p256-pub",
|
||||
);
|
||||
return PEER_DID_MULTIBASE_PREFIX + methodSpecificId;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,8 @@ import * as u8a from "uint8arrays";
|
||||
|
||||
import { createDidPeerJwt } from "@/libs/crypto/vc/passkeyDidPeer";
|
||||
|
||||
export const ETHR_DID_PREFIX = "did:ethr:";
|
||||
|
||||
/**
|
||||
* Meta info about a key
|
||||
*/
|
||||
|
||||
@@ -6,7 +6,7 @@ import { DEFAULT_IMAGE_API_SERVER } from "@/constants/app";
|
||||
import { Contact } from "@/db/tables/contacts";
|
||||
import { accessToken } from "@/libs/crypto";
|
||||
import { NonsensitiveDexie } from "@/db/index";
|
||||
import { getAccount, getIdentity } from "@/libs/util";
|
||||
import { getAccount } from "@/libs/util";
|
||||
import { createEndorserJwtForKey, KeyMeta } from "@/libs/crypto/vc";
|
||||
|
||||
export const SCHEMA_ORG_CONTEXT = "https://schema.org";
|
||||
@@ -1001,8 +1001,7 @@ export async function setVisibilityUtil(
|
||||
}
|
||||
const url =
|
||||
apiServer + "/api/report/" + (visibility ? "canSeeMe" : "cannotSeeMe");
|
||||
const identity = await getIdentity(activeDid);
|
||||
const headers = await getHeaders(identity.did);
|
||||
const headers = await getHeaders(activeDid);
|
||||
const payload = JSON.stringify({ did: contact.did });
|
||||
|
||||
try {
|
||||
|
||||
@@ -211,18 +211,6 @@ export const getAccount = async (
|
||||
return account;
|
||||
};
|
||||
|
||||
export const getIdentity = async (activeDid: string): Promise<IIdentifier> => {
|
||||
const account = await getAccount(activeDid);
|
||||
const identity = JSON.parse(account?.identity || "null");
|
||||
|
||||
if (!identity) {
|
||||
throw new Error(
|
||||
`Attempted to load identity ${activeDid} but no identifier was found`,
|
||||
);
|
||||
}
|
||||
return identity;
|
||||
};
|
||||
|
||||
/**
|
||||
* Generates a new identity, saves it to the database, and sets it as the active identity.
|
||||
* @return {Promise<string>} with the DID of the new identity
|
||||
|
||||
Reference in New Issue
Block a user