toTokenString property

  1. @override
String get toTokenString
override

Implementation

@override
String get toTokenString {
  // Если есть payloadBytes, используем их напрямую (соответствует спецификации PASETO)
  if (payloadBytes != null) {
    return SafeBase64.encode(payloadBytes!);
  }

  // Иначе собираем из компонентов (для обратной совместимости)
  var result = List<int>.empty(growable: true);
  final nonce = this.nonce;
  if (nonce != null) {
    result += nonce.bytes;
  }
  final secretBox = this.secretBox;
  if (secretBox != null) {
    result += secretBox.cipherText;
  }
  final mac = this.mac;
  if (mac != null) {
    result += mac.bytes;
  }
  return SafeBase64.encode(result);
}