issueGrant method

Future<IssuedGrant> issueGrant({
  1. required String principal,
  2. required Set<String> roles,
  3. String note = '',
})

Issues a credential. The token comes back once and cannot be read again — the Hub keeps only a hash of it.

Implementation

Future<IssuedGrant> issueGrant({
  required String principal,
  required Set<String> roles,
  String note = '',
}) async => IssuedGrant.fromJson(
  await _object(
    await post('/grants', {
      'principal': principal,
      'roles': roles.toList(),
      if (note.isNotEmpty) 'note': note,
    }),
  ),
);