import { BytearrayWrapper } from '../bytearray-wrapper'; import { Encoder, MessageEncoder } from '../encoder'; import { VerifyResult } from 'crypto-wasm-new'; import { MessageStructure, SignedMessages } from '../types'; import { BBDT16MacParams } from './params'; import { BBDT16MacSecretKey, BBDT16MacPublicKeyG1 } from './keys'; /** * Proof of knowledge of BBDT16 MAC protocol */ export declare class BBDT16Mac extends MessageEncoder { /** * Signer creates a new MAC * @param messages - Ordered list of messages. Order and contents should be kept same for both signer and verifier * @param secretKey * @param params * @param encodeMessages - If true, the messages are encoded as field elements otherwise they are assumed to be already encoded. */ static generate(messages: Uint8Array[], secretKey: BBDT16MacSecretKey, params: BBDT16MacParams, encodeMessages: boolean): BBDT16Mac; /** * Verify the MAC * @param messages - Ordered list of messages. Order and contents should be kept same for both signer and verifier * @param secretKey * @param params * @param encodeMessages - If true, the messages are encoded as field elements otherwise they are assumed to be already encoded. */ verify(messages: Uint8Array[], secretKey: BBDT16MacSecretKey, params: BBDT16MacParams, encodeMessages: boolean): VerifyResult; static signMessageObject(messages: Object, secretKey: BBDT16MacSecretKey, labelOrParams: Uint8Array | BBDT16MacParams, encoder: Encoder): SignedMessages; static getSignedMessageObjectWithProof(messages: Object, secretKey: BBDT16MacSecretKey, publicKey: BBDT16MacPublicKeyG1, labelOrParams: Uint8Array | BBDT16MacParams, encoder: Encoder): [SignedMessages, BBDT16MacProofOfValidity]; /** * Verifies the MAC on the given messages. Takes the messages as a JS object, flattens it, encodes the values similar * to signing and then verifies the MAC. * @param messages * @param secretKey * @param labelOrParams * @param encoder * @param useConstantTimeEncoding */ verifyMessageObject(messages: object, secretKey: BBDT16MacSecretKey, labelOrParams: Uint8Array | BBDT16MacParams, encoder: Encoder, useConstantTimeEncoding?: boolean): VerifyResult; } export declare class BBDT16BlindMac extends MessageEncoder { /** * Generates a blind MAC over the commitment of unrevealed messages and revealed messages * @param commitment - Commitment over unrevealed messages sent by the requester of the blind MAC. Its assumed that * the signers has verified the knowledge of committed messages * @param revealedMessages * @param secretKey * @param params * @param encodeMessages */ static generate(commitment: Uint8Array, revealedMessages: Map, secretKey: BBDT16MacSecretKey, params: BBDT16MacParams, encodeMessages: boolean): BBDT16BlindMac; /** * Generate a blind MAC from request * @param request * @param secretKey * @param params * @returns {BBDT16BlindMac} */ static fromRequest({ commitment, revealedMessages }: BBDT16BlindMacRequest, secretKey: BBDT16MacSecretKey, params: BBDT16MacParams): BBDT16BlindMac; /** * Unblind the blind MAC to get a regular MAC that can be verified * @param blinding */ unblind(blinding: Uint8Array): BBDT16Mac; /** * Generate a request for a blind MAC * @param messagesToBlind - messages the requester wants to hide from the signer. The key of the map is the index of the * message as per the params. * @param params * @param encodeMessages * @param blinding - If not provided, a random blinding is generated * @param revealedMessages - Any messages that the requester wishes to inform the signer about. This is for informational * purpose only and has no cryptographic use. */ static generateRequest(messagesToBlind: Map, params: BBDT16MacParams, encodeMessages: boolean, blinding?: Uint8Array, revealedMessages?: Map): [Uint8Array, BBDT16BlindMacRequest]; /** * Used by the signer to create a blind MAC * @param blindSigRequest - The blind sig request sent by user. * @param revealedMessages - The messages known to the signer * @param secretKey * @param msgStructure * @param labelOrParams * @param encoder */ static blindSignMessageObject(blindSigRequest: BBDT16BlindMacRequest, revealedMessages: object, secretKey: BBDT16MacSecretKey, msgStructure: MessageStructure, labelOrParams: Uint8Array | BBDT16MacParams, encoder: Encoder): SignedMessages; } /** * Structure to send to the signer to request a blind MAC for BBDT16 scheme. */ export interface BBDT16BlindMacRequest { /** * The commitment to the blinded messages */ commitment: Uint8Array; /** * The messages at these indices were committed to in the commitment and are not revealed to the signer. This is expected * to be sorted in ascending order */ blindedIndices: number[]; /** * The messages which are known to the signer. Here the key is message index (as per the `MACParams`). This is not * mandatory as the signer might already know the messages to sign. This is used when the requester wants to inform the * signer of some or all of the message */ revealedMessages?: Map; } /** * This MAC cannot be verified without the secret key but the signer can give a proof to the user that the MAC is * correct, i.e. it was created using the secret key. */ export declare class BBDT16MacProofOfValidity extends BytearrayWrapper { constructor(mac: BBDT16Mac, secretKey: BBDT16MacSecretKey, publicKey: BBDT16MacPublicKeyG1, params: BBDT16MacParams); verify(mac: BBDT16Mac, messages: Uint8Array[], publicKey: BBDT16MacPublicKeyG1, params: BBDT16MacParams, encodeMessages: boolean): VerifyResult; verifyWithMessageObject(mac: BBDT16Mac, messages: object, publicKey: BBDT16MacPublicKeyG1, labelOrParams: Uint8Array | BBDT16MacParams, encoder: Encoder): VerifyResult; } //# sourceMappingURL=mac.d.ts.map