import { AttributesKeys } from '../types.js'; import { IdStatement } from './idProofTypes.js'; /** * Given a number x, return the date string for x years ago. * @param yearsAgo how many years to go back from today * @param daysOffset optional, how many days should be added to the current date * @returns YYYYMMDD for x years ago today in local time. */ export declare function getPastDate(yearsAgo: number, daysOffset?: number): string; interface StatementBuilder { addRange(attribute: AttributesKeys, lower: string, upper: string): IdStatementBuilder; addMembership(attribute: AttributesKeys, set: string[]): IdStatementBuilder; addNonMembership(attribute: AttributesKeys, set: string[]): IdStatementBuilder; revealAttribute(attribute: AttributesKeys): IdStatementBuilder; getStatement(): IdStatement; } /** * Check that the Id statement is well formed and do not break any rules. * If it does not verify, this throw an error. */ export declare function verifyIdstatement(statements: IdStatement): boolean; export declare class IdStatementBuilder implements StatementBuilder { statements: IdStatement; checkConstraints: boolean; constructor(checkConstraints?: boolean); /** * Outputs the built statement. */ getStatement(): IdStatement; /** * If checkConstraints is true, this checks whether the given statement may be added to the statement being built. * If the statement breaks any rules, this will throw an error. */ private check; /** * Add to the statement, that the given attribute should be in the given range, i.e. that lower <= attribute < upper. * @param attribute the attribute that should be checked * @param lower: the lower end of the range, inclusive. * @param upper: the upper end of the range, exclusive. * @returns the updated builder */ addRange(attribute: AttributesKeys, lower: string, upper: string): IdStatementBuilder; /** * Add to the statement, that the given attribute should be one of the values in the given set. * @param attribute the attribute that should be checked * @param set: the set of values that the attribute must be included in. * @returns the updated builder */ addMembership(attribute: AttributesKeys, set: string[]): IdStatementBuilder; /** * Add to the statement, that the given attribute should be one of the values in the given set. * @param attribute the attribute that should be checked * @param set: the set of values that the attribute must be included in. * @returns the updated builder */ addNonMembership(attribute: AttributesKeys, set: string[]): IdStatementBuilder; /** * Add to the statement, that the given attribute should be revealed. * The proof will contain the value. * @param attribute the attribute that should be revealed * @returns the updated builder */ revealAttribute(attribute: AttributesKeys): IdStatementBuilder; /** * Add to the statement that the age is at minimum the given value. * This adds a range statement that the date of birth is between 1st of january 1800 and years ago. * @param age: the minimum age allowed. * @returns the updated builder */ addMinimumAge(age: number): IdStatementBuilder; /** * Add to the statement that the age is at maximum the given value. * This adds a range statement that the date of birth is between years ago and 1st of january 9999. * @param age: the maximum age allowed. * @returns the updated builder */ addMaximumAge(age: number): IdStatementBuilder; /** * Add to the statement that the age is between two given ages. * This adds a range statement that the date of birth is between years ago and years ago. * @param minAge: the maximum age allowed. * @param maxAge: the maximum age allowed. * @returns the updated builder */ addAgeInRange(minAge: number, maxAge: number): IdStatementBuilder; /** * Add to the statement that the user's document expiry is atleast the given date. * This adds a range statement that the idDocExpiresAt is between the given date and 1st of january 9999 . * @param earliestDate: the earliest the document is allow to be expired at, should be a string in YYYYMMDD format. * @returns the updated builder */ documentExpiryNoEarlierThan(earliestDate: string): IdStatementBuilder; /** * Add to the statement that the country of residence is one of the EU countries * @returns the updated builder */ addEUResidency(): IdStatementBuilder; /** * Add to the statement that the nationality is one of the EU countries * @returns the updated builder */ addEUNationality(): IdStatementBuilder; } export {};