Skip to content

Instantly share code, notes, and snippets.

@MeetMartin
Last active February 9, 2022 21:57
Show Gist options
  • Save MeetMartin/d1c83a29f80a84e687135a7874614849 to your computer and use it in GitHub Desktop.
Save MeetMartin/d1c83a29f80a84e687135a7874614849 to your computer and use it in GitHub Desktop.
const DIDPushAuthentication = request =>
compose(
map(passThrough(() => logger.debug('DID Push Authentication Success.'))),
flatMap(pushAuthentication),
flatMap(saveChallenge),
flatMap(decryptedDID => eitherToAsyncEffect(getEnvironmentVariables({ ...request, recipientDid: decryptedDID }))),
flatMap(did => eitherToAsyncEffect(getDecryptedDID(did))),
map(response => response.data.did),
flatMap(() => getDIDByUserName(request.userName)),
eitherToAsyncEffect,
validateRequest,
map(passThrough(request => logger.debug(`DID Push Authentication Request: ${deepInspect(request)}`)))
)(request);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment