NPM Package: Here
This should be executed in some secure environment and access private key should be stored securely. The access public key is required when creating a new API user in PrimeVault.
The flow is as follows:
- Generate a public-private key pair
- Create a new API user in PrimeVault
- Get the API key for the new user
- Set the API key, API URL, and initialize the API client
- Use the API client to make requests to PrimeVault
#### Option 1: PRIVATE_KEY
import {generatePublicPrivateKeyPair} from "@primevault/js-api-sdk";
const response = await generatePublicPrivateKeyPair()
console.log(response)
#### Option 2: AWS_KMS
In the API documentation
import {APIClient} from "@primevault/js-api-sdk";
const apiClient = new APIClient("API_KEY", "API_URL");
const { APIClient } = require("@primevault/js-api-sdk");
const apiClient = new APIClient("API_KEY", "API_URL");
const apiKey = "509bc039-65b5-4200-ac56-4827acc5a1ee" // replace this with the API user's key
const apiUrl = "https://api.primevault.com"
const privateKey = "..."
Config.set("SIGNATURE_SERVICE", "PRIVATE_KEY")
const apiClient = new APIClient(apiKey, apiUrl, privateKey)
const apiKey = "509bc039-65b5-4200-ac56-4827acc5a1ee" // replace this with the API user's key
const apiUrl = "https://api.primevault.com"
const keyId = '..' // AWS KMS key Id from Key's detail page
Config.set("SIGNATURE_SERVICE", "AWS_KMS")
Config.set("AWS_REGION", "us-east-1") // replace this with your region
const apiClient = new APIClient(apiKey, apiUrl, undefined, keyId)
Code examples here