Browse code

secsipid: docs for secsipid_sign()

Daniel-Constantin Mierla authored on 21/06/2021 06:12:15
Showing 1 changed files
... ...
@@ -397,6 +397,39 @@ request_route {
397 397
     ...
398 398
 }
399 399
 ...
400
+</programlisting>
401
+		</example>
402
+	</section>
403
+	<section id="secsipid.f.secsipid_sign">
404
+		<title>
405
+		<function moreinfo="none">secsipid_sign(sheaders, spaypload, keyPath)</function>
406
+		</title>
407
+		<para>
408
+			Build Identity value using the key specified by "keyPath" to sign the JWT body.
409
+			The sheaders and spayload have to be string representation of JSON
410
+			headers and payload to be signed. On success, the Indentity value is
411
+			stored in variable $secsipid(val). It also sets $secsipid(ret) to
412
+			the return value of the libsecsipid functions.
413
+		</para>
414
+		<para>
415
+		The parameters can contain pseudo-variables.
416
+		</para>
417
+		<para>
418
+		This function can be used from ANY_ROUTE.
419
+		</para>
420
+		<example>
421
+		<title><function>secsipid_sign</function> usage</title>
422
+		<programlisting format="linespecific">
423
+...
424
+request_route {
425
+    ...
426
+    if(secsipid_sign("_JSON_HEADERS_", "_JSON_PAYLOAD_",
427
+            "/secsipid/$rd/key.pem")) {
428
+        xinfo("Identity value: $secsipid(val)\n");
429
+    }
430
+    ...
431
+}
432
+...
400 433
 </programlisting>
401 434
 		</example>
402 435
 	</section>