handleSuccess method

void handleSuccess(
  1. AuthResponseSuccess message,
  2. void onSuccess()?
)

Implementation

void handleSuccess(AuthResponseSuccess message, void Function()? onSuccess) {
  var delegations = message.delegations.map((signedDelegation) {
    return SignedDelegation.fromMap({
      "delegation": Delegation(
        signedDelegation.delegation.pubkey,
        signedDelegation.delegation.expiration,
        signedDelegation.delegation.targets,
      ),
      "signature": signedDelegation.signature,
    });
  }).toList();

  final delegationChain = DelegationChain.fromDelegations(
    delegations,
    message.userPublicKey,
  );

  if (key == null) {
    return;
  }

  chain = delegationChain;
  identity = DelegationIdentity.fromDelegation(key!, chain!);
  onSuccess?.call();
}