@microsoft/useragent-sdk
Version:
SDK for building decentralized identity wallets and enterprise agents.
42 lines (41 loc) • 1.9 kB
TypeScript
import { JweHeader } from './jwe/IJweGeneralJson';
import { JwsHeader } from './jws/IJwsGeneralJson';
import { IJweEncryptionOptions, IJwsSigningOptions } from '../../protocols/jose/IJoseOptions';
import { KeyType } from '../../keys/KeyTypeFactory';
import { KeyUse } from '../../keys/KeyUseFactory';
/**
* Crypto helpers support for plugable crypto layer
*/
export default class JoseHelpers {
/**
* Return true if the header has elements
* @param header to test
*/
static headerHasElements(header: JweHeader | JwsHeader | undefined): boolean;
/**
* Encode the header to JSON and base 64 url.
* The Typescript Map construct does not allow for JSON.stringify returning {}.
* TSMap.toJSON prepares a map so it can be serialized as a dictionary.
* @param header to encode
* @param toBase64Url is true when result needs to be base 64 url
*/
static encodeHeader(header: JweHeader | JwsHeader, toBase64Url?: boolean): string;
/**
* Get the Protected to be used from the options
* @param propertyName Property name in options
* @param [initialOptions] The initial set of options
* @param [overrideOptions] Options passed in after the constructure
* @param [mandatory] True if property is required
*/
static getOptionsProperty<T>(propertyName: string, initialOptions?: IJweEncryptionOptions | IJwsSigningOptions, overrideOptions?: IJweEncryptionOptions | IJwsSigningOptions, mandatory?: boolean): T;
/**
* Create the key use according to the selected algorithm.
* @param algorithm JWA algorithm constant
*/
static createTypeViaJwa(algorithm: string): KeyType;
/**
* Create the key use according to the selected algorithm.
* @param algorithm JWA algorithm constant
*/
static createUseViaJwa(algorithm: string): KeyUse;
}