Skip to content
This repository has been archived by the owner on Dec 1, 2022. It is now read-only.

Commit

Permalink
Duffle 0.3.0 compatibility (#63)
Browse files Browse the repository at this point in the history
  • Loading branch information
itowlson authored Aug 14, 2019
1 parent 71df3e0 commit 1b34c9b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 25 deletions.
5 changes: 2 additions & 3 deletions app/components/Bundle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Container, Card, Header, Message, Step, Segment, Image } from 'semantic
import * as cnab from 'cnabjs';

import { Actionable } from './contract';
import { findDuffleBinary, BinaryInfo, verifyFile, SignatureVerification } from '../utils/duffle';
import { findDuffleBinary, BinaryInfo, SignatureVerification } from '../utils/duffle';
import { shell } from '../utils/shell';
import * as embedded from '../utils/embedded';
import { failed, Errorable, map, succeeded } from '../utils/errorable';
Expand Down Expand Up @@ -58,8 +58,7 @@ export default class Bundle extends React.Component<Properties, State, {}> {
if (duffleBin && succeeded(bundleManifest)) {
const verifyResult = await embedded.withBundleFile(async (tempFile, isSigned) => {
if (isSigned) {
const r = await verifyFile(shell, tempFile);
return this.signingStatus(r);
return this.signingStatus({ succeeded: false, error: ['Signature format is no longer supported'] });
}
return { display: SigningStatus.Unsigned, text: 'This bundle is not digitally signed.' };
});
Expand Down
16 changes: 3 additions & 13 deletions app/utils/duffle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,25 +105,15 @@ export async function pushFile(sh: shell.Shell, filePath: string, repo: string):
}

export async function installFile(sh: shell.Shell, bundleFilePath: string, name: string, params: { [key: string]: string }, credentialSet: string | undefined): Promise<Errorable<string>> {
return await invokeObj(sh, 'install', `${name} "${bundleFilePath}" -f ${paramsArgs(params)} ${credentialArg(credentialSet)} --insecure`, {}, (s) => s);
return await invokeObj(sh, 'install', `${name} "${bundleFilePath}" -f ${paramsArgs(params)} ${credentialArg(credentialSet)}`, {}, (s) => s);
}

export async function installBundle(sh: shell.Shell, bundleName: string, name: string, params: { [key: string]: string }, credentialSet: string | undefined): Promise<Errorable<string>> {
return await invokeObj(sh, 'install', `${name} ${bundleName} ${paramsArgs(params)} ${credentialArg(credentialSet)} --insecure`, {}, (s) => s);
}

export async function verifyFile(sh: shell.Shell, bundleFilePath: string): Promise<Errorable<SignatureVerification>> {
function parse(sr: shell.ShellResult): Errorable<SignatureVerification> {
if (sr.code === 0) {
return { succeeded: true, result: { verified: true, signer: sr.stdout.trim(), reason: '' } };
}
return { succeeded: true, result: { verified: false, signer: '', reason: sr.stderr.trim() } };
}
return await invokeObjFromSR(sh, 'bundle verify', `-f ${bundleFilePath}`, {}, parse);
return await invokeObj(sh, 'install', `${name} ${bundleName} ${paramsArgs(params)} ${credentialArg(credentialSet)}`, {}, (s) => s);
}

export async function importFile(sh: shell.Shell, sourceFile: string, destinationDirectory: string): Promise<Errorable<null>> {
return await invokeObj(sh, 'import', `"${sourceFile}" -d ${destinationDirectory} --insecure`, {}, (s) => null);
return await invokeObj(sh, 'import', `"${sourceFile}" -d ${destinationDirectory}`, {}, (s) => null);
}

function paramsArgs(parameters: { [key: string]: string }): string {
Expand Down
19 changes: 10 additions & 9 deletions data/bundle.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "spline-reticulator",
"version": "0.1.1",
"schemaVersion": "v1.0.0-WD",
"description": "test description",
"invocationImages": [
{
"imageType": "docker",
Expand All @@ -15,7 +16,7 @@
}
},
"definitions": {
"bool": {
"b": {
"type": "boolean"
},
"port": {
Expand All @@ -38,33 +39,33 @@
"Quantum reticulation",
"Quantum reticulation with bicategorical induction"
],
"defaultValue": "Reticulate only"
"default": "Reticulate only"
}
},
"parameters": {
"port": {
"definition": "port",
"destination": {},
"destination": { "env": "INSTALL_PORT" },
"required": true
},
"disconnectionPort": {
"definition": "port",
"destination": {},
"destination": { "env": "DISCO_PORT" },
"applyTo": ["uninstall"]
},
"region": {
"definition": "region",
"destination": {}
"destination": { "env": "INSTALL_REGION" }
},
"public": {
"definition": "bool",
"destination": {},
"makePublic": {
"definition": "b",
"destination": { "env": "MAKE_PUBLIC" },
"applyTo": ["install", "update"],
"required": true
},
"reticulationMode": {
"definition": "reticulationMode",
"destination": {},
"destination": { "env": "RETICULATION_MODE" },
"description": "How to perform the reticulation. Quantum options require NIY (Not Invented Yet) processor at minimum."
}
},
Expand Down

0 comments on commit 1b34c9b

Please sign in to comment.