open-vault/ui/app/templates/components/transit-key-action/hmac.hbs

72 lines
2.3 KiB
Handlebars
Raw Normal View History

<form {{action 'doSubmit' (hash input=input hash_algorithm=hash_algorithm key_version=key_version) on="submit"}}>
2018-04-03 14:16:57 +00:00
{{#if hmac}}
<div class="box is-sideless is-fullwidth is-marginless">
<div class="field">
<label for="hmac" class="is-label">HMAC</label>
<div class="control">
<textarea readonly class="textarea" id="hmac">{{hmac}}</textarea>
</div>
</div>
</div>
<div class="field is-grouped box is-fullwidth is-bottomless">
<div class="control">
{{#copy-button
clipboardTarget="#hmac"
class="button is-primary"
buttonType="button"
success=(action (set-flash-message 'HMAC copied!'))
}}
Copy
{{/copy-button}}
</div>
<div class="control">
<button {{action 'onClear'}} type="button" class="button">
Back
</button>
</div>
</div>
{{else}}
<div class="box is-sideless is-fullwidth is-marginless">
{{key-version-select
key=key
onVersionChange=(action (mut key_version))
key_version=key_version
}}
<div class="field">
<label for="input" class="is-label">
Input
</label>
<div class="control is-relative">
{{textarea id="input" name="input" value=input class="textarea" data-test-transit-input="input"}}
{{b64-toggle value=input isInput=false data-test-transit-b64-toggle="input"}}
</div>
</div>
<div class="field">
<label for="hash_algorithm" class="is-label">Hash Algorithm</label>
2018-04-03 14:16:57 +00:00
<div class="control is-expanded">
<div class="select is-fullwidth">
<select
name="hash_algorithm"
id="hash_algorithm"
onchange={{action (mut hash_algorithm) value="target.value"}}
2018-04-03 14:16:57 +00:00
>
{{#each (sha2-digest-sizes) as |algo|}}
<option selected={{if hash_algorithm (eq hash_algorithm algo)}} value={{algo}}>
2018-04-03 14:16:57 +00:00
<code>{{algo}}</code>
</option>
{{/each}}
</select>
</div>
</div>
</div>
</div>
<div class="field is-grouped box is-fullwidth is-bottomless">
<div class="control">
<button type="submit" class="button is-primary">
HMAC
</button>
</div>
</div>
{{/if}}
</form>