Make the encoding utils public.
This commit is contained in:
1 parent
abe03ffc55
commit
a740d4ce54
7 files changed
+7
-10
No files matched your search
@@ -1,11 +1,10 @@
|
||||
import std/tables
|
||||
import bearssl, bearssl_pkey_decoder
|
||||
|
||||
import ../../encoding
|
||||
import ../../jwa
|
||||
import ../../jwk
|
||||
|
||||
import ../encoding
|
||||
|
||||
import ./hash
|
||||
import ./pem
|
||||
|
||||
|
||||
@@ -2,11 +2,10 @@ import std/logging
|
||||
|
||||
import bearssl
|
||||
|
||||
import ../../encoding
|
||||
import ../../jwa
|
||||
import ../../jwk
|
||||
|
||||
import ../encoding
|
||||
|
||||
proc bearHMAC(message: string, alg: JwtAlgorithm, key: string): string =
|
||||
|
||||
var vtable: ptr HashClass
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import std/options, std/tables
|
||||
import bearssl, bearssl_pkey_decoder
|
||||
|
||||
import ../../encoding
|
||||
import ../../jwa
|
||||
import ../../jwk
|
||||
|
||||
import ../encoding
|
||||
|
||||
import ./hash
|
||||
import ./pem
|
||||
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
import std/base64, std/strutils
|
||||
|
||||
proc b64UrlEncode*(s: string): string =
|
||||
result = encode(s, safe = true)
|
||||
while result.endsWith("="):
|
||||
result.setLen(result.len - 1)
|
||||
|
||||
proc b64UrlEncode*[T: SomeInteger | char](arr: openarray[T]): string =
|
||||
result= encode(arr, safe = true)
|
||||
while result.endsWith("="):
|
||||
result.setLen(result.len - 1)
|
||||
|
||||
proc b64UrlDecode*(s: string): string =
|
||||
var withPadding = s
|
||||
while withPadding.len mod 4 > 0:
|
||||
withPadding &= "="
|
||||
result = decode(withPadding)
|
||||
|
||||
func byteArrToString*[T: SomeInteger | char](arr: openarray[T]): string =
|
||||
result = newString(arr.len)
|
||||
for i in 0..<arr.len:
|
||||
result[i] = cast[char](arr[i])
|
||||
Reference in new issue
Block a user