Credentials.fromJson constructor

Credentials.fromJson(
  1. Map data
)

Constructs Credentials from the provided data.

Implementation

factory Credentials.fromJson(Map<dynamic, dynamic> data) {
  return Credentials(
    AccessToken(
      AccessTokenSecret(data['access']['secret']),
      PreciseDateTime.parse(data['access']['expireAt']),
    ),
    RefreshToken(
      RefreshTokenSecret(data['refresh']['secret']),
      PreciseDateTime.parse(data['refresh']['expireAt']),
    ),
    SessionId(data['sessionId'] ?? ''),
    UserId(data['userId']),
  );
}