|
|
|
@@ -152,25 +152,25 @@ class example_op_t : public opkele::verify_op { |
152 | db.get_table(S,T,&nr,&nc); |
152 | db.get_table(S,T,&nr,&nc); |
153 | if(nr<1) |
153 | if(nr<1) |
154 | throw opkele::failed_lookup(OPKELE_CP_ |
154 | throw opkele::failed_lookup(OPKELE_CP_ |
155 | "couldn't retrieve valid unexpired assoc"); |
155 | "couldn't retrieve valid unexpired assoc"); |
156 | assert(nr==1); assert(nc==6); |
156 | assert(nr==1); assert(nc==6); |
157 | opkele::secret_t secret; opkele::util::decode_base64(T.get(1,2,nc),secret); |
157 | opkele::secret_t secret; opkele::util::decode_base64(T.get(1,2,nc),secret); |
158 | return opkele::assoc_t(new opkele::association( |
158 | return opkele::assoc_t(new opkele::association( |
159 | "", h, T.get(1,1,nc), secret, |
159 | "", h, T.get(1,1,nc), secret, |
160 | strtol(T.get(1,4,nc),0,0), |
160 | strtol(T.get(1,4,nc),0,0), |
161 | strtol(T.get(1,3,nc),0,0) )); |
161 | strtol(T.get(1,3,nc),0,0) )); |
162 | } |
162 | } |
163 | |
163 | |
164 | string& alloc_nonce(string& nonce,bool stateless) { |
164 | string& alloc_nonce(string& nonce) { |
165 | uuid_t uuid; uuid_generate(uuid); |
165 | uuid_t uuid; uuid_generate(uuid); |
166 | nonce += opkele::util::encode_base64(uuid,sizeof(uuid)); |
166 | nonce += opkele::util::encode_base64(uuid,sizeof(uuid)); |
167 | sqlite3_mem_t<char*> |
167 | sqlite3_mem_t<char*> |
168 | S = sqlite3_mprintf( |
168 | S = sqlite3_mprintf( |
169 | "INSERT INTO nonces" |
169 | "INSERT INTO nonces" |
170 | " (n_once) VALUES (%Q)", |
170 | " (n_once) VALUES (%Q)", |
171 | nonce.c_str() ); |
171 | nonce.c_str() ); |
172 | db.exec(S); |
172 | db.exec(S); |
173 | return nonce; |
173 | return nonce; |
174 | } |
174 | } |
175 | bool check_nonce(const string& nonce) { |
175 | bool check_nonce(const string& nonce) { |
176 | sqlite3_mem_t<char*> |
176 | sqlite3_mem_t<char*> |
|