encodeOpenSshPublicKey static method

String encodeOpenSshPublicKey(
  1. Uint8List publicKey, {
  2. String comment = '',
})

Implementation

static String encodeOpenSshPublicKey(
  Uint8List publicKey, {
  String comment = '',
}) {
  if (publicKey.length != 32) {
    throw ArgumentError('Chave publica Ed25519 deve ter 32 bytes');
  }
  final blob = _encodeSshString(utf8.encode('ssh-ed25519')) +
      _encodeSshString(publicKey);
  final base = base64.encode(blob);
  final suffix = comment.trim().isEmpty ? '' : ' ${comment.trim()}';
  return 'ssh-ed25519 $base$suffix';
}