createDID method

Future<CreateDIDRes> createDID({
  1. required String gateway,
  2. required String didImagePath,
  3. required String publicSharePath,
  4. required String publicKey,
  5. required String privateKeyString,
})

Implementation

Future<CreateDIDRes> createDID(
    {required String gateway,
    required String didImagePath,
    required String publicSharePath,
    required String publicKey,
    required String privateKeyString}) async {
  RubixServiceClient stub = getConnection(gateway: gateway, accessToken: "");
  var response =
      await stub.createDIDChallenge(ChallengeReq(publicKey: publicKey));
  var challengeString = response.challenge;
  var privateKey = KeyPair().privateKeyFromPem(privateKeyString);
  var signContent = Uint8List.fromList(challengeString.codeUnits);
  var pvtSign = KeyPair().keySignature(signContent, privateKey);
  return _createDID(
      gateway: gateway,
      didImagePath: didImagePath,
      publicSharePath: publicSharePath,
      publicKey: publicKey,
      signature: pvtSign,
      payload: challengeString);
}