Skip to content

Commit 5e234ee

Browse files
fix: use new policy binding format (#312)
* policy binding updates * don't fail on old backend roundtrip
1 parent 632864f commit 5e234ee

File tree

4 files changed

+21
-6
lines changed

4 files changed

+21
-6
lines changed

.github/workflows/build.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,9 +263,9 @@ jobs:
263263
- cli
264264
- web-app
265265
- scripts
266-
- backend-roundtrip
267266
- platform-roundtrip
268267
- platform-xtest
268+
# - backend-roundtrip
269269
runs-on: ubuntu-latest
270270
timeout-minutes: 5
271271
# To publish from a release or feature branch, remove the ref == condition below

lib/tdf3/src/models/key-access.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,10 @@ export class Wrapped {
4343
protocol: 'kas',
4444
wrappedKey: base64.encode(wrappedKeyBinary.asString()),
4545
encryptedMetadata: base64.encode(encryptedMetadataStr),
46-
policyBinding: base64.encode(policyBinding),
46+
policyBinding: {
47+
alg: 'HS256',
48+
hash: base64.encode(policyBinding),
49+
},
4750
};
4851
if (this.kid) {
4952
this.keyAccessObject.kid = this.kid;
@@ -91,7 +94,10 @@ export class Remote {
9194
protocol: 'kas',
9295
wrappedKey: this.wrappedKey,
9396
encryptedMetadata: base64.encode(encryptedMetadataStr),
94-
policyBinding: base64.encode(policyBinding),
97+
policyBinding: {
98+
alg: 'HS256',
99+
hash: base64.encode(policyBinding),
100+
},
95101
};
96102
if (this.kid) {
97103
this.keyAccessObject.kid = this.kid;
@@ -108,6 +114,9 @@ export type KeyAccessObject = {
108114
kid?: string;
109115
protocol: 'kas';
110116
wrappedKey?: string;
111-
policyBinding?: string;
117+
policyBinding?: {
118+
alg: string;
119+
hash: string;
120+
};
112121
encryptedMetadata?: string;
113122
};

lib/tests/mocks/client/default_manifest.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@
1313
"url": "http://kas.gsk.com:5000",
1414
"protocol": "kas",
1515
"wrappedKey": "OqnOETpwyGE3PVpUpwwWZoJTNW24UMhnXIif0mSnqLVCUPKAAhrjeue11uAXWpb9sD7ZDsmrc9ylmnSKP9vWel8ST68tv6PeVO+CPYUND7cqG2NhUHCLv5Ouys3Klurykvy8/O3cCLDYl6RDISosxFKqnd7LYD7VnxsYqUns4AW5/odXJrwIhNO3szZV0JgoBXs+U9bul4tSGNxmYuPOj0RE0HEX5yF5lWlt2vHNCqPlmSBV6+jePf7tOBBsqDq35GxCSHhFZhqCgA3MvnBLmKzVPArtJ1lqg3WUdnWV+o6BUzhDpOIyXzeKn4cK2mCxOXGMP2ck2C1a0sECyB82uw==",
16-
"policyBinding": "BzmgoIxZzMmIF42qzbdD4Rw30GtdaRSQL2Xlfms1OPs=",
16+
"policyBinding": {
17+
"alg": "HS256",
18+
"hash": "BzmgoIxZzMmIF42qzbdD4Rw30GtdaRSQL2Xlfms1OPs="
19+
},
1720
"encryptedMetadata": "ZoJTNW24UMhnXIif0mSnqLVCU="
1821
}
1922
],

lib/tests/mocks/tdf/0.manifest.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@
1111
"url": "http://127.0.0.1:4000",
1212
"protocol": "kas",
1313
"wrappedKey": "x8lk9Nxhx+zv+DVpCz89XLbMwbeeoNMhWIRO7CKdTNEWRWI9T+Ubkdvvi+SgrTJLQeEFBJspLQdombPI8Li1SVGD3pyfMNGXQ/FDoYIp2JHfyVKETfksU4q4gnNU3G63bTvCdQ41FeJJP26DIm63dKbF8BJQ/iSpXIPFalvMy/E9lR6kEv7ShKrwCKThFzynsg37ProbSmaYtTab+8J1/37oxm39PAUUfOOta9JA0mn8dz7f7a3nMVcXcyqrCTZSYbWKqhTowPeK2QiIfGJ1+K4F0V2UXMVuxIw6SEVbNL2hRkZ6+OSQd+kWMZTuneXtZeOHfBuOFRRzVzIEawagdA==",
14-
"policyBinding": "fNPuURQu6ZpZk26TglgJxG1E7HiOynaFoyajj+8V1xg="
14+
"policyBinding": {
15+
"alg": "HS256",
16+
"hash": "fNPuURQu6ZpZk26TglgJxG1E7HiOynaFoyajj+8V1xg="
17+
}
1518
}
1619
]
1720
]

0 commit comments

Comments
 (0)