fromStorage static method

FromStorageResult fromStorage(
  1. String str
)

Implementation

static FromStorageResult fromStorage(String str) {
  final map = Map<String, dynamic>.from(jsonDecode(str));
  final identityString = map[keyLocalStorageKey] as String?;
  final delegationString = map[keyLocalStorageDelegation] as String?;
  SignIdentity? key = identityString != null
      ? Ed25519KeyIdentity.fromJSON(identityString)
      : null;
  final DelegationChain? chain = delegationString != null
      ? DelegationChain.fromJSON(delegationString)
      : null;
  DelegationIdentity? identity;
  if (chain != null && !isDelegationValid(chain, null)) {
    key = null;
  } else {
    identity = DelegationIdentity.fromDelegation(key!, chain!);
  }
  return FromStorageResult(
    delegationChain: chain,
    signIdentity: key,
    delegationIdentity: identity,
  );
}