import { BaseConnector, Ssid, Claim, ObserveResult, VerificationRequest } from '@discipl/core-baseconnector'; import { Ipv8AttestationClient } from './client/Ipv8AttestationClient'; import { Peer, Verification, ConfigOptions } from './types/ipv8-connector'; import { Ipv8TrustchainClient } from './client/Ipv8TrustchainClient'; declare class Ipv8Connector extends BaseConnector { LINK_TEMPORARY_INIDACOTR: string; LINK_PERMANTENT_INDICATOR: string; LINK_DELIMITER: string; VERIFICATION_REQUEST_MAX_RETRIES: number; VERIFICATION_REQUEST_RETRY_TIMEOUT_MS: number; VERIFICATION_MINIMAl_MATCH: number; OBSERVE_VERIFICATION_POLL_INTERVAL_MS: number; ipv8AttestationClient: Ipv8AttestationClient; ipv8TrustchainClient: Ipv8TrustchainClient; constructor(); /** * Returns the name of this connector. Mainly used in did and link constructions. * * @returns The string 'ipv8'. */ getName(): string; /** * Configure the IPv8 Connector * * @param serverEndpoint IPv8 service endpoint without port number * @param config Configuration options for the IPv8 connector * @param config.VERIFICATION_REQUEST_MAX_RETRIES Maximum amount of retries when waiting for a verification request * @param config.VERIFICATION_REQUEST_RETRY_TIMEOUT_MS Timeout between each retry when waiting for a verification request * @param config.VERIFICATION_MINIMAl_MATCH The minimal match a verification should have to be valid (must be a decimal number like 0.99) * @param config.OBSERVE_VERIFICATION_POLL_INTERVAL_MS Interval on witch outstanding verification requests should be retreived. */ configure(serverEndpoint: string, config?: ConfigOptions): void; /** * Extract the information of a {@link Peer} from a given did. The public_key will be stored as a hexadecimal string. * * @param did Did of a IPv8 peer */ extractPeerFromDid(did: string): Peer; /** * Returns a link to the last attested claim made by this did * * @param did Did to get the last claim for * @returns {Promise} Link to the last claim made by this did */ getLatestClaim(did: string): Promise; /** * Generate a new identify * * @returns Created identity */ newIdentity(): Promise; /** * Expresses a claim * * The data will be serialized using a stable stringify that only depends on the actual data being claimed, * and not on the order of insertion of attributes. * If the exact claim has been made before, this will return the existing link, but not recreate the claim. * * @param ssid Identity that expresses the claim * @param privkey Private key to sign the claim * @param claim Made claim. This is the claim itself (that can be any object) of a attestation. A attestation is a object * with a single key that represents the attestation and a value that holds the actual claim. * @param attester Identity that is expected to attest te claim * @return Link to the maide claim or attestation. */ claim(ssid: string, privkey: string, claim: object | string, attester: string): Promise; /** * Attest a claim that has not been attested for the first time. In IPv8 context this is always a * new attestation request that is in the outgoing queue. * * @param ssid Peer that attests the attribute * @param attributeName Base64 encoded attribute to attest * @param attestationValue Value to attest the attribute with */ attestTemporaryLink(ssid: string, attributeName: string, attestationValue: string): Promise; /** * Re-attest an attribute that is allready attested. * * @param ssid Peer that attests the attribute * @param attributeHash Hash of the attribute to attest * @param attestationValue Value to attest the attribute with */ attestPermanentLink(ssid: string, attributeHash: string, attestationValue: string): Promise; /** * Express a new claim for a given identity * * @param ssid Identity that express the claim * @param attester Identit that is expected to attest the claim * @param data Data that is claimed * @return Temporary link to the made claim */ newClaim(ssid: string, attester: string, data: object | string): Promise; /** * Verifies existence of a claim with the given data in the channel of the given did. * * @param attestorDid The did that might attested the claim * @param attestation Data that needs to be verified in the format of {@code {'value': 'link'}} * @param verifierDid Did that wants to verify (used for access management) * @param verifierPrivkey Private key of the verifier * @returns Link to claim that proves this data, null if such a claim does not exist */ verify(attestorDid: string, attestation: object, verifierDid: string, verifierPrivkey?: string): Promise; /** * Wait for the verification result of a attribute * * @param attributeHash Attribute hash to get the verification result for */ waitForVerificationResult(attributeHash: string): Promise; /** * Retrieve a claim by its link * * @param link Link to the claim * @param did Did that wants access * @param privkey Key of the did requesting access * @returns Object containing the data of the claim and a link to the claim before it. */ get(link: string, did?: string, privkey?: string): Promise; /** * Get the DID of the owner of a claim * * @param link Link to a IPv8 claim */ getDidOfClaim(link: string): Promise; observe(): Promise; /** * Observe for verification requests. * * This method will actively poll the IPv8 node for outstanding verification requests. It will emit all outstanding request and won't * emit when no requests are found. The interval of the polling can be configured with the {@link OBSERVE_VERIFICATION_POLL_INTERVAL_MS} * config option. * * @param did Only observe claims for this did * @param claimFilter Filter claims on a did * @param accessorDid Did that is observing * @param accessorPrivkey Private key of did that is observing */ observeVerificationRequests(did: string, claimFilter?: { did: string; }, accessorDid?: string, accessorPrivkey?: string): Promise>; } export default Ipv8Connector;