mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-12 04:50:18 +00:00
Remove declare module '@google-cloud/kms' and change to use 4 spaces instead of tabs.
This commit is contained in:
@@ -4,114 +4,114 @@ let kmsClientV1: kms.v1.KeyManagementServiceClient;
|
||||
kmsClientV1 = new kms.v1.KeyManagementServiceClient();
|
||||
|
||||
const credentials = {
|
||||
type: 'service_account',
|
||||
project_id: '****',
|
||||
private_key_id: '****',
|
||||
private_key: '****',
|
||||
client_email: '****',
|
||||
client_id: '****',
|
||||
auth_uri: 'https://accounts.google.com/o/oauth2/auth',
|
||||
token_uri: 'https://oauth2.googleapis.com/token',
|
||||
auth_provider_x509_cert_url: 'https://www.googleapis.com/oauth2/v1/certs',
|
||||
client_x509_cert_url: '****'
|
||||
type: 'service_account',
|
||||
project_id: '****',
|
||||
private_key_id: '****',
|
||||
private_key: '****',
|
||||
client_email: '****',
|
||||
client_id: '****',
|
||||
auth_uri: 'https://accounts.google.com/o/oauth2/auth',
|
||||
token_uri: 'https://oauth2.googleapis.com/token',
|
||||
auth_provider_x509_cert_url: 'https://www.googleapis.com/oauth2/v1/certs',
|
||||
client_x509_cert_url: '****'
|
||||
};
|
||||
|
||||
let kmsClient: kms.KeyManagementServiceClient;
|
||||
kmsClient = new kms.KeyManagementServiceClient({ credentials });
|
||||
|
||||
async function exampleListKeyRings() {
|
||||
const locationPath = kmsClient.locationPath('[PROJECT_ID]', '[LOCATION]');
|
||||
const [ asyncKeyRings ] = await kmsClient.listKeyRings({parent: locationPath});
|
||||
if (asyncKeyRings.length > 0) {
|
||||
const keyRing = asyncKeyRings[ 0 ];
|
||||
console.log(`KeyRing: ${keyRing.name}`);
|
||||
}
|
||||
const locationPath = kmsClient.locationPath('[PROJECT_ID]', '[LOCATION]');
|
||||
const [ asyncKeyRings ] = await kmsClient.listKeyRings({parent: locationPath});
|
||||
if (asyncKeyRings.length > 0) {
|
||||
const keyRing = asyncKeyRings[ 0 ];
|
||||
console.log(`KeyRing: ${keyRing.name}`);
|
||||
}
|
||||
|
||||
kmsClient.listKeyRings({parent: locationPath}, (err, [ callbackKeyRings ]) => {
|
||||
if (callbackKeyRings.length > 0) {
|
||||
const keyRing = callbackKeyRings[ 0 ];
|
||||
console.log(`KeyRing: ${keyRing.name}`);
|
||||
}
|
||||
});
|
||||
kmsClient.listKeyRings({parent: locationPath}, (err, [ callbackKeyRings ]) => {
|
||||
if (callbackKeyRings.length > 0) {
|
||||
const keyRing = callbackKeyRings[ 0 ];
|
||||
console.log(`KeyRing: ${keyRing.name}`);
|
||||
}
|
||||
});
|
||||
|
||||
kmsClient.listKeyRings({parent: locationPath}, { timeout: 1000 }, (err, [ callbackWithOptionsKeyRings ]) => {
|
||||
if (callbackWithOptionsKeyRings.length > 0) {
|
||||
const keyRing = callbackWithOptionsKeyRings[ 0 ];
|
||||
console.log(`KeyRing: ${keyRing.name}`);
|
||||
}
|
||||
});
|
||||
kmsClient.listKeyRings({parent: locationPath}, { timeout: 1000 }, (err, [ callbackWithOptionsKeyRings ]) => {
|
||||
if (callbackWithOptionsKeyRings.length > 0) {
|
||||
const keyRing = callbackWithOptionsKeyRings[ 0 ];
|
||||
console.log(`KeyRing: ${keyRing.name}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async function exampleListCryptoKeys() {
|
||||
const keyRingPath = kmsClient.keyRingPath('[PROJECT_ID]', '[LOCATION]', '[KEYRING_ID]');
|
||||
const [ asyncKeys ] = await kmsClient.listCryptoKeys({parent: keyRingPath});
|
||||
if (asyncKeys.length > 0) {
|
||||
const key = asyncKeys[ 0 ];
|
||||
console.log(`CryptoKey: ${key.name} Version: ${key.primary.name}`);
|
||||
}
|
||||
const keyRingPath = kmsClient.keyRingPath('[PROJECT_ID]', '[LOCATION]', '[KEYRING_ID]');
|
||||
const [ asyncKeys ] = await kmsClient.listCryptoKeys({parent: keyRingPath});
|
||||
if (asyncKeys.length > 0) {
|
||||
const key = asyncKeys[ 0 ];
|
||||
console.log(`CryptoKey: ${key.name} Version: ${key.primary.name}`);
|
||||
}
|
||||
|
||||
kmsClient.listCryptoKeys({parent: keyRingPath}, (err, [ callbackKeys ]) => {
|
||||
if (callbackKeys.length > 0) {
|
||||
const key = callbackKeys[ 0 ];
|
||||
console.log(`CryptoKey: ${key.name} Version: ${key.primary.name}`);
|
||||
}
|
||||
});
|
||||
kmsClient.listCryptoKeys({parent: keyRingPath}, (err, [ callbackKeys ]) => {
|
||||
if (callbackKeys.length > 0) {
|
||||
const key = callbackKeys[ 0 ];
|
||||
console.log(`CryptoKey: ${key.name} Version: ${key.primary.name}`);
|
||||
}
|
||||
});
|
||||
|
||||
kmsClient.listCryptoKeys({parent: keyRingPath}, { timeout: 1000 }, (err, [ callbackWithOptionsKeys ]) => {
|
||||
if (callbackWithOptionsKeys.length > 0) {
|
||||
const key = callbackWithOptionsKeys[ 0 ];
|
||||
console.log(`CryptoKey: ${key.name} Version: ${key.primary.name}`);
|
||||
}
|
||||
});
|
||||
kmsClient.listCryptoKeys({parent: keyRingPath}, { timeout: 1000 }, (err, [ callbackWithOptionsKeys ]) => {
|
||||
if (callbackWithOptionsKeys.length > 0) {
|
||||
const key = callbackWithOptionsKeys[ 0 ];
|
||||
console.log(`CryptoKey: ${key.name} Version: ${key.primary.name}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async function exampleEncrypt() {
|
||||
const formattedName = kmsClient.cryptoKeyPath('[PROJECT_ID]', '[LOCATION]', '[KEYRING_ID]', '[KEY_ID]');
|
||||
const unencryptedText = new Buffer('Hello World');
|
||||
const formattedName = kmsClient.cryptoKeyPath('[PROJECT_ID]', '[LOCATION]', '[KEYRING_ID]', '[KEY_ID]');
|
||||
const unencryptedText = new Buffer('Hello World');
|
||||
|
||||
const [ asyncEncryptResult ] = await kmsClient.encrypt({ name: formattedName, plaintext: unencryptedText.toString('base64') });
|
||||
if (asyncEncryptResult != null) {
|
||||
console.log(`Encrypted: ${asyncEncryptResult.ciphertext.toString('base64')}`);
|
||||
}
|
||||
const [ asyncEncryptResult ] = await kmsClient.encrypt({ name: formattedName, plaintext: unencryptedText.toString('base64') });
|
||||
if (asyncEncryptResult != null) {
|
||||
console.log(`Encrypted: ${asyncEncryptResult.ciphertext.toString('base64')}`);
|
||||
}
|
||||
|
||||
kmsClient.encrypt({ name: formattedName, plaintext: unencryptedText.toString('base64') }, (err, [ callbackEncryptResult ]) => {
|
||||
if (callbackEncryptResult != null) {
|
||||
console.log(`Encrypted: ${callbackEncryptResult.ciphertext.toString('base64')}`);
|
||||
}
|
||||
});
|
||||
kmsClient.encrypt({ name: formattedName, plaintext: unencryptedText.toString('base64') }, (err, [ callbackEncryptResult ]) => {
|
||||
if (callbackEncryptResult != null) {
|
||||
console.log(`Encrypted: ${callbackEncryptResult.ciphertext.toString('base64')}`);
|
||||
}
|
||||
});
|
||||
|
||||
kmsClient.encrypt({ name: formattedName, plaintext: unencryptedText.toString('base64') }, { timeout: 1000 }, (err, [ callbackWithOptionsEncryptResult ]) => {
|
||||
if (callbackWithOptionsEncryptResult != null) {
|
||||
console.log(`Encrypted: ${callbackWithOptionsEncryptResult.ciphertext.toString('base64')}`);
|
||||
}
|
||||
});
|
||||
kmsClient.encrypt({ name: formattedName, plaintext: unencryptedText.toString('base64') }, { timeout: 1000 }, (err, [ callbackWithOptionsEncryptResult ]) => {
|
||||
if (callbackWithOptionsEncryptResult != null) {
|
||||
console.log(`Encrypted: ${callbackWithOptionsEncryptResult.ciphertext.toString('base64')}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async function exampleDecrypt() {
|
||||
// Example pulling a file from Cloud Storage
|
||||
// const secretsStorage = new Storage({ credentials });
|
||||
// const bucket = secretsStorage.bucket('[KMS_STORAGE_BUCKET]');
|
||||
// const filePath = '[PATH_TO_KMS_ENCRYPTED_FILE';
|
||||
// const file = bucket.file(filePath);
|
||||
// const buffers = await file.download();
|
||||
// const buffer = buffers[ 0 ];
|
||||
// Example pulling a file from Cloud Storage
|
||||
// const secretsStorage = new Storage({ credentials });
|
||||
// const bucket = secretsStorage.bucket('[KMS_STORAGE_BUCKET]');
|
||||
// const filePath = '[PATH_TO_KMS_ENCRYPTED_FILE';
|
||||
// const file = bucket.file(filePath);
|
||||
// const buffers = await file.download();
|
||||
// const buffer = buffers[ 0 ];
|
||||
|
||||
const buffer = new Buffer('[ENCRYPTED_SOURCE_BUFFER]');
|
||||
const formattedName = kmsClient.cryptoKeyPath('[PROJECT_ID]', '[LOCATION]', '[KEYRING_ID]', '[KEY_ID]');
|
||||
const [ asyncDecryptResult ] = await kmsClient.decrypt({name: formattedName, ciphertext: buffer.toString('base64') });
|
||||
if (asyncDecryptResult != null) {
|
||||
console.log(`Decrypted: ${asyncDecryptResult.plaintext}`);
|
||||
}
|
||||
const buffer = new Buffer('[ENCRYPTED_SOURCE_BUFFER]');
|
||||
const formattedName = kmsClient.cryptoKeyPath('[PROJECT_ID]', '[LOCATION]', '[KEYRING_ID]', '[KEY_ID]');
|
||||
const [ asyncDecryptResult ] = await kmsClient.decrypt({name: formattedName, ciphertext: buffer.toString('base64') });
|
||||
if (asyncDecryptResult != null) {
|
||||
console.log(`Decrypted: ${asyncDecryptResult.plaintext}`);
|
||||
}
|
||||
|
||||
kmsClient.decrypt({ name: formattedName, ciphertext: buffer.toString('base64') }, (err, [ callbackDecryptResult ]) => {
|
||||
if (callbackDecryptResult != null) {
|
||||
console.log(`Decrypted: ${callbackDecryptResult.plaintext}`);
|
||||
}
|
||||
});
|
||||
kmsClient.decrypt({ name: formattedName, ciphertext: buffer.toString('base64') }, (err, [ callbackDecryptResult ]) => {
|
||||
if (callbackDecryptResult != null) {
|
||||
console.log(`Decrypted: ${callbackDecryptResult.plaintext}`);
|
||||
}
|
||||
});
|
||||
|
||||
kmsClient.decrypt({ name: formattedName, ciphertext: buffer.toString('base64') }, (err, [ callbackWithOptionsDecryptResult ]) => {
|
||||
if (callbackWithOptionsDecryptResult != null) {
|
||||
console.log(`Decrypted: ${callbackWithOptionsDecryptResult.plaintext}`);
|
||||
}
|
||||
});
|
||||
kmsClient.decrypt({ name: formattedName, ciphertext: buffer.toString('base64') }, (err, [ callbackWithOptionsDecryptResult ]) => {
|
||||
if (callbackWithOptionsDecryptResult != null) {
|
||||
console.log(`Decrypted: ${callbackWithOptionsDecryptResult.plaintext}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Vendored
+213
-215
@@ -8,268 +8,266 @@
|
||||
|
||||
import * as google_protobuf_timestamp_pb from "google-protobuf/google/protobuf/timestamp_pb";
|
||||
|
||||
declare module '@google-cloud/kms' {
|
||||
namespace v1 {
|
||||
enum CryptoKeyVersionAlgorithm {
|
||||
// Not specified.
|
||||
CRYPTO_KEY_VERSION_ALGORITHM_UNSPECIFIED = 0,
|
||||
export namespace v1 {
|
||||
enum CryptoKeyVersionAlgorithm {
|
||||
// Not specified.
|
||||
CRYPTO_KEY_VERSION_ALGORITHM_UNSPECIFIED = 0,
|
||||
|
||||
// Creates symmetric encryption keys.
|
||||
GOOGLE_SYMMETRIC_ENCRYPTION = 1,
|
||||
// Creates symmetric encryption keys.
|
||||
GOOGLE_SYMMETRIC_ENCRYPTION = 1,
|
||||
|
||||
// RSASSA-PSS 2048 bit key with a SHA256 digest.
|
||||
RSA_SIGN_PSS_2048_SHA256 = 2,
|
||||
// RSASSA-PSS 2048 bit key with a SHA256 digest.
|
||||
RSA_SIGN_PSS_2048_SHA256 = 2,
|
||||
|
||||
// RSASSA-PSS 3072 bit key with a SHA256 digest.
|
||||
RSA_SIGN_PSS_3072_SHA256 = 3,
|
||||
// RSASSA-PSS 3072 bit key with a SHA256 digest.
|
||||
RSA_SIGN_PSS_3072_SHA256 = 3,
|
||||
|
||||
// RSASSA-PSS 4096 bit key with a SHA256 digest.
|
||||
RSA_SIGN_PSS_4096_SHA256 = 4,
|
||||
// RSASSA-PSS 4096 bit key with a SHA256 digest.
|
||||
RSA_SIGN_PSS_4096_SHA256 = 4,
|
||||
|
||||
// RSASSA-PKCS1-v1_5 with a 2048 bit key and a SHA256 digest.
|
||||
RSA_SIGN_PKCS1_2048_SHA256 = 5,
|
||||
// RSASSA-PKCS1-v1_5 with a 2048 bit key and a SHA256 digest.
|
||||
RSA_SIGN_PKCS1_2048_SHA256 = 5,
|
||||
|
||||
// RSASSA-PKCS1-v1_5 with a 3072 bit key and a SHA256 digest.
|
||||
RSA_SIGN_PKCS1_3072_SHA256 = 6,
|
||||
// RSASSA-PKCS1-v1_5 with a 3072 bit key and a SHA256 digest.
|
||||
RSA_SIGN_PKCS1_3072_SHA256 = 6,
|
||||
|
||||
// RSASSA-PKCS1-v1_5 with a 4096 bit key and a SHA256 digest.
|
||||
RSA_SIGN_PKCS1_4096_SHA256 = 7,
|
||||
// RSASSA-PKCS1-v1_5 with a 4096 bit key and a SHA256 digest.
|
||||
RSA_SIGN_PKCS1_4096_SHA256 = 7,
|
||||
|
||||
// RSAES-OAEP 2048 bit key with a SHA256 digest.
|
||||
RSA_DECRYPT_OAEP_2048_SHA256 = 8,
|
||||
// RSAES-OAEP 2048 bit key with a SHA256 digest.
|
||||
RSA_DECRYPT_OAEP_2048_SHA256 = 8,
|
||||
|
||||
// RSAES-OAEP 3072 bit key with a SHA256 digest.
|
||||
RSA_DECRYPT_OAEP_3072_SHA256 = 9,
|
||||
// RSAES-OAEP 3072 bit key with a SHA256 digest.
|
||||
RSA_DECRYPT_OAEP_3072_SHA256 = 9,
|
||||
|
||||
// RSAES-OAEP 4096 bit key with a SHA256 digest.
|
||||
RSA_DECRYPT_OAEP_4096_SHA256 = 10,
|
||||
// RSAES-OAEP 4096 bit key with a SHA256 digest.
|
||||
RSA_DECRYPT_OAEP_4096_SHA256 = 10,
|
||||
|
||||
// ECDSA on the NIST P-256 curve with a SHA256 digest.
|
||||
EC_SIGN_P256_SHA256 = 12,
|
||||
// ECDSA on the NIST P-256 curve with a SHA256 digest.
|
||||
EC_SIGN_P256_SHA256 = 12,
|
||||
|
||||
// ECDSA on the NIST P-384 curve with a SHA384 digest.
|
||||
EC_SIGN_P384_SHA384 = 13,
|
||||
}
|
||||
// ECDSA on the NIST P-384 curve with a SHA384 digest.
|
||||
EC_SIGN_P384_SHA384 = 13,
|
||||
}
|
||||
|
||||
enum CryptoKeyVersionState {
|
||||
// Not specified.
|
||||
CRYPTO_KEY_VERSION_STATE_UNSPECIFIED = 0,
|
||||
enum CryptoKeyVersionState {
|
||||
// Not specified.
|
||||
CRYPTO_KEY_VERSION_STATE_UNSPECIFIED = 0,
|
||||
|
||||
// This version is still being generated. It may not be used, enabled,
|
||||
// disabled, or destroyed yet. Cloud KMS will automatically mark this
|
||||
// version [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED] as soon as the version is ready.
|
||||
PENDING_GENERATION = 5,
|
||||
// This version is still being generated. It may not be used, enabled,
|
||||
// disabled, or destroyed yet. Cloud KMS will automatically mark this
|
||||
// version [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED] as soon as the version is ready.
|
||||
PENDING_GENERATION = 5,
|
||||
|
||||
// This version may be used for cryptographic operations.
|
||||
ENABLED = 1,
|
||||
// This version may be used for cryptographic operations.
|
||||
ENABLED = 1,
|
||||
|
||||
// This version may not be used, but the key material is still available,
|
||||
// and the version can be placed back into the [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED] state.
|
||||
DISABLED = 2,
|
||||
// This version may not be used, but the key material is still available,
|
||||
// and the version can be placed back into the [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED] state.
|
||||
DISABLED = 2,
|
||||
|
||||
// This version is destroyed, and the key material is no longer stored.
|
||||
// A version may not leave this state once entered.
|
||||
DESTROYED = 3,
|
||||
// This version is destroyed, and the key material is no longer stored.
|
||||
// A version may not leave this state once entered.
|
||||
DESTROYED = 3,
|
||||
|
||||
// This version is scheduled for destruction, and will be destroyed soon.
|
||||
// Call
|
||||
// [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion]
|
||||
// to put it back into the [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED] state.
|
||||
DESTROY_SCHEDULED = 4,
|
||||
}
|
||||
// This version is scheduled for destruction, and will be destroyed soon.
|
||||
// Call
|
||||
// [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion]
|
||||
// to put it back into the [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED] state.
|
||||
DESTROY_SCHEDULED = 4,
|
||||
}
|
||||
|
||||
enum CryptoKeyVersionView {
|
||||
// Default view for each [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. Does not include
|
||||
// the [attestation][google.cloud.kms.v1.CryptoKeyVersion.attestation] field.
|
||||
CRYPTO_KEY_VERSION_VIEW_UNSPECIFIED = 0,
|
||||
enum CryptoKeyVersionView {
|
||||
// Default view for each [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. Does not include
|
||||
// the [attestation][google.cloud.kms.v1.CryptoKeyVersion.attestation] field.
|
||||
CRYPTO_KEY_VERSION_VIEW_UNSPECIFIED = 0,
|
||||
|
||||
// Provides all fields in each [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion], including the
|
||||
// [attestation][google.cloud.kms.v1.CryptoKeyVersion.attestation].
|
||||
FULL = 1,
|
||||
}
|
||||
// Provides all fields in each [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion], including the
|
||||
// [attestation][google.cloud.kms.v1.CryptoKeyVersion.attestation].
|
||||
FULL = 1,
|
||||
}
|
||||
|
||||
enum ProtectionLevel {
|
||||
// Not specified.
|
||||
PROTECTION_LEVEL_UNSPECIFIED = 0,
|
||||
enum ProtectionLevel {
|
||||
// Not specified.
|
||||
PROTECTION_LEVEL_UNSPECIFIED = 0,
|
||||
|
||||
// Crypto operations are performed in software.
|
||||
SOFTWARE = 1,
|
||||
// Crypto operations are performed in software.
|
||||
SOFTWARE = 1,
|
||||
|
||||
// Crypto operations are performed in a Hardware Security Module.
|
||||
HSM = 2,
|
||||
}
|
||||
// Crypto operations are performed in a Hardware Security Module.
|
||||
HSM = 2,
|
||||
}
|
||||
|
||||
enum AttestationFormat {
|
||||
ATTESTATION_FORMAT_UNSPECIFIED = 0,
|
||||
enum AttestationFormat {
|
||||
ATTESTATION_FORMAT_UNSPECIFIED = 0,
|
||||
|
||||
// Cavium HSM attestation compressed with gzip. Note that this format is
|
||||
// defined by Cavium and subject to change at any time.
|
||||
CAVIUM_V1_COMPRESSED = 3,
|
||||
}
|
||||
// Cavium HSM attestation compressed with gzip. Note that this format is
|
||||
// defined by Cavium and subject to change at any time.
|
||||
CAVIUM_V1_COMPRESSED = 3,
|
||||
}
|
||||
|
||||
interface KeyOperationAttestation {
|
||||
format: AttestationFormat;
|
||||
}
|
||||
interface KeyOperationAttestation {
|
||||
format: AttestationFormat;
|
||||
}
|
||||
|
||||
interface CryptoKeyVersion {
|
||||
name: string;
|
||||
state: CryptoKeyVersionState;
|
||||
protectionLevel: ProtectionLevel;
|
||||
algorithm: CryptoKeyVersionAlgorithm;
|
||||
attestation?: KeyOperationAttestation;
|
||||
createTime: google_protobuf_timestamp_pb.Timestamp.AsObject;
|
||||
generateTime: google_protobuf_timestamp_pb.Timestamp.AsObject;
|
||||
destroyTime?: google_protobuf_timestamp_pb.Timestamp.AsObject;
|
||||
destroyEventTime?: google_protobuf_timestamp_pb.Timestamp.AsObject;
|
||||
}
|
||||
interface CryptoKeyVersion {
|
||||
name: string;
|
||||
state: CryptoKeyVersionState;
|
||||
protectionLevel: ProtectionLevel;
|
||||
algorithm: CryptoKeyVersionAlgorithm;
|
||||
attestation?: KeyOperationAttestation;
|
||||
createTime: google_protobuf_timestamp_pb.Timestamp.AsObject;
|
||||
generateTime: google_protobuf_timestamp_pb.Timestamp.AsObject;
|
||||
destroyTime?: google_protobuf_timestamp_pb.Timestamp.AsObject;
|
||||
destroyEventTime?: google_protobuf_timestamp_pb.Timestamp.AsObject;
|
||||
}
|
||||
|
||||
interface CryptoKeyVersionTemplate {
|
||||
protectionLevel: ProtectionLevel;
|
||||
algorithm: CryptoKeyVersionAlgorithm;
|
||||
}
|
||||
interface CryptoKeyVersionTemplate {
|
||||
protectionLevel: ProtectionLevel;
|
||||
algorithm: CryptoKeyVersionAlgorithm;
|
||||
}
|
||||
|
||||
enum CryptoKeyPurpose {
|
||||
// Not specified.
|
||||
CRYPTO_KEY_PURPOSE_UNSPECIFIED = 0,
|
||||
enum CryptoKeyPurpose {
|
||||
// Not specified.
|
||||
CRYPTO_KEY_PURPOSE_UNSPECIFIED = 0,
|
||||
|
||||
// [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used with
|
||||
// [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt] and
|
||||
// [Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt].
|
||||
ENCRYPT_DECRYPT = 1,
|
||||
// [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used with
|
||||
// [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt] and
|
||||
// [Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt].
|
||||
ENCRYPT_DECRYPT = 1,
|
||||
|
||||
// [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used with
|
||||
// [AsymmetricSign][google.cloud.kms.v1.KeyManagementService.AsymmetricSign] and
|
||||
// [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey].
|
||||
ASYMMETRIC_SIGN = 5,
|
||||
// [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used with
|
||||
// [AsymmetricSign][google.cloud.kms.v1.KeyManagementService.AsymmetricSign] and
|
||||
// [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey].
|
||||
ASYMMETRIC_SIGN = 5,
|
||||
|
||||
// [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used with
|
||||
// [AsymmetricDecrypt][google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt] and
|
||||
// [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey].
|
||||
ASYMMETRIC_DECRYPT = 6,
|
||||
}
|
||||
// [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used with
|
||||
// [AsymmetricDecrypt][google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt] and
|
||||
// [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey].
|
||||
ASYMMETRIC_DECRYPT = 6,
|
||||
}
|
||||
|
||||
interface CryptoKey {
|
||||
name: string;
|
||||
primary: CryptoKeyVersion;
|
||||
purpose: CryptoKeyPurpose;
|
||||
createTime: google_protobuf_timestamp_pb.Timestamp.AsObject;
|
||||
nextRotationTime?: google_protobuf_timestamp_pb.Timestamp.AsObject;
|
||||
versionTemplate: CryptoKeyVersionTemplate;
|
||||
labels: { [s: string]: string; };
|
||||
}
|
||||
interface CryptoKey {
|
||||
name: string;
|
||||
primary: CryptoKeyVersion;
|
||||
purpose: CryptoKeyPurpose;
|
||||
createTime: google_protobuf_timestamp_pb.Timestamp.AsObject;
|
||||
nextRotationTime?: google_protobuf_timestamp_pb.Timestamp.AsObject;
|
||||
versionTemplate: CryptoKeyVersionTemplate;
|
||||
labels: { [s: string]: string; };
|
||||
}
|
||||
|
||||
interface KeyRing {
|
||||
name: string;
|
||||
createTime: google_protobuf_timestamp_pb.Timestamp.AsObject;
|
||||
}
|
||||
interface KeyRing {
|
||||
name: string;
|
||||
createTime: google_protobuf_timestamp_pb.Timestamp.AsObject;
|
||||
}
|
||||
|
||||
namespace KeyManagementServiceClient {
|
||||
interface ConfigurationObject {
|
||||
credentials?: {
|
||||
client_email?: string;
|
||||
private_key?: string
|
||||
};
|
||||
email?: string;
|
||||
keyFilename?: string;
|
||||
port?: number;
|
||||
projectId?: string;
|
||||
promise?: any;
|
||||
servicePath?: string;
|
||||
}
|
||||
namespace KeyManagementServiceClient {
|
||||
interface ConfigurationObject {
|
||||
credentials?: {
|
||||
client_email?: string;
|
||||
private_key?: string
|
||||
};
|
||||
email?: string;
|
||||
keyFilename?: string;
|
||||
port?: number;
|
||||
projectId?: string;
|
||||
promise?: any;
|
||||
servicePath?: string;
|
||||
}
|
||||
|
||||
interface EncryptRequest {
|
||||
name: string;
|
||||
plaintext: string;
|
||||
additionalAuthenticatedData?: string;
|
||||
}
|
||||
interface EncryptResponse {
|
||||
name: string;
|
||||
ciphertext: Buffer;
|
||||
}
|
||||
type EncryptCallback = (err: Error | null, apiResponse: [EncryptResponse, any, any]) => void;
|
||||
interface EncryptRequest {
|
||||
name: string;
|
||||
plaintext: string;
|
||||
additionalAuthenticatedData?: string;
|
||||
}
|
||||
interface EncryptResponse {
|
||||
name: string;
|
||||
ciphertext: Buffer;
|
||||
}
|
||||
type EncryptCallback = (err: Error | null, apiResponse: [EncryptResponse, any, any]) => void;
|
||||
|
||||
interface DecryptRequest {
|
||||
name: string;
|
||||
ciphertext: string;
|
||||
additionalAuthenticatedData?: string;
|
||||
}
|
||||
interface DecryptResponse {
|
||||
plaintext: Buffer;
|
||||
}
|
||||
type DecryptCallback = (err: Error | null, apiResponse: [DecryptResponse, any, any]) => void;
|
||||
interface DecryptRequest {
|
||||
name: string;
|
||||
ciphertext: string;
|
||||
additionalAuthenticatedData?: string;
|
||||
}
|
||||
interface DecryptResponse {
|
||||
plaintext: Buffer;
|
||||
}
|
||||
type DecryptCallback = (err: Error | null, apiResponse: [DecryptResponse, any, any]) => void;
|
||||
|
||||
interface ListKeyRingsRequest {
|
||||
parent: string;
|
||||
page_size?: number;
|
||||
page_token?: string;
|
||||
}
|
||||
type ListKeyRingsCallback = (err: Error | null, apiResponse: [KeyRing[], any, any]) => void;
|
||||
interface ListKeyRingsRequest {
|
||||
parent: string;
|
||||
page_size?: number;
|
||||
page_token?: string;
|
||||
}
|
||||
type ListKeyRingsCallback = (err: Error | null, apiResponse: [KeyRing[], any, any]) => void;
|
||||
|
||||
interface ListCryptoKeysRequest {
|
||||
parent: string;
|
||||
page_size?: number;
|
||||
page_token?: string;
|
||||
}
|
||||
type ListCryptoKeysCallback = (err: Error | null, apiResponse: [CryptoKey[], any, any]) => void;
|
||||
}
|
||||
interface ListCryptoKeysRequest {
|
||||
parent: string;
|
||||
page_size?: number;
|
||||
page_token?: string;
|
||||
}
|
||||
type ListCryptoKeysCallback = (err: Error | null, apiResponse: [CryptoKey[], any, any]) => void;
|
||||
}
|
||||
|
||||
class KeyManagementServiceClient {
|
||||
constructor(options?: KeyManagementServiceClient.ConfigurationObject);
|
||||
class KeyManagementServiceClient {
|
||||
constructor(options?: KeyManagementServiceClient.ConfigurationObject);
|
||||
|
||||
keyRingPath(project: string, location: string, keyRing: string): string;
|
||||
cryptoKeyPathPath(project: string, location: string, keyRing: string, cryptoKeyPath: string): string;
|
||||
locationPath(project: string, location: string): string;
|
||||
cryptoKeyPath(project: string, location: string, keyRing: string, cryptoKey: string): string;
|
||||
cryptoKeyVersionPath(project: string, location: string, keyRing: string, cryptoKey: string, cryptoKeyVersion: string): string;
|
||||
keyRingPath(project: string, location: string, keyRing: string): string;
|
||||
cryptoKeyPathPath(project: string, location: string, keyRing: string, cryptoKeyPath: string): string;
|
||||
locationPath(project: string, location: string): string;
|
||||
cryptoKeyPath(project: string, location: string, keyRing: string, cryptoKey: string): string;
|
||||
cryptoKeyVersionPath(project: string, location: string, keyRing: string, cryptoKey: string, cryptoKeyVersion: string): string;
|
||||
|
||||
encrypt(request: KeyManagementServiceClient.EncryptRequest, gaxOpts?: GAX.CallOptions): Promise<[KeyManagementServiceClient.EncryptResponse, any, any]>;
|
||||
encrypt(request: KeyManagementServiceClient.EncryptRequest, callback: KeyManagementServiceClient.EncryptCallback): void;
|
||||
encrypt(request: KeyManagementServiceClient.EncryptRequest, gaxOpts: GAX.CallOptions, callback: KeyManagementServiceClient.EncryptCallback): void;
|
||||
encrypt(request: KeyManagementServiceClient.EncryptRequest, gaxOpts?: GAX.CallOptions): Promise<[KeyManagementServiceClient.EncryptResponse, any, any]>;
|
||||
encrypt(request: KeyManagementServiceClient.EncryptRequest, callback: KeyManagementServiceClient.EncryptCallback): void;
|
||||
encrypt(request: KeyManagementServiceClient.EncryptRequest, gaxOpts: GAX.CallOptions, callback: KeyManagementServiceClient.EncryptCallback): void;
|
||||
|
||||
decrypt(request: KeyManagementServiceClient.DecryptRequest, gaxOpts?: GAX.CallOptions): Promise<[KeyManagementServiceClient.DecryptResponse, any, any]>;
|
||||
decrypt(request: KeyManagementServiceClient.DecryptRequest, callback: KeyManagementServiceClient.DecryptCallback): void;
|
||||
decrypt(request: KeyManagementServiceClient.DecryptRequest, gaxOpts: GAX.CallOptions, callback: KeyManagementServiceClient.DecryptCallback): void;
|
||||
decrypt(request: KeyManagementServiceClient.DecryptRequest, gaxOpts?: GAX.CallOptions): Promise<[KeyManagementServiceClient.DecryptResponse, any, any]>;
|
||||
decrypt(request: KeyManagementServiceClient.DecryptRequest, callback: KeyManagementServiceClient.DecryptCallback): void;
|
||||
decrypt(request: KeyManagementServiceClient.DecryptRequest, gaxOpts: GAX.CallOptions, callback: KeyManagementServiceClient.DecryptCallback): void;
|
||||
|
||||
listKeyRings(request: KeyManagementServiceClient.ListKeyRingsRequest, gaxOpts?: GAX.CallOptions): Promise<[KeyRing[], any, any]>;
|
||||
listKeyRings(request: KeyManagementServiceClient.ListKeyRingsRequest, callback: KeyManagementServiceClient.ListKeyRingsCallback): void;
|
||||
listKeyRings(request: KeyManagementServiceClient.ListKeyRingsRequest, gaxOpts: GAX.CallOptions, callback: KeyManagementServiceClient.ListKeyRingsCallback): void;
|
||||
listKeyRings(request: KeyManagementServiceClient.ListKeyRingsRequest, gaxOpts?: GAX.CallOptions): Promise<[KeyRing[], any, any]>;
|
||||
listKeyRings(request: KeyManagementServiceClient.ListKeyRingsRequest, callback: KeyManagementServiceClient.ListKeyRingsCallback): void;
|
||||
listKeyRings(request: KeyManagementServiceClient.ListKeyRingsRequest, gaxOpts: GAX.CallOptions, callback: KeyManagementServiceClient.ListKeyRingsCallback): void;
|
||||
|
||||
listCryptoKeys(request: KeyManagementServiceClient.ListCryptoKeysRequest, gaxOpts?: GAX.CallOptions): Promise<[CryptoKey[], any, any]>;
|
||||
listCryptoKeys(request: KeyManagementServiceClient.ListCryptoKeysRequest, callback: KeyManagementServiceClient.ListCryptoKeysCallback): void;
|
||||
listCryptoKeys(request: KeyManagementServiceClient.ListCryptoKeysRequest, gaxOpts: GAX.CallOptions, callback: KeyManagementServiceClient.ListCryptoKeysCallback): void;
|
||||
}
|
||||
}
|
||||
listCryptoKeys(request: KeyManagementServiceClient.ListCryptoKeysRequest, gaxOpts?: GAX.CallOptions): Promise<[CryptoKey[], any, any]>;
|
||||
listCryptoKeys(request: KeyManagementServiceClient.ListCryptoKeysRequest, callback: KeyManagementServiceClient.ListCryptoKeysCallback): void;
|
||||
listCryptoKeys(request: KeyManagementServiceClient.ListCryptoKeysRequest, gaxOpts: GAX.CallOptions, callback: KeyManagementServiceClient.ListCryptoKeysCallback): void;
|
||||
}
|
||||
}
|
||||
|
||||
class KeyManagementServiceClient extends v1.KeyManagementServiceClient {
|
||||
constructor(options?: v1.KeyManagementServiceClient.ConfigurationObject);
|
||||
}
|
||||
export class KeyManagementServiceClient extends v1.KeyManagementServiceClient {
|
||||
constructor(options?: v1.KeyManagementServiceClient.ConfigurationObject);
|
||||
}
|
||||
|
||||
namespace GAX {
|
||||
/** https://googleapis.github.io/gax-nodejs/global.html#CallOptions */
|
||||
interface CallOptions {
|
||||
timeout?: number;
|
||||
retry?: RetryOptions;
|
||||
autoPaginate?: boolean;
|
||||
pageToken?: object;
|
||||
isBundling?: boolean;
|
||||
longrunning?: BackoffSettings;
|
||||
promise?: PromiseConstructor; // FIXME Unsure if this is the correct type; remove this comment if it is
|
||||
}
|
||||
export namespace GAX {
|
||||
/** https://googleapis.github.io/gax-nodejs/global.html#CallOptions */
|
||||
interface CallOptions {
|
||||
timeout?: number;
|
||||
retry?: RetryOptions;
|
||||
autoPaginate?: boolean;
|
||||
pageToken?: object;
|
||||
isBundling?: boolean;
|
||||
longrunning?: BackoffSettings;
|
||||
promise?: PromiseConstructor; // FIXME Unsure if this is the correct type; remove this comment if it is
|
||||
}
|
||||
|
||||
/** https://googleapis.github.io/gax-nodejs/global.html#RetryOptions */
|
||||
interface RetryOptions {
|
||||
retryCodes: string[];
|
||||
backoffSettings: BackoffSettings;
|
||||
}
|
||||
/** https://googleapis.github.io/gax-nodejs/global.html#RetryOptions */
|
||||
interface RetryOptions {
|
||||
retryCodes: string[];
|
||||
backoffSettings: BackoffSettings;
|
||||
}
|
||||
|
||||
/** https://googleapis.github.io/gax-nodejs/global.html#BackoffSettings */
|
||||
interface BackoffSettings {
|
||||
initialRetryDelayMillis: number;
|
||||
retryDelayMultiplier: number;
|
||||
maxRetryDelayMillis: number;
|
||||
initialRpcTimeoutMillis: number;
|
||||
maxRpcTimeoutMillis: number;
|
||||
totalTimeoutMillis: number;
|
||||
}
|
||||
}
|
||||
/** https://googleapis.github.io/gax-nodejs/global.html#BackoffSettings */
|
||||
interface BackoffSettings {
|
||||
initialRetryDelayMillis: number;
|
||||
retryDelayMultiplier: number;
|
||||
maxRetryDelayMillis: number;
|
||||
initialRpcTimeoutMillis: number;
|
||||
maxRpcTimeoutMillis: number;
|
||||
totalTimeoutMillis: number;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"indent": [true, "tabs"]
|
||||
}
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user