1
1
import { PaymentInformation } from '@paystring/utils'
2
- import { JWKECKey , JWKOctKey , JWKOKPKey , JWKRSAKey } from 'jose'
2
+ import { JWK } from 'jose/webcrypto/types '
3
3
import * as Vorpal from 'vorpal'
4
4
5
5
/**
@@ -53,12 +53,10 @@ export default class LocalStorage {
53
53
* @param name - The name of the key.
54
54
* @returns The key or null.
55
55
*/
56
- public getSigningKeys (
57
- name : string ,
58
- ) : Array < JWKRSAKey | JWKECKey | JWKOKPKey | JWKOctKey > {
56
+ public getSigningKeys ( name : string ) : JWK [ ] {
59
57
const existing = this . getItem ( name )
60
58
if ( existing ) {
61
- return existing as Array < JWKRSAKey | JWKECKey | JWKOKPKey | JWKOctKey >
59
+ return existing as JWK [ ]
62
60
}
63
61
return [ ]
64
62
}
@@ -70,10 +68,7 @@ export default class LocalStorage {
70
68
* @param name - The name of the key.
71
69
* @param key - The key to store.
72
70
*/
73
- public addSigningKey (
74
- name : string ,
75
- key : JWKRSAKey | JWKECKey | JWKOKPKey | JWKOctKey ,
76
- ) : void {
71
+ public addSigningKey ( name : string , key : JWK ) : void {
77
72
const keys = this . getSigningKeys ( name )
78
73
const updated = keys . concat ( key )
79
74
this . setItem ( name , JSON . stringify ( updated ) )
@@ -94,12 +89,7 @@ export default class LocalStorage {
94
89
* @param name - The name of the item to get.
95
90
* @returns The object or undefined if not in localstore.
96
91
*/
97
- private getItem (
98
- name : string ,
99
- ) :
100
- | Array < JWKRSAKey | JWKECKey | JWKOKPKey | JWKOctKey >
101
- | PaymentInformation
102
- | undefined {
92
+ private getItem ( name : string ) : JWK [ ] | PaymentInformation | undefined {
103
93
const rawValue = this . localStorage . getItem ( name )
104
94
if ( rawValue && typeof rawValue === 'string' ) {
105
95
try {
0 commit comments