@@ -191,10 +191,12 @@ describe('Process context control', function () {
191191 expect ( output . body ) . to . equal ( 'AC' ) ;
192192 } ) ;
193193
194- it ( 'exposes age encrypt/decrypt helpers in script operators' , async function ( ) {
194+ it ( 'exposes age helpers in script operators' , async function ( ) {
195195 this . timeout ( 10000 ) ;
196196
197197 const pair = await generateKeyPair ( ) ;
198+ expect ( Object . isFrozen ( ProxyUtils . age ) ) . to . equal ( false ) ;
199+
198200 const operators = [
199201 {
200202 type : 'Script Operator' ,
@@ -205,17 +207,22 @@ describe('Process context control', function () {
205207 secretKey : pair [ 'age-secret-key' ] ,
206208 } ,
207209 content : `async function operator(proxies) {
210+ const publicKey = await ProxyUtils.age.derivePublicKey(
211+ $arguments.secretKey,
212+ );
213+ const isExpectedPublicKey =
214+ publicKey === $arguments.publicKey;
208215 const encrypted = await ProxyUtils.age.encrypt(
209216 'hello age',
210- $arguments. publicKey,
217+ publicKey,
211218 );
212219 const decrypted = await ProxyUtils.age.decrypt(
213220 encrypted,
214221 $arguments.secretKey,
215222 );
216223 return proxies.map((proxy) => ({
217224 ...proxy,
218- name: proxy.name + '-' + decrypted ,
225+ name: [ proxy.name, decrypted, isExpectedPublicKey].join( '-') ,
219226 }));
220227 }` ,
221228 } ,
@@ -225,7 +232,7 @@ describe('Process context control', function () {
225232 const output = await ProxyUtils . process ( [ { name : 'A' } ] , operators ) ;
226233
227234 expect ( output . map ( ( proxy ) => proxy . name ) ) . to . deep . equal ( [
228- 'A-hello age' ,
235+ 'A-hello age-true ' ,
229236 ] ) ;
230237 } ) ;
231238} ) ;
0 commit comments