1.0.1 • Published 2 years ago

@nuagebiztech/ecdh-angular-service v1.0.1

Weekly downloads
-
License
-
Repository
-
Last release
2 years ago

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 1. GET Retrieving server's public key 2. 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.

Further reading

1.0.1

2 years ago