Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
@serverless/platform-sdk
Advanced tools
Functional SDK for the Serverless Platfrom.
npm i -s @serverless/platform-sdk
login
Opens a browser for the user to login, along with a running server awaiting auth data once the user logs in.
Parameters
None
Returns
Promise resolving to the following object:
username
- string
- dashboard usernameaccessToken
- string
- Auth0 access tokenidToken
- string
- Auth0 idTokenrefreshToken
- string
- Auth0 refreshTokenexpiresAt
- string
- epoch time at which the idToken expiresExample
const { login } = require('@serverless/platform-sdk')
const { username, accessToken, idToken, expiresAt } = await login()
refreshToken
Refreshes Auth0 idToken
Parameters
refresh token string
Returns
Promise resolving to the following object:
id_token
- string
- new Auth0 id tokenaccess_token
- string
- new Auth0 access tokenexpires_in
- string
- number of seconds until token expirationExample
const { refreshToken } = require('@serverless/platform-sdk')
const { id_token, access_token, expires_in } = await refreshToken('some-refresh-token')
createAccessKey
Creates a platform access key for the authenticated user.
Parameters
Object
username
- string
- dashboard usernametenant
- string
- dashboard tenantidToken
- string
- Auth0 idTokentitle
- string
- title of the access keyReturns
Promise resolving to an accessKey
string, that is the access key.
Example
const { createAccessKey } = require('@serverless/platform-sdk')
const data = {
username: 'eahefnawy',
tenant: 'eahefnawy',
idToken: 'abc',
title: 'Framework'
}
const accessKey = await createAccessKey(data)
archiveService
Archives a service in the platform.
Parameters
Object
tenant
- string
- dashboard tenantaccessKey
- string
- dashboard access keyapp
- string
- service appname
- string
- service nameprovider
- string
- provider nameregion
- string
- region nameReturns
None
Example
const { archiveService } = require('@serverless/platform-sdk')
const data = {
tenant: 'eahefnawy',
accessKey: 'abc',
app: 'my-app',
name: 'my-service',
provider: 'aws',
region: 'us-east-1'
}
await archiveService(data)
getServiceUrl
Constructs a service url based on passed-in data.
Parameters
Object
tenant
- string
- dashboard tenantapp
- string
- service appname
- string
- service nameReturns
The service url string.
Example
const { getServiceUrl } = require('@serverless/platform-sdk')
const data = {
tenant: 'eahefnawy',
app: 'my-app',
name: 'my-service'
}
const serviceUrl = getServiceUrl(data)
listTenants
Lists the tenants for a given username
Parameters
Object
username
- string
- dashboard usernameidToken
- string
- auth0 user id tokenReturns
Array of objects, each represents a single tenant data model.
Example
const { listTenants } = require('@serverless/platform-sdk')
const data = {
username: 'eahefnawy',
idToken: 'abc'
}
const tenants = await listTenants(data)
createDeploymnet
Creates a platform deployment
Parameters
Object
tenant
- string
- dashboard tenant nameapp
- string
- app nameserviceName
- string
- service nameaccessKey
- string
- dashboard access keyfiles
- object
- files which should be stored in the Platforms deployment recordReturns
Object - Deployment model
Example
const { createDeployment } = require('@serverless/platform-sdk')
const data = {
tenant: 'eahefnawy',
app: 'my-app',
serviceName: 'my-service',
accessKey: 'abc',
files: {
'serverless-state.json': {
//...snip...
}
}
}
const { id } = await createDeployment(data)
updateDeployment
Updates a platform deployment
Parameters
Object
tenant
- string
- dashboard tenant nameapp
- string
- app nameserviceName
- string
- service namedeploymentId
- string
- id of the previously created deploymentstatus
- string
- status of the deployment to updateaccessKey
- string
- dashboard access keycomputedData
- object
- computed data the Platform needs to generate the state itemsReturns
Object - Deployment model
Example
const { updateDeployment } = require('@serverless/platform-sdk')
const data = {
tenant: 'eahefnawy',
app: 'my-app',
serviceName: 'my-service',
deploymentId: 'abc',
status: 'failed',
accessKey: 'abc',
computedData: {
// ...snip...
}
}
const { id } = await updateDeployment(data)
getApp
Gets a platform app
Parameters
Object
tenant
- string
- dashboard tenant nameapp
- string
- app nametoken
- string
- Auth0 id tokenReturns
Object - App model
Example
const { getApp } = require('@serverless/platform-sdk')
const data = {
tenant: 'eahefnawy',
app: 'my-app',
token: 'abc'
}
const app = await getApp(data)
createApp
Creates a platform app
Parameters
Object
tenant
- string
- dashboard tenant nameapp
- string
- app nametoken
- string
- Auth0 id tokenReturns
Object - App model
Example
const { createApp } = require('@serverless/platform-sdk')
const data = {
tenant: 'eahefnawy',
app: 'my-app',
token: 'abc'
}
const app = await createApp(data)
FAQs
Serverless Platform SDK
The npm package @serverless/platform-sdk receives a total of 28,412 weekly downloads. As such, @serverless/platform-sdk popularity was classified as popular.
We found that @serverless/platform-sdk demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.