This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import datetime | |
| def create_signing_string(digest_base64, created=None, expires=None): | |
| if created is None: | |
| created = int(datetime.datetime.now().timestamp()) | |
| if expires is None: | |
| expires = int((datetime.datetime.now() + datetime.timedelta(hours=1)).timestamp()) | |
| signing_string = f"""(created): {created} | |
| (expires): {expires} | |
| digest: BLAKE-512={digest_base64}""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "context": { | |
| "domain": "nic2004:52110", | |
| "action": "search", | |
| "country": "IND", | |
| "city": "std:080", | |
| "core_version": "1.0.0", | |
| "bpp_id": "", | |
| "bpp_uri": "", | |
| "bap_id": "bap_subcriber_id", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import sodium, { base64_variants } from "libsodium-wrappers"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const created = Math.floor(new Date().getTime() / 1000).toString(); | |
| const expires = (parseInt(created) + (1 * 60 * 60)).toString(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const digest = sodium.crypto_generichash(64, sodium.from_string(message)); | |
| const digest_base64 = sodium.to_base64(digest, base64_variants.ORIGINAL); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const signing_string = `(created): ${created} | |
| (expires): ${expires} | |
| digest: BLAKE-512=${digest_base64}`; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const signedMessage = sodium.crypto_sign_detached(signing_string, sodium.from_base64(privateKey, base64_variants.ORIGINAL)); | |
| const signedMessage_ = sodium.to_base64(signedMessage, base64_variants.ORIGINAL); |