Revelation 3:18 I counsel thee to buy of me gold tried in the fire, that thou mayest be rich; and white raiment, that thou mayest be clothed, and that the shame of thy nakedness do not appear; and anoint thine eyes with eyesalve, that thou mayest see.
Gold represents faith which is tried by affliction in this life. White clothing represents righteousness which is the successful outcome of a tried faith. The bride will be presented freed from sin, without spot or blemish, her righteousness imputed by faith.
Revelation 19:8 And to her was granted that she should be arrayed in fine linen, clean and white: for the fine linen is the righteousness of saints.
White clothing occurs again in vv 4 & 5.
Revelation 3:4 Thou hast a few names even in Sardis which have not defiled their garments; and they shall walk with me in white: for they are worthy.
Revelation 3:5 He that overcometh, the same shall be clothed in white raiment; and I will not blot out his name out of the book of life, but I will confess his name before my Father, and before his angels.
The figure of keeping our garments clean – holding fast to our faith – appears in ch.16:15
Revelation 16:15 Behold, I come as a thief. Blessed is he that watcheth, and keepeth his garments, lest he walk naked, and they see his shame.
Our righteousness has to exceed that of the scribes and Pharisees.
Matthew 5:20 For I say unto you, That except your righteousness shall exceed the righteousness of the scribes and Pharisees, ye shall in no case enter into the kingdom of heaven.
Righteousness is attained not by keeping the Law but living by faith of Jesus Christ.
Philippians 3:9 And be found in him, not having mine own righteousness, which is of the law, but that which is through the faith of Christ, the righteousness which is of God by faith
The faithful of the Old Testament are presented to us as examples, to demonstrate that righteousness is by faith.
Galatians 3:6 Even as Abraham believed God, and it was accounted to him for righteousness. 7 Know ye therefore that they which are of faith, the same are the children of Abraham. 8 And the scripture, foreseeing that God would justify the heathen through faith, preached before the gospel unto Abraham, saying, In thee shall all nations be blessed. 9 So then they which be of faith are blessed with faithful Abraham.
Hebrews 11:7 By faith Noah, being warned of God of things not seen as yet, moved with fear, prepared an ark to the saving of his house; by the which he condemned the world, and became heir of the righteousness which is by faith.
Hebrews 11:13 These all died in faith, not having received the promises, but having seen them afar off, and were persuaded of them, and embraced them, and confessed that they were strangers and pilgrims on the earth.
Hebrews 11:39 And these all, having obtained a good report through faith, received not the promise: 40 God having provided some better thing for us, that they without us should not be made perfect.
Jude explains that without works faith is dead.
James 2:14 What doth it profit, my brethren, though a man say he hath faith, and have not works? can faith save him? 15 If a brother or sister be naked, and destitute of daily food, 16 And one of you say unto them, Depart in peace, be ye warmed and filled; notwithstanding ye give them not those things which are needful to the body; what doth it profit? 17 Even so faith, if it hath not works, is dead, being alone. 18 Yea, a man may say, Thou hast faith, and I have works: shew me thy faith without thy works, and I will shew thee my faith by my works... 20 But wilt thou know, O vain man, that faith without works is dead? 21 Was not Abraham our father justified by works, when he had offered Isaac his son upon the altar? 22 Seest thou how faith wrought with his works, and by works was faith made perfect? 23 And the scripture was fulfilled which saith, Abraham believed God, and it was imputed unto him for righteousness: and he was called the Friend of God. 24 Ye see then how that by works a man is justified, and not by faith only. 25 Likewise also was not Rahab the harlot justified by works, when she had received the messengers, and had sent them out another way? 26 For as the body without the spirit is dead, so faith without works is dead also.
Matthew 5:16 Let your light so shine before men, that they may see your good works, and glorify your Father which is in heaven.
If we do that which is evil we sully our garments. If we do that which is good we keep our garments clean. We won’t be completely successful but the grace of God will make up that which we lack. He is prepared to overlook our shortcomings for Christ’s sake.
1 John 1:9 If we confess our sins, he is faithful and just to forgive us our sins, and to cleanse us from all unrighteousness.
We can but echo the words of Jude
Jude 1:24 Now unto him that is able to keep you from falling, and to present you faultless before the presence of his glory with exceeding joy, 25 To the only wise God our Saviour, be glory and majesty, dominion and power, both now and ever. Amen.
I hope you have found this helpful.