An Oberon Token
| 52 | |
| 53 | |
| 54 | class Token: |
| 55 | """An Oberon Token""" |
| 56 | |
| 57 | def __init__(self, value: bytes): |
| 58 | if len(value) == token_size(): |
| 59 | self.value = value |
| 60 | else: |
| 61 | raise Exception("invalid size") |
| 62 | |
| 63 | def __bytes__(self): |
| 64 | return self.value |
| 65 | |
| 66 | def add_blinding(self, blinder: bytes): |
| 67 | return Token(add_blinding(self.value, blinder)) |
| 68 | |
| 69 | def remove_blinding(self, blinder: bytes): |
| 70 | return Token(remove_blinding(self.value, blinder)) |
| 71 | |
| 72 | def create_proof(self, identifier: bytes, blindings: list[bytes], nonce: bytes): |
| 73 | return Proof(create_proof(self.value, identifier, blindings, nonce)) |
| 74 | |
| 75 | def verify(self, identifier: bytes, public_key: PublicKey): |
| 76 | return verify_token(self.value, public_key.value, identifier) |
| 77 | |
| 78 | |
| 79 | class Proof: |
no outgoing calls
no test coverage detected