@microsoft/windows-admin-center-sdk
Version:
Microsoft - Windows Admin Center Shell
133 lines (132 loc) • 3.94 kB
TypeScript
import { Observable } from 'rxjs';
/**
* Web Crypto interface class.
* @dynamic
*/
export declare class Crypto {
private static algRsaOaepSha1Key;
private static algHmacSha256Key;
/**
* hash with SHA-256
* (If it doesn't support web based crypto, encode as base64.)
* @param data the original data to hash.
* @return Observable<string> the hash generated.
*/
static getSha256(data: string): Observable<string>;
/**
* encrypt with RSA/SHA-1
*
* @param jwk the JSON Web Key. Single string with JSON.stringify format.
* @param data the original data to hash.
* @return Observable<string> the hash generated.
*/
static encryptRsaSha1(jwk: string, data: string): Observable<string>;
/**
* sign with HMAC/SHA-256
*
* @param key the key (base64 encoded).
* @param data the original data to hash. (unicode - not utf8)
* @return Observable<string> the hash generated.
*/
static signHmac(key: string, data: string): Observable<string>;
/**
* Hash with SHA-256 for WebAPI.
*
* @param subtle the Web API subtle.
* @param data the original data to hash.
* @return Observable<string> the hash generated.
*/
private static hash256WebAPI;
/**
* Hash with SHA-256 for IE/Older API.
*
* @param subtle the older API subtle.
* @param data the original data to hash.
* @return Observable<string> the hash generated.
*/
private static hash256IE;
/**
* Encrypt with RSA/SHA-1 for WebAPI.
*
* @param subtle the Web API subtle.
* @param jwkObject the JSON Web key object or ArrayBufferView on webkit.
* @param data the original data to encrypt.
* @return Observable<string> the encrypted base64 string.
*/
private static encryptRsaWebAPI;
/**
* Encrypt with RSA/SHA-1 for IE/Older API.
*
* @param subtle the older API subtle.
* @param jwk the JSON Web key format (Stringfiy).
* @param data the original data to hash.
* @return Observable<string> the encrypted base64 string.
*/
private static encryptRsaIE;
/**
* Sign with HMAC for WebAPI.
*
* @param subtle the Web API subtle.
* @param key the key.
* @param data the original data to encrypt.
* @return Observable<string> the encrypted base64 string.
*/
private static signHmacWebAPI;
/**
* Sign with HMAC for IE/Older API.
*
* @param subtle the older API subtle.
* @param jwk the key.
* @param data the original data to hash.
* @return Observable<string> the encrypted base64 string.
*/
private static signHmacIE;
/**
* Create hex string from byte raw data.
*
* @param bytes the array buffer.
* @return string the hex string.
*/
private static toHexString;
/**
* Create Uint8Array from a string.
*
* @param data The string data.
* @return Uint8Array The bytes array.
*/
private static toUint8Array;
/**
* Create ArrayBuffer from a string with unicode.
*
* @param data The string data.
* @return ArrayBuffer The bytes array.
*/
private static toUtf8ArrayBuffer;
/**
* Encode utf8 string.
*
* @param data the unencoded string.
*/
private static utf8Encode;
/**
* Create ArrayBuffer from a string with unicode.
*
* @param data The string data.
* @return ArrayBuffer The bytes array.
*/
private static toArrayBuffer;
/**
* Create ArrayBufferView from a string with unicode.
*
* @param data The string data.
* @return ArrayBuffer The bytes array.
*/
private static toArrayBufferView;
/**
* Create base64 from byte data.
*
* @param data The byte data.
* @return string The base64 encoded data.
*/
private static createBase64;
}