aboutsummaryrefslogtreecommitdiff
path: root/packages/merchant-backoffice-ui/src/utils/crypto.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/merchant-backoffice-ui/src/utils/crypto.ts')
-rw-r--r--packages/merchant-backoffice-ui/src/utils/crypto.ts8
1 files changed, 8 insertions, 0 deletions
diff --git a/packages/merchant-backoffice-ui/src/utils/crypto.ts b/packages/merchant-backoffice-ui/src/utils/crypto.ts
index 7bab8abf1..27e6ade02 100644
--- a/packages/merchant-backoffice-ui/src/utils/crypto.ts
+++ b/packages/merchant-backoffice-ui/src/utils/crypto.ts
@@ -46,6 +46,14 @@ function encodeBase32(data: ArrayBuffer) {
return sb;
}
+export function isBase32RFC3548Charset(s: string): boolean {
+ for (let idx = 0; idx < s.length; idx++) {
+ const c = s.charAt(idx);
+ if (encTable.indexOf(c) === -1) return false;
+ }
+ return true;
+}
+
export function randomBase32Key(): string {
var buf = new Uint8Array(20);
window.crypto.getRandomValues(buf);