@edirect/tokenization 11.0.39 → 11.0.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +53 -56
- package/dist/README.md +53 -56
- package/dist/package.json +4 -4
- package/package.json +5 -6
package/README.md
CHANGED
|
@@ -1,68 +1,73 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @edirect/tokenization
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
`@edirect/tokenization` is a Node.js client for the Tokenization Service, providing methods to securely tokenize and detokenize sensitive data. It supports caching of configurations and tokens to reduce unnecessary requests.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Features
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
- Tokenize and detokenize payloads with a simple API
|
|
8
|
+
- Caches configurations (5 min) and tokens (1 min) for efficiency
|
|
9
|
+
- Supports parsing and validation of token strings
|
|
8
10
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
12
14
|
|
|
13
|
-
|
|
15
|
+
```sh
|
|
16
|
+
pnpm add @edirect/tokenization
|
|
17
|
+
# or
|
|
18
|
+
npm install @edirect/tokenization
|
|
19
|
+
```
|
|
14
20
|
|
|
15
|
-
|
|
21
|
+
## Caching Behavior
|
|
16
22
|
|
|
17
|
-
This
|
|
23
|
+
This client **caches** configurations for **5 minutes** and tokens for **1 minute** to avoid unnecessary requests. If you update configurations on the tokenization service, allow cache expiry before expecting changes.
|
|
18
24
|
|
|
19
25
|
## Usage
|
|
20
26
|
|
|
21
|
-
The `Tokenization` class provides methods to tokenize and detokenize payloads.
|
|
27
|
+
The `Tokenization` class provides methods to tokenize and detokenize payloads.
|
|
22
28
|
|
|
23
29
|
### Importing the Tokenization Class
|
|
24
30
|
|
|
25
|
-
```
|
|
31
|
+
```js
|
|
26
32
|
import { Tokenization } from '@edirect/tokenization';
|
|
27
33
|
```
|
|
28
34
|
|
|
29
35
|
### Creating an Instance
|
|
30
36
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
```javascript
|
|
37
|
+
```js
|
|
34
38
|
const baseUrl = 'https://tokenization-service.api.example.com';
|
|
35
39
|
const tokenization = new Tokenization(baseUrl);
|
|
36
40
|
```
|
|
37
41
|
|
|
38
42
|
### Tokenizing a Payload
|
|
39
43
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
```javascript
|
|
44
|
+
```js
|
|
43
45
|
const auth = 'your-auth-token';
|
|
44
46
|
const tenant = 'your-tenant';
|
|
45
47
|
const config = 'your-config';
|
|
46
48
|
const payload = {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
49
|
+
name: 'John Doe',
|
|
50
|
+
email: 'johndoe@test.com',
|
|
51
|
+
phone: '123-456-7890',
|
|
52
|
+
payment: {
|
|
53
|
+
cardNumber: '1234 5678 9012 3456',
|
|
54
|
+
expirationDate: '12/23',
|
|
55
|
+
cvv: '123',
|
|
56
|
+
},
|
|
55
57
|
};
|
|
56
58
|
|
|
57
|
-
const tokenizedData = await tokenization.tokenize(
|
|
59
|
+
const tokenizedData = await tokenization.tokenize(
|
|
60
|
+
auth,
|
|
61
|
+
tenant,
|
|
62
|
+
config,
|
|
63
|
+
payload
|
|
64
|
+
);
|
|
58
65
|
console.log('Tokenized Payload:', tokenizedData);
|
|
59
66
|
```
|
|
60
67
|
|
|
61
68
|
### Detokenizing a Payload
|
|
62
69
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
```javascript
|
|
70
|
+
```js
|
|
66
71
|
const detokenizedData = await tokenization.detokenize(
|
|
67
72
|
auth,
|
|
68
73
|
tenant,
|
|
@@ -74,9 +79,7 @@ console.log('Detokenized Payload:', detokenizedData);
|
|
|
74
79
|
|
|
75
80
|
### Parsing the Token
|
|
76
81
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
```javascript
|
|
82
|
+
```js
|
|
80
83
|
const token = Tokenization.parseToken('token:tenant1:str:asdf1234');
|
|
81
84
|
console.log(`Is Token: ${token.isToken}`);
|
|
82
85
|
console.log(`Tenant: ${token.tenant}`);
|
|
@@ -88,26 +91,20 @@ console.log(`Hash: ${token.Hash}`);
|
|
|
88
91
|
|
|
89
92
|
### `Tokenization`
|
|
90
93
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
- `
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
- `
|
|
103
|
-
-
|
|
104
|
-
- `
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
Detokenizes the given payload.
|
|
109
|
-
|
|
110
|
-
- `auth`: The authentication token.
|
|
111
|
-
- `tenant`: The tenant to detokenize the payload for.
|
|
112
|
-
- `config`: The configuration for detokenization.
|
|
113
|
-
- `payload`: The payload to detokenize.
|
|
94
|
+
- `constructor(baseUrl: string)`
|
|
95
|
+
- Creates an instance of the `Tokenization` class.
|
|
96
|
+
- `baseUrl`: The base URL of the tokenization service.
|
|
97
|
+
|
|
98
|
+
- `tokenize(auth: string, tenant: string, config: string, payload: TokenPayload): Promise<TokenPayload>`
|
|
99
|
+
- Tokenizes the given payload.
|
|
100
|
+
- `auth`: The authentication token.
|
|
101
|
+
- `tenant`: The tenant to tokenize the payload for.
|
|
102
|
+
- `config`: The configuration for tokenization.
|
|
103
|
+
- `payload`: The payload to tokenize.
|
|
104
|
+
|
|
105
|
+
- `detokenize(auth: string, tenant: string, config: string, payload: TokenPayload): Promise<TokenPayload>`
|
|
106
|
+
- Detokenizes the given payload.
|
|
107
|
+
- `auth`: The authentication token.
|
|
108
|
+
- `tenant`: The tenant to detokenize the payload for.
|
|
109
|
+
- `config`: The configuration for detokenization.
|
|
110
|
+
- `payload`: The payload to detokenize.
|
package/dist/README.md
CHANGED
|
@@ -1,68 +1,73 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @edirect/tokenization
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
`@edirect/tokenization` is a Node.js client for the Tokenization Service, providing methods to securely tokenize and detokenize sensitive data. It supports caching of configurations and tokens to reduce unnecessary requests.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Features
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
- Tokenize and detokenize payloads with a simple API
|
|
8
|
+
- Caches configurations (5 min) and tokens (1 min) for efficiency
|
|
9
|
+
- Supports parsing and validation of token strings
|
|
8
10
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
12
14
|
|
|
13
|
-
|
|
15
|
+
```sh
|
|
16
|
+
pnpm add @edirect/tokenization
|
|
17
|
+
# or
|
|
18
|
+
npm install @edirect/tokenization
|
|
19
|
+
```
|
|
14
20
|
|
|
15
|
-
|
|
21
|
+
## Caching Behavior
|
|
16
22
|
|
|
17
|
-
This
|
|
23
|
+
This client **caches** configurations for **5 minutes** and tokens for **1 minute** to avoid unnecessary requests. If you update configurations on the tokenization service, allow cache expiry before expecting changes.
|
|
18
24
|
|
|
19
25
|
## Usage
|
|
20
26
|
|
|
21
|
-
The `Tokenization` class provides methods to tokenize and detokenize payloads.
|
|
27
|
+
The `Tokenization` class provides methods to tokenize and detokenize payloads.
|
|
22
28
|
|
|
23
29
|
### Importing the Tokenization Class
|
|
24
30
|
|
|
25
|
-
```
|
|
31
|
+
```js
|
|
26
32
|
import { Tokenization } from '@edirect/tokenization';
|
|
27
33
|
```
|
|
28
34
|
|
|
29
35
|
### Creating an Instance
|
|
30
36
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
```javascript
|
|
37
|
+
```js
|
|
34
38
|
const baseUrl = 'https://tokenization-service.api.example.com';
|
|
35
39
|
const tokenization = new Tokenization(baseUrl);
|
|
36
40
|
```
|
|
37
41
|
|
|
38
42
|
### Tokenizing a Payload
|
|
39
43
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
```javascript
|
|
44
|
+
```js
|
|
43
45
|
const auth = 'your-auth-token';
|
|
44
46
|
const tenant = 'your-tenant';
|
|
45
47
|
const config = 'your-config';
|
|
46
48
|
const payload = {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
49
|
+
name: 'John Doe',
|
|
50
|
+
email: 'johndoe@test.com',
|
|
51
|
+
phone: '123-456-7890',
|
|
52
|
+
payment: {
|
|
53
|
+
cardNumber: '1234 5678 9012 3456',
|
|
54
|
+
expirationDate: '12/23',
|
|
55
|
+
cvv: '123',
|
|
56
|
+
},
|
|
55
57
|
};
|
|
56
58
|
|
|
57
|
-
const tokenizedData = await tokenization.tokenize(
|
|
59
|
+
const tokenizedData = await tokenization.tokenize(
|
|
60
|
+
auth,
|
|
61
|
+
tenant,
|
|
62
|
+
config,
|
|
63
|
+
payload
|
|
64
|
+
);
|
|
58
65
|
console.log('Tokenized Payload:', tokenizedData);
|
|
59
66
|
```
|
|
60
67
|
|
|
61
68
|
### Detokenizing a Payload
|
|
62
69
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
```javascript
|
|
70
|
+
```js
|
|
66
71
|
const detokenizedData = await tokenization.detokenize(
|
|
67
72
|
auth,
|
|
68
73
|
tenant,
|
|
@@ -74,9 +79,7 @@ console.log('Detokenized Payload:', detokenizedData);
|
|
|
74
79
|
|
|
75
80
|
### Parsing the Token
|
|
76
81
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
```javascript
|
|
82
|
+
```js
|
|
80
83
|
const token = Tokenization.parseToken('token:tenant1:str:asdf1234');
|
|
81
84
|
console.log(`Is Token: ${token.isToken}`);
|
|
82
85
|
console.log(`Tenant: ${token.tenant}`);
|
|
@@ -88,26 +91,20 @@ console.log(`Hash: ${token.Hash}`);
|
|
|
88
91
|
|
|
89
92
|
### `Tokenization`
|
|
90
93
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
- `
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
- `
|
|
103
|
-
-
|
|
104
|
-
- `
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
Detokenizes the given payload.
|
|
109
|
-
|
|
110
|
-
- `auth`: The authentication token.
|
|
111
|
-
- `tenant`: The tenant to detokenize the payload for.
|
|
112
|
-
- `config`: The configuration for detokenization.
|
|
113
|
-
- `payload`: The payload to detokenize.
|
|
94
|
+
- `constructor(baseUrl: string)`
|
|
95
|
+
- Creates an instance of the `Tokenization` class.
|
|
96
|
+
- `baseUrl`: The base URL of the tokenization service.
|
|
97
|
+
|
|
98
|
+
- `tokenize(auth: string, tenant: string, config: string, payload: TokenPayload): Promise<TokenPayload>`
|
|
99
|
+
- Tokenizes the given payload.
|
|
100
|
+
- `auth`: The authentication token.
|
|
101
|
+
- `tenant`: The tenant to tokenize the payload for.
|
|
102
|
+
- `config`: The configuration for tokenization.
|
|
103
|
+
- `payload`: The payload to tokenize.
|
|
104
|
+
|
|
105
|
+
- `detokenize(auth: string, tenant: string, config: string, payload: TokenPayload): Promise<TokenPayload>`
|
|
106
|
+
- Detokenizes the given payload.
|
|
107
|
+
- `auth`: The authentication token.
|
|
108
|
+
- `tenant`: The tenant to detokenize the payload for.
|
|
109
|
+
- `config`: The configuration for detokenization.
|
|
110
|
+
- `payload`: The payload to detokenize.
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@edirect/tokenization",
|
|
3
|
-
"version": "11.0.
|
|
3
|
+
"version": "11.0.40",
|
|
4
4
|
"description": "Javascript library for tokenization service",
|
|
5
5
|
"main": "./dist/src/index.js",
|
|
6
6
|
"types": "./dist/src/index.d.ts",
|
|
@@ -24,12 +24,12 @@
|
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"homepage": "https://bolttech.io",
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"lru-cache": "^11.2.
|
|
27
|
+
"lru-cache": "^11.2.5",
|
|
28
28
|
"tslib": "^2.8.1",
|
|
29
|
-
"vitest": "4.0.
|
|
29
|
+
"vitest": "4.0.18"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@types/node": "^25.0.
|
|
32
|
+
"@types/node": "^25.0.10",
|
|
33
33
|
"typescript": "^5.9.3"
|
|
34
34
|
},
|
|
35
35
|
"type": "commonjs"
|
package/package.json
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@edirect/tokenization",
|
|
3
|
-
"version": "11.0.
|
|
3
|
+
"version": "11.0.41",
|
|
4
4
|
"description": "Javascript library for tokenization service",
|
|
5
5
|
"packageScope": "@edirect",
|
|
6
6
|
"main": "./dist/src/index.js",
|
|
7
7
|
"types": "./dist/src/index.d.ts",
|
|
8
8
|
"exports": {
|
|
9
9
|
".": {
|
|
10
|
-
"development": "./src/index.ts",
|
|
11
10
|
"import": "./dist/src/index.js",
|
|
12
11
|
"default": "./dist/src/index.js",
|
|
13
12
|
"require": "./dist/src/index.js",
|
|
@@ -26,13 +25,13 @@
|
|
|
26
25
|
"license": "MIT",
|
|
27
26
|
"homepage": "https://bolttech.io",
|
|
28
27
|
"dependencies": {
|
|
29
|
-
"lru-cache": "^11.2.
|
|
28
|
+
"lru-cache": "^11.2.5",
|
|
30
29
|
"tslib": "^2.8.1",
|
|
31
|
-
"vitest": "4.0.
|
|
30
|
+
"vitest": "4.0.18"
|
|
32
31
|
},
|
|
33
32
|
"devDependencies": {
|
|
34
|
-
"@types/node": "^25.0.
|
|
35
|
-
"@vitest/coverage-istanbul": "^4.0.
|
|
33
|
+
"@types/node": "^25.0.10",
|
|
34
|
+
"@vitest/coverage-istanbul": "^4.0.18",
|
|
36
35
|
"typescript": "^5.9.3",
|
|
37
36
|
"vitest": "^3.2.4"
|
|
38
37
|
},
|