decentralized-identity / DIDComm-js

JS implementation of pack and unpack
Apache License 2.0
55 stars 25 forks source link

Use types provided by '@types/libsodium-wrappers' instead of declaring sodium as 'any' #35

Closed Arxcis closed 3 years ago

Arxcis commented 3 years ago

NB!: I have not discussed this change with anyone yet, so please voice your oppinion :pray:

Motivation

Since this repo is a typescript repo, and it relies heavily on libsodium-wrappers, it would be nice to have types. As a newcomer to the code, it was difficult to understand the integration with libsodium-wrappers, when every value and function-call was declared as any.

Demo

Before (with any) After (with types)
(property) DIDComm.sodium: any (property) DIDComm.sodium: typeof sodium
image image
image image
before after