Skip to content

Commit

Permalink
0.4.14 增加 kms 加密字段支持
Browse files Browse the repository at this point in the history
  • Loading branch information
carsonxu committed Aug 23, 2018
1 parent 2a875e8 commit b100fb3
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 6 deletions.
12 changes: 10 additions & 2 deletions dist/cos-js-sdk-v5.js
Original file line number Diff line number Diff line change
Expand Up @@ -352,14 +352,22 @@ var apiWrapper = function (apiName, apiFn) {
Headers['x-cos-copy-source-If-Unmodified-Since'] = params['CopySourceIfUnmodifiedSince'];
Headers['x-cos-copy-source-If-Match'] = params['CopySourceIfMatch'];
Headers['x-cos-copy-source-If-None-Match'] = params['CopySourceIfNoneMatch'];
Headers['x-cos-server-side-encryption'] = params['ServerSideEncryption'];
Headers['x-cos-acl'] = params['ACL'];
Headers['x-cos-grant-read'] = params['GrantRead'];
Headers['x-cos-grant-write'] = params['GrantWrite'];
Headers['x-cos-grant-full-control'] = params['GrantFullControl'];
Headers['x-cos-grant-read-acp'] = params['GrantReadAcp'];
Headers['x-cos-grant-write-acp'] = params['GrantWriteAcp'];
Headers['x-cos-storage-class'] = params['StorageClass'];
// SSE-C
Headers['x-cos-server-side-encryption-customer-algorithm'] = params['SSECustomerAlgorithm'];
Headers['x-cos-server-side-encryption-customer-key'] = params['SSECustomerKey'];
Headers['x-cos-server-side-encryption-customer-key-MD5'] = params['SSECustomerKeyMD5'];
// SSE-COS、SSE-KMS
Headers['x-cos-server-side-encryption'] = params['ServerSideEncryption'];
Headers['x-cos-server-side-encryption-cos-kms-key-id'] = params['SSEKMSKeyId'];
Headers['x-cos-server-side-encryption-context'] = params['SSEContext'];

params.Headers = clearKey(Headers);
}
}
Expand Down Expand Up @@ -1917,7 +1925,7 @@ util.extend(COS.prototype, base);
util.extend(COS.prototype, advance);

COS.getAuthorization = util.getAuth;
COS.version = '0.4.13';
COS.version = '0.4.14';

module.exports = COS;

Expand Down
2 changes: 1 addition & 1 deletion dist/cos-js-sdk-v5.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cos-js-sdk-v5",
"version": "0.4.13",
"version": "0.4.14",
"description": "cos js sdk v5",
"main": "index.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion src/cos.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@ util.extend(COS.prototype, base);
util.extend(COS.prototype, advance);

COS.getAuthorization = util.getAuth;
COS.version = '0.4.13';
COS.version = '0.4.14';

module.exports = COS;
10 changes: 9 additions & 1 deletion src/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,14 +284,22 @@ var apiWrapper = function (apiName, apiFn) {
Headers['x-cos-copy-source-If-Unmodified-Since'] = params['CopySourceIfUnmodifiedSince'];
Headers['x-cos-copy-source-If-Match'] = params['CopySourceIfMatch'];
Headers['x-cos-copy-source-If-None-Match'] = params['CopySourceIfNoneMatch'];
Headers['x-cos-server-side-encryption'] = params['ServerSideEncryption'];
Headers['x-cos-acl'] = params['ACL'];
Headers['x-cos-grant-read'] = params['GrantRead'];
Headers['x-cos-grant-write'] = params['GrantWrite'];
Headers['x-cos-grant-full-control'] = params['GrantFullControl'];
Headers['x-cos-grant-read-acp'] = params['GrantReadAcp'];
Headers['x-cos-grant-write-acp'] = params['GrantWriteAcp'];
Headers['x-cos-storage-class'] = params['StorageClass'];
// SSE-C
Headers['x-cos-server-side-encryption-customer-algorithm'] = params['SSECustomerAlgorithm'];
Headers['x-cos-server-side-encryption-customer-key'] = params['SSECustomerKey'];
Headers['x-cos-server-side-encryption-customer-key-MD5'] = params['SSECustomerKeyMD5'];
// SSE-COS、SSE-KMS
Headers['x-cos-server-side-encryption'] = params['ServerSideEncryption'];
Headers['x-cos-server-side-encryption-cos-kms-key-id'] = params['SSEKMSKeyId'];
Headers['x-cos-server-side-encryption-context'] = params['SSEContext'];

params.Headers = clearKey(Headers);
}
}
Expand Down

0 comments on commit b100fb3

Please sign in to comment.