1.4.0 • Published 2 years ago

@keyforgecloud/lib v1.4.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

keyforge

npm package Build Status Downloads Issues Code Coverage Commitizen Friendly Semantic Release

The official Keyforge API client library for Javascript and Typescript.

Install

npm install @keyforgecloud/lib

Usage

import KeyforgeAPI from '@keyforgecloud/lib';

const createAndVerify = async () => {
  KeyforgeAPI.setAccountToken("your-account-token")
  KeyforgeAPI.setDefaultAPI("your-api-id")

  const key = await KeyforgeAPI.createKey({
    name: 'My Key',
    ownerId: 'user_abc123',
    permissions: ['read', 'write'],
    metadata: {
      "key": "value"
    }
  }, 'your-api-id'); // API ID is optional if set a default (KeyforgeAPI.setDefaultAPI)

  const verification = await KeyforgeAPI.verifyKey(key.token)
    .then(() => true)
    .catch(() => false);

  if (verification) {
    console.log('Key verified successfully');
  } else {
    console.log('Key verification failed');
  }
};

createAndVerify();
1.2.0

2 years ago

0.0.2-dev

2 years ago

1.3.2

2 years ago

1.4.0

2 years ago

1.3.1

2 years ago

1.3.0

2 years ago

1.1.0

2 years ago

1.0.0

2 years ago

1.0.1

2 years ago

0.0.1-snapshot

2 years ago