build-security-sdk-node

Build.Security node SDK

Usage no npm install needed!

<script type="module">
  import buildSecuritySdkNode from 'https://cdn.skypack.dev/build-security-sdk-node';
</script>

README

Build Security SDK for Node

The Build Security SDK for Node enables Node developers to easily work with Build Security Services.

How to Install

❯ cd Build.Security.Sdk.node
❯ npm run build

Getting started

  • Please follow the installation procedure
  • Run an example from the samples directory

Examples

Authorization

❯ cd samples/authorization/01_middleware/
❯ npm run start

Encryption

❯ cd samples/encryption/01_envelope_encryption/
❯ npm run start

Encrypt a file

❯ cd samples/encryption/02_encrypt_file/
❯ npm run start -- plaintext.in encrypted.out

Decrypt a file

❯ cd samples/encryption/03_decrypt_file/
❯ npm run start -- encrypted.in decrypted.out

How to Generate an SDK

The Ruby SDK is based on a generated code by the Openapi Generator.

If you want to generate this part of the SDK by yourself, please follow the instructions below:

  • Run
❯ echo '{                                                                                                                                                                          ⏎
        "supportsES6": true
}' > node_generation_conf.js
❯ curl https://localhost:5001/swagger/v1/swagger.json --output swagger.json
❯ openapi-generator generate -i swagger.json -g typescript-node -o ./src -c node_generation_conf.js
❯ npm run fix

What is not auto-generated

the project's template is based on https://github.com/bitjson/typescript-starter src directory is generated

We used rider to:

  • Code > Optimize Imports

The changes that have been made by us are:

  • Search & Replace broken imports
  • 'AnonymousIdentity | IdToken | PlainIdentity' have to be replaced with 'impersonatedIdentity'
  • MasterKeyCredentials.ts: provider type should be CredentialsProvider and not object
  • src/client directory added
  • samples directory added
  • running npm run fix to apply the linter on the code.