@nuagebiztech/ecdh-angular-service
v1.0.1
Published
This package provides a Angular injectible service `EchdEncryptionService` which implements client side of `Elliptic Curve Diffie-Hellman (ECDH)` key exchange algorithm using [ZenRoom](https://www.npmjs.com/package/zenroom)
Downloads
3
Readme
Angular Library for ECDH Encryption Service
This package provides a Angular injectible service EchdEncryptionService
which implements client side of Elliptic Curve Diffie-Hellman (ECDH)
key exchange algorithm using ZenRoom
How to use
To use this service inject this in your App for example:
import { EcdhEncryptionService } from '@nuagebiztech/ecdh-angular-service'
constructor(
private encryptionService: EcdhEncryptionService,
private http: HttpClient
) {}
To start using this service you must initialize this with corresponding ECDH encryption server endpoints for
- [GET] Retrieving server's public key
- [POST] Submitting Client's Unique ID and Public Key
Note: service with automatically generates a 16 digit random id for client
public initializedService(): void {
this.encryptionService
.initialize(this.serverPublicKeyUrl, this.sharedKeyUrl)
.subscribe((clientId) => {
console.log(clientId)
this.clientId = clientId;
});
}
Once the service is initialized you can call encryptMessage(<<message>>)
to encrypt the message, or decryptMessage(<<message>>)
to decrypt the message.