/** * Copyright (c) 2018-2023, BOTLabs GmbH. * * This source code is licensed under the BSD 4-Clause "Original" license * found in the LICENSE file in the root directory of this source tree. */ import type { HexString, DidUri, IAssetClaim, ICType, IDelegationNode, IPublicCredential, IPublicCredentialInput } from '@kiltprotocol/types'; /** * Calculates the ID of a [[IPublicCredentialInput]], to be used to retrieve the full credential content from the blockchain. * * The ID is formed by first concatenating the SCALE-encoded [[IPublicCredentialInput]] with the SCALE-encoded [[DidUri]] and then Blake2b hashing the result. * * @param credential The input credential object. * @param attester The DID of the credential attester. * @returns The credential ID. */ export declare function getIdForCredential(credential: IPublicCredentialInput, attester: DidUri): HexString; /** * Checks the [[IPublicCredential]] with a given [[CType]] to check if the included claim meets the [[schema]] structure. * * This function is meant to be used by consumers of this [[IPublicCredential]], once they have retrieved the full credential content. * * @param credential A [[IPublicCredential]] for the attester. * @param cType A [[CType]] to verify the [[Claim]] structure. */ export declare function verifyAgainstCType(credential: IPublicCredential, cType: ICType): void; declare type VerifyOptions = { cType?: ICType; }; /** * Verifies if a received [[IPublicCredential]] is valid, meaning if its content has not been tampered with and optionally if its structure matches a given [[ICType]]. * * **Successful verification of a public credential still requires the consumer to check the `revoked` property and take the appropriate action**. * * We recommend consumer of credentials to fetch them themselves using the functions exposed in this SDK. * Nevertheless, for some use cases having a function that verifies the content of a credential directly could be handy. * This function does that: it takes a [[IPublicCredential]], and re-computes its cryptographically-generated ID to verify the content authenticity. * * @param credential The full [[IPublicCredential]] object. * @param options - Additional parameter for more verification steps. * @param options.cType - CType which the included claim should be checked against. */ export declare function verifyCredential(credential: IPublicCredential, { cType }?: VerifyOptions): Promise; export declare type PublicCredentialCreationOptions = { delegationId?: IDelegationNode['id'] | null; }; /** * Builds a new [[IPublicCredentialInput]] object, from a complete set of required parameters. * * @param claim An [[IClaim]] object to build the credential for. * @param option Container for different options that can be passed to this method. * @param option.delegationId The id of the DelegationNode of the Attester, which should be used in the attestation. * @returns A new [[IPublicCredentialInput]] object ready to be submitted to the blockchain for issuance. */ export declare function fromClaim(claim: IAssetClaim, { delegationId }?: PublicCredentialCreationOptions): IPublicCredentialInput; export {};