@confluentinc/schemaregistry
Version:
Node.js client for Confluent Schema Registry
31 lines (30 loc) • 1.08 kB
TypeScript
/**
* Copyright 2020 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
/**
* Interface for Message Authentication Codes (MAC).
*
* Security guarantees: Message Authentication Codes provide symmetric message
* authentication. Instances implementing this interface are secure against
* existential forgery under chosen plaintext attack, and can be deterministic
* or randomized. This interface should be used for authentication only, and not
* for other purposes like generation of pseudorandom bytes.
*
*/
export declare abstract class Mac {
/**
* Computes message authentication code (MAC) for `data`.
*
* @param data - the data to compute MAC
* @returns the MAC tag
*/
abstract computeMac(data: Uint8Array<ArrayBuffer>): Promise<Uint8Array<ArrayBuffer>>;
/**
* Verifies whether `tag` is a correct authentication code for `data`.
*
* @param tag - the MAC tag
* @param data - the data to compute MAC
*/
abstract verifyMac(tag: Uint8Array<ArrayBuffer>, data: Uint8Array<ArrayBuffer>): Promise<boolean>;
}