mirror of
https://github.com/crypto-pro-web/crypto-pro-js.git
synced 2025-04-18 19:43:12 +03:00
25 lines
773 B
TypeScript
25 lines
773 B
TypeScript
import { OIDS_DICTIONARY } from '../../constants';
|
|
import { _afterPluginsLoaded } from '../../helpers/_afterPluginsLoaded';
|
|
import { Certificate } from './certificate';
|
|
|
|
export interface ExtendedKeysTranslations {
|
|
[key: string]: string | null;
|
|
}
|
|
|
|
/**
|
|
* Возвращает расшифрованные ОИД'ы сертификата
|
|
*
|
|
* @returns словарь расшифрованных ОИД'ов
|
|
*/
|
|
export const getDecodedExtendedKeyUsage = _afterPluginsLoaded(async function (): Promise<ExtendedKeysTranslations> {
|
|
const certificateOids = await (this as Certificate).getExtendedKeyUsage();
|
|
|
|
return certificateOids.reduce(
|
|
(decodedOids, oidCode) => ({
|
|
...decodedOids,
|
|
[oidCode]: OIDS_DICTIONARY[oidCode] || null,
|
|
}),
|
|
{},
|
|
);
|
|
});
|