-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Support generic messages * Support generic messages
- Loading branch information
1 parent
c569d92
commit 668161a
Showing
4 changed files
with
49 additions
and
6 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Copyright 2020 Self Group Ltd. All Rights Reserved. | ||
|
||
# frozen_string_literal: true | ||
|
||
require 'self_msgproto' | ||
require_relative 'base' | ||
require_relative '../ntptime' | ||
|
||
module SelfSDK | ||
module Messages | ||
class Generic < Base | ||
def parse(input, envelope=nil) | ||
@input = input | ||
@payload = get_payload input | ||
@id = @payload[:jti] | ||
@from = @payload[:iss] | ||
@to = @payload[:sub] | ||
@audience = payload[:aud] | ||
@expires = @payload[:exp] | ||
@typ = @payload[:typ] | ||
@body = @payload[:msg] | ||
|
||
if envelope | ||
issuer = envelope.sender.split(":") | ||
@from = issuer.first | ||
@from_device = issuer.last | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains 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
This file contains 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
This file contains 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