fromStorage static method

FromStorageResult fromStorage(
  1. String str
)

Implementation

static FromStorageResult fromStorage(String str) {
  var map = Map<String, dynamic>.from(jsonDecode(str));
  var identityString = map[KEY_LOCALSTORAGE_KEY] as String?;
  var delegationString = map[KEY_LOCALSTORAGE_DELEGATION] as String?;

  SignIdentity? key = identityString != null
      ? Ed25519KeyIdentity.fromJSON(identityString)
      : null;
  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);
}