Skip to content
This repository has been archived by the owner on Dec 30, 2022. It is now read-only.

feat: adds settings on Tenant and deduplicate_token on Token #199

Merged
merged 6 commits into from
Jun 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 36 additions & 13 deletions source/includes/api-reference/_tenants.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@ Tenants provide a way to logically group your Applications and tokens. Common us

## Tenant Object

| Attribute | Type | Description |
|---------------|----------|---------------------------------------------------------------------------------------------|
| `id` | *uuid* | Unique identifier of the Tenants |
| `owner_id` | *uuid* | The user ID which owns the Tenants |
| `name` | *string* | The name of the Tenants |
| `created_by` | *uuid* | (Optional) The ID of the user that created the Tenant |
| `created_at` | *date* | (Optional) Created date of the Tenant in ISO 8601 format |
| `modified_by` | *uuid* | (Optional) The ID of the user or [Application](#applications) that last modified the Tenant |
| `modified_at` | *date* | (Optional) Last modified date of the Tenant in ISO 8601 format |
| Attribute | Type | Description |
|---------------|----------------------------------------------------|---------------------------------------------------------------------------------------------|
| `id` | *uuid* | Unique identifier of the Tenant |
| `owner_id` | *uuid* | The user ID which owns the Tenant |
| `name` | *string* | The name of the Tenant |
| `settings` | [Tenant Settings](#tenants-tenant-settings-object) | The setting for the Tenant |
| `created_by` | *uuid* | (Optional) The ID of the user that created the Tenant |
| `created_at` | *date* | (Optional) Created date of the Tenant in ISO 8601 format |
| `modified_by` | *uuid* | (Optional) The ID of the user or [Application](#applications) that last modified the Tenant |
| `modified_at` | *date* | (Optional) Last modified date of the Tenant in ISO 8601 format |

## Tenant Usage Report Object

Expand All @@ -40,6 +41,12 @@ Tenants provide a way to logically group your Applications and tokens. Common us
| `count` | *long* | Number of tokens |
| `last_created_at` | *date* | (Optional) Last created date in ISO 8601 format |

## Tenant Settings Object

| Attribute | Type | Description |
|----------------------|------------|----------------------------------------------------------------|
| `deduplicate_tokens` | *string* | (Bool) Whether tokens are deduplicated on creation and updates |

## Get a Tenant

> Request
Expand Down Expand Up @@ -101,6 +108,9 @@ func main() {
"id": "f88da999-b124-4a14-acde-cbc121444f14",
"owner_id": "97cec6e8-a143-4fb4-9ab0-cf7e49242d21",
"name": "My Tenant",
"settings": {
"deduplicate_tokens": "false"
},
"created_by": "fb124bba-f90d-45f0-9a59-5edca27b3b4a",
"created_at": "2020-09-15T15:53:00+00:00",
"modified_by": "fb124bba-f90d-45f0-9a59-5edca27b3b4a",
Expand Down Expand Up @@ -136,7 +146,10 @@ curl "https://api.basistheory.com/tenants/self" \
-H "Content-Type: application/json" \
-X "PUT" \
-d '{
"name": "My Example Tenant"
"name": "My Example Tenant",
"settings": {
"deduplicate_tokens": "true"
}
}'
```

Expand All @@ -147,6 +160,9 @@ const bt = await new BasisTheory().init('key_N88mVGsp3sCXkykyN2EFED');

const tenant = await bt.tenants.update({
name: 'My Example Tenant',
settings: {
"deduplicate_tokens": "true"
}
});
```

Expand All @@ -157,6 +173,9 @@ var client = new TenantClient("key_N88mVGsp3sCXkykyN2EFED");

var tenant = await client.UpdateAsync(new Tenant {
Name = "My Example Tenant"
Settings = new Dictionary<string, string> {
{ "deduplicate_tokens", "true" }
},
});
```

Expand Down Expand Up @@ -201,6 +220,9 @@ func main() {
"id": "f88da999-b124-4a14-acde-cbc121444f14",
"owner_id": "97cec6e8-a143-4fb4-9ab0-cf7e49242d21",
"name": "My Example Tenant",
"settings": {
"deduplicate_tokens": "true"
},
"created_by": "fb124bba-f90d-45f0-9a59-5edca27b3b4a",
"created_at": "2020-09-15T15:53:00+00:00",
"modified_by": "fb124bba-f90d-45f0-9a59-5edca27b3b4a",
Expand All @@ -223,9 +245,10 @@ Update the Tenant associated with the provided `BT-API-KEY`.

### Request Parameters

| Attribute | Required | Type | Default | Description |
|-----------|----------|----------|---------|-------------------------------------------------------|
| `name` | true | *string* | `null` | The name of the Tenant. Has a maximum length of `200` |
| Attribute | Required | Type | Default | Description |
|------------|----------|----------|----------------------------------------------------|-------------------------------------------------------|
| `name` | true | *string* | `null` | The name of the Tenant. Has a maximum length of `200` |
| `settings` | false | *string* | [Tenant Settings](#tenants-tenant-settings-object) | The settings for the Tenant |

### Response

Expand Down
20 changes: 10 additions & 10 deletions source/includes/api-reference/_token-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ Token Types define the rules around a data type such as validation requirements,

The `token` type is used for general data types that don't require input validation or formatting restrictions.

| Token Attribute | Value |
|------------------------------------|-----------|
| **Type** | `token` |
| **Default Classification** | `general` |
| **Default Impact Level** | `high` |
| **Minimum Impact Level** | `low` |
| **Default Restriction Policy** | `redact` |
| **Input Validation** | None |
| **Input Length** | Any |
| **Default Fingerprint Expression** | None |
| Token Attribute | Value |
|------------------------------------|-----------------------------------------|
| **Type** | `token` |
| **Default Classification** | `general` |
| **Default Impact Level** | `high` |
| **Minimum Impact Level** | `low` |
| **Default Restriction Policy** | `redact` |
| **Input Validation** | None |
| **Input Length** | Any |
| **Default Fingerprint Expression** | <code>{{ data &#124; stringify}}</code> |


## Card
Expand Down
55 changes: 30 additions & 25 deletions source/includes/api-reference/_tokens.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@

## Token Object

| Attribute | Type | Description |
|--------------------------|---------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------|
| `id` | *uuid* | Unique identifier of the token which can be used to [get a token](#get-a-token) |
| `tenant_id` | *uuid* | The [Tenant](#tenants-tenant-object) ID which owns the token |
| `type` | *string* | [Token type](#token-types) |
| `data` | *any* | Token data |
| `fingerprint` | *string* | Uniquely identifies the contents of this token. See [Token Types](#token-types) for a list of which token types support fingerprinting. |
| `privacy` | *[privacy object](#tokens-token-object-privacy-object)* | Token Privacy Settings |
| `metadata` | *map* | A key-value map of non-sensitive data. |
| `created_by` | *uuid* | (Optional) The [Application](#applications-application-object) ID which created the token |
| `created_at` | *date* | (Optional) Created date of the token in ISO 8601 format |
| `modified_by` | *uuid* | (Optional) The [Application](#applications) ID which last modified the token |
| `modified_at` | *date* | (Optional) Last modified date of the token in ISO 8601 format |
| `search_indexes` | *array* | (Optional) Array of search index [expressions](/expressions/#search-indexes) used when creating the token. |
| `fingerprint_expression` | *string* | (Optional) An [expression](/expressions/#fingerprints) defining the value to fingerprint when creating the token. |
| Attribute | Type | Description |
|--------------------------|---------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------|
| `id` | *uuid* | Unique identifier of the token which can be used to [get a token](#get-a-token) |
| `tenant_id` | *uuid* | The [Tenant](#tenants-tenant-object) ID which owns the token |
| `type` | *string* | [Token type](#token-types) |
| `data` | *any* | Token data |
| `fingerprint` | *string* | Uniquely identifies the contents of this token. See [Token Types](#token-types) for the default expression for each token type. |
| `privacy` | *[privacy object](#tokens-token-object-privacy-object)* | Token Privacy Settings |
| `metadata` | *map* | A key-value map of non-sensitive data. |
| `created_by` | *uuid* | (Optional) The [Application](#applications-application-object) ID which created the token |
| `created_at` | *date* | (Optional) Created date of the token in ISO 8601 format |
| `modified_by` | *uuid* | (Optional) The [Application](#applications) ID which last modified the token |
| `modified_at` | *date* | (Optional) Last modified date of the token in ISO 8601 format |
| `search_indexes` | *array* | (Optional) Array of search index [expressions](/expressions/#search-indexes) used when creating the token. |
| `fingerprint_expression` | *string* | (Optional) An [expression](/expressions/#fingerprints) defining the value to fingerprint when creating the token. |

### Privacy Object

Expand Down Expand Up @@ -133,7 +133,8 @@ curl "https://api.basistheory.com/tokens" \
"{{ data }}",
"{{ data | last4}}"
],
"fingerprint_expression": "{{ data }}"
"fingerprint_expression": "{{ data }}",
"deduplicate_token": true,
}'
```

Expand All @@ -155,7 +156,8 @@ const token = await bt.tokens.create({
'{{ data }}',
'{{ data | last4}}'
],
fingerprintExpression: "{{ data }}"
fingerprintExpression: "{{ data }}",
deduplicateToken: true,
});
```

Expand All @@ -177,7 +179,8 @@ var token = await client.CreateAsync(new Token {
"{{ data }}",
"{{ data | last4}}"
}
FingerprintExpression = "{{ data }}"
FingerprintExpression = "{{ data }}",
DeduplicateToken = true,
});
```

Expand Down Expand Up @@ -277,13 +280,15 @@ Create a new token for the Tenant.

### Request Parameters

| Attribute | Required | Type | Default | Description |
|------------------|----------|---------------------------------------------------------|---------|--------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `type` | true | *string* | `null` | [Token type](#token-types) of the token |
| `data` | true | *any* | `null` | Token data. Can be an object, array, or any primitive type such as an integer, boolean, or string |
| `privacy` | false | *[privacy object](#tokens-token-object-privacy-object)* | `null` | Token Privacy Settings overrides. Overrides must be a higher specificity level than the default or minimum setting for the [Token Type](#token-token-types). |
| `metadata` | false | *map* | `null` | A key-value map of non-sensitive data. |
| `search_indexes` | false | *array* | `null` | Array of [expressions](#expressions) used to generate indexes to be able to search against. |
| Attribute | Required | Type | Default | Description |
|--------------------------|----------|---------------------------------------------------------|------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `type` | true | *string* | `null` | [Token type](#token-types) of the token |
| `data` | true | *any* | `null` | Token data. Can be an object, array, or any primitive type such as an integer, boolean, or string |
| `privacy` | false | *[privacy object](#tokens-token-object-privacy-object)* | `null` | Token Privacy Settings overrides. Overrides must be a higher specificity level than the default or minimum setting for the [Token Type](#token-token-types). |
| `metadata` | false | *map* | `null` | A key-value map of non-sensitive data. |
| `search_indexes` | false | *array* | `null` | Array of [expressions](#expressions) used to generate indexes to be able to search against. |
| `fingerprint_expression` | false | *string* | <code>{{ data &#124; stringify }}</code> | [Expressions](#expressions) used to fingerprint your token. |
| `deduplicate_token` | false | *bool* | `null` | Whether the token is deduplicated on creation. |

<aside class="warning">
<span>WARNING - Never store sensitive plaintext information in the <code>metadata</code> of your token.</span>
Expand Down
Loading