Registry / http-networking / easycodef-node

easycodef-node

JSON →
library1.0.4jsnpmunverified

The `easycodef-node` library, currently at version 1.0.4, serves as a utility for integrating Node.js applications with the CODEF API services. It abstracts away common complexities associated with API interactions, such as automatic handling of access token issuance and reuse (which are valid for one week), and provides functionalities for secure data exchange using RSA encryption. The library supports managing Connected IDs for end-user account authentication with various financial institutions (banks, cards, insurance, etc.), although this step is optional for APIs not requiring a Connected ID. While the release cadence appears to be low, indicating stability, the library is actively maintained with recent patch updates addressing bug fixes. Key differentiators include its comprehensive support for CODEF's authentication mechanisms and streamlined API request process, contrasting with direct API calls that would require manual token and encryption management. It ships with TypeScript types, facilitating development in typed environments.

npm install easycodef-node
INSTALL
IMPORT
SIG · EASYCODEF-NODE
E
easycodef-node
http-networkingjavascriptv1.0.4
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18–226 runs
build_error
glibc
node 18–226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

EasyCodef
✓ import { EasyCodef } from 'easycodef-node';
✗ const EasyCodef = require('easycodef-node').EasyCodef;
Primary class for interacting with the CODEF API. CommonJS `require` is a common anti-pattern in modern Node.js ESM projects.
EasyCodefConstant
✓ import { EasyCodefConstant } from 'easycodef-node';
✗ const EasyCodefConstant = require('easycodef-node').EasyCodefConstant;
Provides constants like `SERVICE_TYPE_SANDBOX`, `SERVICE_TYPE_DEMO`, `SERVICE_TYPE_API` for specifying the target environment.
EasyCodefUtil
✓ import { EasyCodefUtil } from 'easycodef-node';
✗ const EasyCodefUtil = require('easycodef-node').EasyCodefUtil;
Includes utility functions such as `encodeToFileString` for handling file data (e.g., certificates) and `encryptRSA` for manual RSA encryption.

Demonstrates how to initialize the EasyCodef client and explicitly request an access token from the CODEF API sandbox environment, setting necessary client information and the RSA public key for encryption.

import { EasyCodef, EasyCodefConstant, EasyCodefUtil } from 'easycodef-node'; import path from 'path'; // Needed for EasyCodefUtil.encodeToFileString example if used // Placeholder for CODEF client credentials (replace with your actual keys). // Obtain these from the CODEF website after signing up for demo/official service. const DEMO_CLIENT_ID: string = process.env.CODEF_DEMO_CLIENT_ID ?? 'YOUR_DEMO_CLIENT_ID'; const DEMO_CLIENT_SECRET: string = process.env.CODEF_DEMO_CLIENT_SECRET ?? 'YOUR_DEMO_CLIENT_SECRET'; const CLIENT_ID: string = process.env.CODEF_CLIENT_ID ?? 'YOUR_CLIENT_ID'; const CLIENT_SECRET: string = process.env.CODEF_CLIENT_SECRET ?? 'YOUR_CLIENT_SECRET'; // Placeholder for CODEF RSA Public Key (required for encryption). // Obtain this from the CODEF website (e.g., https://codef.io/#/account/keys). const PUBLIC_KEY: string = process.env.CODEF_PUBLIC_KEY ?? 'YOUR_PUBLIC_KEY'; // 1. Create an EasyCodef instance. const codef = new EasyCodef(); // 2. Set the RSA Public Key for encryption. // This is crucial for encrypting sensitive data sent to the CODEF API. codef.setPublicKey(PUBLIC_KEY); // 3. Set demo client information (for sandbox/demo environments). codef.setClientInfoForDemo(DEMO_CLIENT_ID, DEMO_CLIENT_SECRET); // 4. Set official client information (for production environment). codef.setClientInfo(CLIENT_ID, CLIENT_SECRET); // 5. Request an access token for the Sandbox environment. // Note: easycodef-node automatically handles token issuance and reuse for API calls, // so explicit token requests are usually only for specific scenarios or testing. console.log('Requesting token for Sandbox...'); codef .requestToken(EasyCodefConstant.SERVICE_TYPE_SANDBOX) .then(function (response) { console.log('Token 발급 결과 (Sandbox):'); console.log(response); // Expected response for Sandbox token request: // { data: { accessToken: "sandbox-access-token", ... } } }) .catch(function (error) { console.error('Error requesting token:', error); });
Debug
Known issues
gotchaFailing to set correct client credentials (Client ID, Client Secret) for the target environment (demo, official) will result in authentication failures when making API requests.
fix
Ensure `setClientInfoForDemo` and/or `setClientInfo` are called with valid credentials obtained from your CODEF account page. Use environment variables for sensitive data in production.
affects: >=1.0.0
gotchaThe RSA Public Key must be set via `setPublicKey` if any API requests involve encrypting sensitive user data (e.g., account details, certificates). Failure to do so will lead to encryption errors or rejected requests for sensitive operations.
fix
Obtain your RSA Public Key from the CODEF website and set it using `codef.setPublicKey(PUBLIC_KEY)`. Verify which API endpoints require encrypted parameters.
affects: >=1.0.0
gotchaConnected IDs are specific to end-user account management and are not required for all CODEF API products. Attempting to use or manage Connected IDs unnecessarily can add complexity to your integration.
fix
Refer to the CODEF developer guide to determine if a specific API product requires a Connected ID. Only implement Connected ID management where explicitly necessary.
affects: >=1.0.0
Errors
Common errors & fixes
Cannot find module 'easycodef-node' or its corresponding type declarations.
The package has not been installed or there's a module resolution issue in your environment.
fix
Run `npm install easycodef-node` in your project directory. For TypeScript, ensure `moduleResolution` in `tsconfig.json` is set appropriately (e.g., `NodeNext` or `Bundler`).
Error: Invalid client information.
The provided `CLIENT_ID` or `CLIENT_SECRET` for the requested service type (demo/official) is incorrect or not registered with CODEF.
fix
Double-check your client credentials against your CODEF account page. Ensure you are using the correct set of keys for the `SERVICE_TYPE` you are requesting (e.g., `DEMO_CLIENT_ID` for `SERVICE_TYPE_SANDBOX` or `SERVICE_TYPE_DEMO`).
TypeError: codef.setPublicKey is not a function
The `codef` object is not an instance of `EasyCodef` or the `EasyCodef` class was imported incorrectly.
fix
Ensure you are creating an instance using `const codef = new EasyCodef();` and that `EasyCodef` is correctly imported from `easycodef-node`.
Error: Required public key not set for encryption.
You are attempting to perform an operation or send data that requires RSA encryption, but `codef.setPublicKey()` has not been called or was called with an invalid key.
fix
Provide a valid RSA public key string to `codef.setPublicKey(PUBLIC_KEY)` before making API calls that involve encryption.
Upgrade
Version history
1.0.4latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
20 hits · last 30 days
node
18
Amazon
1
OpenAI (training)
1
Resources
easycodef-node — npm install easycodef-node · libregistry