File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
extension/js/common/core/crypto Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -275,7 +275,8 @@ export class KeyUtil {
275275 const opgpresult = await OpenPGPKey . diagnose ( key , passphrase ) ;
276276 result = new Map < string , string > ( [ ...result , ...opgpresult ] ) ;
277277 }
278- result . set ( `expiration` , KeyUtil . formatResult ( key . expiration ) ) ;
278+ const expirationIso = key . expiration ? new Date ( key . expiration ) . toISOString ( ) : undefined ;
279+ result . set ( `expiration` , KeyUtil . formatResult ( expirationIso ) ) ;
279280 result . set ( `internal dateBeforeExpiration` , await KeyUtil . formatResultAsync ( async ( ) => KeyUtil . dateBeforeExpirationIfAlreadyExpired ( key ) ) ) ;
280281 result . set ( `internal usableForEncryption` , KeyUtil . formatResult ( key . usableForEncryption ) ) ;
281282 result . set ( `internal usableForSigning` , KeyUtil . formatResult ( key . usableForSigning ) ) ;
@@ -292,8 +293,9 @@ export class KeyUtil {
292293 }
293294 }
294295
295- public static formatResult ( value : unknown ) : string {
296- return `[-] ${ String ( value ) } ` ;
296+ public static formatResult ( value : unknown | undefined ) : string {
297+ const formattedOutput = value !== undefined ? ( value as string ) : '-' ;
298+ return `[-] ${ formattedOutput } ` ;
297299 }
298300
299301 public static async asPublicKey ( key : Key ) : Promise < Key > {
You can’t perform that action at this time.
0 commit comments