Package org.ngengine.nostr4j.event
Class SignedNostrEvent
- java.lang.Object
-
- org.ngengine.nostr4j.proto.NostrMessageFragment
-
- org.ngengine.nostr4j.proto.NostrMessage
-
- org.ngengine.nostr4j.event.SignedNostrEvent
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
,NostrEvent
- Direct Known Subclasses:
SignedNostrEvent.ReceivedSignedNostrEvent
public class SignedNostrEvent extends NostrMessage implements NostrEvent
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SignedNostrEvent.Identifier
static class
SignedNostrEvent.ReceivedSignedNostrEvent
-
Nested classes/interfaces inherited from interface org.ngengine.nostr4j.event.NostrEvent
NostrEvent.Coordinates, NostrEvent.TagValue
-
-
Constructor Summary
Constructors Constructor Description SignedNostrEvent(java.lang.String id, NostrPublicKey pubkey, int kind, java.lang.String content, java.time.Instant created_at, java.lang.String signature, java.util.List<java.util.List<java.lang.String>> tags)
SignedNostrEvent(java.util.Map<java.lang.String,java.lang.Object> map)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description boolean
checkPow(int difficulty)
SignedNostrEvent
clone()
boolean
equals(java.lang.Object obj)
NostrPublicKey
getAuthor()
Deprecated.use getPubkey insteadjava.lang.String
getContent()
NostrEvent.Coordinates
getCoordinates()
Get coordinates to this event.java.time.Instant
getCreatedAt()
java.time.Instant
getExpiration()
NostrEvent.TagValue
getFirstTag(java.lang.String key)
protected java.util.Collection<java.lang.Object>
getFragments()
java.lang.String
getId()
java.lang.String
getIdBech32()
SignedNostrEvent.Identifier
getIdentifier()
int
getKind()
int
getPow()
protected java.lang.String
getPrefix()
NostrPublicKey
getPubkey()
java.lang.String
getSignature()
java.util.List<NostrEvent.TagValue>
getTag(java.lang.String key)
java.util.List<java.util.List<java.lang.String>>
getTagRows()
int
hashCode()
boolean
hasTag(java.lang.String tag)
java.util.Set<java.lang.String>
listTagKeys()
static SignedNostrEvent.ReceivedSignedNostrEvent
parse(java.util.List<java.lang.Object> doc)
java.util.Map<java.lang.String,java.lang.Object>
toMap()
boolean
verify()
org.ngengine.platform.AsyncTask<java.lang.Boolean>
verifyAsync()
-
Methods inherited from class org.ngengine.nostr4j.proto.NostrMessage
ack, toJSON, toJSON, toSerial, toSerial, toString
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.ngengine.nostr4j.event.NostrEvent
isAddressable, isEphemeral, isRegular, isReplaceable
-
-
-
-
Constructor Detail
-
SignedNostrEvent
public SignedNostrEvent(java.lang.String id, NostrPublicKey pubkey, int kind, java.lang.String content, java.time.Instant created_at, java.lang.String signature, java.util.List<java.util.List<java.lang.String>> tags)
-
SignedNostrEvent
public SignedNostrEvent(java.util.Map<java.lang.String,java.lang.Object> map)
-
-
Method Detail
-
getCreatedAt
public java.time.Instant getCreatedAt()
- Specified by:
getCreatedAt
in interfaceNostrEvent
-
getKind
public int getKind()
- Specified by:
getKind
in interfaceNostrEvent
-
getContent
public java.lang.String getContent()
- Specified by:
getContent
in interfaceNostrEvent
-
getSignature
public java.lang.String getSignature()
-
getId
public java.lang.String getId()
-
getPubkey
public NostrPublicKey getPubkey()
-
getAuthor
@Deprecated public NostrPublicKey getAuthor()
Deprecated.use getPubkey instead
-
toMap
public java.util.Map<java.lang.String,java.lang.Object> toMap()
- Overrides:
toMap
in classNostrMessage
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classNostrMessage
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classNostrMessage
-
clone
public SignedNostrEvent clone()
- Overrides:
clone
in classjava.lang.Object
-
verify
public boolean verify() throws java.lang.Exception
- Throws:
java.lang.Exception
-
verifyAsync
public org.ngengine.platform.AsyncTask<java.lang.Boolean> verifyAsync()
-
getIdBech32
public java.lang.String getIdBech32()
-
getIdentifier
public SignedNostrEvent.Identifier getIdentifier()
-
getPrefix
protected java.lang.String getPrefix()
- Specified by:
getPrefix
in classNostrMessage
-
getFragments
protected java.util.Collection<java.lang.Object> getFragments()
- Specified by:
getFragments
in classNostrMessage
-
parse
public static SignedNostrEvent.ReceivedSignedNostrEvent parse(java.util.List<java.lang.Object> doc)
-
getExpiration
public java.time.Instant getExpiration()
- Specified by:
getExpiration
in interfaceNostrEvent
-
hasTag
public boolean hasTag(java.lang.String tag)
- Specified by:
hasTag
in interfaceNostrEvent
-
getTag
public java.util.List<NostrEvent.TagValue> getTag(java.lang.String key)
- Specified by:
getTag
in interfaceNostrEvent
-
getFirstTag
public NostrEvent.TagValue getFirstTag(java.lang.String key)
- Specified by:
getFirstTag
in interfaceNostrEvent
-
listTagKeys
public java.util.Set<java.lang.String> listTagKeys()
- Specified by:
listTagKeys
in interfaceNostrEvent
-
getTagRows
public java.util.List<java.util.List<java.lang.String>> getTagRows()
- Specified by:
getTagRows
in interfaceNostrEvent
-
getCoordinates
public NostrEvent.Coordinates getCoordinates()
Get coordinates to this event.If the event is addressable or replaceable, it returns a coordinates object with type "a". If the event is not addressable or replaceable, it returns a coordinates object with type "e". Type matches the tag key used to refer to this event as detailed in NIP-01
- Returns:
-
getPow
public int getPow()
-
checkPow
public boolean checkPow(int difficulty)
-
-