...

Text file src/go.mongodb.org/mongo-driver/testdata/client-side-encryption/unified/getKey.json

Documentation: go.mongodb.org/mongo-driver/testdata/client-side-encryption/unified

     1{
     2  "description": "getKey",
     3  "schemaVersion": "1.8",
     4  "runOnRequirements": [
     5    {
     6      "csfle": true
     7    }
     8  ],
     9  "createEntities": [
    10    {
    11      "client": {
    12        "id": "client0",
    13        "observeEvents": [
    14          "commandStartedEvent"
    15        ]
    16      }
    17    },
    18    {
    19      "clientEncryption": {
    20        "id": "clientEncryption0",
    21        "clientEncryptionOpts": {
    22          "keyVaultClient": "client0",
    23          "keyVaultNamespace": "keyvault.datakeys",
    24          "kmsProviders": {
    25            "local": {
    26              "key": {
    27                "$$placeholder": 1
    28              }
    29            }
    30          }
    31        }
    32      }
    33    },
    34    {
    35      "database": {
    36        "id": "database0",
    37        "client": "client0",
    38        "databaseName": "keyvault"
    39      }
    40    },
    41    {
    42      "collection": {
    43        "id": "collection0",
    44        "database": "database0",
    45        "collectionName": "datakeys"
    46      }
    47    }
    48  ],
    49  "initialData": [
    50    {
    51      "databaseName": "keyvault",
    52      "collectionName": "datakeys",
    53      "documents": [
    54        {
    55          "_id": {
    56            "$binary": {
    57              "base64": "YXdzYXdzYXdzYXdzYXdzYQ==",
    58              "subType": "04"
    59            }
    60          },
    61          "keyAltNames": [
    62            "aws_key"
    63          ],
    64          "keyMaterial": {
    65            "$binary": {
    66              "base64": "AQICAHhQNmWG2CzOm1dq3kWLM+iDUZhEqnhJwH9wZVpuZ94A8gFXJqbF0Fy872MD7xl56D/2AAAAwjCBvwYJKoZIhvcNAQcGoIGxMIGuAgEAMIGoBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDO7HPisPUlGzaio9vgIBEIB7/Qow46PMh/8JbEUbdXgTGhLfXPE+KIVW7T8s6YEMlGiRvMu7TV0QCIUJlSHPKZxzlJ2iwuz5yXeOag+EdY+eIQ0RKrsJ3b8UTisZYzGjfzZnxUKLzLoeXremtRCm3x47wCuHKd1dhh6FBbYt5TL2tDaj+vL2GBrKat2L",
    67              "subType": "00"
    68            }
    69          },
    70          "creationDate": {
    71            "$date": {
    72              "$numberLong": "1641024000000"
    73            }
    74          },
    75          "updateDate": {
    76            "$date": {
    77              "$numberLong": "1641024000000"
    78            }
    79          },
    80          "status": 1,
    81          "masterKey": {
    82            "provider": "aws",
    83            "key": "arn:aws:kms:us-east-1:579766882180:key/89fcc2c4-08b0-4bd9-9f25-e30687b580d0",
    84            "region": "us-east-1"
    85          }
    86        },
    87        {
    88          "_id": {
    89            "$binary": {
    90              "base64": "bG9jYWxrZXlsb2NhbGtleQ==",
    91              "subType": "04"
    92            }
    93          },
    94          "keyAltNames": [
    95            "local_key"
    96          ],
    97          "keyMaterial": {
    98            "$binary": {
    99              "base64": "ABKBldDEoDW323yejOnIRk6YQmlD9d3eQthd16scKL75nz2LjNL9fgPDZWrFFOlqlhMCFaSrNJfGrFUjYk5JFDO7soG5Syb50k1niJoKg4ilsj0L4mpimFUtTpOr2nzZOeQtvAksEXc7gsFgq8gV7t/U3lsaXPY7I0t42DfSE8EGlPdxRjFdHnxh+OR8h7U9b8Qs5K5UuhgyeyxaBZ1Hgw==",
   100              "subType": "00"
   101            }
   102          },
   103          "creationDate": {
   104            "$date": {
   105              "$numberLong": "1641024000000"
   106            }
   107          },
   108          "updateDate": {
   109            "$date": {
   110              "$numberLong": "1641024000000"
   111            }
   112          },
   113          "status": 1,
   114          "masterKey": {
   115            "provider": "local"
   116          }
   117        }
   118      ]
   119    }
   120  ],
   121  "tests": [
   122    {
   123      "description": "get non-existent data key",
   124      "operations": [
   125        {
   126          "name": "getKey",
   127          "object": "clientEncryption0",
   128          "arguments": {
   129            "id": {
   130              "$binary": {
   131                "base64": "AAAzYXdzYXdzYXdzYXdzYQ==",
   132                "subType": "04"
   133              }
   134            }
   135          },
   136          "expectResult": {
   137            "$$unsetOrMatches": null
   138          }
   139        }
   140      ],
   141      "expectEvents": [
   142        {
   143          "client": "client0",
   144          "events": [
   145            {
   146              "commandStartedEvent": {
   147                "databaseName": "keyvault",
   148                "command": {
   149                  "find": "datakeys",
   150                  "filter": {
   151                    "_id": {
   152                      "$binary": {
   153                        "base64": "AAAzYXdzYXdzYXdzYXdzYQ==",
   154                        "subType": "04"
   155                      }
   156                    }
   157                  },
   158                  "readConcern": {
   159                    "level": "majority"
   160                  }
   161                }
   162              }
   163            }
   164          ]
   165        }
   166      ]
   167    },
   168    {
   169      "description": "get existing AWS data key",
   170      "operations": [
   171        {
   172          "name": "getKey",
   173          "object": "clientEncryption0",
   174          "arguments": {
   175            "id": {
   176              "$binary": {
   177                "base64": "YXdzYXdzYXdzYXdzYXdzYQ==",
   178                "subType": "04"
   179              }
   180            }
   181          },
   182          "expectResult": {
   183            "_id": {
   184              "$binary": {
   185                "base64": "YXdzYXdzYXdzYXdzYXdzYQ==",
   186                "subType": "04"
   187              }
   188            },
   189            "keyAltNames": [
   190              "aws_key"
   191            ],
   192            "keyMaterial": {
   193              "$binary": {
   194                "base64": "AQICAHhQNmWG2CzOm1dq3kWLM+iDUZhEqnhJwH9wZVpuZ94A8gFXJqbF0Fy872MD7xl56D/2AAAAwjCBvwYJKoZIhvcNAQcGoIGxMIGuAgEAMIGoBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDO7HPisPUlGzaio9vgIBEIB7/Qow46PMh/8JbEUbdXgTGhLfXPE+KIVW7T8s6YEMlGiRvMu7TV0QCIUJlSHPKZxzlJ2iwuz5yXeOag+EdY+eIQ0RKrsJ3b8UTisZYzGjfzZnxUKLzLoeXremtRCm3x47wCuHKd1dhh6FBbYt5TL2tDaj+vL2GBrKat2L",
   195                "subType": "00"
   196              }
   197            },
   198            "creationDate": {
   199              "$date": {
   200                "$numberLong": "1641024000000"
   201              }
   202            },
   203            "updateDate": {
   204              "$date": {
   205                "$numberLong": "1641024000000"
   206              }
   207            },
   208            "status": 1,
   209            "masterKey": {
   210              "provider": "aws",
   211              "key": "arn:aws:kms:us-east-1:579766882180:key/89fcc2c4-08b0-4bd9-9f25-e30687b580d0",
   212              "region": "us-east-1"
   213            }
   214          }
   215        }
   216      ],
   217      "expectEvents": [
   218        {
   219          "client": "client0",
   220          "events": [
   221            {
   222              "commandStartedEvent": {
   223                "databaseName": "keyvault",
   224                "command": {
   225                  "find": "datakeys",
   226                  "filter": {
   227                    "_id": {
   228                      "$binary": {
   229                        "base64": "YXdzYXdzYXdzYXdzYXdzYQ==",
   230                        "subType": "04"
   231                      }
   232                    }
   233                  },
   234                  "readConcern": {
   235                    "level": "majority"
   236                  }
   237                }
   238              }
   239            }
   240          ]
   241        }
   242      ]
   243    },
   244    {
   245      "description": "get existing local data key",
   246      "operations": [
   247        {
   248          "name": "getKey",
   249          "object": "clientEncryption0",
   250          "arguments": {
   251            "id": {
   252              "$binary": {
   253                "base64": "bG9jYWxrZXlsb2NhbGtleQ==",
   254                "subType": "04"
   255              }
   256            }
   257          },
   258          "expectResult": {
   259            "_id": {
   260              "$binary": {
   261                "base64": "bG9jYWxrZXlsb2NhbGtleQ==",
   262                "subType": "04"
   263              }
   264            },
   265            "keyAltNames": [
   266              "local_key"
   267            ],
   268            "keyMaterial": {
   269              "$binary": {
   270                "base64": "ABKBldDEoDW323yejOnIRk6YQmlD9d3eQthd16scKL75nz2LjNL9fgPDZWrFFOlqlhMCFaSrNJfGrFUjYk5JFDO7soG5Syb50k1niJoKg4ilsj0L4mpimFUtTpOr2nzZOeQtvAksEXc7gsFgq8gV7t/U3lsaXPY7I0t42DfSE8EGlPdxRjFdHnxh+OR8h7U9b8Qs5K5UuhgyeyxaBZ1Hgw==",
   271                "subType": "00"
   272              }
   273            },
   274            "creationDate": {
   275              "$date": {
   276                "$numberLong": "1641024000000"
   277              }
   278            },
   279            "updateDate": {
   280              "$date": {
   281                "$numberLong": "1641024000000"
   282              }
   283            },
   284            "status": 1,
   285            "masterKey": {
   286              "provider": "local"
   287            }
   288          }
   289        }
   290      ],
   291      "expectEvents": [
   292        {
   293          "client": "client0",
   294          "events": [
   295            {
   296              "commandStartedEvent": {
   297                "databaseName": "keyvault",
   298                "command": {
   299                  "find": "datakeys",
   300                  "filter": {
   301                    "_id": {
   302                      "$binary": {
   303                        "base64": "bG9jYWxrZXlsb2NhbGtleQ==",
   304                        "subType": "04"
   305                      }
   306                    }
   307                  },
   308                  "readConcern": {
   309                    "level": "majority"
   310                  }
   311                }
   312              }
   313            }
   314          ]
   315        }
   316      ]
   317    }
   318  ]
   319}

View as plain text