2222 <option v-bind:value =" 8" >8</option >
2323 </select >
2424 <br />
25+ <label class =" combo-label" >{{ i18n.algorithm }}</label >
26+ <select v-model =" newAccount.algorithm" >
27+ <option v-bind:value =" OTPAlgorithm.SHA1" >SHA-1</option >
28+ <option v-bind:value =" OTPAlgorithm.SHA256" >SHA-256</option >
29+ <option v-bind:value =" OTPAlgorithm.SHA512" >SHA-512</option >
30+ </select >
31+ <br />
2532 <label class =" combo-label" >{{ i18n.type }}</label >
2633 <select v-model =" newAccount.type" >
2734 <option v-bind:value =" OTPType.totp" >{{ i18n.based_on_time }}</option >
3643<script lang="ts">
3744import Vue from " vue" ;
3845import { mapState } from " vuex" ;
39- import { OTPType , OTPEntry } from " ../../models/otp" ;
46+ import { OTPType , OTPEntry , OTPAlgorithm } from " ../../models/otp" ;
4047
4148export default Vue .extend ({
4249 data : function (): {
@@ -47,6 +54,7 @@ export default Vue.extend({
4754 type: OTPType ;
4855 period: number | undefined ;
4956 digits: number ;
57+ algorithm: OTPAlgorithm ;
5058 };
5159 } {
5260 return {
@@ -56,11 +64,12 @@ export default Vue.extend({
5664 secret: " " ,
5765 type: OTPType .totp ,
5866 period: undefined ,
59- digits: 6
67+ digits: 6 ,
68+ algorithm: OTPAlgorithm .SHA1
6069 }
6170 };
6271 },
63- computed: mapState (" accounts" , [" OTPType" ]),
72+ computed: mapState (" accounts" , [" OTPType" , " OTPAlgorithm " ]),
6473 methods: {
6574 async addNewAccount() {
6675 this .newAccount .secret = this .newAccount .secret .replace (/ / g , " " );
@@ -113,7 +122,8 @@ export default Vue.extend({
113122 secret: this .newAccount .secret ,
114123 counter: 0 ,
115124 period: this .newAccount .period ,
116- digits: this .newAccount .digits
125+ digits: this .newAccount .digits ,
126+ algorithm: this .newAccount .algorithm
117127 },
118128 this .$store .state .accounts .encryption
119129 );
0 commit comments