JoseObject.fromCompactSerialization constructor

JoseObject.fromCompactSerialization(
  1. String serialization
)

Constructs a JsonWebSignature or JsonWebEncryption from its compact serialization.

Implementation

factory JoseObject.fromCompactSerialization(String serialization) {
  var parts = serialization.split('.');
  switch (parts.length) {
    case 3:
      return JsonWebSignature.fromCompactSerialization(serialization);
    case 5:
      return JsonWebEncryption.fromCompactSerialization(serialization);
    default:
      throw ArgumentError.value(serialization, 'serialization',
          'Not a valid `JsonWebSignature` or `JsonWebEncryption`');
  }
}