@adobe/aio-lib-core-tvm
A JS client to access the Adobe I/O token vending machine
Last updated 22 days ago by spaliwal .
Apache-2.0 · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @adobe/aio-lib-core-tvm 
SYNC missed versions from official npm registry.

Version Downloads/week Build Status License CodecovCoverage

Adobe I/O Lib Core Token Vending Machine

A JS client to access the token vending machine.

For more details on the server side, goto adobe/aio-tvm

Install

npm install @adobe/aio-lib-core-tvm

Use

const TvmClient = require('@adobe/aio-lib-core-tvm')
// init
const tvm = await TvmClient.init({ ow: { auth: '<myauth>', namespace: '<mynamespace>' } })
// init with retryOptions
const tvm = await TvmClient.init({ ow: { auth: '<myauth>', namespace: '<mynamespace>' }, retryOptions: { maxRetries: 5, initialDelayInMillis: 100} })

// aws s3
const awsS3Credentials = await tvm.getAwsS3Credentials()
const aws = require('aws-sdk')
const s3 = new aws.S3(awsS3Credentials)
// ...operations on s3 object

// azure blob
const azureBlobCredentials = await tvm.getAzureBlobCredentials()
const azure = require('@azure/storage-blob')
const azureCreds = new azure.AnonymousCredential()
const pipeline = azure.StorageURL.newPipeline(azureCreds)
const containerURLPrivate = new azure.ContainerURL(azureBlobCredentials.sasURLPrivate, pipeline)
const containerURLPublic = new azure.ContainerURL(azureBlobCredentials.sasURLPublic, pipeline)
// ...operations on containerURLPrivate and containerURLPublic

// azure cosmos
const azureCosmosCredentials = await tvm.getAzureCosmosCredentials()
const cosmos = require('@azure/cosmos')
const container = new cosmos.CosmosClient({ endpoint: azureCosmosCredentials.endpoint, tokenProvider: async () => azureCosmosCredentials.resourceToken })
                            .database(azureCosmosCredentials.databaseId)
                            .container(azureCosmosCredentials.containerId)
const data = await container.item('<itemKey>', azureCosmosCredentials.partitionKey).read()
// ...operations on items within azureCosmosCredentials.partitionKey

Explore

goto API

Debug

set DEBUG=@adobe/aio-lib-core-tvm* to see debug logs.

Contributing

Contributions are welcomed! Read the Contributing Guide for more information.

Licensing

This project is licensed under the Apache V2 License. See LICENSE for more information.

Current Tags

  • 2.1.0                                ...           latest (22 days ago)

15 Versions

  • 2.1.0                                ...           22 days ago
  • 2.0.0                                ...           2 months ago
  • 1.3.2                                ...           2 months ago
  • 1.3.1                                ...           2 months ago
  • 1.3.0                                ...           2 months ago
  • 1.2.0                                ...           4 months ago
  • 1.0.3                                ...           a year ago
  • 1.0.2                                ...           a year ago
  • 1.0.1                                ...           a year ago
  • 1.0.0                                ...           a year ago
  • 0.11.0                                ...           a year ago
  • 0.10.0                                ...           a year ago
  • 0.9.0                                ...           a year ago
  • 0.8.0                                ...           a year ago
  • 0.7.0                                ...           a year ago

Copyright 2014 - 2017 © taobao.org |