// Validate a chain of delegations.
// See https://sdk.dfinity.org/docs/interface-spec/index.html#_envelope_authentication
//
// If the delegations are valid, returns the public key used to sign the
// request as well as the set of canister IDs that the public key is valid for.
Validate a chain of delegations.

If the delegations are valid, returns the public key used to sign the
request as well as the set of canister IDs that the public key is valid for.
Validate a chain of delegations . If the delegations are valid returns the public key used to sign the request as well as the set of canister IDs that the public key is valid for .
fn validate_delegations(
    validator: &dyn IngressSigVerifier,
    signed_delegations: &[SignedDelegation],
    mut pubkey: Vec<u8>,
    registry_version: RegistryVersion,
) -> Result<(Vec<u8>, CanisterIdSet), RequestValidationError> {
    // Initially, assume that the delegations target all possible canister IDs.
    let mut targets = CanisterIdSet::All;
    for sd in signed_delegations {
        let delegation = sd.delegation();
        let signature = sd.signature();
        let new_targets =
            validate_delegation(validator, signature, delegation, &pubkey, registry_version)
                .map_err(InvalidDelegation)?;
        // Restrict the canister targets to the ones specified in the delegation.
        targets = targets.intersect(new_targets);
        pubkey = delegation.pubkey().to_vec();
    }
    Ok((pubkey, targets))
}
fn validate_delegations ( validator : & dyn IngressSigVerifier , signed_delegations : & [ SignedDelegation ] , mut pubkey : Vec < u8 > , registry_version : RegistryVersion , ) -> Result < ( Vec < u8 > , CanisterIdSet ) , RequestValidationError > { // Initially, assume that the delegations target all possible canister IDs. let mut targets = CanisterIdSet :: All ; for sd in signed_delegations { let delegation = sd . delegation ( ) ; let signature = sd . signature ( ) ; let new_targets = validate_delegation ( validator , signature , delegation , & pubkey , registry_version ) . map_err ( InvalidDelegation ) ? ; // Restrict the canister targets to the ones specified in the delegation. targets = targets . intersect ( new_targets ) ; pubkey = delegation . pubkey ( ) . to_vec ( ) ; } Ok ( ( pubkey , targets ) ) }
Validate a chain of delegations.
Validate a chain of delegations .
validator
&dyn IngressSigVerifier
signed_delegations
&[SignedDelegation]
pubkey
Vec<u8>
registry_version
RegistryVersion