File

src/app/_services/keystore.service.ts

Index

Properties
Methods

Constructor

constructor()

Methods

Static Async getKeystore
getKeystore()

Properties

Private Static mutableKeyStore
Type : MutableKeyStore
import { Injectable } from '@angular/core';
import { MutableKeyStore, MutablePgpKeyStore } from '@app/_pgp';

@Injectable({
  providedIn: 'root',
})
export class KeystoreService {
  private static mutableKeyStore: MutableKeyStore;

  constructor() {}

  public static async getKeystore(): Promise<MutableKeyStore> {
    return new Promise(async (resolve, reject) => {
      if (!KeystoreService.mutableKeyStore) {
        this.mutableKeyStore = new MutablePgpKeyStore();
        await this.mutableKeyStore.loadKeyring();
        return resolve(KeystoreService.mutableKeyStore);
      }
      return resolve(KeystoreService.mutableKeyStore);
    });
  }
}

result-matching ""

    No results matching ""