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 classSignedNostrEvent.Identifierstatic classSignedNostrEvent.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 booleancheckPow(int difficulty)SignedNostrEventclone()booleanequals(java.lang.Object obj)NostrPublicKeygetAuthor()Deprecated.use getPubkey insteadjava.lang.StringgetContent()NostrEvent.CoordinatesgetCoordinates()Get coordinates to this event.java.time.InstantgetCreatedAt()java.time.InstantgetExpiration()NostrEvent.TagValuegetFirstTag(java.lang.String key)protected java.util.Collection<java.lang.Object>getFragments()java.lang.StringgetId()java.lang.StringgetIdBech32()SignedNostrEvent.IdentifiergetIdentifier()intgetKind()intgetPow()protected java.lang.StringgetPrefix()NostrPublicKeygetPubkey()java.lang.StringgetSignature()java.util.List<NostrEvent.TagValue>getTag(java.lang.String key)java.util.List<java.util.List<java.lang.String>>getTagRows()inthashCode()booleanhasTag(java.lang.String tag)java.util.Set<java.lang.String>listTagKeys()static SignedNostrEvent.ReceivedSignedNostrEventparse(java.util.List<java.lang.Object> doc)java.util.Map<java.lang.String,java.lang.Object>toMap()booleanverify()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:
getCreatedAtin interfaceNostrEvent
-
getKind
public int getKind()
- Specified by:
getKindin interfaceNostrEvent
-
getContent
public java.lang.String getContent()
- Specified by:
getContentin 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:
toMapin classNostrMessage
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classNostrMessage
-
hashCode
public int hashCode()
- Overrides:
hashCodein classNostrMessage
-
clone
public SignedNostrEvent clone()
- Overrides:
clonein 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:
getPrefixin classNostrMessage
-
getFragments
protected java.util.Collection<java.lang.Object> getFragments()
- Specified by:
getFragmentsin classNostrMessage
-
parse
public static SignedNostrEvent.ReceivedSignedNostrEvent parse(java.util.List<java.lang.Object> doc)
-
getExpiration
public java.time.Instant getExpiration()
- Specified by:
getExpirationin interfaceNostrEvent
-
hasTag
public boolean hasTag(java.lang.String tag)
- Specified by:
hasTagin interfaceNostrEvent
-
getTag
public java.util.List<NostrEvent.TagValue> getTag(java.lang.String key)
- Specified by:
getTagin interfaceNostrEvent
-
getFirstTag
public NostrEvent.TagValue getFirstTag(java.lang.String key)
- Specified by:
getFirstTagin interfaceNostrEvent
-
listTagKeys
public java.util.Set<java.lang.String> listTagKeys()
- Specified by:
listTagKeysin interfaceNostrEvent
-
getTagRows
public java.util.List<java.util.List<java.lang.String>> getTagRows()
- Specified by:
getTagRowsin 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)
-
-