add sanity checks for importing bulk contacts, eg. when there is a truncated link

This commit is contained in:
2025-01-07 20:56:39 -07:00
parent df724162b2
commit 181de625ba
6 changed files with 235 additions and 130 deletions

View File

@@ -103,10 +103,9 @@ export const accessToken = async (did?: string) => {
};
/**
@return payload of JWT pulled out of the URL and decoded:
@return payload of JWT pulled out of any recognized URL path (if any) and decoded:
{ iat: number, iss: string (DID), own: { name, publicEncKey (base64-encoded key) } }
Result may be a single contact or it may be { contacts: [ contact, ... ] }
... or an array of such as { contacts: [ contact, ... ] }
*/
export const getContactPayloadFromJwtUrl = (jwtUrlText: string) => {
let jwtText = jwtUrlText;

View File

@@ -124,7 +124,7 @@ function bytesToHex(b: Uint8Array): string {
}
// We should be calling 'verify' in more places, showing warnings if it fails.
// @returns JWTDecoded with { header: JWTHeader, payload: string, signature: string, data: string } (but doesn't verify the signature)
// @returns JWTDecoded with { header: JWTHeader, payload: any, signature: string, data: string } (but doesn't verify the signature)
export function decodeEndorserJwt(jwt: string) {
return didJwt.decodeJWT(jwt);
}