import { SecureDelegation } from '../../icc-api/model/SecureDelegation'; import { UserEncryptionKeysManager } from './UserEncryptionKeysManager'; import { CryptoPrimitives } from './CryptoPrimitives'; /** * @internal this class is for internal use only and may be changed without notice. */ export declare class SecureDelegationsEncryption { private readonly userKeys; private readonly primitives; constructor(userKeys: UserEncryptionKeysManager, primitives: CryptoPrimitives); /** * WARNING: this values should be ALWAYS be the string 'Cure' and its utf-8 bytes. If changed, it would not be possible to decrypt old secretIds and owningEntityIds * anymore. * @private */ private readonly decryptionValidatorPrefix; private readonly decryptionValidatorBytes; /** * Check if a Uint8Array or an Array buffer contains the decryption validator prefix. * @param bytes an ArrayBuffer or Uint8Array to verify. * @return true if the buffer contains the prefix, false otherwise. */ private prefixVerification; /** * If the secure delegation has an encrypted exchange data id attempts to decrypt it with the available keys for the current user. * @param encryptedExchangeIds a map that associates an encrypted exchange data id to the fingerprint of the public key used to encrypt it. * @return the id of the exchange data used for the encryption of the provided secure delegation if it was encrypted and could be decrypted, * undefined otherwise (there was no encrypted id of the exchange data, or it could not be decrypted as no key was available). */ decryptExchangeDataId(encryptedExchangeIds: { [fp: string]: string; }): Promise; /** * Encrypts the exchange data id for a secure delegation. To avoid leaks of sensitive data the provided public keys should be only keys of users * which DO NOT REQUIRE anonymous delegations */ encryptExchangeDataId(exchangeDataId: string, publicKeys: { [fp: string]: CryptoKey; }): Promise<{ [fp: string]: string; }>; encryptEncryptionKey(hexKey: string, key: CryptoKey): Promise; encryptEncryptionKeys(hexKeys: string[], key: CryptoKey): Promise; decryptEncryptionKey(encrypted: string, key: CryptoKey): Promise; decryptEncryptionKeys(delegation: SecureDelegation, key: CryptoKey): Promise; encryptSecretId(secretId: string, key: CryptoKey): Promise; encryptSecretIds(secretIds: string[], key: CryptoKey): Promise; decryptSecretId(encrypted: string, key: CryptoKey): Promise; decryptSecretIds(delegation: SecureDelegation, key: CryptoKey): Promise; encryptOwningEntityId(owningEntityId: string, key: CryptoKey): Promise; encryptOwningEntityIds(owningEntityIds: string[], key: CryptoKey): Promise; decryptOwningEntityId(encrypted: string, key: CryptoKey): Promise; decryptOwningEntityIds(delegation: SecureDelegation, key: CryptoKey): Promise; }