Skip to content

Commit 748ca60

Browse files
feat(NODE-5506): add Binary subtype sensitive (#657)
1 parent 2ac17ec commit 748ca60

File tree

4 files changed

+17
-0
lines changed

4 files changed

+17
-0
lines changed

src/binary.ts

+2
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ export class Binary extends BSONValue {
5656
static readonly SUBTYPE_ENCRYPTED = 6;
5757
/** Column BSON type */
5858
static readonly SUBTYPE_COLUMN = 7;
59+
/** Sensitive BSON type */
60+
static readonly SUBTYPE_SENSITIVE = 8;
5961
/** User BSON type */
6062
static readonly SUBTYPE_USER_DEFINED = 128;
6163

src/constants.ts

+3
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,9 @@ export const BSON_BINARY_SUBTYPE_ENCRYPTED = 6;
109109
/** Column BSON type @internal */
110110
export const BSON_BINARY_SUBTYPE_COLUMN = 7;
111111

112+
/** Sensitive BSON type @internal */
113+
export const BSON_BINARY_SUBTYPE_SENSITIVE = 8;
114+
112115
/** Binary User Defined Type @internal */
113116
export const BSON_BINARY_SUBTYPE_USER_DEFINED = 128;
114117

test/node/constants.test.ts

+7
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ describe('BSON Constants', () => {
1919
| "\x04" UUID
2020
| "\x05" MD5
2121
| "\x06" Encrypted BSON value
22+
| "\x07" Column BSON value
23+
| "\x08" Sensitive BSON value
2224
| "\x80" User defined
2325
*/
2426
it('Default should be 0', () => {
@@ -55,6 +57,11 @@ describe('BSON Constants', () => {
5557
expect(constants.BSON_BINARY_SUBTYPE_COLUMN).to.equal(7);
5658
expect(Binary.SUBTYPE_COLUMN).to.equal(7);
5759
});
60+
61+
it('Sensitive should be 8', () => {
62+
expect(constants.BSON_BINARY_SUBTYPE_SENSITIVE).to.equal(8);
63+
expect(Binary.SUBTYPE_SENSITIVE).to.equal(8);
64+
});
5865
});
5966
context('BSON Type indicators', () => {
6067
/*

test/node/specs/bson-corpus/binary.json

+5
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@
5555
"canonical_bson": "1D000000057800100000000773FFD26444B34C6990E8E7D1DFC035D400",
5656
"canonical_extjson": "{\"x\" : { \"$binary\" : {\"base64\" : \"c//SZESzTGmQ6OfR38A11A==\", \"subType\" : \"07\"}}}"
5757
},
58+
{
59+
"description": "subtype 0x08",
60+
"canonical_bson": "1D000000057800100000000873FFD26444B34C6990E8E7D1DFC035D400",
61+
"canonical_extjson": "{\"x\" : { \"$binary\" : {\"base64\" : \"c//SZESzTGmQ6OfR38A11A==\", \"subType\" : \"08\"}}}"
62+
},
5863
{
5964
"description": "subtype 0x80",
6065
"canonical_bson": "0F0000000578000200000080FFFF00",

0 commit comments

Comments
 (0)