Software /
code /
prosody
Comparison
spec/util_paseto_spec.lua @ 12713:52eead170bb8
util.paseto: Drop custom wrappers around key objects
The PASETO spec recommends - no, *requires* - that implementations enforce
type safety for keys, and e.g. do not pass them around as arbitrary byte
strings. Typed wrapper objects are recommended.
I originally followed this advice when starting the lib. However, key wrapping
and type safety is now also a feature of util.crypto. All we're doing is
duplicating it unnecessarily with this additional wrapper code.
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Mon, 11 Jul 2022 14:30:39 +0100 |
parent | 12712:719a72f14e90 |
child | 12840:33d902b093f0 |
comparison
equal
deleted
inserted
replaced
12712:719a72f14e90 | 12713:52eead170bb8 |
---|---|
71 end | 71 end |
72 | 72 |
73 describe("basic sign/verify", function () | 73 describe("basic sign/verify", function () |
74 local function new_keypair() | 74 local function new_keypair() |
75 local kp = paseto.v4_public.new_keypair(); | 75 local kp = paseto.v4_public.new_keypair(); |
76 return kp.private_key:export(), kp.public_key:export(); | 76 return kp:private_pem(), kp:public_pem(); |
77 end | 77 end |
78 | 78 |
79 local privkey1, pubkey1 = new_keypair(); | 79 local privkey1, pubkey1 = new_keypair(); |
80 local privkey2, pubkey2 = new_keypair(); | 80 local privkey2, pubkey2 = new_keypair(); |
81 local sign1, verify1 = paseto.v4_public.init(privkey1, pubkey1); | 81 local sign1, verify1 = paseto.v4_public.init(privkey1, pubkey1); |