public async getSign()

in src/index.ts [49:66]


  public async getSign(
    data: string | Buffer,
    secretId: string,
    shouldCache = false
  ): Promise<string> {
    const privateKey = this.keyMap.get(secretId);
    if (privateKey) {
      return this.cryptoClient.sign(privateKey, data);
    } else {
      // Fetch the key from ASM and generate the sign. Cache the key if said so
      const key = await this.asmClient.getSecret({ SecretId: secretId });
      if (shouldCache) {
        this.keyMap.set(secretId, key);
      }

      return this.cryptoClient.sign(key, data);
    }
  }